Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 58d94af5 authored by Chris Craik's avatar Chris Craik
Browse files

actually pause webkit thread, remove costly invalidate

pass isScrolling info to glwebviewstate
pause webkit in a way that doesn't require full inval on resume

depends on change https://android-git.corp.google.com/g/#/c/130210/

bug:5106313
Change-Id: Icbe57e3a163c17c99bd1ea49ab42e40f9d41cc6d
parent 9b9783ad
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -3451,6 +3451,7 @@ public class WebView extends AbsoluteLayout
                }
                abortAnimation();
                mPrivateHandler.removeMessages(RESUME_WEBCORE_PRIORITY);
                nativeSetIsScrolling(false);
                if (!mBlockWebkitViewMessages) {
                    WebViewCore.resumePriority();
                    if (!mSelectingText) {
@@ -6382,6 +6383,8 @@ public class WebView extends AbsoluteLayout
        WebViewCore.reducePriority();
        // to get better performance, pause updating the picture
        WebViewCore.pauseUpdatePicture(mWebViewCore);
        nativeSetIsScrolling(true);

        if (!mDragFromTextInput) {
            nativeHideCursor();
        }
@@ -6478,6 +6481,7 @@ public class WebView extends AbsoluteLayout
                || mTouchMode == TOUCH_DRAG_LAYER_MODE) && !mSelectingText) {
            WebViewCore.resumePriority();
            WebViewCore.resumeUpdatePicture(mWebViewCore);
            nativeSetIsScrolling(false);
        }
        mPrivateHandler.removeMessages(SWITCH_TO_SHORTPRESS);
        mPrivateHandler.removeMessages(SWITCH_TO_LONGPRESS);
@@ -9277,6 +9281,7 @@ public class WebView extends AbsoluteLayout
     * @return True if the layer is successfully scrolled.
     */
    private native boolean  nativeScrollLayer(int layer, int newX, int newY);
    private native void     nativeSetIsScrolling(boolean isScrolling);
    private native int      nativeGetBackgroundColor();
    native boolean  nativeSetProperty(String key, String value);
    native String   nativeGetProperty(String key);
+5 −8
Original line number Diff line number Diff line
@@ -2070,10 +2070,8 @@ public final class WebViewCore {
            if (!core.getSettings().enableSmoothTransition()) return;

            synchronized (core) {
                core.nativeSetIsPaused(true);
                core.mDrawIsPaused = true;
                if (core.mDrawIsScheduled) {
                    core.mEventHub.removeMessages(EventHub.WEBKIT_DRAW);
                }
            }
        }

@@ -2082,15 +2080,14 @@ public final class WebViewCore {
    static void resumeUpdatePicture(WebViewCore core) {
        if (core != null) {
            // if mDrawIsPaused is true, ignore the setting, continue to resume
            if (!core.mDrawIsPaused
                    && !core.getSettings().enableSmoothTransition()) return;
            if (!core.mDrawIsPaused)
                return;

            synchronized (core) {
                core.nativeSetIsPaused(false);
                core.mDrawIsPaused = false;
                // always redraw on resume to reenable gif animations
                core.mDrawIsScheduled = false;
                core.nativeContentInvalidateAll();
                core.contentDraw();
            }
        }
    }
@@ -2127,7 +2124,6 @@ public final class WebViewCore {
            // only fire an event if this is our first request
            if (mDrawIsScheduled) return;
            mDrawIsScheduled = true;
            if (mDrawIsPaused) return;
            mEventHub.sendMessage(Message.obtain(null, EventHub.WEBKIT_DRAW));
        }
    }
@@ -2789,6 +2785,7 @@ public final class WebViewCore {
        return mDeviceOrientationService;
    }

    private native void nativeSetIsPaused(boolean isPaused);
    private native void nativePause();
    private native void nativeResume();
    private native void nativeFreeMemory();