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

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

Merge "No-fail invokeFunctor"

parents 287c0361 3b20251a
Loading
Loading
Loading
Loading
+0 −11
Original line number Diff line number Diff line
@@ -386,17 +386,6 @@ public abstract class HardwareRenderer {

    abstract boolean copyLayerInto(HardwareLayer layer, Bitmap bitmap);

    /**
     * Schedules the functor for execution in either kModeProcess or
     * kModeProcessNoContext, depending on whether or not there is an EGLContext.
     *
     * @param functor The native functor to invoke
     * @param waitForCompletion If true, this will not return until the functor
     *                          has invoked. If false, the functor may be invoked
     *                          asynchronously.
     */
    abstract void invokeFunctor(long functor, boolean waitForCompletion);

    /**
     * Initializes the hardware renderer for the specified surface and setup the
     * renderer for drawing, if needed. This is invoked when the ViewAncestor has
+8 −9
Original line number Diff line number Diff line
@@ -80,13 +80,13 @@ public class ThreadedRenderer extends HardwareRenderer {
    private boolean mProfilingEnabled;

    ThreadedRenderer(Context context, boolean translucent) {
        AtlasInitializer.sInstance.init(context);

        long rootNodePtr = nCreateRootRenderNode();
        mRootNode = RenderNode.adopt(rootNodePtr);
        mRootNode.setClipToBounds(false);
        mNativeProxy = nCreateProxy(translucent, rootNodePtr);

        AtlasInitializer.sInstance.init(context, mNativeProxy);

        // Setup timing
        mChoreographer = Choreographer.getInstance();
        nSetFrameInterval(mNativeProxy, mChoreographer.getFrameIntervalNanos());
@@ -259,9 +259,8 @@ public class ThreadedRenderer extends HardwareRenderer {
        }
    }

    @Override
    void invokeFunctor(long functor, boolean waitForCompletion) {
        nInvokeFunctor(mNativeProxy, functor, waitForCompletion);
    static void invokeFunctor(long functor, boolean waitForCompletion) {
        nInvokeFunctor(functor, waitForCompletion);
    }

    @Override
@@ -342,7 +341,7 @@ public class ThreadedRenderer extends HardwareRenderer {

        private AtlasInitializer() {}

        synchronized void init(Context context) {
        synchronized void init(Context context, long renderProxy) {
            if (mInitialized) return;
            IBinder binder = ServiceManager.getService("assetatlas");
            if (binder == null) return;
@@ -356,7 +355,7 @@ public class ThreadedRenderer extends HardwareRenderer {
                        if (map != null) {
                            // TODO Remove after fixing b/15425820
                            validateMap(context, map);
                            nSetAtlas(buffer, map);
                            nSetAtlas(renderProxy, buffer, map);
                            mInitialized = true;
                        }
                        // If IAssetAtlas is not the same class as the IBinder
@@ -399,7 +398,7 @@ public class ThreadedRenderer extends HardwareRenderer {

    static native void setupShadersDiskCache(String cacheFile);

    private static native void nSetAtlas(GraphicBuffer buffer, long[] map);
    private static native void nSetAtlas(long nativeProxy, GraphicBuffer buffer, long[] map);

    private static native long nCreateRootRenderNode();
    private static native long nCreateProxy(boolean translucent, long rootRenderNode);
@@ -419,7 +418,7 @@ public class ThreadedRenderer extends HardwareRenderer {
    private static native void nRunWithGlContext(long nativeProxy, Runnable runnable);
    private static native void nDestroyCanvasAndSurface(long nativeProxy);

    private static native void nInvokeFunctor(long nativeProxy, long functor, boolean waitForCompletion);
    private static native void nInvokeFunctor(long functor, boolean waitForCompletion);

    private static native long nCreateDisplayListLayer(long nativeProxy, int width, int height);
    private static native long nCreateTextureLayer(long nativeProxy);
+12 −4
Original line number Diff line number Diff line
@@ -661,11 +661,19 @@ public final class ViewRootImpl implements ViewParent,
        }
    }

    /**
     * Schedules the functor for execution in either kModeProcess or
     * kModeProcessNoContext, depending on whether or not there is an EGLContext.
     *
     * @param functor The native functor to invoke
     * @param waitForCompletion If true, this will not return until the functor
     *                          has invoked. If false, the functor may be invoked
     *                          asynchronously.
     */
    public boolean invokeFunctor(long functor, boolean waitForCompletion) {
        if (mAttachInfo.mHardwareRenderer == null) {
            return false;
        }
        mAttachInfo.mHardwareRenderer.invokeFunctor(functor, waitForCompletion);
        ThreadedRenderer.invokeFunctor(functor, waitForCompletion);
        // TODO: Remove the return value. This is here for compatibility
        // with current webview, which expects a boolean
        return true;
    }

Loading