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

Commit 28abdc03 authored by Sangita Mohan's avatar Sangita Mohan Committed by Steve Kondik
Browse files

Dom Caching feature:

This feature caches the header portion of a webpage
when the user visits the webpage for the 1st time.
On subsequent visits to the page, we paint the header instantly
before the page is fetched over the network. This improves user's
initial response.

Change-Id: I0ac5ea721522dcae4abff8371083353e0d1a702b
parent abff94d3
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -362,7 +362,8 @@ class BrowserFrame extends Handler {
            mFirstLayoutDone = true;
            // ensure {@link WebViewCore#webkitDraw} is called as we were
            // blocking the update in {@link #loadStarted}
            mWebViewCore.contentDraw();
            //we pass false as the parameter paintHeader to contentDraw since here we are not painting a cached header
            mWebViewCore.contentDraw(false);
        }
    }

+12 −6
Original line number Diff line number Diff line
@@ -1704,7 +1704,8 @@ final class WebViewCore {
            // ensure {@link #webkitDraw} is called as we were blocking in
            // {@link #contentDraw} when mCurrentViewWidth is 0
            if (DebugFlags.WEB_VIEW_CORE) Log.v(LOGTAG, "viewSizeChanged");
            contentDraw();
            //we pass false as the parameter paintHeader to contentDraw since here we are not painting a cached header
            contentDraw(false);
        }
        mEventHub.sendMessage(Message.obtain(null,
                EventHub.UPDATE_CACHE_AND_TEXT_ENTRY));
@@ -1892,7 +1893,8 @@ final class WebViewCore {
                core.mDrawIsPaused = false;
                if (core.mDrawIsScheduled) {
                    core.mDrawIsScheduled = false;
                    core.contentDraw();
                    //we pass false as the parameter paintHeader to contentDraw since here we are not painting a cached header
                    core.contentDraw(false);
                }
            }
        }
@@ -1916,12 +1918,16 @@ final class WebViewCore {
    //-------------------------------------------------------------------------

    // called from JNI or WebView thread
    /* package */ void contentDraw() {
    /* package */ void contentDraw(boolean paintHeader) {
        // don't update the Picture until we have an initial width and finish
        // the first layout
        if (mCurrentViewWidth == 0 || !mBrowserFrame.firstLayoutDone()) {

        if (mCurrentViewWidth == 0)
            return;
        }

        if (!paintHeader && !mBrowserFrame.firstLayoutDone())
            return;

        // only fire an event if this is our first request
        synchronized (this) {
            if (mDrawIsScheduled) return;
@@ -2006,7 +2012,7 @@ final class WebViewCore {
                WebViewWorker.MSG_CACHE_TRANSACTION_TICKER);
        WebViewWorker.getHandler().sendEmptyMessage(
                WebViewWorker.MSG_CACHE_TRANSACTION_TICKER);
        contentDraw();
        contentDraw(false);
    }

    /*  Called by JNI. The coordinates are in doc coordinates, so they need to