Index: content/browser/geolocation/gps_location_provider_linux.cc |
diff --git a/content/browser/geolocation/gps_location_provider_linux.cc b/content/browser/geolocation/gps_location_provider_linux.cc |
index 52c8050fe07fcc5d303adca1da3a63f10730ae88..9b53999ec65b9a2cba44307023f0bbcfb8c9f9e7 100644 |
--- a/content/browser/geolocation/gps_location_provider_linux.cc |
+++ b/content/browser/geolocation/gps_location_provider_linux.cc |
@@ -46,7 +46,10 @@ bool PositionsDifferSiginificantly(const Geoposition& position_1, |
} // namespace |
GpsLocationProviderLinux::GpsLocationProviderLinux(LibGpsFactory libgps_factory) |
- : libgps_factory_(libgps_factory), |
+ : gpsd_reconnect_interval_millis_(kGpsdReconnectRetryIntervalMillis), |
+ poll_period_moving_millis_(kPollPeriodMovingMillis), |
+ poll_period_stationary_millis_(kPollPeriodStationaryMillis), |
+ libgps_factory_(libgps_factory), |
ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { |
DCHECK(libgps_factory_); |
} |
@@ -66,7 +69,7 @@ bool GpsLocationProviderLinux::StartProvider(bool high_accuracy) { |
position_.error_code = Geoposition::ERROR_CODE_POSITION_UNAVAILABLE; |
gps_.reset(libgps_factory_()); |
if (gps_ == NULL) { |
- DLOG(WARNING) << "libgps.so could not be loaded"; |
+ DLOG(WARNING) << "libgps could not be loaded"; |
return false; |
} |
ScheduleNextGpsPoll(0); |
@@ -95,19 +98,20 @@ void GpsLocationProviderLinux::OnPermissionGranted( |
void GpsLocationProviderLinux::DoGpsPollTask() { |
if (!gps_->Start()) { |
DLOG(WARNING) << "Couldn't start GPS provider."; |
- ScheduleNextGpsPoll(kGpsdReconnectRetryIntervalMillis); |
+ ScheduleNextGpsPoll(gpsd_reconnect_interval_millis_); |
return; |
} |
- if (!gps_->Poll()) { |
- ScheduleNextGpsPoll(kPollPeriodStationaryMillis); |
+ |
+ Geoposition new_position; |
+ if (!gps_->Read(&new_position)) { |
+ ScheduleNextGpsPoll(poll_period_stationary_millis_); |
return; |
} |
- Geoposition new_position; |
- gps_->GetPosition(&new_position); |
+ |
DCHECK(new_position.IsInitialized()); |
const bool differ = PositionsDifferSiginificantly(position_, new_position); |
- ScheduleNextGpsPoll(differ ? kPollPeriodMovingMillis : |
- kPollPeriodStationaryMillis); |
+ ScheduleNextGpsPoll(differ ? poll_period_moving_millis_ : |
+ poll_period_stationary_millis_); |
if (differ || new_position.error_code != Geoposition::ERROR_CODE_NONE) { |
// Update if the new location is interesting or we have an error to report. |
position_ = new_position; |