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

Commit 834f66b6 authored by John Reck's avatar John Reck
Browse files

Do pause painting better

Change-Id: Ia58bbb19cea899c8826d74d7afcbd7e7c541d9c6
parent c72cb1c2
Loading
Loading
Loading
Loading
+1 −6
Original line number Diff line number Diff line
@@ -42,12 +42,7 @@ class DebugFlags {
    public static final boolean WEB_BACK_FORWARD_LIST = false;
    public static final boolean WEB_SETTINGS = false;
    public static final boolean WEB_SYNC_MANAGER = false;
    public static final boolean WEB_TEXT_VIEW = false;
    public static final boolean WEB_VIEW = false;
    public static final boolean WEB_VIEW_CORE = false;
    /*
     * Set to true to allow the WebTextView to draw on top of the web page in a
     * different color with no background so you can see how the two line up.
     */
    public static final boolean DRAW_WEBTEXTVIEW = false;
    public static final boolean MEASURE_PAGE_SWAP_FPS = false;
}
+13 −3
Original line number Diff line number Diff line
@@ -4717,10 +4717,10 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
        queueFull = nativeSetBaseLayer(mNativeClass, layer, invalRegion,
                                       showVisualIndicator, isPictureAfterFirstLayout);

        if (layer == 0 || isPictureAfterFirstLayout) {
            mWebViewCore.resumeWebKitDraw();
        } else if (queueFull) {
        if (queueFull) {
            mWebViewCore.pauseWebKitDraw();
        } else {
            mWebViewCore.resumeWebKitDraw();
        }

        if (mHTML5VideoViewProxy != null) {
@@ -8615,9 +8615,19 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
        void onPageSwapOccurred(boolean notifyAnimationStarted);
    }

    long mLastSwapTime;
    double mAverageSwapFps;

    /** Called by JNI when pages are swapped (only occurs with hardware
     * acceleration) */
    protected void pageSwapCallback(boolean notifyAnimationStarted) {
        if (DebugFlags.MEASURE_PAGE_SWAP_FPS) {
            long now = System.currentTimeMillis();
            long diff = now - mLastSwapTime;
            mAverageSwapFps = ((1000.0 / diff) + mAverageSwapFps) / 2;
            Log.d(LOGTAG, "page swap fps: " + mAverageSwapFps);
            mLastSwapTime = now;
        }
        mWebViewCore.resumeWebKitDraw();
        if (notifyAnimationStarted) {
            mWebViewCore.sendMessage(EventHub.NOTIFY_ANIMATION_STARTED);
+1 −0
Original line number Diff line number Diff line
@@ -2271,6 +2271,7 @@ public final class WebViewCore {
                mFirstLayoutForNonStandardLoad = false;
            }
            if (DebugFlags.WEB_VIEW_CORE) Log.v(LOGTAG, "webkitDraw NEW_PICTURE_MSG_ID");
            pauseWebKitDraw();
            Message.obtain(mWebViewClassic.mPrivateHandler,
                    WebViewClassic.NEW_PICTURE_MSG_ID, draw).sendToTarget();
        }