diff options
author | Steve Block <steveblock@google.com> | 2010-02-18 11:26:48 +0000 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-02-18 12:17:02 +0000 |
commit | 930792dfdde9ad0fac3251ab70eb00d97f2fe88d (patch) | |
tree | 034286e22e38d273d2bba3dad8983fdea9a2f77f /WebCore/platform | |
parent | 2e837c8b6511f85209518f832e340662218eb3dc (diff) | |
download | external_webkit-930792dfdde9ad0fac3251ab70eb00d97f2fe88d.zip external_webkit-930792dfdde9ad0fac3251ab70eb00d97f2fe88d.tar.gz external_webkit-930792dfdde9ad0fac3251ab70eb00d97f2fe88d.tar.bz2 |
Fixes a bug with the Geolocation suspend/resume behaviour
PlatformBridge::isWebViewPaused needs to be an instance method, rather than a
static. This fixes a bug where if the user switches browser windows while a
page that uses Geolocation is still loading, the Geolocation service won't be
started in the suspended state.
Note that this is a temporary fix, as the upstreaming of the existing
suspend/resume code will introduce a new approach, which will avoid this problem
altogether. See https://android-git.corp.google.com/g/#change,38942
Change-Id: I3f07f8837b8a8c1c5e7e4f5112ab487188670c3a
Diffstat (limited to 'WebCore/platform')
-rw-r--r-- | WebCore/platform/GeolocationService.h | 5 | ||||
-rw-r--r-- | WebCore/platform/android/GeolocationServiceAndroid.cpp | 9 | ||||
-rw-r--r-- | WebCore/platform/android/GeolocationServiceAndroid.h | 4 | ||||
-rw-r--r-- | WebCore/platform/android/PlatformBridge.h | 4 | ||||
-rw-r--r-- | WebCore/platform/mock/GeolocationServiceMock.cpp | 5 | ||||
-rwxr-xr-x | WebCore/platform/mock/GeolocationServiceMock.h | 5 |
6 files changed, 27 insertions, 5 deletions
diff --git a/WebCore/platform/GeolocationService.h b/WebCore/platform/GeolocationService.h index cebf313..f991f67 100644 --- a/WebCore/platform/GeolocationService.h +++ b/WebCore/platform/GeolocationService.h @@ -47,7 +47,12 @@ public: static GeolocationService* create(GeolocationServiceClient*); virtual ~GeolocationService() { } +#if PLATFORM(ANDROID) + // TODO: Upstream to webkit.org. See https://bugs.webkit.org/show_bug.cgi?id=34082 + virtual bool startUpdating(PositionOptions*, bool suspend) { return false; } +#else virtual bool startUpdating(PositionOptions*) { return false; } +#endif virtual void stopUpdating() { } virtual void suspend() { } diff --git a/WebCore/platform/android/GeolocationServiceAndroid.cpp b/WebCore/platform/android/GeolocationServiceAndroid.cpp index 3d45e75..aaa7af7 100644 --- a/WebCore/platform/android/GeolocationServiceAndroid.cpp +++ b/WebCore/platform/android/GeolocationServiceAndroid.cpp @@ -28,7 +28,6 @@ #include "GeolocationServiceBridge.h" #include "Geoposition.h" -#include "PlatformBridge.h" #include "PositionError.h" #include "PositionOptions.h" @@ -66,7 +65,9 @@ GeolocationServiceAndroid::GeolocationServiceAndroid(GeolocationServiceClient* c { } -bool GeolocationServiceAndroid::startUpdating(PositionOptions* options) +// ANDROID +// TODO: Upstream to webkit.org. See https://bugs.webkit.org/show_bug.cgi?id=34082 +bool GeolocationServiceAndroid::startUpdating(PositionOptions* options, bool suspend) { // This method is called every time a new watch or one-shot position request // is started. If we already have a position or an error, call back @@ -92,7 +93,9 @@ bool GeolocationServiceAndroid::startUpdating(PositionOptions* options) if (!haveJavaBridge) { // If the browser is paused, don't start the service. It will be started // when we get the call to resume. - if (!PlatformBridge::isWebViewPaused()) + // ANDROID + // TODO: Upstream to webkit.org. See https://bugs.webkit.org/show_bug.cgi?id=34082 + if (!suspend) m_javaBridge->start(); } diff --git a/WebCore/platform/android/GeolocationServiceAndroid.h b/WebCore/platform/android/GeolocationServiceAndroid.h index b2be750..72532f6 100644 --- a/WebCore/platform/android/GeolocationServiceAndroid.h +++ b/WebCore/platform/android/GeolocationServiceAndroid.h @@ -45,7 +45,9 @@ public: virtual ~GeolocationServiceAndroid() { }; - virtual bool startUpdating(PositionOptions*); + // ANDROID + // TODO: Upstream to webkit.org. See https://bugs.webkit.org/show_bug.cgi?id=34082 + virtual bool startUpdating(PositionOptions*, bool suspend); virtual void stopUpdating(); virtual Geoposition* lastPosition() const { return m_lastPosition.get(); } diff --git a/WebCore/platform/android/PlatformBridge.h b/WebCore/platform/android/PlatformBridge.h index 5eb127f..0918fe9 100644 --- a/WebCore/platform/android/PlatformBridge.h +++ b/WebCore/platform/android/PlatformBridge.h @@ -126,7 +126,9 @@ public: #endif // USE(ACCELERATED_COMPOSITING) // Whether the WebView is paused. - static bool isWebViewPaused(); + // ANDROID + // TODO: Upstream to webkit.org. See https://bugs.webkit.org/show_bug.cgi?id=34082 + static bool isWebViewPaused(const FrameView*); }; } diff --git a/WebCore/platform/mock/GeolocationServiceMock.cpp b/WebCore/platform/mock/GeolocationServiceMock.cpp index f187104..0104747 100644 --- a/WebCore/platform/mock/GeolocationServiceMock.cpp +++ b/WebCore/platform/mock/GeolocationServiceMock.cpp @@ -78,7 +78,12 @@ void GeolocationServiceMock::setError(PassRefPtr<PositionError> error) makeGeolocationCallbackFromAllInstances(); } +#if PLATFORM(ANDROID) +// TODO: Upstream to webkit.org. See https://bugs.webkit.org/show_bug.cgi?id=34082 +bool GeolocationServiceMock::startUpdating(PositionOptions*, bool /* suspend */) +#else bool GeolocationServiceMock::startUpdating(PositionOptions*) +#endif { m_isActive = true; m_timer.startOneShot(0); diff --git a/WebCore/platform/mock/GeolocationServiceMock.h b/WebCore/platform/mock/GeolocationServiceMock.h index 7d02797..1b4db93 100755 --- a/WebCore/platform/mock/GeolocationServiceMock.h +++ b/WebCore/platform/mock/GeolocationServiceMock.h @@ -46,7 +46,12 @@ class GeolocationServiceMock : public GeolocationService { GeolocationServiceMock(GeolocationServiceClient*); virtual ~GeolocationServiceMock(); +#if PLATFORM(ANDROID) + // TODO: Upstream to webkit.org. See https://bugs.webkit.org/show_bug.cgi?id=34082 + virtual bool startUpdating(PositionOptions*, bool suspend); +#else virtual bool startUpdating(PositionOptions*); +#endif virtual void stopUpdating(); static void setPosition(PassRefPtr<Geoposition> position); |