summaryrefslogtreecommitdiffstats
path: root/WebKit/android/jni
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/android/jni')
-rw-r--r--WebKit/android/jni/JavaBridge.cpp29
-rw-r--r--WebKit/android/jni/JavaSharedClient.cpp9
-rw-r--r--WebKit/android/jni/WebCoreFrameBridge.cpp135
-rw-r--r--WebKit/android/jni/WebCoreJni.cpp35
-rw-r--r--WebKit/android/jni/WebCoreJni.h6
-rw-r--r--WebKit/android/jni/WebCoreJniOnLoad.cpp2
-rw-r--r--WebKit/android/jni/WebHistory.cpp5
-rw-r--r--WebKit/android/jni/WebHistory.h2
-rw-r--r--WebKit/android/jni/WebIconDatabase.cpp16
-rw-r--r--WebKit/android/jni/WebIconDatabase.h3
-rw-r--r--WebKit/android/jni/WebStorage.cpp6
-rw-r--r--WebKit/android/jni/WebViewCore.cpp480
-rw-r--r--WebKit/android/jni/WebViewCore.h4
13 files changed, 143 insertions, 589 deletions
diff --git a/WebKit/android/jni/JavaBridge.cpp b/WebKit/android/jni/JavaBridge.cpp
index 842d841..049a7da 100644
--- a/WebKit/android/jni/JavaBridge.cpp
+++ b/WebKit/android/jni/JavaBridge.cpp
@@ -101,7 +101,7 @@ public:
static void UpdatePluginDirectories(JNIEnv* env, jobject obj, jobjectArray array, jboolean reload);
private:
- jobject mJavaObject;
+ jweak mJavaObject;
jmethodID mSetSharedTimer;
jmethodID mStopSharedTimer;
jmethodID mSetCookies;
@@ -118,7 +118,7 @@ static void (*sSharedTimerFiredCallback)();
JavaBridge::JavaBridge(JNIEnv* env, jobject obj)
{
- mJavaObject = adoptGlobalRef(env, obj);
+ mJavaObject = env->NewWeakGlobalRef(obj);
jclass clazz = env->GetObjectClass(obj);
mSetSharedTimer = env->GetMethodID(clazz, "setSharedTimer", "(J)V");
@@ -152,7 +152,7 @@ JavaBridge::~JavaBridge()
{
if (mJavaObject) {
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->DeleteGlobalRef(mJavaObject);
+ env->DeleteWeakGlobalRef(mJavaObject);
mJavaObject = 0;
}
@@ -167,8 +167,6 @@ JavaBridge::setSharedTimer(long long timemillis)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = getRealObject(env, mJavaObject);
- if (!obj.get())
- return;
env->CallVoidMethod(obj.get(), mSetSharedTimer, timemillis);
}
@@ -177,8 +175,6 @@ JavaBridge::stopSharedTimer()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = getRealObject(env, mJavaObject);
- if (!obj.get())
- return;
env->CallVoidMethod(obj.get(), mStopSharedTimer);
}
@@ -186,13 +182,11 @@ void
JavaBridge::setCookies(WebCore::KURL const& url, WebCore::String const& value)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = getRealObject(env, mJavaObject);
- if (!obj.get())
- return;
const WebCore::String& urlStr = url.string();
jstring jUrlStr = env->NewString(urlStr.characters(), urlStr.length());
jstring jValueStr = env->NewString(value.characters(), value.length());
+ AutoJObject obj = getRealObject(env, mJavaObject);
env->CallVoidMethod(obj.get(), mSetCookies, jUrlStr, jValueStr);
env->DeleteLocalRef(jUrlStr);
env->DeleteLocalRef(jValueStr);
@@ -203,10 +197,9 @@ JavaBridge::cookies(WebCore::KURL const& url)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
const WebCore::String& urlStr = url.string();
- AutoJObject obj = getRealObject(env, mJavaObject);
- if (!obj.get())
- return WebCore::String();
jstring jUrlStr = env->NewString(urlStr.characters(), urlStr.length());
+
+ AutoJObject obj = getRealObject(env, mJavaObject);
jstring string = (jstring)(env->CallObjectMethod(obj.get(), mCookies, jUrlStr));
WebCore::String ret = to_string(env, string);
@@ -220,8 +213,6 @@ JavaBridge::cookiesEnabled()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = getRealObject(env, mJavaObject);
- if (!obj.get())
- return false;
jboolean ret = env->CallBooleanMethod(obj.get(), mCookiesEnabled);
return (ret != 0);
}
@@ -232,8 +223,6 @@ JavaBridge::getPluginDirectories()
WTF::Vector<WebCore::String> directories;
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = getRealObject(env, mJavaObject);
- if (!obj.get())
- return directories;
jobjectArray array = (jobjectArray)
env->CallObjectMethod(obj.get(), mGetPluginDirectories);
int count = env->GetArrayLength(array);
@@ -252,8 +241,6 @@ JavaBridge::getPluginSharedDataDirectory()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = getRealObject(env, mJavaObject);
- if (!obj.get())
- return WebCore::String();
jstring ret = (jstring)env->CallObjectMethod(obj.get(), mGetPluginSharedDataDirectory);
WebCore::String path = to_string(env, ret);
checkException(env);
@@ -276,8 +263,6 @@ void JavaBridge::signalServiceFuncPtrQueue()
// environment is setup.
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = getRealObject(env, mJavaObject);
- if (!obj.get())
- return;
env->CallVoidMethod(obj.get(), mSignalFuncPtrQueue);
}
@@ -285,8 +270,6 @@ WTF::Vector<WebCore::String>JavaBridge::getSupportedKeyStrengthList() {
WTF::Vector<WebCore::String> list;
JNIEnv* env = JSC::Bindings::getJNIEnv();
AutoJObject obj = getRealObject(env, mJavaObject);
- if (!obj.get())
- return list;
jobjectArray array = (jobjectArray) env->CallObjectMethod(obj.get(),
mGetKeyStrengthList);
int count = env->GetArrayLength(array);
diff --git a/WebKit/android/jni/JavaSharedClient.cpp b/WebKit/android/jni/JavaSharedClient.cpp
index b9ecff7..ce46570 100644
--- a/WebKit/android/jni/JavaSharedClient.cpp
+++ b/WebKit/android/jni/JavaSharedClient.cpp
@@ -102,24 +102,23 @@ namespace android {
void JavaSharedClient::ServiceFunctionPtrQueue()
{
for (;;) {
- void (*proc)(void*);
- void* payload;
+ void (*proc)(void*) = 0;
+ void* payload = 0;
const FuncPtrRec* rec;
// we have to copy the proc/payload (if present). we do this so we
// don't call the proc inside the mutex (possible deadlock!)
gFuncPtrQMutex.acquire();
rec = (const FuncPtrRec*)gFuncPtrQ.front();
- if (NULL != rec) {
+ if (rec) {
proc = rec->fProc;
payload = rec->fPayload;
gFuncPtrQ.pop_front();
}
gFuncPtrQMutex.release();
- if (NULL == rec) {
+ if (!rec)
break;
- }
proc(payload);
}
}
diff --git a/WebKit/android/jni/WebCoreFrameBridge.cpp b/WebKit/android/jni/WebCoreFrameBridge.cpp
index ee39462..150c428 100644
--- a/WebKit/android/jni/WebCoreFrameBridge.cpp
+++ b/WebKit/android/jni/WebCoreFrameBridge.cpp
@@ -171,8 +171,8 @@ namespace android {
struct WebFrame::JavaBrowserFrame
{
- jobject mObj;
- jobject mHistoryList; // WebBackForwardList object
+ jweak mObj;
+ jweak mHistoryList; // WebBackForwardList object
jmethodID mStartLoadingResource;
jmethodID mLoadStarted;
jmethodID mTransitionToCommitted;
@@ -212,8 +212,8 @@ WebFrame::WebFrame(JNIEnv* env, jobject obj, jobject historyList, WebCore::Page*
{
jclass clazz = env->GetObjectClass(obj);
mJavaFrame = new JavaBrowserFrame;
- mJavaFrame->mObj = adoptGlobalRef(env, obj);
- mJavaFrame->mHistoryList = adoptGlobalRef(env, historyList);
+ mJavaFrame->mObj = env->NewWeakGlobalRef(obj);
+ mJavaFrame->mHistoryList = env->NewWeakGlobalRef(historyList);
mJavaFrame->mStartLoadingResource = env->GetMethodID(clazz, "startLoadingResource",
"(ILjava/lang/String;Ljava/lang/String;Ljava/util/HashMap;[BJIZZZ)Landroid/webkit/LoadListener;");
mJavaFrame->mLoadStarted = env->GetMethodID(clazz, "loadStarted",
@@ -281,8 +281,8 @@ WebFrame::~WebFrame()
{
if (mJavaFrame->mObj) {
JNIEnv* env = getJNIEnv();
- env->DeleteGlobalRef(mJavaFrame->mObj);
- env->DeleteGlobalRef(mJavaFrame->mHistoryList);
+ env->DeleteWeakGlobalRef(mJavaFrame->mObj);
+ env->DeleteWeakGlobalRef(mJavaFrame->mHistoryList);
mJavaFrame->mObj = 0;
}
delete mJavaFrame;
@@ -381,10 +381,6 @@ WebFrame::startLoadingResource(WebCore::ResourceHandle* loader,
WebCore::HTTPHeaderMap headers = request.httpHeaderFields();
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return 0;
-
WebCore::String urlStr = request.url().string();
int colon = urlStr.find(':');
bool allLower = true;
@@ -405,6 +401,7 @@ WebFrame::startLoadingResource(WebCore::ResourceHandle* loader,
jMethodStr = env->NewString(method.characters(), method.length());
jbyteArray jPostDataStr = NULL;
WebCore::FormData* formdata = request.httpBody();
+ AutoJObject obj = mJavaFrame->frame(env);
if (formdata) {
// We can use the formdata->flatten() but it will result in two
// memcpys, first through loading up the vector with the form data
@@ -487,10 +484,10 @@ WebFrame::startLoadingResource(WebCore::ResourceHandle* loader,
jobject jLoadListener =
env->CallObjectMethod(obj.get(), mJavaFrame->mStartLoadingResource,
- (int)loader, jUrlStr, jMethodStr, jHeaderMap,
- jPostDataStr, formdata ? formdata->identifier(): 0,
- cacheMode, mainResource, request.getUserGesture(),
- synchronous);
+ (int)loader, jUrlStr, jMethodStr, jHeaderMap,
+ jPostDataStr, formdata ? formdata->identifier(): 0,
+ cacheMode, mainResource, request.getUserGesture(),
+ synchronous);
env->DeleteLocalRef(jUrlStr);
env->DeleteLocalRef(jMethodStr);
@@ -515,13 +512,11 @@ WebFrame::reportError(int errorCode, const WebCore::String& description,
#endif
LOGV("::WebCore:: reportError(%d, %s)", errorCode, description.ascii().data());
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
jstring descStr = env->NewString((unsigned short*)description.characters(), description.length());
jstring failUrl = env->NewString((unsigned short*)failingUrl.characters(), failingUrl.length());
- env->CallVoidMethod(obj.get(), mJavaFrame->mReportError, errorCode, descStr, failUrl);
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mReportError,
+ errorCode, descStr, failUrl);
env->DeleteLocalRef(descStr);
env->DeleteLocalRef(failUrl);
}
@@ -547,9 +542,6 @@ WebFrame::loadStarted(WebCore::Frame* frame)
return;
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
WebCore::String urlString(url.string());
// If this is the main frame and we already have a favicon in the database,
// send it along with the page started notification.
@@ -562,7 +554,7 @@ WebFrame::loadStarted(WebCore::Frame* frame)
}
jstring urlStr = env->NewString((unsigned short*)urlString.characters(), urlString.length());
- env->CallVoidMethod(obj.get(), mJavaFrame->mLoadStarted, urlStr, favicon,
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mLoadStarted, urlStr, favicon,
(int)loadType, isMainFrame);
checkException(env);
env->DeleteLocalRef(urlStr);
@@ -587,12 +579,9 @@ WebFrame::transitionToCommitted(WebCore::Frame* frame)
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
WebCore::FrameLoadType loadType = frame->loader()->loadType();
bool isMainFrame = (!frame->tree() || !frame->tree()->parent());
- env->CallVoidMethod(obj.get(), mJavaFrame->mTransitionToCommitted,
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mTransitionToCommitted,
(int)loadType, isMainFrame);
checkException(env);
}
@@ -604,9 +593,6 @@ WebFrame::didFinishLoad(WebCore::Frame* frame)
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
WebCore::FrameLoader* loader = frame->loader();
const WebCore::KURL& url = loader->activeDocumentLoader()->url();
if (url.isEmpty())
@@ -617,7 +603,7 @@ WebFrame::didFinishLoad(WebCore::Frame* frame)
WebCore::FrameLoadType loadType = loader->loadType();
WebCore::String urlString(url.string());
jstring urlStr = env->NewString((unsigned short*)urlString.characters(), urlString.length());
- env->CallVoidMethod(obj.get(), mJavaFrame->mLoadFinished, urlStr,
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mLoadFinished, urlStr,
(int)loadType, isMainFrame);
checkException(env);
env->DeleteLocalRef(urlStr);
@@ -666,12 +652,9 @@ WebFrame::setTitle(const WebCore::String& title)
LOGV("setTitle(%s)", title.ascii().data());
#endif
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
jstring jTitleStr = env->NewString((unsigned short *)title.characters(), title.length());
- env->CallVoidMethod(obj.get(), mJavaFrame->mSetTitle,
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mSetTitle,
jTitleStr);
checkException(env);
env->DeleteLocalRef(jTitleStr);
@@ -685,11 +668,8 @@ WebFrame::windowObjectCleared(WebCore::Frame* frame)
#endif
LOGV("::WebCore:: windowObjectCleared");
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), mJavaFrame->mWindowObjectCleared, (int)frame);
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mWindowObjectCleared, (int)frame);
checkException(env);
}
@@ -700,11 +680,8 @@ WebFrame::setProgress(float newProgress)
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
int progress = (int) (100 * newProgress);
- env->CallVoidMethod(obj.get(), mJavaFrame->mSetProgress, progress);
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mSetProgress, progress);
checkException(env);
}
@@ -722,14 +699,11 @@ WebFrame::didReceiveIcon(WebCore::Image* icon)
#endif
LOG_ASSERT(icon, "DidReceiveIcon called without an image!");
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
jobject bitmap = webcoreImageToJavaBitmap(env, icon);
if (!bitmap)
return;
- env->CallVoidMethod(obj.get(), mJavaFrame->mDidReceiveIcon, bitmap);
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mDidReceiveIcon, bitmap);
env->DeleteLocalRef(bitmap);
checkException(env);
}
@@ -741,13 +715,10 @@ WebFrame::didReceiveTouchIconURL(const WebCore::String& url, bool precomposed)
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
jstring jUrlStr = env->NewString((unsigned short*)url.characters(),
url.length());
- env->CallVoidMethod(obj.get(),
+ env->CallVoidMethod(mJavaFrame->frame(env).get(),
mJavaFrame->mDidReceiveTouchIconUrl, jUrlStr, precomposed);
checkException(env);
}
@@ -760,13 +731,9 @@ WebFrame::updateVisitedHistory(const WebCore::KURL& url, bool reload)
#endif
WebCore::String urlStr(url.string());
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
-
jstring jUrlStr = env->NewString((unsigned short*)urlStr.characters(), urlStr.length());
- env->CallVoidMethod(obj.get(), mJavaFrame->mUpdateVisitedHistory, jUrlStr, reload);
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mUpdateVisitedHistory, jUrlStr, reload);
checkException(env);
}
@@ -790,14 +757,11 @@ WebFrame::canHandleRequest(const WebCore::ResourceRequest& request)
if (url.isEmpty())
return true;
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return true;
jstring jUrlStr = env->NewString((unsigned short *)url.characters(), url.length());
// check to see whether browser app wants to hijack url loading.
// if browser app handles the url, we will return false to bail out WebCore loading
- jboolean ret = env->CallBooleanMethod(obj.get(), mJavaFrame->mHandleUrl, jUrlStr);
+ jboolean ret = env->CallBooleanMethod(mJavaFrame->frame(env).get(), mJavaFrame->mHandleUrl, jUrlStr);
checkException(env);
return (ret == 0);
}
@@ -809,13 +773,10 @@ WebFrame::createWindow(bool dialog, bool userGesture)
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return NULL;
- jobject jobj = env->CallObjectMethod(obj.get(),
+ jobject obj = env->CallObjectMethod(mJavaFrame->frame(env).get(),
mJavaFrame->mCreateWindow, dialog, userGesture);
- if (jobj) {
- WebCore::Frame* frame = GET_NATIVE_FRAME(env, jobj);
+ if (obj) {
+ WebCore::Frame* frame = GET_NATIVE_FRAME(env, obj);
return frame;
}
return NULL;
@@ -828,10 +789,7 @@ WebFrame::requestFocus() const
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), mJavaFrame->mRequestFocus);
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mRequestFocus);
checkException(env);
}
@@ -843,10 +801,7 @@ WebFrame::closeWindow(WebViewCore* webViewCore)
#endif
assert(webViewCore);
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), mJavaFrame->mCloseWindow,
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mCloseWindow,
webViewCore->getJavaObject().get());
}
@@ -861,22 +816,16 @@ WebFrame::decidePolicyForFormResubmission(WebCore::FramePolicyFunction func)
TimeCounterAuto counter(TimeCounter::JavaCallbackTimeCounter);
#endif
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return;
PolicyFunctionWrapper* p = new PolicyFunctionWrapper;
p->func = func;
- env->CallVoidMethod(obj.get(), mJavaFrame->mDecidePolicyForFormResubmission, p);
+ env->CallVoidMethod(mJavaFrame->frame(env).get(), mJavaFrame->mDecidePolicyForFormResubmission, p);
}
WebCore::String
WebFrame::getRawResourceFilename(WebCore::PlatformBridge::rawResId id) const
{
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return WebCore::String();
- jstring ret = (jstring) env->CallObjectMethod(obj.get(),
+ jstring ret = (jstring) env->CallObjectMethod(mJavaFrame->frame(env).get(),
mJavaFrame->mGetRawResFilename, (int)id);
return to_string(env, ret);
@@ -886,10 +835,7 @@ float
WebFrame::density() const
{
JNIEnv* env = getJNIEnv();
- AutoJObject obj = mJavaFrame->frame(env);
- if (!obj.get())
- return 1.0;
- jfloat dpi = env->CallFloatMethod(obj.get(), mJavaFrame->mDensity);
+ jfloat dpi = env->CallFloatMethod(mJavaFrame->frame(env).get(), mJavaFrame->mDensity);
checkException(env);
return dpi;
}
@@ -1223,8 +1169,21 @@ private:
JNIEnv* env = getJNIEnv();
// JavaInstance creates a global ref to instance in its constructor.
env->DeleteGlobalRef(_instance->instance());
- // Set the object to our WeakReference wrapper.
- _instance->setInstance(adoptGlobalRef(env, instance));
+ // Set the object to a weak reference.
+ _instance->setInstance(env->NewWeakGlobalRef(instance));
+ }
+ ~WeakJavaInstance()
+ {
+ JNIEnv* env = getJNIEnv();
+ // Store the weak reference so we can delete it later.
+ jweak weak = _instance->instance();
+ // The JavaInstance destructor attempts to delete the global ref stored
+ // in _instance. Since we replaced it in our constructor with a weak
+ // reference, restore the global ref here so the vm will not complain.
+ _instance->setInstance(env->NewGlobalRef(
+ getRealObject(env, _instance->instance()).get()));
+ // Delete the weak reference.
+ env->DeleteWeakGlobalRef(weak);
}
virtual void virtualBegin()
@@ -1256,7 +1215,7 @@ private:
private:
typedef JavaInstance INHERITED;
jobject _realObject;
- jobject _weakRef;
+ jweak _weakRef;
};
static void AddJavascriptInterface(JNIEnv *env, jobject obj, jint nativeFramePointer,
diff --git a/WebKit/android/jni/WebCoreJni.cpp b/WebKit/android/jni/WebCoreJni.cpp
index aa3e2c7..ef33cc0 100644
--- a/WebKit/android/jni/WebCoreJni.cpp
+++ b/WebKit/android/jni/WebCoreJni.cpp
@@ -35,25 +35,10 @@
namespace android {
-// Class, constructor, and get method on WeakReference
-jclass gWeakRefClass;
-jmethodID gWeakRefInit;
-jmethodID gWeakRefGet;
-
-jobject adoptGlobalRef(JNIEnv* env, jobject obj)
-{
- // Create a WeakReference object
- jobject ref = env->NewObject(gWeakRefClass, gWeakRefInit, obj);
- // Increment the ref count of the WeakReference
- ref = env->NewGlobalRef(ref);
- return ref;
-}
-
AutoJObject getRealObject(JNIEnv* env, jobject obj)
{
- jobject real = env->CallObjectMethod(obj, gWeakRefGet);
- if (!real)
- LOGE("The real object has been deleted");
+ jobject real = env->NewLocalRef(obj);
+ LOG_ASSERT(real, "The real object has been deleted!");
return AutoJObject(env, real);
}
@@ -86,20 +71,4 @@ WebCore::String to_string(JNIEnv* env, jstring str)
return ret;
}
-int register_webcorejni(JNIEnv* env) {
- // Instantiate the WeakReference fields.
- jclass weakRef = env->FindClass("java/lang/ref/WeakReference");
- LOG_ASSERT(weakRef, "Could not find WeakReference");
- android::gWeakRefClass = (jclass)env->NewGlobalRef(weakRef);
- android::gWeakRefInit = env->GetMethodID(android::gWeakRefClass,
- "<init>", "(Ljava/lang/Object;)V");
- LOG_ASSERT(android::gWeakRefInit,
- "Could not find constructor for WeakReference");
- android::gWeakRefGet = env->GetMethodID(android::gWeakRefClass, "get",
- "()Ljava/lang/Object;");
- LOG_ASSERT(android::gWeakRefInit,
- "Could not find get method for WeakReference");
- return JNI_OK;
-}
-
}
diff --git a/WebKit/android/jni/WebCoreJni.h b/WebKit/android/jni/WebCoreJni.h
index c1dd07c..1a1bfc0 100644
--- a/WebKit/android/jni/WebCoreJni.h
+++ b/WebKit/android/jni/WebCoreJni.h
@@ -61,14 +61,10 @@ private:
friend AutoJObject getRealObject(JNIEnv*, jobject);
};
-// Get the real object stored in the WeakReference returned as an
+// Get the real object stored in the weak reference returned as an
// AutoJObject.
AutoJObject getRealObject(JNIEnv*, jobject);
-// Convert the given jobject to a WeakReference and create a new global
-// reference to that WeakReference.
-jobject adoptGlobalRef(JNIEnv*, jobject);
-
// Helper method for check java exceptions. Returns true if an exception
// occurred and logs the exception.
bool checkException(JNIEnv* env);
diff --git a/WebKit/android/jni/WebCoreJniOnLoad.cpp b/WebKit/android/jni/WebCoreJniOnLoad.cpp
index f02e92a..d69177e 100644
--- a/WebKit/android/jni/WebCoreJniOnLoad.cpp
+++ b/WebKit/android/jni/WebCoreJniOnLoad.cpp
@@ -79,7 +79,6 @@ extern int register_webhistory(JNIEnv*);
extern int register_webicondatabase(JNIEnv*);
extern int register_websettings(JNIEnv*);
extern int register_webview(JNIEnv*);
-extern int register_webcorejni(JNIEnv*);
#if ENABLE(DATABASE)
extern int register_webstorage(JNIEnv*);
#endif
@@ -100,7 +99,6 @@ static RegistrationMethod gWebCoreRegMethods[] = {
{ "JavaBridge", android::register_javabridge },
{ "WebFrame", android::register_webframe },
{ "WebCoreResourceLoader", android::register_resource_loader },
- { "WebCoreJni", android::register_webcorejni },
{ "WebViewCore", android::register_webviewcore },
{ "WebHistory", android::register_webhistory },
{ "WebIconDatabase", android::register_webicondatabase },
diff --git a/WebKit/android/jni/WebHistory.cpp b/WebKit/android/jni/WebHistory.cpp
index 71cd416..76a310b 100644
--- a/WebKit/android/jni/WebHistory.cpp
+++ b/WebKit/android/jni/WebHistory.cpp
@@ -44,6 +44,7 @@
#include "TextEncoding.h"
#include "WebCoreFrameBridge.h"
#include "WebCoreJni.h"
+#include "WebIconDatabase.h"
#include "jni_utility.h"
#include <JNIHelp.h>
@@ -226,7 +227,7 @@ jbyteArray WebHistory::Flatten(JNIEnv* env, WTF::Vector<char>& v, WebCore::Histo
WebHistoryItem::WebHistoryItem(JNIEnv* env, jobject obj,
WebCore::HistoryItem* item) : WebCore::AndroidWebHistoryBridge(item) {
- m_object = adoptGlobalRef(env, obj);
+ m_object = env->NewWeakGlobalRef(obj);
m_parent = 0;
}
@@ -235,7 +236,7 @@ WebHistoryItem::~WebHistoryItem() {
JNIEnv* env = JSC::Bindings::getJNIEnv();
if (!env)
return;
- env->DeleteGlobalRef(m_object);
+ env->DeleteWeakGlobalRef(m_object);
}
}
diff --git a/WebKit/android/jni/WebHistory.h b/WebKit/android/jni/WebHistory.h
index b961872..12bf00a 100644
--- a/WebKit/android/jni/WebHistory.h
+++ b/WebKit/android/jni/WebHistory.h
@@ -60,7 +60,7 @@ public:
WebHistoryItem* parent() const { return m_parent.get(); }
private:
RefPtr<WebHistoryItem> m_parent;
- jobject m_object;
+ jweak m_object;
};
};
diff --git a/WebKit/android/jni/WebIconDatabase.cpp b/WebKit/android/jni/WebIconDatabase.cpp
index e15d179..20258a4 100644
--- a/WebKit/android/jni/WebIconDatabase.cpp
+++ b/WebKit/android/jni/WebIconDatabase.cpp
@@ -67,10 +67,6 @@ static WebIconDatabase* gIconDatabaseClient = new WebIconDatabase();
// XXX: Called by the IconDatabase thread
void WebIconDatabase::dispatchDidAddIconForPageURL(const WebCore::String& pageURL)
{
- // If there are no clients currently, drop this message.
- if (mClients.size() == 0)
- return;
-
mNotificationsMutex.lock();
mNotifications.append(pageURL);
if (!mDeliveryRequested) {
@@ -83,23 +79,25 @@ void WebIconDatabase::dispatchDidAddIconForPageURL(const WebCore::String& pageUR
// Called in the WebCore thread
void WebIconDatabase::RegisterForIconNotification(WebIconDatabaseClient* client)
{
- gIconDatabaseClient->mClientsMutex.lock();
+ WebIconDatabase* db = gIconDatabaseClient;
+ for (unsigned i = 0; i < db->mClients.size(); ++i) {
+ // Do not add the same client twice.
+ if (db->mClients[i] == client)
+ return;
+ }
gIconDatabaseClient->mClients.append(client);
- gIconDatabaseClient->mClientsMutex.unlock();
}
// Called in the WebCore thread
void WebIconDatabase::UnregisterForIconNotification(WebIconDatabaseClient* client)
{
WebIconDatabase* db = gIconDatabaseClient;
- db->mClientsMutex.lock();
for (unsigned i = 0; i < db->mClients.size(); ++i) {
if (db->mClients[i] == client) {
db->mClients.remove(i);
break;
}
}
- db->mClientsMutex.unlock();
}
// Called in the WebCore thread
@@ -123,9 +121,7 @@ void WebIconDatabase::deliverNotifications()
// Swap the clients queue
Vector<WebIconDatabaseClient*> clients;
- mClientsMutex.lock();
clients.swap(mClients);
- mClientsMutex.unlock();
for (unsigned i = 0; i < queue.size(); ++i) {
for (unsigned j = 0; j < clients.size(); ++j) {
diff --git a/WebKit/android/jni/WebIconDatabase.h b/WebKit/android/jni/WebIconDatabase.h
index 743c5eb..c91c4ae 100644
--- a/WebKit/android/jni/WebIconDatabase.h
+++ b/WebKit/android/jni/WebIconDatabase.h
@@ -59,9 +59,8 @@ namespace android {
// Deliver all the icon notifications
void deliverNotifications();
- // List of clients and a mutex to protect it.
+ // List of clients.
Vector<WebIconDatabaseClient*> mClients;
- android::Mutex mClientsMutex;
// Queue of page urls that have received an icon.
Vector<WebCore::String> mNotifications;
diff --git a/WebKit/android/jni/WebStorage.cpp b/WebKit/android/jni/WebStorage.cpp
index f175fd3..07e4880 100644
--- a/WebKit/android/jni/WebStorage.cpp
+++ b/WebKit/android/jni/WebStorage.cpp
@@ -93,9 +93,9 @@ static unsigned long long GetUsageForOrigin(JNIEnv* env, jobject obj, jstring or
if (manifestOrigin.get() == 0)
continue;
if (manifestOrigin->isSameSchemeHostPort(securityOrigin.get())) {
- int64_t size = 0;
- WebCore::cacheStorage().cacheGroupSize(manifestUrls[i].string(), &size);
- usage += size;
+ int64_t cacheSize = 0;
+ WebCore::cacheStorage().cacheGroupSize(manifestUrls[i].string(), &cacheSize);
+ usage += cacheSize;
}
}
return usage;
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp
index 5d2b8bb..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) {
@@ -185,7 +187,7 @@ struct WebViewCoreFields {
// ----------------------------------------------------------------------------
struct WebViewCore::JavaGlue {
- jobject m_obj;
+ jweak m_obj;
jmethodID m_spawnScrollTo;
jmethodID m_scrollTo;
jmethodID m_scrollBy;
@@ -269,7 +271,7 @@ WebViewCore::WebViewCore(JNIEnv* env, jobject javaWebViewCore, WebCore::Frame* m
jclass clazz = env->GetObjectClass(javaWebViewCore);
m_javaGlue = new JavaGlue;
- m_javaGlue->m_obj = adoptGlobalRef(env, javaWebViewCore);
+ m_javaGlue->m_obj = env->NewWeakGlobalRef(javaWebViewCore);
m_javaGlue->m_spawnScrollTo = GetJMethod(env, clazz, "contentSpawnScrollTo", "(II)V");
m_javaGlue->m_scrollTo = GetJMethod(env, clazz, "contentScrollTo", "(II)V");
m_javaGlue->m_scrollBy = GetJMethod(env, clazz, "contentScrollBy", "(IIZ)V");
@@ -331,7 +333,7 @@ WebViewCore::~WebViewCore()
if (m_javaGlue->m_obj) {
JNIEnv* env = JSC::Bindings::getJNIEnv();
- env->DeleteGlobalRef(m_javaGlue->m_obj);
+ env->DeleteWeakGlobalRef(m_javaGlue->m_obj);
m_javaGlue->m_obj = 0;
}
delete m_javaGlue;
@@ -626,13 +628,11 @@ void WebViewCore::recordPictureSet(PictureSet* content)
DBG_NAV_LOG("call updateFrameCache");
updateFrameCache();
if (m_findIsUp) {
+ LOG_ASSERT(m_javaGlue->m_obj,
+ "A Java widget was not associated with this view bridge!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_sendFindAgain);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_sendFindAgain);
checkException(env);
}
}
@@ -838,12 +838,9 @@ void WebViewCore::scrollTo(int x, int y, bool animate)
// LOGD("WebViewCore::scrollTo(%d %d)\n", x, y);
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), animate ? m_javaGlue->m_spawnScrollTo : m_javaGlue->m_scrollTo, x, y);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ animate ? m_javaGlue->m_spawnScrollTo : m_javaGlue->m_scrollTo,
+ x, y);
checkException(env);
}
@@ -851,12 +848,7 @@ void WebViewCore::sendNotifyProgressFinished()
{
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_sendNotifyProgressFinished);
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_sendNotifyProgressFinished);
checkException(env);
}
@@ -864,12 +856,7 @@ void WebViewCore::viewInvalidate(const WebCore::IntRect& rect)
{
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(),
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
m_javaGlue->m_sendViewInvalidate,
rect.x(), rect.y(), rect.right(), rect.bottom());
checkException(env);
@@ -880,12 +867,7 @@ void WebViewCore::scrollBy(int dx, int dy, bool animate)
if (!(dx | dy))
return;
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_scrollBy,
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_scrollBy,
dx, dy, animate);
checkException(env);
}
@@ -915,12 +897,7 @@ void WebViewCore::setRootLayer(int layer)
void WebViewCore::contentDraw()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_contentDraw);
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_contentDraw);
checkException(env);
}
@@ -969,18 +946,14 @@ void WebViewCore::didFirstLayout()
WebCore::FrameLoadType loadType = loader->loadType();
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_didFirstLayout,
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_didFirstLayout,
loadType == WebCore::FrameLoadTypeStandard
// When redirect with locked history, we would like to reset the
// scale factor. This is important for www.yahoo.com as it is
// redirected to www.yahoo.com/?rs=1 on load.
|| loadType == WebCore::FrameLoadTypeRedirectWithLockedBackForwardList);
checkException(env);
+
DBG_NAV_LOG("call updateFrameCache");
m_check_domtree_version = false;
updateFrameCache();
@@ -993,12 +966,7 @@ void WebViewCore::updateViewport()
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_updateViewport);
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_updateViewport);
checkException(env);
}
@@ -1008,12 +976,7 @@ void WebViewCore::restoreScale(int scale)
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_restoreScale, scale);
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_restoreScale, scale);
checkException(env);
}
@@ -1023,12 +986,8 @@ void WebViewCore::restoreScreenWidthScale(int scale)
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_restoreScreenWidthScale, scale);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_restoreScreenWidthScale, scale);
checkException(env);
}
@@ -1039,12 +998,7 @@ void WebViewCore::needTouchEvents(bool need)
#if ENABLE(TOUCH_EVENTS) // Android
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_needTouchEvents, need);
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_needTouchEvents, need);
checkException(env);
#endif
}
@@ -1055,12 +1009,7 @@ void WebViewCore::requestKeyboard(bool showKeyboard, bool isTextView)
LOG_ASSERT(m_javaGlue->m_obj, "A Java widget was not associated with this view bridge!");
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_requestKeyboard, showKeyboard,
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_requestKeyboard, showKeyboard,
isTextView);
checkException(env);
}
@@ -1588,209 +1537,6 @@ void WebViewCore::moveMouse(WebCore::Frame* frame, int x, int y)
updateCacheOnNodeChange();
}
-static int findTextBoxIndex(WebCore::Node* node, const WebCore::IntPoint& pt)
-{
- if (!node->isTextNode()) {
- DBG_NAV_LOGD("node=%p pt=(%d,%d) isText=false", node, pt.x(), pt.y());
- return -2; // error
- }
- WebCore::RenderText* renderText = (WebCore::RenderText*) node->renderer();
- if (!renderText) {
- DBG_NAV_LOGD("node=%p pt=(%d,%d) renderText=0", node, pt.x(), pt.y());
- return -3; // error
- }
- FloatPoint absPt = renderText->localToAbsolute();
- WebCore::InlineTextBox *textBox = renderText->firstTextBox();
- int globalX, globalY;
- CacheBuilder::GetGlobalOffset(node, &globalX, &globalY);
- int x = pt.x() - globalX;
- int y = pt.y() - globalY;
- do {
- int textBoxStart = textBox->start();
- int textBoxEnd = textBoxStart + textBox->len();
- if (textBoxEnd <= textBoxStart) {
- DBG_NAV_LOGD("textBoxStart=%d <= textBoxEnd=%d", textBoxStart,
- textBoxEnd);
- continue;
- }
- WebCore::IntRect bounds = textBox->selectionRect(absPt.x(), absPt.y(),
- textBoxStart, textBoxEnd);
- if (!bounds.contains(x, y)) {
- DBG_NAV_LOGD("[absPt=(%g,%g) textBoxStart=%d textBoxEnd=%d]"
- " !contains (x=%d, y=%d)",
- absPt.x(), absPt.y(), textBoxStart, textBoxEnd, x, y);
- continue;
- }
- int offset = textBox->offsetForPosition(x - absPt.x());
-#if DEBUG_NAV_UI
- int prior = offset > 0 ? textBox->positionForOffset(offset - 1) : -1;
- int current = textBox->positionForOffset(offset);
- int next = textBox->positionForOffset(offset + 1);
- DBG_NAV_LOGD("offset=%d pt.x=%d globalX=%d renderX=%g x=%d "
- "textBox->x()=%d textBox->start()=%d prior=%d current=%d next=%d",
- offset, pt.x(), globalX, absPt.x(), x,
- textBox->x(), textBox->start(), prior, current, next
- );
-#endif
- return textBox->start() + offset;
- } while ((textBox = textBox->nextTextBox()));
- return -1; // couldn't find point, may have walked off end
-}
-
-static inline bool isPunctuation(UChar c)
-{
- return WTF::Unicode::category(c) & (0
- | WTF::Unicode::Punctuation_Dash
- | WTF::Unicode::Punctuation_Open
- | WTF::Unicode::Punctuation_Close
- | WTF::Unicode::Punctuation_Connector
- | WTF::Unicode::Punctuation_Other
- | WTF::Unicode::Punctuation_InitialQuote
- | WTF::Unicode::Punctuation_FinalQuote
- );
-}
-
-static int centerX(const SkIRect& rect)
-{
- return (rect.fLeft + rect.fRight) >> 1;
-}
-
-static int centerY(const SkIRect& rect)
-{
- return (rect.fTop + rect.fBottom) >> 1;
-}
-
-static void ShowNode(Node* node)
-{
-#if DEBUG_NAV_UI
- WebCore::Node* match = node->document();
- int index = 1;
- while (match != node && (match = match->traverseNextNode()))
- index++;
- if (match != node)
- index = -1;
- const char* name = "text";
- WebCore::CString cstr;
- if (!node->isTextNode()) {
- cstr = node->localName().string().utf8();
- name = cstr.data();
- }
- node->getRect();
- const WebCore::IntRect& b = node->getRect();
- DBG_NAV_LOGD("%s %p (%d) (%d,%d,w=%d,h=%d)", name, node, index,
- b.x(), b.y(), b.width(), b.height());
-#endif
-}
-
-static WebCore::Node* ChildIsTextNode(WebCore::Node* node)
-{
- WebCore::Node* child = node;
- while (child && !child->isTextNode()) {
- ShowNode(child);
- child = child->traverseNextNode(node);
- }
- return child;
-}
-
-WebCore::String WebViewCore::getSelection(SkRegion* selRgn)
-{
- SkRegion::Iterator iter(*selRgn);
- // FIXME: switch this to use StringBuilder instead
- WebCore::String result;
- WebCore::Node* lastStartNode = 0;
- int lastStartEnd = -1;
- UChar lastChar = 0xffff;
- for (; !iter.done(); iter.next()) {
- const SkIRect& rect = iter.rect();
- DBG_NAV_LOGD("rect=(%d, %d, %d, %d)", rect.fLeft, rect.fTop,
- rect.fRight, rect.fBottom);
- int cy = centerY(rect);
- WebCore::IntPoint startPt, endPt;
- WebCore::Node* node, * endNode;
- for (int top = rect.fTop + 2; top != cy; top = cy) {
- startPt = WebCore::IntPoint(rect.fLeft + 1, top);
- WebCore::HitTestResult hitTestResult = m_mainFrame->eventHandler()->
- hitTestResultAtPoint(startPt, false);
- node = ChildIsTextNode(hitTestResult.innerNode());
- if (node)
- break;
- DBG_NAV_LOGD("node=%p (%s)", node, top != cy ? "top+1" : "cy");
- }
- if (!node) {
- DBG_NAV_LOG("!node");
- return result;
- }
- for (int bottom = rect.fBottom - 1; bottom != cy; bottom = cy) {
- for (int right = rect.fRight - 1; right != rect.fRight-2; --right) {
- endPt = WebCore::IntPoint(right, bottom);
- WebCore::HitTestResult hitTestResult = m_mainFrame->
- eventHandler()->hitTestResultAtPoint(endPt, false);
- endNode = ChildIsTextNode(hitTestResult.innerNode());
- if (endNode)
- break;
- DBG_NAV_LOGD("!endNode=%p (%s) (right-%d)", node,
- bottom != cy ? "bottom-1" : "cy", rect.fRight - right);
- }
- }
- if (!endNode) {
- DBG_NAV_LOG("!endNode");
- return result;
- }
- int start = findTextBoxIndex(node, startPt);
- if (start < 0)
- continue;
- int end = findTextBoxIndex(endNode, endPt);
- if (end < -1) // use node if endNode is not valid
- endNode = node;
- if (end <= 0)
- end = static_cast<WebCore::Text*>(endNode)->dataImpl()->length();
- DBG_NAV_LOGD("node=%p start=%d endNode=%p end=%d", node, start, endNode, end);
- WebCore::Node* startNode = node;
- do {
- if (!node->isTextNode())
- continue;
- if (node->getRect().isEmpty())
- continue;
- WebCore::Text* textNode = static_cast<WebCore::Text*>(node);
- WebCore::StringImpl* string = textNode->dataImpl();
- if (!string->length())
- continue;
- const UChar* chars = string->characters();
- int newLength = node == endNode ? end : string->length();
- if (node == startNode) {
- #if DEBUG_NAV_UI
- if (node == lastStartNode)
- DBG_NAV_LOGD("start=%d last=%d", start, lastStartEnd);
- #endif
- if (node == lastStartNode && start < lastStartEnd)
- break; // skip rect if text overlaps already written text
- lastStartNode = node;
- lastStartEnd = newLength - start;
- }
- if (newLength < start) {
- DBG_NAV_LOGD("newLen=%d < start=%d", newLength, start);
- break;
- }
- if (!isPunctuation(chars[start]))
- result.append(' ');
- result.append(chars + start, newLength - start);
- start = 0;
- } while (node != endNode && (node = node->traverseNextNode()));
- }
- result = result.simplifyWhiteSpace().stripWhiteSpace();
-#if DUMP_NAV_CACHE
- {
- char buffer[256];
- CacheBuilder::Debug debug;
- debug.init(buffer, sizeof(buffer));
- debug.print("copy: ");
- debug.wideString(result);
- DUMP_NAV_LOGD("%s", buffer);
- }
-#endif
- return result;
-}
-
void WebViewCore::setSelection(int start, int end)
{
WebCore::Node* focus = currentFocus();
@@ -2072,11 +1818,6 @@ void WebViewCore::listBoxRequest(WebCoreReply* reply, const uint16_t** labels, s
// Create an array of java Strings for the drop down.
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
jobjectArray labelArray = makeLabelArray(env, labels, count);
// Create an array determining whether each item is enabled.
@@ -2101,11 +1842,15 @@ void WebViewCore::listBoxRequest(WebCoreReply* reply, const uint16_t** labels, s
}
env->ReleaseIntArrayElements(selectedArray, selArray, 0);
- env->CallVoidMethod(obj.get(), m_javaGlue->m_requestListBox, labelArray, enabledArray, selectedArray);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_requestListBox, labelArray, enabledArray,
+ selectedArray);
env->DeleteLocalRef(selectedArray);
} else {
// Pass up the single selection.
- env->CallVoidMethod(obj.get(), m_javaGlue->m_requestSingleListBox, labelArray, enabledArray, selectedCountOrSelection);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_requestSingleListBox, labelArray, enabledArray,
+ selectedCountOrSelection);
}
env->DeleteLocalRef(labelArray);
@@ -2325,14 +2070,11 @@ void WebViewCore::popupReply(const int* array, int count)
void WebViewCore::addMessageToConsole(const WebCore::String& message, unsigned int lineNumber, const WebCore::String& sourceID) {
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
jstring jMessageStr = env->NewString((unsigned short *)message.characters(), message.length());
jstring jSourceIDStr = env->NewString((unsigned short *)sourceID.characters(), sourceID.length());
- env->CallVoidMethod(obj.get(), m_javaGlue->m_addMessageToConsole, jMessageStr, lineNumber, jSourceIDStr);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_addMessageToConsole, jMessageStr, lineNumber,
+ jSourceIDStr);
env->DeleteLocalRef(jMessageStr);
env->DeleteLocalRef(jSourceIDStr);
checkException(env);
@@ -2341,14 +2083,9 @@ void WebViewCore::addMessageToConsole(const WebCore::String& message, unsigned i
void WebViewCore::jsAlert(const WebCore::String& url, const WebCore::String& text)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
jstring jInputStr = env->NewString((unsigned short *)text.characters(), text.length());
jstring jUrlStr = env->NewString((unsigned short *)url.characters(), url.length());
- env->CallVoidMethod(obj.get(), m_javaGlue->m_jsAlert, jUrlStr, jInputStr);
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_jsAlert, jUrlStr, jInputStr);
env->DeleteLocalRef(jInputStr);
env->DeleteLocalRef(jUrlStr);
checkException(env);
@@ -2358,14 +2095,11 @@ void WebViewCore::exceededDatabaseQuota(const WebCore::String& url, const WebCor
{
#if ENABLE(DATABASE)
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
jstring jDatabaseIdentifierStr = env->NewString((unsigned short *)databaseIdentifier.characters(), databaseIdentifier.length());
jstring jUrlStr = env->NewString((unsigned short *)url.characters(), url.length());
- env->CallVoidMethod(obj.get(), m_javaGlue->m_exceededDatabaseQuota, jUrlStr, jDatabaseIdentifierStr, currentQuota, estimatedSize);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_exceededDatabaseQuota, jUrlStr,
+ jDatabaseIdentifierStr, currentQuota, estimatedSize);
env->DeleteLocalRef(jDatabaseIdentifierStr);
env->DeleteLocalRef(jUrlStr);
checkException(env);
@@ -2376,12 +2110,8 @@ void WebViewCore::reachedMaxAppCacheSize(const unsigned long long spaceNeeded)
{
#if ENABLE(OFFLINE_WEB_APPLICATIONS)
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_reachedMaxAppCacheSize, spaceNeeded);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_reachedMaxAppCacheSize, spaceNeeded);
checkException(env);
#endif
}
@@ -2390,25 +2120,15 @@ void WebViewCore::populateVisitedLinks(WebCore::PageGroup* group)
{
m_groupForVisitedLinks = group;
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(), m_javaGlue->m_populateVisitedLinks);
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_populateVisitedLinks);
checkException(env);
}
void WebViewCore::geolocationPermissionsShowPrompt(const WebCore::String& origin)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
jstring originString = env->NewString((unsigned short *)origin.characters(), origin.length());
- env->CallVoidMethod(obj.get(),
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
m_javaGlue->m_geolocationPermissionsShowPrompt,
originString);
env->DeleteLocalRef(originString);
@@ -2418,12 +2138,7 @@ void WebViewCore::geolocationPermissionsShowPrompt(const WebCore::String& origin
void WebViewCore::geolocationPermissionsHidePrompt()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(),
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
m_javaGlue->m_geolocationPermissionsHidePrompt);
checkException(env);
}
@@ -2431,14 +2146,9 @@ void WebViewCore::geolocationPermissionsHidePrompt()
bool WebViewCore::jsConfirm(const WebCore::String& url, const WebCore::String& text)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return false;
jstring jInputStr = env->NewString((unsigned short *)text.characters(), text.length());
jstring jUrlStr = env->NewString((unsigned short *)url.characters(), url.length());
- jboolean result = env->CallBooleanMethod(obj.get(), m_javaGlue->m_jsConfirm, jUrlStr, jInputStr);
+ jboolean result = env->CallBooleanMethod(m_javaGlue->object(env).get(), m_javaGlue->m_jsConfirm, jUrlStr, jInputStr);
env->DeleteLocalRef(jInputStr);
env->DeleteLocalRef(jUrlStr);
checkException(env);
@@ -2448,16 +2158,10 @@ bool WebViewCore::jsConfirm(const WebCore::String& url, const WebCore::String& t
bool WebViewCore::jsPrompt(const WebCore::String& url, const WebCore::String& text, const WebCore::String& defaultValue, WebCore::String& result)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return false;
-
jstring jInputStr = env->NewString((unsigned short *)text.characters(), text.length());
jstring jDefaultStr = env->NewString((unsigned short *)defaultValue.characters(), defaultValue.length());
jstring jUrlStr = env->NewString((unsigned short *)url.characters(), url.length());
- jstring returnVal = (jstring) env->CallObjectMethod(obj.get(), m_javaGlue->m_jsPrompt, jUrlStr, jInputStr, jDefaultStr);
+ jstring returnVal = (jstring) env->CallObjectMethod(m_javaGlue->object(env).get(), m_javaGlue->m_jsPrompt, jUrlStr, jInputStr, jDefaultStr);
// If returnVal is null, it means that the user cancelled the dialog.
if (!returnVal)
return false;
@@ -2473,14 +2177,9 @@ bool WebViewCore::jsPrompt(const WebCore::String& url, const WebCore::String& te
bool WebViewCore::jsUnload(const WebCore::String& url, const WebCore::String& message)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return false;
jstring jInputStr = env->NewString((unsigned short *)message.characters(), message.length());
jstring jUrlStr = env->NewString((unsigned short *)url.characters(), url.length());
- jboolean result = env->CallBooleanMethod(obj.get(), m_javaGlue->m_jsUnload, jUrlStr, jInputStr);
+ jboolean result = env->CallBooleanMethod(m_javaGlue->object(env).get(), m_javaGlue->m_jsUnload, jUrlStr, jInputStr);
env->DeleteLocalRef(jInputStr);
env->DeleteLocalRef(jUrlStr);
checkException(env);
@@ -2490,12 +2189,7 @@ bool WebViewCore::jsUnload(const WebCore::String& url, const WebCore::String& me
bool WebViewCore::jsInterrupt()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return true; // default to interrupt
- jboolean result = env->CallBooleanMethod(obj.get(), m_javaGlue->m_jsInterrupt);
+ jboolean result = env->CallBooleanMethod(m_javaGlue->object(env).get(), m_javaGlue->m_jsInterrupt);
checkException(env);
return result;
}
@@ -2510,12 +2204,7 @@ jobject
WebViewCore::getWebViewJavaObject()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return 0;
- return env->GetObjectField(obj.get(), gWebViewCoreFields.m_webView);
+ return env->GetObjectField(m_javaGlue->object(env).get(), gWebViewCoreFields.m_webView);
}
void WebViewCore::updateTextSelection() {
@@ -2527,12 +2216,7 @@ void WebViewCore::updateTextSelection() {
return;
RenderTextControl* rtc = static_cast<RenderTextControl*>(renderer);
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
- env->CallVoidMethod(obj.get(),
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
m_javaGlue->m_updateTextSelection, reinterpret_cast<int>(focusNode),
rtc->selectionStart(), rtc->selectionEnd(), m_textGeneration);
checkException(env);
@@ -2544,21 +2228,15 @@ void WebViewCore::updateTextfield(WebCore::Node* ptr, bool changeToPassword,
if (m_blockTextfieldUpdates)
return;
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
-
if (changeToPassword) {
- env->CallVoidMethod(obj.get(), m_javaGlue->m_updateTextfield,
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_updateTextfield,
(int) ptr, true, 0, m_textGeneration);
checkException(env);
return;
}
int length = text.length();
jstring string = env->NewString((unsigned short *) text.characters(), length);
- env->CallVoidMethod(obj.get(), m_javaGlue->m_updateTextfield,
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_updateTextfield,
(int) ptr, false, string, m_textGeneration);
env->DeleteLocalRef(string);
checkException(env);
@@ -2567,13 +2245,8 @@ void WebViewCore::updateTextfield(WebCore::Node* ptr, bool changeToPassword,
void WebViewCore::clearTextEntry()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
- // if it is called during DESTROY is handled, the real object of WebViewCore
- // can be gone. Check before using it.
- if (!obj.get())
- return;
-
- env->CallVoidMethod(obj.get(), m_javaGlue->m_clearTextEntry);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_clearTextEntry);
}
void WebViewCore::setBackgroundColor(SkColor c)
@@ -2591,11 +2264,10 @@ void WebViewCore::setBackgroundColor(SkColor c)
jclass WebViewCore::getPluginClass(const WebCore::String& libName, const char* className)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
jstring libString = env->NewString(libName.characters(), libName.length());
jstring classString = env->NewStringUTF(className);
- jobject pluginClass = env->CallObjectMethod(obj.get(),
+ jobject pluginClass = env->CallObjectMethod(m_javaGlue->object(env).get(),
m_javaGlue->m_getPluginClass,
libString, classString);
checkException(env);
@@ -2626,18 +2298,16 @@ void WebViewCore::showFullScreenPlugin(jobject childView, NPP npp, int x,
void WebViewCore::hideFullScreenPlugin()
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
-
- env->CallVoidMethod(obj.get(), m_javaGlue->m_hideFullScreenPlugin);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_hideFullScreenPlugin);
checkException(env);
}
void WebViewCore::updateFullScreenPlugin(int x, int y, int width, int height)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
-
- env->CallVoidMethod(obj.get(), m_javaGlue->m_updateFullScreenPlugin, x, y,
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_updateFullScreenPlugin, x, y,
width, height);
checkException(env);
}
@@ -2645,9 +2315,7 @@ void WebViewCore::updateFullScreenPlugin(int x, int y, int width, int height)
jobject WebViewCore::addSurface(jobject view, int x, int y, int width, int height)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
-
- jobject result = env->CallObjectMethod(obj.get(),
+ jobject result = env->CallObjectMethod(m_javaGlue->object(env).get(),
m_javaGlue->m_addSurface,
view, x, y, width, height);
checkException(env);
@@ -2657,19 +2325,16 @@ jobject WebViewCore::addSurface(jobject view, int x, int y, int width, int heigh
void WebViewCore::updateSurface(jobject childView, int x, int y, int width, int height)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
-
- env->CallVoidMethod(obj.get(), m_javaGlue->m_updateSurface, childView, x,
- y, width, height);
+ env->CallVoidMethod(m_javaGlue->object(env).get(),
+ m_javaGlue->m_updateSurface, childView,
+ x, y, width, height);
checkException(env);
}
void WebViewCore::destroySurface(jobject childView)
{
JNIEnv* env = JSC::Bindings::getJNIEnv();
- AutoJObject obj = m_javaGlue->object(env);
-
- env->CallVoidMethod(obj.get(), m_javaGlue->m_destroySurface, childView);
+ env->CallVoidMethod(m_javaGlue->object(env).get(), m_javaGlue->m_destroySurface, childView);
checkException(env);
}
@@ -3100,20 +2765,6 @@ static void SetBackgroundColor(JNIEnv *env, jobject obj, jint color)
viewImpl->setBackgroundColor((SkColor) color);
}
-static jstring GetSelection(JNIEnv *env, jobject obj, jobject selRgn)
-{
-#ifdef ANDROID_INSTRUMENT
- TimeCounterAuto counter(TimeCounter::WebViewCoreTimeCounter);
-#endif
- WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj);
- LOG_ASSERT(viewImpl, "viewImpl not set in %s", __FUNCTION__);
- SkRegion* selectionRegion = GraphicsJNI::getNativeRegion(env, selRgn);
- WebCore::String result = viewImpl->getSelection(selectionRegion);
- if (!result.isEmpty())
- return WebCoreStringToJString(env, result);
- return 0;
-}
-
static void DumpDomTree(JNIEnv *env, jobject obj, jboolean useFile)
{
WebViewCore* viewImpl = GET_NATIVE_VIEW(env, obj);
@@ -3240,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)
@@ -3255,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)
@@ -3281,7 +2936,6 @@ static void ProvideVisitedHistory(JNIEnv *env, jobject obj, jobject hist)
env->ReleaseStringChars(item, str);
env->DeleteLocalRef(item);
}
- env->DeleteLocalRef(array);
}
// Notification from the UI thread that the plugin's full-screen surface has been discarded
@@ -3380,8 +3034,6 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = {
(void*) SplitContent },
{ "nativeSetBackgroundColor", "(I)V",
(void*) SetBackgroundColor },
- { "nativeGetSelection", "(Landroid/graphics/Region;)Ljava/lang/String;",
- (void*) GetSelection },
{ "nativeRegisterURLSchemeAsLocal", "(Ljava/lang/String;)V",
(void*) RegisterURLSchemeAsLocal },
{ "nativeDumpDomTree", "(Z)V",
diff --git a/WebKit/android/jni/WebViewCore.h b/WebKit/android/jni/WebViewCore.h
index f1893ff..0569b4d 100644
--- a/WebKit/android/jni/WebViewCore.h
+++ b/WebKit/android/jni/WebViewCore.h
@@ -247,7 +247,6 @@ namespace android {
WebCore::String retrieveHref(WebCore::Frame* frame, WebCore::Node* node);
WebCore::String retrieveAnchorText(WebCore::Frame* frame, WebCore::Node* node);
WebCore::String requestLabel(WebCore::Frame* , WebCore::Node* );
- WebCore::String getSelection(SkRegion* );
// Create a single picture to represent the drawn DOM (used by navcache)
void recordPicture(SkPicture* picture);
@@ -454,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
@@ -510,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;