summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chromium/device/geolocation/location_arbitrator.cc15
-rw-r--r--chromium/device/geolocation/location_arbitrator.h5
2 files changed, 14 insertions, 6 deletions
diff --git a/chromium/device/geolocation/location_arbitrator.cc b/chromium/device/geolocation/location_arbitrator.cc
index 2e10c303e63..a83983bf3a8 100644
--- a/chromium/device/geolocation/location_arbitrator.cc
+++ b/chromium/device/geolocation/location_arbitrator.cc
@@ -130,12 +130,15 @@ void LocationArbitrator::OnLocationUpdate(const LocationProvider* provider,
const Geoposition& new_position) {
DCHECK(new_position.Validate() ||
new_position.error_code != Geoposition::ERROR_CODE_NONE);
- if (!IsNewPositionBetter(position_, new_position,
- provider == position_provider_))
- return;
- position_provider_ = provider;
- position_ = new_position;
- arbitrator_update_callback_.Run(this, position_);
+ providers_polled_.insert(provider);
+ if (IsNewPositionBetter(position_, new_position,
+ provider == position_provider_)) {
+ position_provider_ = provider;
+ position_ = new_position;
+ }
+ // Don't fail until all providers had their say.
+ if (position_.Validate() || (providers_polled_.size() == providers_.size()))
+ arbitrator_update_callback_.Run(this, position_);
}
const Geoposition& LocationArbitrator::GetPosition() {
diff --git a/chromium/device/geolocation/location_arbitrator.h b/chromium/device/geolocation/location_arbitrator.h
index 6f6684f42ef..72a8ed5f03c 100644
--- a/chromium/device/geolocation/location_arbitrator.h
+++ b/chromium/device/geolocation/location_arbitrator.h
@@ -21,6 +21,8 @@
#include "device/geolocation/location_provider.h"
#include "net/url_request/url_request_context_getter.h"
+#include <set>
+
namespace net {
class URLRequestContextGetter;
}
@@ -115,6 +117,9 @@ class DEVICE_GEOLOCATION_EXPORT LocationArbitrator : public LocationProvider {
// The current best estimate of our position.
Geoposition position_;
+ // Used to track if all providers had a chance to provide a location.
+ std::set<const LocationProvider*> providers_polled_;
+
// Tracks whether providers should be running.
bool is_running_;