Index: Source/modules/geolocation/Geolocation.cpp |
diff --git a/Source/modules/geolocation/Geolocation.cpp b/Source/modules/geolocation/Geolocation.cpp |
index 00f6acabbda7bea92e93a592284a73323bee3169..a52de3abe6321016005909e1ec141462866e20f0 100644 |
--- a/Source/modules/geolocation/Geolocation.cpp |
+++ b/Source/modules/geolocation/Geolocation.cpp |
@@ -119,11 +119,6 @@ void Geolocation::GeoNotifier::setUseCachedPosition() |
m_timer.startOneShot(0, FROM_HERE); |
} |
-bool Geolocation::GeoNotifier::hasZeroTimeout() const |
-{ |
- return m_options->hasTimeout() && m_options->timeout() == 0; |
-} |
- |
void Geolocation::GeoNotifier::runSuccessCallback(Geoposition* position) |
{ |
// If we are here and the Geolocation permission is not approved, something has |
@@ -140,10 +135,9 @@ void Geolocation::GeoNotifier::runErrorCallback(PositionError* error) |
m_errorCallback->handleEvent(error); |
} |
-void Geolocation::GeoNotifier::startTimerIfNeeded() |
+void Geolocation::GeoNotifier::startTimer() |
{ |
- if (m_options->hasTimeout()) |
- m_timer.startOneShot(m_options->timeout() / 1000.0, FROM_HERE); |
+ m_timer.startOneShot(m_options->timeout() / 1000.0, FROM_HERE); |
} |
void Geolocation::GeoNotifier::stopTimer() |
@@ -350,14 +344,14 @@ void Geolocation::startRequest(GeoNotifier *notifier) |
notifier->setFatalError(PositionError::create(PositionError::PERMISSION_DENIED, permissionDeniedErrorMessage)); |
else if (haveSuitableCachedPosition(notifier->options())) |
notifier->setUseCachedPosition(); |
- else if (notifier->hasZeroTimeout()) |
- notifier->startTimerIfNeeded(); |
+ else if (!notifier->options()->timeout()) |
+ notifier->startTimer(); |
else if (!isAllowed()) { |
// if we don't yet have permission, request for permission before calling startUpdating() |
m_pendingForPermissionNotifiers.add(notifier); |
requestPermission(); |
} else if (startUpdating(notifier)) |
- notifier->startTimerIfNeeded(); |
+ notifier->startTimer(); |
else |
notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, failedToStartServiceErrorMessage)); |
} |
@@ -408,8 +402,8 @@ void Geolocation::makeCachedPositionCallbacks() |
if (m_oneShots.contains(notifier)) |
m_oneShots.remove(notifier); |
else if (m_watchers.contains(notifier)) { |
- if (notifier->hasZeroTimeout() || startUpdating(notifier)) |
- notifier->startTimerIfNeeded(); |
+ if (!notifier->options()->timeout() || startUpdating(notifier)) |
+ notifier->startTimer(); |
else |
notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, failedToStartServiceErrorMessage)); |
} |
@@ -435,8 +429,6 @@ bool Geolocation::haveSuitableCachedPosition(PositionOptions* options) |
Geoposition* cachedPosition = lastPosition(); |
if (!cachedPosition) |
return false; |
- if (!options->hasMaximumAge()) |
- return true; |
if (!options->maximumAge()) |
return false; |
DOMTimeStamp currentTimeMillis = convertSecondsToDOMTimeStamp(currentTime()); |
@@ -698,7 +690,7 @@ void Geolocation::handlePendingPermissionNotifiers() |
// start all pending notification requests as permission granted. |
// The notifier is always ref'ed by m_oneShots or m_watchers. |
if (startUpdating(notifier)) |
- notifier->startTimerIfNeeded(); |
+ notifier->startTimer(); |
else |
notifier->setFatalError(PositionError::create(PositionError::POSITION_UNAVAILABLE, failedToStartServiceErrorMessage)); |
} else { |