summaryrefslogtreecommitdiffstats
path: root/device/core
diff options
context:
space:
mode:
authorreillyg <reillyg@chromium.org>2015-10-15 13:29:17 -0700
committerCommit bot <commit-bot@chromium.org>2015-10-15 20:30:57 +0000
commitb7f71d38b2b3224e8e288d55fbab8d7c95d4c499 (patch)
treea0cad2fdd7a07d7a2add79e9d05dfb704bf825dc /device/core
parent0551d33a501724394e6cd44980638691ad9dc854 (diff)
downloadchromium_src-b7f71d38b2b3224e8e288d55fbab8d7c95d4c499.zip
chromium_src-b7f71d38b2b3224e8e288d55fbab8d7c95d4c499.tar.gz
chromium_src-b7f71d38b2b3224e8e288d55fbab8d7c95d4c499.tar.bz2
Make //device/core a component.
//device/core/device_client.cc defines a global variable. Thus, in component builds there should be only on instance of this compilation unit but if it is built as a static library there is the possibility that different parts of Chrome use different instances. BUG=538339 Review URL: https://codereview.chromium.org/1390423003 Cr-Commit-Position: refs/heads/master@{#354338}
Diffstat (limited to 'device/core')
-rw-r--r--device/core/BUILD.gn6
-rw-r--r--device/core/core.gyp9
-rw-r--r--device/core/device_client.h7
-rw-r--r--device/core/device_core_export.h28
-rw-r--r--device/core/device_monitor_win.h5
5 files changed, 44 insertions, 11 deletions
diff --git a/device/core/BUILD.gn b/device/core/BUILD.gn
index d931807..e85acb6 100644
--- a/device/core/BUILD.gn
+++ b/device/core/BUILD.gn
@@ -2,7 +2,9 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-source_set("core") {
+component("core") {
+ output_name = "device_core"
+
sources = [
"device_client.cc",
"device_client.h",
@@ -10,6 +12,8 @@ source_set("core") {
"device_monitor_win.h",
]
+ defines = [ "DEVICE_CORE_IMPLEMENTATION" ]
+
public_deps = [
"//base",
]
diff --git a/device/core/core.gyp b/device/core/core.gyp
index 034b9e3..d27073d 100644
--- a/device/core/core.gyp
+++ b/device/core/core.gyp
@@ -9,10 +9,13 @@
'targets': [
{
'target_name': 'device_core',
- 'type': 'static_library',
+ 'type': '<(component)',
'include_dirs': [
'../..',
],
+ 'defines': [
+ 'DEVICE_CORE_IMPLEMENTATION',
+ ],
'sources': [
'device_client.cc',
'device_client.h',
@@ -20,8 +23,8 @@
'device_monitor_win.h',
],
'dependencies': [
- '<(DEPTH)/third_party/mojo/mojo_public.gyp:mojo_cpp_bindings',
- ],
+ '../../base/base.gyp:base',
+ ]
},
],
}
diff --git a/device/core/device_client.h b/device/core/device_client.h
index d63471b..9fdc7f1 100644
--- a/device/core/device_client.h
+++ b/device/core/device_client.h
@@ -6,20 +6,17 @@
#define DEVICE_CORE_DEVICE_CLIENT_H_
#include "base/macros.h"
+#include "device/core/device_core_export.h"
namespace device {
class HidService;
class UsbService;
-namespace usb {
-class DeviceManager;
-}
-
// Interface used by consumers of //device APIs to get pointers to the service
// singletons appropriate for a given embedding application. For an example see
// //chrome/browser/chrome_device_client.h.
-class DeviceClient {
+class DEVICE_CORE_EXPORT DeviceClient {
public:
// Construction sets the single instance.
DeviceClient();
diff --git a/device/core/device_core_export.h b/device/core/device_core_export.h
new file mode 100644
index 0000000..6f1cddb
--- /dev/null
+++ b/device/core/device_core_export.h
@@ -0,0 +1,28 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef DEVICE_CORE_DEVICE_CORE_EXPORT_H_
+#define DEVICE_CORE_DEVICE_CORE_EXPORT_H_
+
+#if defined(COMPONENT_BUILD) && defined(WIN32)
+
+#if defined(DEVICE_CORE_IMPLEMENTATION)
+#define DEVICE_CORE_EXPORT __declspec(dllexport)
+#else
+#define DEVICE_CORE_EXPORT __declspec(dllimport)
+#endif
+
+#elif defined(COMPONENT_BUILD) && !defined(WIN32)
+
+#if defined(DEVICE_CORE_IMPLEMENTATION)
+#define DEVICE_CORE_EXPORT __attribute__((visibility("default")))
+#else
+#define DEVICE_CORE_EXPORT
+#endif
+
+#else
+#define DEVICE_CORE_EXPORT
+#endif
+
+#endif // DEVICE_CORE_DEVICE_CORE_EXPORT_H_
diff --git a/device/core/device_monitor_win.h b/device/core/device_monitor_win.h
index e8becd7..36600e4 100644
--- a/device/core/device_monitor_win.h
+++ b/device/core/device_monitor_win.h
@@ -8,14 +8,15 @@
#include <windows.h>
#include "base/observer_list.h"
+#include "device/core/device_core_export.h"
namespace device {
// Use an instance of this class to observe devices being added and removed
// from the system, matched by device interface GUID.
-class DeviceMonitorWin {
+class DEVICE_CORE_EXPORT DeviceMonitorWin {
public:
- class Observer {
+ class DEVICE_CORE_EXPORT Observer {
public:
virtual void OnDeviceAdded(const GUID& class_guid,
const std::string& device_path);