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

Commit d9624138 authored by Teng-Hui Zhu's avatar Teng-Hui Zhu
Browse files

Allow webview to delete GL resource in a valid EGL context

bug:6079959

Change-Id: Idee1031b0bcc4aeb498a18eb01970a8ed7efd285
parent fdd646b2
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -3751,6 +3751,7 @@ public final class ActivityThread {
    }

    final void handleTrimMemory(int level) {
        WindowManagerImpl.getDefault().trimMemory(level);
        ArrayList<ComponentCallbacks2> callbacks;

        synchronized (mPackages) {
@@ -3761,7 +3762,7 @@ public final class ActivityThread {
        for (int i=0; i<N; i++) {
            callbacks.get(i).onTrimMemory(level);
        }
        WindowManagerImpl.getDefault().trimMemory(level);
        WindowManagerImpl.getDefault().terminateEgl();
    }

    private void setupGraphicsSupport(LoadedApk info) {
+12 −2
Original line number Diff line number Diff line
@@ -105,6 +105,7 @@ public class WindowManagerImpl implements WindowManager {
    private View[] mViews;
    private ViewRootImpl[] mRoots;
    private WindowManager.LayoutParams[] mParams;
    private boolean mNeedsEglTerminate;

    private final static Object sLock = new Object();
    private final static WindowManagerImpl sWindowManager = new WindowManagerImpl();
@@ -447,8 +448,7 @@ public class WindowManagerImpl implements WindowManager {
                                mRoots[i].terminateHardwareResources();
                            }
                        }
                        // Terminate the hardware renderer to free all resources
                        ManagedEGLContext.doTerminate();
                        mNeedsEglTerminate = true;
                        break;
                    }
                    // high end gfx devices fall through to next case
@@ -458,6 +458,16 @@ public class WindowManagerImpl implements WindowManager {
        }
    }

    /**
     * @hide
     */
    public void terminateEgl() {
        if (mNeedsEglTerminate) {
            ManagedEGLContext.doTerminate();
            mNeedsEglTerminate = false;
        }
    }

    /**
     * @hide
     */