diff options
-rw-r--r-- | WebCore/platform/android/GeolocationServiceAndroid.cpp | 10 | ||||
-rw-r--r-- | WebCore/platform/android/PlatformBridge.h | 2 | ||||
-rw-r--r-- | WebKit/android/WebCoreSupport/PlatformBridge.cpp | 5 | ||||
-rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 6 | ||||
-rw-r--r-- | WebKit/android/jni/WebViewCore.h | 3 |
5 files changed, 24 insertions, 2 deletions
diff --git a/WebCore/platform/android/GeolocationServiceAndroid.cpp b/WebCore/platform/android/GeolocationServiceAndroid.cpp index 43a8f5f..3ffb9b9 100644 --- a/WebCore/platform/android/GeolocationServiceAndroid.cpp +++ b/WebCore/platform/android/GeolocationServiceAndroid.cpp @@ -28,6 +28,7 @@ #include "GeolocationServiceBridge.h" #include "Geoposition.h" +#include "PlatformBridge.h" #include "PositionError.h" #include "PositionOptions.h" @@ -83,8 +84,13 @@ bool GeolocationServiceAndroid::startUpdating(PositionOptions* options) if (options->enableHighAccuracy()) m_javaBridge->setEnableGps(true); - if (!haveJavaBridge) - m_javaBridge->start(); + // We need only start the service when it's first created. + 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()) + m_javaBridge->start(); + } return true; } diff --git a/WebCore/platform/android/PlatformBridge.h b/WebCore/platform/android/PlatformBridge.h index a1ed50a..a73abab 100644 --- a/WebCore/platform/android/PlatformBridge.h +++ b/WebCore/platform/android/PlatformBridge.h @@ -71,6 +71,8 @@ public: static void immediateRepaint(const FrameView* view); #endif // USE(ACCELERATED_COMPOSITING) + // Whether the WebView is paused. + static bool isWebViewPaused(); }; } diff --git a/WebKit/android/WebCoreSupport/PlatformBridge.cpp b/WebKit/android/WebCoreSupport/PlatformBridge.cpp index cd5e2e6..f36ecf7 100644 --- a/WebKit/android/WebCoreSupport/PlatformBridge.cpp +++ b/WebKit/android/WebCoreSupport/PlatformBridge.cpp @@ -98,6 +98,11 @@ bool PlatformBridge::cookiesEnabled() return client->cookiesEnabled(); } +bool PlatformBridge::isWebViewPaused() +{ + return WebViewCore::isPaused(); +} + } // namespace WebCore diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index fdd9e05..8414068 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -147,6 +147,8 @@ FILE* gRenderTreeFile = 0; namespace android { +bool WebViewCore::s_isPaused = false; + static SkTDArray<WebViewCore*> gInstanceList; void WebViewCore::addInstance(WebViewCore* inst) { @@ -2889,6 +2891,8 @@ static void Pause(JNIEnv* env, jobject obj) SkANP::InitEvent(&event, kLifecycle_ANPEventType); event.data.lifecycle.action = kPause_ANPLifecycleAction; GET_NATIVE_VIEW(env, obj)->sendPluginEvent(event); + + WebViewCore::setIsPaused(true); } static void Resume(JNIEnv* env, jobject obj) @@ -2904,6 +2908,8 @@ static void Resume(JNIEnv* env, jobject obj) SkANP::InitEvent(&event, kLifecycle_ANPEventType); event.data.lifecycle.action = kResume_ANPLifecycleAction; GET_NATIVE_VIEW(env, obj)->sendPluginEvent(event); + + WebViewCore::setIsPaused(false); } static void FreeMemory(JNIEnv* env, jobject obj) diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h index c4d1cae..0569b4d 100644 --- a/WebKit/android/jni/WebViewCore.h +++ b/WebKit/android/jni/WebViewCore.h @@ -453,6 +453,8 @@ namespace android { // field safely from our respective threads static Mutex gButtonMutex; WTF::Vector<Container> m_buttons; + static bool isPaused() { return s_isPaused; } + static void setIsPaused(bool isPaused) { s_isPaused = isPaused; } // end of shared members // internal functions @@ -509,6 +511,7 @@ namespace android { unsigned m_domtree_version; bool m_check_domtree_version; PageGroup* m_groupForVisitedLinks; + static bool s_isPaused; SkTDArray<PluginWidgetAndroid*> m_plugins; WebCore::Timer<WebViewCore> m_pluginInvalTimer; |