diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-09-04 09:54:34 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-09-04 09:54:34 -0700 |
commit | 4423677617c38c5d234aff356cc0e982ac06820c (patch) | |
tree | 97dd02732c2fa925ffdaf38a07a923c21b1a0919 /WebCore | |
parent | 4bcc1c92652ce492c6762866a8eef534d4352661 (diff) | |
parent | feee28e61b0337792c7129c54623c71adffc8ed1 (diff) | |
download | external_webkit-4423677617c38c5d234aff356cc0e982ac06820c.zip external_webkit-4423677617c38c5d234aff356cc0e982ac06820c.tar.gz external_webkit-4423677617c38c5d234aff356cc0e982ac06820c.tar.bz2 |
Merge change 23969 into eclair
* changes:
Updates MockGeolocationService to call back to the Geolocation object only when active.
Diffstat (limited to 'WebCore')
-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 |