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") {
"//crypto",
"//crypto:platform",
"//device/base",
"//device/geolocation",
"//device/usb/mojo",
"//device/usb/public/mojom",
"//device/vr/buildflags",
......
......@@ -9,9 +9,7 @@ if (is_android) {
import("//build/config/android/rules.gni") # For generate_jni().
}
component("geolocation") {
defines = [ "DEVICE_GEOLOCATION_IMPLEMENTATION" ]
source_set("geolocation") {
sources = [
"empty_wifi_data_provider.cc",
"empty_wifi_data_provider.h",
......@@ -19,7 +17,6 @@ component("geolocation") {
"geolocation_config.h",
"geolocation_context.cc",
"geolocation_context.h",
"geolocation_export.h",
"geolocation_impl.cc",
"geolocation_impl.h",
"geolocation_provider.h",
......
......@@ -6,7 +6,6 @@
#define DEVICE_GEOLOCATION_GEOLOCATION_CONFIG_H_
#include "base/compiler_specific.h"
#include "device/geolocation/geolocation_export.h"
#include "device/geolocation/geolocation_provider_impl.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "services/device/public/mojom/geolocation_config.mojom.h"
......@@ -14,8 +13,7 @@
namespace device {
// Implements the GeolocationConfig Mojo interface.
class DEVICE_GEOLOCATION_EXPORT GeolocationConfig
: public mojom::GeolocationConfig {
class GeolocationConfig : public mojom::GeolocationConfig {
public:
GeolocationConfig();
~GeolocationConfig() override;
......
......@@ -9,7 +9,6 @@
#include <vector>
#include "base/macros.h"
#include "device/geolocation/geolocation_export.h"
#include "services/device/public/mojom/geolocation.mojom.h"
#include "services/device/public/mojom/geolocation_context.mojom.h"
#include "services/device/public/mojom/geoposition.mojom.h"
......@@ -21,8 +20,7 @@ class GeolocationImpl;
// Provides information to a set of GeolocationImpl instances that are
// associated with a given context. Notably, allows pausing and resuming
// geolocation on these instances.
class DEVICE_GEOLOCATION_EXPORT GeolocationContext
: public mojom::GeolocationContext {
class GeolocationContext : public mojom::GeolocationContext {
public:
GeolocationContext();
~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 @@
#include <memory>
#include "base/callback_list.h"
#include "device/geolocation/geolocation_export.h"
#include "net/url_request/url_request_context_getter.h"
#include "services/device/public/mojom/geoposition.mojom.h"
......@@ -32,7 +31,7 @@ namespace device {
// removed.
class GeolocationProvider {
public:
DEVICE_GEOLOCATION_EXPORT static GeolocationProvider* GetInstance();
static GeolocationProvider* GetInstance();
// Callback type for a function that asynchronously produces a
// URLRequestContextGetter.
......
......@@ -14,7 +14,6 @@
#include "base/macros.h"
#include "base/threading/thread.h"
#include "build/build_config.h"
#include "device/geolocation/geolocation_export.h"
#include "device/geolocation/geolocation_provider.h"
#include "device/geolocation/public/cpp/location_provider.h"
#include "mojo/public/cpp/bindings/binding.h"
......@@ -34,10 +33,9 @@ namespace device {
using CustomLocationProviderCallback =
base::Callback<std::unique_ptr<LocationProvider>()>;
class DEVICE_GEOLOCATION_EXPORT GeolocationProviderImpl
: public GeolocationProvider,
public mojom::GeolocationControl,
public base::Thread {
class GeolocationProviderImpl : public GeolocationProvider,
public mojom::GeolocationControl,
public base::Thread {
public:
// GeolocationProvider implementation:
std::unique_ptr<GeolocationProvider::Subscription> AddLocationUpdateCallback(
......
......@@ -14,7 +14,6 @@
#include "base/macros.h"
#include "base/strings/string16.h"
#include "base/time/time.h"
#include "device/geolocation/geolocation_export.h"
#include "device/geolocation/geolocation_provider_impl.h"
#include "device/geolocation/network_location_provider.h"
#include "device/geolocation/public/cpp/location_provider.h"
......@@ -31,9 +30,8 @@ namespace device {
// This class is responsible for handling updates from multiple underlying
// providers and resolving them to a single 'best' location fix at any given
// moment.
class DEVICE_GEOLOCATION_EXPORT LocationArbitrator
: public LocationProvider,
public NetworkLocationProvider::LastPositionCache {
class LocationArbitrator : public LocationProvider,
public NetworkLocationProvider::LastPositionCache {
public:
// The TimeDelta newer a location provider has to be that it's worth
// switching to this location provider on the basis of it being fresher
......
......@@ -17,7 +17,6 @@
#include "base/strings/string16.h"
#include "base/threading/thread.h"
#include "base/threading/thread_checker.h"
#include "device/geolocation/geolocation_export.h"
#include "device/geolocation/network_location_request.h"
#include "device/geolocation/public/cpp/location_provider.h"
#include "device/geolocation/wifi_data_provider_manager.h"
......@@ -40,7 +39,7 @@ class NetworkLocationProvider : public LocationProvider {
// Cache of recently resolved locations, keyed by the set of unique WiFi APs
// used in the network query. Public for tests.
class DEVICE_GEOLOCATION_EXPORT PositionCache {
class PositionCache {
public:
// The maximum size of the cache of positions.
static const size_t kMaximumSize;
......@@ -74,10 +73,9 @@ class NetworkLocationProvider : public LocationProvider {
CacheAgeList cache_age_list_; // Oldest first.
};
DEVICE_GEOLOCATION_EXPORT NetworkLocationProvider(
scoped_refptr<net::URLRequestContextGetter> context,
const std::string& api_key,
LastPositionCache* last_position_cache);
NetworkLocationProvider(scoped_refptr<net::URLRequestContextGetter> context,
const std::string& api_key,
LastPositionCache* last_position_cache);
~NetworkLocationProvider() override;
// LocationProvider implementation
......
......@@ -11,7 +11,6 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/strings/string16.h"
#include "device/geolocation/geolocation_export.h"
#include "device/geolocation/wifi_data_provider.h"
#include "net/url_request/url_fetcher_delegate.h"
#include "services/device/public/mojom/geoposition.mojom.h"
......@@ -28,8 +27,7 @@ namespace device {
// 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.
class DEVICE_GEOLOCATION_EXPORT NetworkLocationRequest
: private net::URLFetcherDelegate {
class NetworkLocationRequest : private net::URLFetcherDelegate {
public:
// ID passed to URLFetcher::Create(). Used for testing.
static int url_fetcher_id_for_tests;
......
......@@ -8,12 +8,11 @@
#include <set>
#include "base/strings/string16.h"
#include "device/geolocation/geolocation_export.h"
namespace device {
// Wifi data relating to a single access point.
struct DEVICE_GEOLOCATION_EXPORT AccessPointData {
struct AccessPointData {
AccessPointData();
~AccessPointData();
......@@ -35,7 +34,7 @@ struct AccessPointDataLess {
};
// All data for wifi.
struct DEVICE_GEOLOCATION_EXPORT WifiData {
struct WifiData {
WifiData();
WifiData(const WifiData& other);
~WifiData();
......
......@@ -11,13 +11,11 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/single_thread_task_runner.h"
#include "device/geolocation/geolocation_export.h"
#include "device/geolocation/wifi_data.h"
namespace device {
class DEVICE_GEOLOCATION_EXPORT WifiDataProvider
: public base::RefCountedThreadSafe<WifiDataProvider> {
class WifiDataProvider : public base::RefCountedThreadSafe<WifiDataProvider> {
public:
WifiDataProvider();
......
......@@ -14,8 +14,7 @@
namespace device {
class DEVICE_GEOLOCATION_EXPORT WifiDataProviderChromeOs
: public WifiDataProvider {
class WifiDataProviderChromeOs : public WifiDataProvider {
public:
WifiDataProviderChromeOs();
......
......@@ -14,7 +14,6 @@
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/string16.h"
#include "device/geolocation/geolocation_export.h"
#include "device/geolocation/wifi_data_provider.h"
#include "device/geolocation/wifi_polling_policy.h"
......@@ -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
// need do is provide the underlying WLAN access API and polling policy.
// Also designed this way for ease of testing the cross-platform behavior.
class DEVICE_GEOLOCATION_EXPORT WifiDataProviderCommon
: public WifiDataProvider {
class WifiDataProviderCommon : public WifiDataProvider {
public:
// Interface to abstract the low level data OS library call, and to allow
// mocking (hence public).
......
......@@ -8,7 +8,6 @@
#include <memory>
#include "base/macros.h"
#include "device/geolocation/geolocation_export.h"
#include "device/geolocation/wifi_data_provider_common.h"
namespace dbus {
......@@ -17,8 +16,7 @@ class Bus;
namespace device {
class DEVICE_GEOLOCATION_EXPORT WifiDataProviderLinux
: public WifiDataProviderCommon {
class WifiDataProviderLinux : public WifiDataProviderCommon {
public:
WifiDataProviderLinux();
......
......@@ -23,7 +23,6 @@
#include "base/memory/ref_counted.h"
#include "base/strings/string16.h"
#include "base/strings/string_util.h"
#include "device/geolocation/geolocation_export.h"
#include "device/geolocation/wifi_data.h"
namespace device {
......@@ -35,7 +34,7 @@ class WifiDataProvider;
// We use a singleton instance of this class which is shared by multiple network
// location providers. These location providers access the instance through the
// Register and Unregister methods.
class DEVICE_GEOLOCATION_EXPORT WifiDataProviderManager {
class WifiDataProviderManager {
public:
typedef WifiDataProvider* (*ImplFactoryFunction)(void);
......
......@@ -6,13 +6,11 @@
#define DEVICE_GEOLOCATION_WIFI_DATA_PROVIDER_WIN_H_
#include "base/macros.h"
#include "device/geolocation/geolocation_export.h"
#include "device/geolocation/wifi_data_provider_common.h"
namespace device {
class DEVICE_GEOLOCATION_EXPORT WifiDataProviderWin
: public WifiDataProviderCommon {
class WifiDataProviderWin : public WifiDataProviderCommon {
public:
WifiDataProviderWin();
......
......@@ -9,12 +9,11 @@
#include "base/macros.h"
#include "base/time/time.h"
#include "device/geolocation/geolocation_export.h"
namespace device {
// Allows sharing and mocking of the update polling policy function.
class DEVICE_GEOLOCATION_EXPORT WifiPollingPolicy {
class WifiPollingPolicy {
public:
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