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

Commit ec0c9254 authored by John Reck's avatar John Reck
Browse files

Fix destroyHardwareResources

 The UI thread needs to know whether or not the display list is
 valid, so bring back View.destroyHardwareResources and instead
 have the native side assert that View did the right thing

Change-Id: I4f8dee6e9c13ec7ab520becdc5cfe20e92a76f8f
parent eb2263dd
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -127,6 +127,8 @@ public class ThreadedRenderer extends HardwareRenderer {
    @Override
    void destroyHardwareResources(View view) {
        destroyResources(view);
        // mRootNode belongs to us and not a view, so we need to destroy it
        mRootNode.destroyDisplayListData();
        nDestroyHardwareResources(mNativeProxy);
    }

+1 −3
Original line number Diff line number Diff line
@@ -13625,9 +13625,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * @hide
     */
    protected void destroyHardwareResources() {
        // Intentionally empty. RenderNode's lifecycle is now fully managed
        // by the hardware renderer.
        // However some subclasses (eg, WebView, TextureView) still need this signal
        resetDisplayList();
    }
    /**
+7 −2
Original line number Diff line number Diff line
@@ -211,7 +211,8 @@ void RenderNode::prepareTreeImpl(TreeInfo& info) {
        // This will also release the hardware layer if we have one as
        // isRenderable() will return false, thus causing pushLayerUpdate
        // to recycle the hardware layer
        setStagingDisplayList(NULL);
        LOG_ALWAYS_FATAL_IF(mStagingDisplayListData || (mDisplayListData && !mNeedsDisplayListDataSync),
                "View.destroyHardwareResources wasn't called!");
        break;
    }

@@ -260,7 +261,11 @@ void RenderNode::pushStagingDisplayListChanges(TreeInfo& info) {
        mNeedsDisplayListDataSync = false;
        // Do a push pass on the old tree to handle freeing DisplayListData
        // that are no longer used
        TreeInfo oldTreeInfo(TreeInfo::MODE_MAYBE_DETACHING, info);
        TreeInfo::TraversalMode mode = TreeInfo::MODE_MAYBE_DETACHING;
        if (CC_UNLIKELY(info.mode == TreeInfo::MODE_DESTROY_RESOURCES)) {
            mode = TreeInfo::MODE_DESTROY_RESOURCES;
        }
        TreeInfo oldTreeInfo(mode, info);
        prepareSubTree(oldTreeInfo, mDisplayListData);
        delete mDisplayListData;
        mDisplayListData = mStagingDisplayListData;