Commit 4c9c4653 authored by Ke He's avatar Ke He Committed by Commit Bot

Change //device/geolocation gn target from component to source_set

Before moving //device/geolocation into //services, we have to make sure
all the clients do not depend on //device/geolocation directly.

Now the chrome/browser:browser depends on //device/geolocation, to
remove that dependency, we have to change the geolocation target from
"component" to "source_set". The reason is:

When building libchrome.so, linker tries to find the symbol:
"Java_org_chromium_device_geolocation_LocationProviderAdapter_nativeNew
ErrorAvailable" as there are native functions being declared in
LocationProviderAdapter.java. Without depending on
"//device/geolocation" in chrome/browser:browser, linker will complain
error that symbol cannot be found. Note that there is no *actual*
dependency from //chrome to //device/geolocation, the Java code that is
using the native function will be moved into Device Service as an
internal implementation.

So we change the "component" to "source_set" to let the symbols inside
the //device/geolocation can be propagated up to target which builds the
libchrome.so. At the same time, the geolocation_export.h is removed.

Because the //device/geolocation will be moved into //services/device
and be hidden, sooner or later it will be changed to type of source_set.

BUG=800659

Change-Id: I3e581f9a0e5c492528a85a07e97e93af48ab7eb1
Reviewed-on: https://chromium-review.googlesource.com/1086490
Commit-Queue: Ke He <ke.he@intel.com>
Reviewed-by: default avatarMiguel Casas <mcasas@chromium.org>
Reviewed-by: default avatarColin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567176}
parent 4d4b9424
...@@ -1794,7 +1794,6 @@ jumbo_split_static_library("browser") { ...@@ -1794,7 +1794,6 @@ jumbo_split_static_library("browser") {
"//crypto", "//crypto",
"//crypto:platform", "//crypto:platform",
"//device/base", "//device/base",
"//device/geolocation",
"//device/usb/mojo", "//device/usb/mojo",
"//device/usb/public/mojom", "//device/usb/public/mojom",
"//device/vr/buildflags", "//device/vr/buildflags",
......
...@@ -9,9 +9,7 @@ if (is_android) { ...@@ -9,9 +9,7 @@ if (is_android) {
import("//build/config/android/rules.gni") # For generate_jni(). import("//build/config/android/rules.gni") # For generate_jni().
} }
component("geolocation") { source_set("geolocation") {
defines = [ "DEVICE_GEOLOCATION_IMPLEMENTATION" ]
sources = [ sources = [
"empty_wifi_data_provider.cc", "empty_wifi_data_provider.cc",
"empty_wifi_data_provider.h", "empty_wifi_data_provider.h",
...@@ -19,7 +17,6 @@ component("geolocation") { ...@@ -19,7 +17,6 @@ component("geolocation") {
"geolocation_config.h", "geolocation_config.h",
"geolocation_context.cc", "geolocation_context.cc",
"geolocation_context.h", "geolocation_context.h",
"geolocation_export.h",
"geolocation_impl.cc", "geolocation_impl.cc",
"geolocation_impl.h", "geolocation_impl.h",
"geolocation_provider.h", "geolocation_provider.h",
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#define DEVICE_GEOLOCATION_GEOLOCATION_CONFIG_H_ #define DEVICE_GEOLOCATION_GEOLOCATION_CONFIG_H_
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "device/geolocation/geolocation_export.h"
#include "device/geolocation/geolocation_provider_impl.h" #include "device/geolocation/geolocation_provider_impl.h"
#include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/bindings/binding.h"
#include "services/device/public/mojom/geolocation_config.mojom.h" #include "services/device/public/mojom/geolocation_config.mojom.h"
...@@ -14,8 +13,7 @@ ...@@ -14,8 +13,7 @@
namespace device { namespace device {
// Implements the GeolocationConfig Mojo interface. // Implements the GeolocationConfig Mojo interface.
class DEVICE_GEOLOCATION_EXPORT GeolocationConfig class GeolocationConfig : public mojom::GeolocationConfig {
: public mojom::GeolocationConfig {
public: public:
GeolocationConfig(); GeolocationConfig();
~GeolocationConfig() override; ~GeolocationConfig() override;
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include <vector> #include <vector>
#include "base/macros.h" #include "base/macros.h"
#include "device/geolocation/geolocation_export.h"
#include "services/device/public/mojom/geolocation.mojom.h" #include "services/device/public/mojom/geolocation.mojom.h"
#include "services/device/public/mojom/geolocation_context.mojom.h" #include "services/device/public/mojom/geolocation_context.mojom.h"
#include "services/device/public/mojom/geoposition.mojom.h" #include "services/device/public/mojom/geoposition.mojom.h"
...@@ -21,8 +20,7 @@ class GeolocationImpl; ...@@ -21,8 +20,7 @@ class GeolocationImpl;
// Provides information to a set of GeolocationImpl instances that are // Provides information to a set of GeolocationImpl instances that are
// associated with a given context. Notably, allows pausing and resuming // associated with a given context. Notably, allows pausing and resuming
// geolocation on these instances. // geolocation on these instances.
class DEVICE_GEOLOCATION_EXPORT GeolocationContext class GeolocationContext : public mojom::GeolocationContext {
: public mojom::GeolocationContext {
public: public:
GeolocationContext(); GeolocationContext();
~GeolocationContext() override; ~GeolocationContext() override;
......
// Copyright 2016 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_GEOLOCATION_PUBLIC_CPP_DEVICE_GEOLOCATION_EXPORT_H_
#define DEVICE_GEOLOCATION_PUBLIC_CPP_DEVICE_GEOLOCATION_EXPORT_H_
#if defined(COMPONENT_BUILD) && defined(WIN32)
#if defined(DEVICE_GEOLOCATION_IMPLEMENTATION)
#define DEVICE_GEOLOCATION_EXPORT __declspec(dllexport)
#else
#define DEVICE_GEOLOCATION_EXPORT __declspec(dllimport)
#endif
#elif defined(COMPONENT_BUILD) && !defined(WIN32)
#if defined(DEVICE_GEOLOCATION_IMPLEMENTATION)
#define DEVICE_GEOLOCATION_EXPORT __attribute__((visibility("default")))
#else
#define DEVICE_GEOLOCATION_EXPORT
#endif
#else
#define DEVICE_GEOLOCATION_EXPORT
#endif
#endif // DEVICE_GEOLOCATION_PUBLIC_CPP_DEVICE_GEOLOCATION_EXPORT_H_
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include <memory> #include <memory>
#include "base/callback_list.h" #include "base/callback_list.h"
#include "device/geolocation/geolocation_export.h"
#include "net/url_request/url_request_context_getter.h" #include "net/url_request/url_request_context_getter.h"
#include "services/device/public/mojom/geoposition.mojom.h" #include "services/device/public/mojom/geoposition.mojom.h"
...@@ -32,7 +31,7 @@ namespace device { ...@@ -32,7 +31,7 @@ namespace device {
// removed. // removed.
class GeolocationProvider { class GeolocationProvider {
public: public:
DEVICE_GEOLOCATION_EXPORT static GeolocationProvider* GetInstance(); static GeolocationProvider* GetInstance();
// Callback type for a function that asynchronously produces a // Callback type for a function that asynchronously produces a
// URLRequestContextGetter. // URLRequestContextGetter.
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/threading/thread.h" #include "base/threading/thread.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "device/geolocation/geolocation_export.h"
#include "device/geolocation/geolocation_provider.h" #include "device/geolocation/geolocation_provider.h"
#include "device/geolocation/public/cpp/location_provider.h" #include "device/geolocation/public/cpp/location_provider.h"
#include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/bindings/binding.h"
...@@ -34,8 +33,7 @@ namespace device { ...@@ -34,8 +33,7 @@ namespace device {
using CustomLocationProviderCallback = using CustomLocationProviderCallback =
base::Callback<std::unique_ptr<LocationProvider>()>; base::Callback<std::unique_ptr<LocationProvider>()>;
class DEVICE_GEOLOCATION_EXPORT GeolocationProviderImpl class GeolocationProviderImpl : public GeolocationProvider,
: public GeolocationProvider,
public mojom::GeolocationControl, public mojom::GeolocationControl,
public base::Thread { public base::Thread {
public: public:
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "device/geolocation/geolocation_export.h"
#include "device/geolocation/geolocation_provider_impl.h" #include "device/geolocation/geolocation_provider_impl.h"
#include "device/geolocation/network_location_provider.h" #include "device/geolocation/network_location_provider.h"
#include "device/geolocation/public/cpp/location_provider.h" #include "device/geolocation/public/cpp/location_provider.h"
...@@ -31,8 +30,7 @@ namespace device { ...@@ -31,8 +30,7 @@ namespace device {
// This class is responsible for handling updates from multiple underlying // This class is responsible for handling updates from multiple underlying
// providers and resolving them to a single 'best' location fix at any given // providers and resolving them to a single 'best' location fix at any given
// moment. // moment.
class DEVICE_GEOLOCATION_EXPORT LocationArbitrator class LocationArbitrator : public LocationProvider,
: public LocationProvider,
public NetworkLocationProvider::LastPositionCache { public NetworkLocationProvider::LastPositionCache {
public: public:
// The TimeDelta newer a location provider has to be that it's worth // The TimeDelta newer a location provider has to be that it's worth
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "base/threading/thread.h" #include "base/threading/thread.h"
#include "base/threading/thread_checker.h" #include "base/threading/thread_checker.h"
#include "device/geolocation/geolocation_export.h"
#include "device/geolocation/network_location_request.h" #include "device/geolocation/network_location_request.h"
#include "device/geolocation/public/cpp/location_provider.h" #include "device/geolocation/public/cpp/location_provider.h"
#include "device/geolocation/wifi_data_provider_manager.h" #include "device/geolocation/wifi_data_provider_manager.h"
...@@ -40,7 +39,7 @@ class NetworkLocationProvider : public LocationProvider { ...@@ -40,7 +39,7 @@ class NetworkLocationProvider : public LocationProvider {
// Cache of recently resolved locations, keyed by the set of unique WiFi APs // Cache of recently resolved locations, keyed by the set of unique WiFi APs
// used in the network query. Public for tests. // used in the network query. Public for tests.
class DEVICE_GEOLOCATION_EXPORT PositionCache { class PositionCache {
public: public:
// The maximum size of the cache of positions. // The maximum size of the cache of positions.
static const size_t kMaximumSize; static const size_t kMaximumSize;
...@@ -74,8 +73,7 @@ class NetworkLocationProvider : public LocationProvider { ...@@ -74,8 +73,7 @@ class NetworkLocationProvider : public LocationProvider {
CacheAgeList cache_age_list_; // Oldest first. CacheAgeList cache_age_list_; // Oldest first.
}; };
DEVICE_GEOLOCATION_EXPORT NetworkLocationProvider( NetworkLocationProvider(scoped_refptr<net::URLRequestContextGetter> context,
scoped_refptr<net::URLRequestContextGetter> context,
const std::string& api_key, const std::string& api_key,
LastPositionCache* last_position_cache); LastPositionCache* last_position_cache);
~NetworkLocationProvider() override; ~NetworkLocationProvider() override;
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "device/geolocation/geolocation_export.h"
#include "device/geolocation/wifi_data_provider.h" #include "device/geolocation/wifi_data_provider.h"
#include "net/url_request/url_fetcher_delegate.h" #include "net/url_request/url_fetcher_delegate.h"
#include "services/device/public/mojom/geoposition.mojom.h" #include "services/device/public/mojom/geoposition.mojom.h"
...@@ -28,8 +27,7 @@ namespace device { ...@@ -28,8 +27,7 @@ namespace device {
// Takes wifi data and sends it to a server to get a position fix. // Takes wifi data and sends it to a server to get a position fix.
// It performs formatting of the request and interpretation of the response. // It performs formatting of the request and interpretation of the response.
class DEVICE_GEOLOCATION_EXPORT NetworkLocationRequest class NetworkLocationRequest : private net::URLFetcherDelegate {
: private net::URLFetcherDelegate {
public: public:
// ID passed to URLFetcher::Create(). Used for testing. // ID passed to URLFetcher::Create(). Used for testing.
static int url_fetcher_id_for_tests; static int url_fetcher_id_for_tests;
......
...@@ -8,12 +8,11 @@ ...@@ -8,12 +8,11 @@
#include <set> #include <set>
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "device/geolocation/geolocation_export.h"
namespace device { namespace device {
// Wifi data relating to a single access point. // Wifi data relating to a single access point.
struct DEVICE_GEOLOCATION_EXPORT AccessPointData { struct AccessPointData {
AccessPointData(); AccessPointData();
~AccessPointData(); ~AccessPointData();
...@@ -35,7 +34,7 @@ struct AccessPointDataLess { ...@@ -35,7 +34,7 @@ struct AccessPointDataLess {
}; };
// All data for wifi. // All data for wifi.
struct DEVICE_GEOLOCATION_EXPORT WifiData { struct WifiData {
WifiData(); WifiData();
WifiData(const WifiData& other); WifiData(const WifiData& other);
~WifiData(); ~WifiData();
......
...@@ -11,13 +11,11 @@ ...@@ -11,13 +11,11 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "device/geolocation/geolocation_export.h"
#include "device/geolocation/wifi_data.h" #include "device/geolocation/wifi_data.h"
namespace device { namespace device {
class DEVICE_GEOLOCATION_EXPORT WifiDataProvider class WifiDataProvider : public base::RefCountedThreadSafe<WifiDataProvider> {
: public base::RefCountedThreadSafe<WifiDataProvider> {
public: public:
WifiDataProvider(); WifiDataProvider();
......
...@@ -14,8 +14,7 @@ ...@@ -14,8 +14,7 @@
namespace device { namespace device {
class DEVICE_GEOLOCATION_EXPORT WifiDataProviderChromeOs class WifiDataProviderChromeOs : public WifiDataProvider {
: public WifiDataProvider {
public: public:
WifiDataProviderChromeOs(); WifiDataProviderChromeOs();
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "device/geolocation/geolocation_export.h"
#include "device/geolocation/wifi_data_provider.h" #include "device/geolocation/wifi_data_provider.h"
#include "device/geolocation/wifi_polling_policy.h" #include "device/geolocation/wifi_polling_policy.h"
...@@ -28,8 +27,7 @@ base::string16 MacAddressAsString16(const uint8_t mac_as_int[6]); ...@@ -28,8 +27,7 @@ base::string16 MacAddressAsString16(const uint8_t mac_as_int[6]);
// do polling behavior is taken care of by this base class, and all the platform // do polling behavior is taken care of by this base class, and all the platform
// need do is provide the underlying WLAN access API and polling policy. // need do is provide the underlying WLAN access API and polling policy.
// Also designed this way for ease of testing the cross-platform behavior. // Also designed this way for ease of testing the cross-platform behavior.
class DEVICE_GEOLOCATION_EXPORT WifiDataProviderCommon class WifiDataProviderCommon : public WifiDataProvider {
: public WifiDataProvider {
public: public:
// Interface to abstract the low level data OS library call, and to allow // Interface to abstract the low level data OS library call, and to allow
// mocking (hence public). // mocking (hence public).
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include <memory> #include <memory>
#include "base/macros.h" #include "base/macros.h"
#include "device/geolocation/geolocation_export.h"
#include "device/geolocation/wifi_data_provider_common.h" #include "device/geolocation/wifi_data_provider_common.h"
namespace dbus { namespace dbus {
...@@ -17,8 +16,7 @@ class Bus; ...@@ -17,8 +16,7 @@ class Bus;
namespace device { namespace device {
class DEVICE_GEOLOCATION_EXPORT WifiDataProviderLinux class WifiDataProviderLinux : public WifiDataProviderCommon {
: public WifiDataProviderCommon {
public: public:
WifiDataProviderLinux(); WifiDataProviderLinux();
......
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "device/geolocation/geolocation_export.h"
#include "device/geolocation/wifi_data.h" #include "device/geolocation/wifi_data.h"
namespace device { namespace device {
...@@ -35,7 +34,7 @@ class WifiDataProvider; ...@@ -35,7 +34,7 @@ class WifiDataProvider;
// We use a singleton instance of this class which is shared by multiple network // We use a singleton instance of this class which is shared by multiple network
// location providers. These location providers access the instance through the // location providers. These location providers access the instance through the
// Register and Unregister methods. // Register and Unregister methods.
class DEVICE_GEOLOCATION_EXPORT WifiDataProviderManager { class WifiDataProviderManager {
public: public:
typedef WifiDataProvider* (*ImplFactoryFunction)(void); typedef WifiDataProvider* (*ImplFactoryFunction)(void);
......
...@@ -6,13 +6,11 @@ ...@@ -6,13 +6,11 @@
#define DEVICE_GEOLOCATION_WIFI_DATA_PROVIDER_WIN_H_ #define DEVICE_GEOLOCATION_WIFI_DATA_PROVIDER_WIN_H_
#include "base/macros.h" #include "base/macros.h"
#include "device/geolocation/geolocation_export.h"
#include "device/geolocation/wifi_data_provider_common.h" #include "device/geolocation/wifi_data_provider_common.h"
namespace device { namespace device {
class DEVICE_GEOLOCATION_EXPORT WifiDataProviderWin class WifiDataProviderWin : public WifiDataProviderCommon {
: public WifiDataProviderCommon {
public: public:
WifiDataProviderWin(); WifiDataProviderWin();
......
...@@ -9,12 +9,11 @@ ...@@ -9,12 +9,11 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "device/geolocation/geolocation_export.h"
namespace device { namespace device {
// Allows sharing and mocking of the update polling policy function. // Allows sharing and mocking of the update polling policy function.
class DEVICE_GEOLOCATION_EXPORT WifiPollingPolicy { class WifiPollingPolicy {
public: public:
virtual ~WifiPollingPolicy() = default; virtual ~WifiPollingPolicy() = default;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment