Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2855)

Unified Diff: android_webview/test/shell/src/org/chromium/android_webview/test/AwTestContainerView.java

Issue 1927543003: Remove DrawGLFunctor CleanupReference. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: make Runnable static, throw if native DrawGLFunctor destroyed Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « android_webview/java/src/org/chromium/android_webview/AwGLFunctor.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/test/shell/src/org/chromium/android_webview/test/AwTestContainerView.java
diff --git a/android_webview/test/shell/src/org/chromium/android_webview/test/AwTestContainerView.java b/android_webview/test/shell/src/org/chromium/android_webview/test/AwTestContainerView.java
index d03a662f2fe8f4f70a65b813740cd1770bc0766c..da0009eb9f184705d73b28f68d93883c2ebcad35 100644
--- a/android_webview/test/shell/src/org/chromium/android_webview/test/AwTestContainerView.java
+++ b/android_webview/test/shell/src/org/chromium/android_webview/test/AwTestContainerView.java
@@ -145,6 +145,7 @@ public class AwTestContainerView extends FrameLayout {
public void requestRender(long viewContext, Canvas canvas, boolean waitForCompletion) {
synchronized (mSyncLock) {
+ assert viewContext != 0;
assert mViewContext == 0 || mViewContext == viewContext;
mViewContext = viewContext;
super.requestRender();
@@ -420,11 +421,22 @@ public class AwTestContainerView extends FrameLayout {
}
}
+ private static final class NativeDrawGLFunctorDestroyRunnable implements Runnable {
+ public long mContext;
+ NativeDrawGLFunctorDestroyRunnable(long context) {
+ mContext = context;
+ }
+ @Override
+ public void run() {
+ mContext = 0;
+ }
+ }
+
private class NativeDrawGLFunctor implements AwContents.NativeDrawGLFunctor {
- private long mContext;
+ private NativeDrawGLFunctorDestroyRunnable mDestroyRunnable;
NativeDrawGLFunctor(long context) {
- mContext = context;
+ mDestroyRunnable = new NativeDrawGLFunctorDestroyRunnable(context);
}
@Override
@@ -436,14 +448,14 @@ public class AwTestContainerView extends FrameLayout {
public boolean requestDrawGL(Canvas canvas, Runnable releasedRunnable) {
assert releasedRunnable == null;
if (!isBackedByHardwareView()) return false;
- mHardwareView.requestRender(mContext, canvas, false);
+ mHardwareView.requestRender(mDestroyRunnable.mContext, canvas, false);
return true;
}
@Override
public boolean requestInvokeGL(View containerView, boolean waitForCompletion) {
if (!isBackedByHardwareView()) return false;
- mHardwareView.requestRender(mContext, null, waitForCompletion);
+ mHardwareView.requestRender(mDestroyRunnable.mContext, null, waitForCompletion);
return true;
}
@@ -451,6 +463,11 @@ public class AwTestContainerView extends FrameLayout {
public void detach(View containerView) {
if (isBackedByHardwareView()) mHardwareView.detachGLFunctor();
}
+
+ @Override
+ public Runnable getDestroyRunnable() {
+ return mDestroyRunnable;
+ }
}
// TODO: AwContents could define a generic class that holds an implementation similar to
« no previous file with comments | « android_webview/java/src/org/chromium/android_webview/AwGLFunctor.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698