diff options
author | Steve Block <steveblock@google.com> | 2009-09-02 16:41:24 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2009-09-04 17:29:19 +0100 |
commit | feee28e61b0337792c7129c54623c71adffc8ed1 (patch) | |
tree | 031cab0a77b4131d893a7eadc991c6c9f267de8e /WebCore/platform | |
parent | e27fedc48d78b1c1b6e656fe42d64efd60056464 (diff) | |
download | external_webkit-feee28e61b0337792c7129c54623c71adffc8ed1.zip external_webkit-feee28e61b0337792c7129c54623c71adffc8ed1.tar.gz external_webkit-feee28e61b0337792c7129c54623c71adffc8ed1.tar.bz2 |
Updates MockGeolocationService to call back to the Geolocation object only when active.
Diffstat (limited to 'WebCore/platform')
-rwxr-xr-x | WebCore/platform/MockGeolocationService.cpp | 10 | ||||
-rwxr-xr-x | WebCore/platform/MockGeolocationService.h | 3 |
2 files changed, 13 insertions, 0 deletions
diff --git a/WebCore/platform/MockGeolocationService.cpp b/WebCore/platform/MockGeolocationService.cpp index 72d85ef..b147f53 100755 --- a/WebCore/platform/MockGeolocationService.cpp +++ b/WebCore/platform/MockGeolocationService.cpp @@ -45,6 +45,7 @@ GeolocationService* MockGeolocationService::create(GeolocationServiceClient* cli MockGeolocationService::MockGeolocationService(GeolocationServiceClient* client) : GeolocationService(client) , m_timer(this, &MockGeolocationService::timerFired) + , m_isActive(false) { s_instances->add(this); } @@ -77,10 +78,16 @@ void MockGeolocationService::setError(PassRefPtr<PositionError> error) bool MockGeolocationService::startUpdating(PositionOptions*) { + m_isActive = true; m_timer.startOneShot(0); return true; } +void MockGeolocationService::stopUpdating() +{ + m_isActive = false; +} + void MockGeolocationService::timerFired(Timer<MockGeolocationService>* timer) { ASSERT_UNUSED(timer, timer == &m_timer); @@ -99,6 +106,9 @@ void MockGeolocationService::makeGeolocationCallbackFromAllInstances() void MockGeolocationService::makeGeolocationCallback() { + if (!m_isActive) + return; + if (*s_lastPosition) { positionChanged(); } else if (*s_lastError) { diff --git a/WebCore/platform/MockGeolocationService.h b/WebCore/platform/MockGeolocationService.h index 2f190e6..6cb2493 100755 --- a/WebCore/platform/MockGeolocationService.h +++ b/WebCore/platform/MockGeolocationService.h @@ -47,6 +47,7 @@ class MockGeolocationService : public GeolocationService { virtual ~MockGeolocationService(); virtual bool startUpdating(PositionOptions*); + virtual void stopUpdating(); static void setPosition(PassRefPtr<Geoposition> position); static void setError(PassRefPtr<PositionError> position); @@ -70,6 +71,8 @@ class MockGeolocationService : public GeolocationService { static RefPtr<PositionError>* s_lastError; Timer<MockGeolocationService> m_timer; + + bool m_isActive; }; } // namespace WebCore |