Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3099)

Unified Diff: blimp/engine/feature/geolocation/blimp_location_provider.h

Issue 2328453003: Makes use of EngineGeolocationFeature weak_ptr threadsafe. (Closed)
Patch Set: Addresses Wez's #23 comments. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | blimp/engine/feature/geolocation/blimp_location_provider.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: blimp/engine/feature/geolocation/blimp_location_provider.h
diff --git a/blimp/engine/feature/geolocation/blimp_location_provider.h b/blimp/engine/feature/geolocation/blimp_location_provider.h
index 39372da41c5dda1edc1d186653844ac6a5bce41c..89fd5baf87f36a1a1aa0e5492b4a67b7c3c4d4d2 100644
--- a/blimp/engine/feature/geolocation/blimp_location_provider.h
+++ b/blimp/engine/feature/geolocation/blimp_location_provider.h
@@ -17,11 +17,11 @@ namespace engine {
class BlimpLocationProvider : public device::LocationProvider {
public:
// A delegate that implements a subset of LocationProvider's functions.
+ // All methods will be executed on |delegate_task_runner_|.
class Delegate {
public:
using GeopositionReceivedCallback =
base::Callback<void(const device::Geoposition&)>;
-
virtual ~Delegate() {}
virtual void RequestAccuracy(
@@ -31,7 +31,9 @@ class BlimpLocationProvider : public device::LocationProvider {
const GeopositionReceivedCallback& callback) = 0;
};
- explicit BlimpLocationProvider(base::WeakPtr<Delegate> delegate);
+ BlimpLocationProvider(
+ base::WeakPtr<Delegate> delegate,
+ scoped_refptr<base::SequencedTaskRunner> delegate_task_runner);
~BlimpLocationProvider() override;
// device::LocationProvider implementation.
@@ -43,14 +45,21 @@ class BlimpLocationProvider : public device::LocationProvider {
const LocationProviderUpdateCallback& callback) override;
private:
+ void OnLocationUpdate(const device::Geoposition& geoposition);
+
// This delegate handles a subset of the LocationProvider functionality.
base::WeakPtr<Delegate> delegate_;
+ scoped_refptr<base::SequencedTaskRunner> delegate_task_runner_;
device::Geoposition cached_position_;
// True if a successful StartProvider call has occured.
bool is_started_;
+ LocationProviderUpdateCallback location_update_callback_;
+
+ base::WeakPtrFactory<BlimpLocationProvider> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(BlimpLocationProvider);
};
« no previous file with comments | « no previous file | blimp/engine/feature/geolocation/blimp_location_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698