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

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

Issue 2328453003: Makes use of EngineGeolocationFeature weak_ptr threadsafe. (Closed)
Patch Set: Addresses kmarshall's #3 comments. Created 4 years, 3 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
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..6d37a5229705644cdf757e70225ee9747a7d657f 100644
--- a/blimp/engine/feature/geolocation/blimp_location_provider.h
+++ b/blimp/engine/feature/geolocation/blimp_location_provider.h
@@ -14,9 +14,12 @@ namespace blimp {
namespace engine {
// Location provider for Blimp using the device's provider over the network.
+// All calls made from BlimpLocationProvider involving |delegate_| must be
+// posted using |delegate_task_runner_|.
Wez 2016/09/13 20:19:07 nit: This is part of the Delegate contract, so you
CJ 2016/09/13 23:34:02 Done.
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 =
@@ -31,7 +34,9 @@ class BlimpLocationProvider : public device::LocationProvider {
const GeopositionReceivedCallback& callback) = 0;
};
- explicit BlimpLocationProvider(base::WeakPtr<Delegate> delegate);
+ BlimpLocationProvider(
+ base::WeakPtr<Delegate> delegate,
+ scoped_refptr<base::SingleThreadTaskRunner> delegate_task_runner);
Wez 2016/09/13 20:19:07 nit: Strictly a SequencedTaskRunner is sufficient
CJ 2016/09/13 23:34:02 Are you saying remove the scoped_refptr part?
Wez 2016/09/16 00:40:16 So, I'm saying you should accept a scoped_refptr<S
CJ 2016/09/16 22:55:53 Done.
~BlimpLocationProvider() override;
// device::LocationProvider implementation.
@@ -46,6 +51,8 @@ class BlimpLocationProvider : public device::LocationProvider {
// This delegate handles a subset of the LocationProvider functionality.
base::WeakPtr<Delegate> delegate_;
+ scoped_refptr<base::SingleThreadTaskRunner> delegate_task_runner_;
+
device::Geoposition cached_position_;
// True if a successful StartProvider call has occured.

Powered by Google App Engine
This is Rietveld 408576698