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

Commit 53913ed5 authored by Chris Craik's avatar Chris Craik Committed by Android (Google) Code Review
Browse files

Merge "Force webview invalidates on unsuccessful functor attach" into jb-dev

parents f0e96de8 41ee4657
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -458,8 +458,10 @@ public abstract class HardwareRenderer {
     *
     * @see HardwareCanvas#callDrawGLFunction(int)
     * @see #detachFunctor(int)
     *
     * @return true if the functor was attached successfully
     */
    abstract void attachFunctor(View.AttachInfo attachInfo, int functor);
    abstract boolean attachFunctor(View.AttachInfo attachInfo, int functor);

    /**
     * Initializes the hardware renderer for the specified surface and setup the
@@ -1227,11 +1229,13 @@ public abstract class HardwareRenderer {
        }

        @Override
        void attachFunctor(View.AttachInfo attachInfo, int functor) {
        boolean attachFunctor(View.AttachInfo attachInfo, int functor) {
            if (mCanvas != null) {
                mCanvas.attachFunctor(functor);
                scheduleFunctors(attachInfo);
                return true;
            }
            return false;
        }

        /**
+3 −2
Original line number Diff line number Diff line
@@ -670,10 +670,11 @@ public final class ViewRootImpl implements ViewParent,
        }
    }

    public void attachFunctor(int functor) {
    public boolean attachFunctor(int functor) {
        if (mAttachInfo.mHardwareRenderer != null && mAttachInfo.mHardwareRenderer.isEnabled()) {
            mAttachInfo.mHardwareRenderer.attachFunctor(mAttachInfo, functor);
            return mAttachInfo.mHardwareRenderer.attachFunctor(mAttachInfo, functor);
        }
        return false;
    }

    public void detachFunctor(int functor) {
+4 −1
Original line number Diff line number Diff line
@@ -7827,15 +7827,18 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
        mSendScrollEvent = true;

        int functor = 0;
        boolean forceInval = isPictureAfterFirstLayout;
        ViewRootImpl viewRoot = mWebView.getViewRootImpl();
        if (mWebView.isHardwareAccelerated() && viewRoot != null) {
            functor = nativeGetDrawGLFunction(mNativeClass);
            if (functor != 0) {
                viewRoot.attachFunctor(functor);
                // force an invalidate if functor attach not successful
                forceInval |= !viewRoot.attachFunctor(functor);
            }
        }

        if (functor == 0
                || forceInval
                || mWebView.getLayerType() != View.LAYER_TYPE_NONE) {
            // invalidate the screen so that the next repaint will show new content
            // TODO: partial invalidate