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

Unified Diff: content/browser/geolocation/geolocation_provider_impl.cc

Issue 65273002: Add a mechanism to pause and resume geolocation requests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Wire up onPause/onResume Created 7 years, 1 month 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: content/browser/geolocation/geolocation_provider_impl.cc
diff --git a/content/browser/geolocation/geolocation_provider_impl.cc b/content/browser/geolocation/geolocation_provider_impl.cc
index f343c2920ff527466011c87b469a48a93f475f3d..d8f06ea79e0c9791a0377dc8ab2131575f1346b5 100644
--- a/content/browser/geolocation/geolocation_provider_impl.cc
+++ b/content/browser/geolocation/geolocation_provider_impl.cc
@@ -233,4 +233,34 @@ LocationArbitrator* GeolocationProviderImpl::CreateArbitrator() {
return new LocationArbitratorImpl(callback);
}
+void GeolocationProviderImpl::PauseAllLocationUpdateCallbacks() {
+ if (!IsRunning()) return;
+ if (!OnGeolocationThread()) {
+ message_loop()->PostTask(
+ FROM_HERE,
+ base::Bind(&GeolocationProviderImpl::PauseAllLocationUpdateCallbacks,
+ base::Unretained(this)));
+ return;
+ }
+
+ DCHECK(OnGeolocationThread());
+ DCHECK(arbitrator_);
+ arbitrator_->PauseProviders();
+}
+
+void GeolocationProviderImpl::ResumeAllLocationUpdateCallbacks() {
+ if (!IsRunning()) return;
+ if (!OnGeolocationThread()) {
+ message_loop()->PostTask(
+ FROM_HERE,
+ base::Bind(&GeolocationProviderImpl::ResumeAllLocationUpdateCallbacks,
+ base::Unretained(this)));
+ return;
+ }
+
+ DCHECK(OnGeolocationThread());
+ DCHECK(arbitrator_);
+ arbitrator_->ResumeProviders();
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698