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

Unified Diff: chrome/browser/geolocation/core_location_provider_mac.mm

Issue 6037016: Fix incorrect assertion following the move of Geolocation provider in to its own thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nits. Created 9 years, 11 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 | « chrome/browser/geolocation/core_location_provider_mac.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/geolocation/core_location_provider_mac.mm
diff --git a/chrome/browser/geolocation/core_location_provider_mac.mm b/chrome/browser/geolocation/core_location_provider_mac.mm
index deb92c90d7130c6b50b8170e03123939b06b6823..dbcd7d07926a7e9c0662faf3c4919abccb7fa031 100644
--- a/chrome/browser/geolocation/core_location_provider_mac.mm
+++ b/chrome/browser/geolocation/core_location_provider_mac.mm
@@ -9,7 +9,8 @@
#include "base/command_line.h"
#include "chrome/common/chrome_switches.h"
-CoreLocationProviderMac::CoreLocationProviderMac() {
+CoreLocationProviderMac::CoreLocationProviderMac()
+ : is_updating_(false) {
data_provider_ = new CoreLocationDataProviderMac();
data_provider_->AddRef();
}
@@ -20,12 +21,19 @@ CoreLocationProviderMac::~CoreLocationProviderMac() {
}
bool CoreLocationProviderMac::StartProvider(bool high_accuracy) {
- data_provider_->StartUpdating(this);
+ // StartProvider maybe called multiple times. For example, to update the high
+ // accuracy hint.
+ // TODO(jknotten): Support high_accuracy hint in underlying data provider.
+ if (is_updating_)
+ return true;
+
+ is_updating_ = data_provider_->StartUpdating(this);
return true;
}
void CoreLocationProviderMac::StopProvider() {
data_provider_->StopUpdating();
+ is_updating_ = false;
}
void CoreLocationProviderMac::GetPosition(Geoposition* position) {
@@ -43,8 +51,8 @@ void CoreLocationProviderMac::SetPosition(Geoposition* position) {
}
LocationProviderBase* NewSystemLocationProvider() {
- if(CommandLine::ForCurrentProcess()
- ->HasSwitch(switches::kExperimentalLocationFeatures)) {
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kExperimentalLocationFeatures)) {
return new CoreLocationProviderMac;
}
return NULL;
« no previous file with comments | « chrome/browser/geolocation/core_location_provider_mac.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698