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

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

Revert "Destroy DisplayLists on time"

This reverts commit 2874daa4.

It broke a bunch of stuff and occasionally blank webviews are preferable to native crashes

Bug: 34638191
Change-Id: I6c5849d4ef0db3ac7c9ed1b1a128f2272a5344c2
parent 2874daa4
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -360,7 +360,6 @@ public final class ThreadedRenderer {
    void destroy() {
        mInitialized = false;
        updateEnabledState(null);
        mRootNode.discardDisplayList();
        nDestroy(mNativeProxy, mRootNode.mNativeRenderNode);
    }

@@ -492,12 +491,20 @@ public final class ThreadedRenderer {
     */
    void destroyHardwareResources(View view) {
        destroyResources(view);
        mRootNode.discardDisplayList();
        nDestroyHardwareResources(mNativeProxy);
    }

    private static void destroyResources(View view) {
        view.destroyHardwareResources();

        if (view instanceof ViewGroup) {
            ViewGroup group = (ViewGroup) view;

            int count = group.getChildCount();
            for (int i = 0; i < count; i++) {
                destroyResources(group.getChildAt(i));
            }
        }
    }

    /**
+4 −8
Original line number Diff line number Diff line
@@ -16642,12 +16642,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
        // safe to free its copy of the display list as it knows that we will
        // push an updated DisplayList if we try to draw again
        resetDisplayList();
        if (mOverlay != null) {
            mOverlay.getOverlayView().destroyHardwareResources();
        }
        if (mGhostView != null) {
            mGhostView.destroyHardwareResources();
        }
    }
    /**
@@ -16818,9 +16812,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    }
    private void resetDisplayList() {
        if (mRenderNode.isValid()) {
            mRenderNode.discardDisplayList();
        }
        if (mBackgroundRenderNode != null) {
        if (mBackgroundRenderNode != null && mBackgroundRenderNode.isValid()) {
            mBackgroundRenderNode.discardDisplayList();
        }
    }
+0 −10
Original line number Diff line number Diff line
@@ -3449,16 +3449,6 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
        super.dispatchDetachedFromWindow();
    }

    /** @hide */
    @Override
    protected void destroyHardwareResources() {
        super.destroyHardwareResources();
        int count = getChildCount();
        for (int i = 0; i < count; i++) {
            getChildAt(i).destroyHardwareResources();
        }
    }

    /**
     * @hide
     */
+0 −1
Original line number Diff line number Diff line
@@ -88,7 +88,6 @@ void onRenderNodeRemoved(JNIEnv* env, RenderNode* node) {
        return;
    }

    node->setStagingDisplayList(nullptr, nullptr);
    // Update the valid field, since native has already removed
    // the staging DisplayList
    env->SetBooleanField(jnode, gRenderNode_validFieldID, false);