diff options
Diffstat (limited to 'Source/WebKit/android/jni')
-rw-r--r-- | Source/WebKit/android/jni/PictureSet.cpp | 4 | ||||
-rw-r--r-- | Source/WebKit/android/jni/WebCoreFrameBridge.cpp | 5 | ||||
-rw-r--r-- | Source/WebKit/android/jni/WebViewCore.cpp | 38 |
3 files changed, 40 insertions, 7 deletions
diff --git a/Source/WebKit/android/jni/PictureSet.cpp b/Source/WebKit/android/jni/PictureSet.cpp index d05f315..bf61c3e 100644 --- a/Source/WebKit/android/jni/PictureSet.cpp +++ b/Source/WebKit/android/jni/PictureSet.cpp @@ -298,11 +298,11 @@ void PictureSet::checkDimensions(int width, int height, SkRegion* inval) { if (mWidth == width && mHeight == height) return; - DBG_SET_LOGD("%p old:(w=%d,h=%d) new:(w=%d,h=%d)", this, + DBG_SET_LOGD("%p old:(w=%d,h=%d) new:(w=%d,h=%d)", this, mWidth, mHeight, width, height); if (mWidth == width && height > mHeight) { // only grew vertically SkIRect rect; - rect.set(0, mHeight, width, height - mHeight); + rect.set(0, mHeight, width, height); inval->op(rect, SkRegion::kUnion_Op); } else { clear(); // if both width/height changed, clear the old cache diff --git a/Source/WebKit/android/jni/WebCoreFrameBridge.cpp b/Source/WebKit/android/jni/WebCoreFrameBridge.cpp index 5fbe0a1..c1c8d96 100644 --- a/Source/WebKit/android/jni/WebCoreFrameBridge.cpp +++ b/Source/WebKit/android/jni/WebCoreFrameBridge.cpp @@ -1477,6 +1477,11 @@ static void LoadUrl(JNIEnv *env, jobject obj, jstring url, jobject headers) } LOGV("LoadUrl %s", kurl.string().latin1().data()); pFrame->loader()->load(request, false); + + // Loading a new URL, clear the picture set. + WebCore::FrameView* view = pFrame->view(); + if (view) + WebViewCore::getWebViewCore(view)->clearContent(); } static void PostUrl(JNIEnv *env, jobject obj, jstring url, jbyteArray postData) diff --git a/Source/WebKit/android/jni/WebViewCore.cpp b/Source/WebKit/android/jni/WebViewCore.cpp index 964a33d..5bc7f48 100644 --- a/Source/WebKit/android/jni/WebViewCore.cpp +++ b/Source/WebKit/android/jni/WebViewCore.cpp @@ -164,6 +164,11 @@ FILE* gRenderTreeFile = 0; #include <v8.h> #endif +// In some cases, too many invalidations passed to the UI will slow us down. +// Limit ourselves to 32 rectangles, past this just send the area bounds to the UI. +// see WebViewCore::recordPictureSet(). +#define MAX_INVALIDATIONS 32 + /* We pass this flag when recording the actual content, so that we don't spend time actually regionizing complex path clips, when all we really want to do is record them. @@ -684,6 +689,21 @@ void WebViewCore::recordPictureSet(PictureSet* content) // Add the current inval rects to the PictureSet, and rebuild it. content->add(m_addInval, 0, 0, false); + + // If we have too many invalidations, just get the area bounds + SkRegion::Iterator iterator(m_addInval); + int nbInvals = 0; + while (!iterator.done()) { + iterator.next(); + nbInvals++; + if (nbInvals > MAX_INVALIDATIONS) + break; + } + if (nbInvals > MAX_INVALIDATIONS) { + SkIRect r = m_addInval.getBounds(); + m_addInval.setRect(r); + } + rebuildPictureSet(content); } // WebViewCoreRecordTimeCounter @@ -3822,11 +3842,10 @@ void WebViewCore::setWebTextViewAutoFillable(int queryId, const string16& previe bool WebViewCore::drawIsPaused() const { - JNIEnv* env = JSC::Bindings::getJNIEnv(); - AutoJObject javaObject = m_javaGlue->object(env); - if (!javaObject.get()) - return false; - return env->GetBooleanField(javaObject.get(), gWebViewCoreFields.m_drawIsPaused); + // returning true says scrollview should be offscreen, which pauses + // gifs. because this is not again queried when we stop scrolling, we don't + // use the stopping currently. + return false; } #if USE(CHROME_NETWORK_STACK) @@ -4418,6 +4437,14 @@ static bool FocusBoundsChanged(JNIEnv* env, jobject obj) return GET_NATIVE_VIEW(env, obj)->focusBoundsChanged(); } +static void SetIsPaused(JNIEnv* env, jobject obj, jboolean isPaused) +{ + // tell the webcore thread to stop thinking while we do other work + // (selection and scrolling). This has nothing to do with the lifecycle + // pause and resume. + GET_NATIVE_VIEW(env, obj)->setIsPaused(isPaused); +} + static void Pause(JNIEnv* env, jobject obj) { // This is called for the foreground tab when the browser is put to the @@ -4665,6 +4692,7 @@ static JNINativeMethod gJavaWebViewCoreMethods[] = { (void*) SetNewStorageLimit }, { "nativeGeolocationPermissionsProvide", "(Ljava/lang/String;ZZ)V", (void*) GeolocationPermissionsProvide }, + { "nativeSetIsPaused", "(Z)V", (void*) SetIsPaused }, { "nativePause", "()V", (void*) Pause }, { "nativeResume", "()V", (void*) Resume }, { "nativeFreeMemory", "()V", (void*) FreeMemory }, |