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

Unified Diff: android_webview/glue/java/src/com/android/webview/chromium/DrawGLFunctor.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 | « no previous file | android_webview/java/src/org/chromium/android_webview/AwContents.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/glue/java/src/com/android/webview/chromium/DrawGLFunctor.java
diff --git a/android_webview/glue/java/src/com/android/webview/chromium/DrawGLFunctor.java b/android_webview/glue/java/src/com/android/webview/chromium/DrawGLFunctor.java
index 9192b340ddba0c79bacdb8811d4b344c961ab1a8..55f39bab6916edc86bc0a363758d39b2c0cef57f 100644
--- a/android_webview/glue/java/src/com/android/webview/chromium/DrawGLFunctor.java
+++ b/android_webview/glue/java/src/com/android/webview/chromium/DrawGLFunctor.java
@@ -11,7 +11,6 @@ import android.view.View;
import com.android.webview.chromium.WebViewDelegateFactory.WebViewDelegate;
import org.chromium.android_webview.AwContents;
-import org.chromium.content.common.CleanupReference;
/**
* Simple Java abstraction and wrapper for the native DrawGLFunctor flow.
@@ -23,18 +22,19 @@ class DrawGLFunctor implements AwContents.NativeDrawGLFunctor {
private static final String TAG = DrawGLFunctor.class.getSimpleName();
// Pointer to native side instance
- private final CleanupReference mCleanupReference;
private final DestroyRunnable mDestroyRunnable;
private final WebViewDelegate mWebViewDelegate;
public DrawGLFunctor(long viewContext, WebViewDelegate webViewDelegate) {
mDestroyRunnable = new DestroyRunnable(nativeCreateGLFunctor(viewContext));
- mCleanupReference = new CleanupReference(this, mDestroyRunnable);
mWebViewDelegate = webViewDelegate;
}
@Override
public void detach(View containerView) {
+ if (mDestroyRunnable.mNativeDrawGLFunctor == 0) {
+ throw new RuntimeException("detach on already destroyed DrawGLFunctor");
+ }
mWebViewDelegate.detachDrawGlFunctor(containerView, mDestroyRunnable.mNativeDrawGLFunctor);
}
@@ -43,6 +43,9 @@ class DrawGLFunctor implements AwContents.NativeDrawGLFunctor {
@Override
public boolean requestDrawGL(Canvas canvas, Runnable releasedCallback) {
+ if (mDestroyRunnable.mNativeDrawGLFunctor == 0) {
+ throw new RuntimeException("requestDrawGL on already destroyed DrawGLFunctor");
+ }
assert canvas != null;
if (sSupportFunctorReleasedCallback) {
assert releasedCallback != null;
@@ -57,6 +60,9 @@ class DrawGLFunctor implements AwContents.NativeDrawGLFunctor {
@Override
public boolean requestInvokeGL(View containerView, boolean waitForCompletion) {
+ if (mDestroyRunnable.mNativeDrawGLFunctor == 0) {
+ throw new RuntimeException("requestInvokeGL on already destroyed DrawGLFunctor");
+ }
if (!sSupportFunctorReleasedCallback
&& !mWebViewDelegate.canInvokeDrawGlFunctor(containerView)) {
return false;
@@ -72,6 +78,11 @@ class DrawGLFunctor implements AwContents.NativeDrawGLFunctor {
return sSupportFunctorReleasedCallback;
}
+ @Override
+ public Runnable getDestroyRunnable() {
+ return mDestroyRunnable;
+ }
+
public static void setChromiumAwDrawGLFunction(long functionPointer) {
nativeSetChromiumAwDrawGLFunction(functionPointer);
}
« no previous file with comments | « no previous file | android_webview/java/src/org/chromium/android_webview/AwContents.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698