summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-02-18 06:37:45 -0800
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-02-18 06:37:45 -0800
commitc7c7c3dc7fcdc5bff8c781d66a6d181eddf7c035 (patch)
tree9dd0d176195fc953a5dfaca6926bbddb05e749ad
parent9c8b266fb74dbb8b53cf7b4ad9997a6c6ff09305 (diff)
parent930792dfdde9ad0fac3251ab70eb00d97f2fe88d (diff)
downloadexternal_webkit-c7c7c3dc7fcdc5bff8c781d66a6d181eddf7c035.zip
external_webkit-c7c7c3dc7fcdc5bff8c781d66a6d181eddf7c035.tar.gz
external_webkit-c7c7c3dc7fcdc5bff8c781d66a6d181eddf7c035.tar.bz2
Merge "Fixes a bug with the Geolocation suspend/resume behaviour"
-rw-r--r--WebCore/page/Geolocation.cpp8
-rw-r--r--WebCore/platform/GeolocationService.h5
-rw-r--r--WebCore/platform/android/GeolocationServiceAndroid.cpp9
-rw-r--r--WebCore/platform/android/GeolocationServiceAndroid.h4
-rw-r--r--WebCore/platform/android/PlatformBridge.h4
-rw-r--r--WebCore/platform/mock/GeolocationServiceMock.cpp5
-rwxr-xr-xWebCore/platform/mock/GeolocationServiceMock.h5
-rw-r--r--WebKit/android/WebCoreSupport/PlatformBridge.cpp5
-rw-r--r--WebKit/android/jni/WebViewCore.cpp7
-rw-r--r--WebKit/android/jni/WebViewCore.h6
10 files changed, 44 insertions, 14 deletions
diff --git a/WebCore/page/Geolocation.cpp b/WebCore/page/Geolocation.cpp
index e55d2b1..9ca844c 100644
--- a/WebCore/page/Geolocation.cpp
+++ b/WebCore/page/Geolocation.cpp
@@ -34,6 +34,7 @@
#include "EventNames.h"
#include "Frame.h"
#include "Page.h"
+#include "PlatformBridge.h"
#include <wtf/CurrentTime.h>
#if ENABLE(CLIENT_BASED_GEOLOCATION)
@@ -648,8 +649,15 @@ bool Geolocation::startUpdating(GeoNotifier* notifier)
page->geolocationController()->addObserver(this);
return true;
#else
+#if PLATFORM(ANDROID)
+ // TODO: Upstream to webkit.org. See https://bugs.webkit.org/show_bug.cgi?id=34082
+ // Note that the correct fix is to use a 'paused' flag in WebCore, rather
+ // than calling into PlatformBridge.
+ return m_service->startUpdating(notifier->m_options.get(), PlatformBridge::isWebViewPaused(m_frame->view()));
+#else
return m_service->startUpdating(notifier->m_options.get());
#endif
+#endif
}
void Geolocation::stopUpdating()
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);
diff --git a/WebKit/android/WebCoreSupport/PlatformBridge.cpp b/WebKit/android/WebCoreSupport/PlatformBridge.cpp
index b91a5d8..c04600d 100644
--- a/WebKit/android/WebCoreSupport/PlatformBridge.cpp
+++ b/WebKit/android/WebCoreSupport/PlatformBridge.cpp
@@ -113,9 +113,10 @@ NPObject* PlatformBridge::pluginScriptableObject(Widget* widget)
#endif
}
-bool PlatformBridge::isWebViewPaused()
+bool PlatformBridge::isWebViewPaused(const WebCore::FrameView* frameView)
{
- return WebViewCore::isPaused();
+ android::WebViewCore* webViewCore = android::WebViewCore::getWebViewCore(frameView);
+ return webViewCore->isPaused();
}
bool PlatformBridge::popupsAllowed(NPP)
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 4385f4d..0c37380 100644
--- a/WebKit/android/jni/WebViewCore.cpp
+++ b/WebKit/android/jni/WebViewCore.cpp
@@ -150,8 +150,6 @@ FILE* gRenderTreeFile = 0;
namespace android {
-bool WebViewCore::s_isPaused = false;
-
static SkTDArray<WebViewCore*> gInstanceList;
void WebViewCore::addInstance(WebViewCore* inst) {
@@ -273,6 +271,7 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m
#if ENABLE(TOUCH_EVENTS)
m_forwardingTouchEvents = false;
#endif
+ m_isPaused = false;
LOG_ASSERT(m_mainFrame, "Uh oh, somehow a frameview was made without an initial frame!");
@@ -2965,7 +2964,7 @@ static void Pause(JNIEnv* env, jobject obj)
event.data.lifecycle.action = kPause_ANPLifecycleAction;
GET_NATIVE_VIEW(env, obj)->sendPluginEvent(event);
- WebViewCore::setIsPaused(true);
+ GET_NATIVE_VIEW(env, obj)->setIsPaused(true);
}
static void Resume(JNIEnv* env, jobject obj)
@@ -2982,7 +2981,7 @@ static void Resume(JNIEnv* env, jobject obj)
event.data.lifecycle.action = kResume_ANPLifecycleAction;
GET_NATIVE_VIEW(env, obj)->sendPluginEvent(event);
- WebViewCore::setIsPaused(false);
+ GET_NATIVE_VIEW(env, obj)->setIsPaused(false);
}
static void FreeMemory(JNIEnv* env, jobject obj)
diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h
index 3085a49..fc5ffc7 100644
--- a/WebKit/android/jni/WebViewCore.h
+++ b/WebKit/android/jni/WebViewCore.h
@@ -462,8 +462,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; }
+ bool isPaused() const { return m_isPaused; }
+ void setIsPaused(bool isPaused) { m_isPaused = isPaused; }
// end of shared members
// internal functions
@@ -520,7 +520,7 @@ namespace android {
unsigned m_domtree_version;
bool m_check_domtree_version;
PageGroup* m_groupForVisitedLinks;
- static bool s_isPaused;
+ bool m_isPaused;
SkTDArray<PluginWidgetAndroid*> m_plugins;
WebCore::Timer<WebViewCore> m_pluginInvalTimer;