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

Commit a75fbc3c authored by John Reck's avatar John Reck Committed by Android (Google) Code Review
Browse files

Merge "On new content, attach functor directly" into jb-dev

parents 85973212 c2c9543c
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -64,7 +64,6 @@ class ViewStateSerializer {
        draw.mViewState = new WebViewCore.ViewState();
        draw.mContentSize = new Point(contentWidth, contentHeight);
        draw.mBaseLayer = baseLayer;
        draw.mInvalRegion = new Region(0, 0, contentWidth, contentHeight);
        stream.close();
        return draw;
    }
+14 −13
Original line number Diff line number Diff line
@@ -2669,7 +2669,7 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
    public void clearView() {
        mContentWidth = 0;
        mContentHeight = 0;
        setBaseLayer(0, null, false, false);
        setBaseLayer(0, false, false);
        mWebViewCore.sendMessage(EventHub.CLEAR_CONTENT);
    }

@@ -4448,12 +4448,12 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
     */
    private SelectActionModeCallback mSelectCallback;

    void setBaseLayer(int layer, Region invalRegion, boolean showVisualIndicator,
    void setBaseLayer(int layer, boolean showVisualIndicator,
            boolean isPictureAfterFirstLayout) {
        if (mNativeClass == 0)
            return;
        boolean queueFull;
        queueFull = nativeSetBaseLayer(mNativeClass, layer, invalRegion,
        queueFull = nativeSetBaseLayer(mNativeClass, layer,
                                       showVisualIndicator, isPictureAfterFirstLayout);

        if (queueFull) {
@@ -7848,7 +7848,7 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
        boolean isPictureAfterFirstLayout = viewState != null;

        if (updateBaseLayer) {
            setBaseLayer(draw.mBaseLayer, draw.mInvalRegion,
            setBaseLayer(draw.mBaseLayer,
                    getSettings().getShowVisualIndicator(),
                    isPictureAfterFirstLayout);
        }
@@ -7880,15 +7880,17 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
        }
        mSendScrollEvent = true;

        if (DebugFlags.WEB_VIEW) {
            Rect b = draw.mInvalRegion.getBounds();
            Log.v(LOGTAG, "NEW_PICTURE_MSG_ID {" +
                    b.left+","+b.top+","+b.right+","+b.bottom+"}");
        int functor = 0;
        if (mWebView.isHardwareAccelerated()
                || mWebView.getLayerType() != View.LAYER_TYPE_HARDWARE) {
            functor = nativeGetDrawGLFunction(mNativeClass);
        }
        Rect invalBounds = draw.mInvalRegion.getBounds();
        if (!invalBounds.isEmpty()) {
            invalidateContentRect(invalBounds);

        if (functor != 0) {
            mWebView.getViewRootImpl().attachFunctor(functor);
        } else {
            // invalidate the screen so that the next repaint will show new content
            // TODO: partial invalidate
            mWebView.invalidate();
        }

@@ -8576,8 +8578,7 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
    private native Rect     nativeLayerBounds(int layer);
    private native void     nativeSetHeightCanMeasure(boolean measure);
    private native boolean  nativeSetBaseLayer(int nativeInstance,
            int layer, Region invalRegion,
            boolean showVisualIndicator, boolean isPictureAfterFirstLayout);
            int layer, boolean showVisualIndicator, boolean isPictureAfterFirstLayout);
    private native int      nativeGetBaseLayer();
    private native void     nativeReplaceBaseContent(int content);
    private native void     nativeCopyBaseContentToPicture(Picture pict);
+3 −8
Original line number Diff line number Diff line
@@ -601,8 +601,7 @@ public final class WebViewCore {
     * Redraw a portion of the picture set. The Point wh returns the
     * width and height of the overall picture.
     */
    private native int nativeRecordContent(int nativeClass, Region invalRegion,
            Point wh);
    private native int nativeRecordContent(int nativeClass, Point wh);

    /**
     * Notify webkit that animations have begun (on the hardware accelerated content)
@@ -2180,11 +2179,9 @@ public final class WebViewCore {
    static class DrawData {
        DrawData() {
            mBaseLayer = 0;
            mInvalRegion = new Region();
            mContentSize = new Point();
        }
        int mBaseLayer;
        Region mInvalRegion;
        // view size that was used by webkit during the most recent layout
        Point mViewSize;
        Point mContentSize;
@@ -2230,8 +2227,7 @@ public final class WebViewCore {
        mDrawIsScheduled = false;
        DrawData draw = new DrawData();
        if (DebugFlags.WEB_VIEW_CORE) Log.v(LOGTAG, "webkitDraw start");
        draw.mBaseLayer = nativeRecordContent(mNativeClass, draw.mInvalRegion,
                draw.mContentSize);
        draw.mBaseLayer = nativeRecordContent(mNativeClass, draw.mContentSize);
        if (draw.mBaseLayer == 0) {
            if (mWebViewClassic != null && !mWebViewClassic.isPaused()) {
                if (DebugFlags.WEB_VIEW_CORE) Log.v(LOGTAG, "webkitDraw abort, resending draw message");
@@ -2277,8 +2273,7 @@ public final class WebViewCore {
        // the draw path (and fix saving <canvas>)
        DrawData draw = new DrawData();
        if (DebugFlags.WEB_VIEW_CORE) Log.v(LOGTAG, "saveViewState start");
        draw.mBaseLayer = nativeRecordContent(mNativeClass, draw.mInvalRegion,
                draw.mContentSize);
        draw.mBaseLayer = nativeRecordContent(mNativeClass, draw.mContentSize);
        boolean result = false;
        try {
            result = ViewStateSerializer.serializeViewState(stream, draw);
+4 −4
Original line number Diff line number Diff line
@@ -267,16 +267,16 @@ status_t OpenGLRenderer::invokeFunctors(Rect& dirty) {
            Functor* f = functors.itemAt(i);
            result |= (*f)(DrawGlInfo::kModeProcess, &info);

            if (result != DrawGlInfo::kStatusDone) {
            if (result & DrawGlInfo::kStatusDraw) {
                Rect localDirty(info.dirtyLeft, info.dirtyTop, info.dirtyRight, info.dirtyBottom);
                dirty.unionWith(localDirty);
            }

            if (result & DrawGlInfo::kStatusInvoke) {
                mFunctors.add(f);
            }
        }
    }
    }

    // Restore state possibly changed by the functors in process mode
    GLboolean value;