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

Commit 7d4c2ec0 authored by Chris Craik's avatar Chris Craik Committed by Android Git Automerger
Browse files

am 53913ed5: Merge "Force webview invalidates on unsuccessful functor attach" into jb-dev

* commit '53913ed5':
  Force webview invalidates on unsuccessful functor attach
parents ce2907b1 53913ed5
Loading
Loading
Loading
Loading
+7 −3
Original line number Original line Diff line number Diff line
@@ -458,8 +458,10 @@ public abstract class HardwareRenderer {
     *
     *
     * @see HardwareCanvas#callDrawGLFunction(int)
     * @see HardwareCanvas#callDrawGLFunction(int)
     * @see #detachFunctor(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
     * Initializes the hardware renderer for the specified surface and setup the
@@ -1227,11 +1229,13 @@ public abstract class HardwareRenderer {
        }
        }


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


        /**
        /**
+3 −2
Original line number Original line 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()) {
        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) {
    public void detachFunctor(int functor) {
+4 −1
Original line number Original line Diff line number Diff line
@@ -7827,15 +7827,18 @@ public final class WebViewClassic implements WebViewProvider, WebViewProvider.Sc
        mSendScrollEvent = true;
        mSendScrollEvent = true;


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


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