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

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwContents.java

Issue 2281313002: aw: Generalize destroy runnable hasRun (Closed)
Patch Set: Created 4 years, 4 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/CleanupReference.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/java/src/org/chromium/android_webview/AwContents.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java
index 0bcc78783f96f3f8144acbdd1d7e730512cd62ae..030a0a55bf0a10e9dbe748bc7c357e23b0e7f600 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -354,8 +354,6 @@ public class AwContents implements SmartClipProvider,
// Do not use directly, call isDestroyed() instead.
private boolean mIsDestroyed = false;
- private AwContentsDestroyRunnable mAwContentsDestroyRunnable;
-
private static String sCurrentLocale = "";
private static final class AwContentsDestroyRunnable implements Runnable {
@@ -363,7 +361,6 @@ public class AwContents implements SmartClipProvider,
// Hold onto a reference to the window (via its wrapper), so that it is not destroyed
// until we are done here.
private final WindowAndroidWrapper mWindowAndroid;
- private boolean mHasRun;
private AwContentsDestroyRunnable(
long nativeAwContents, WindowAndroidWrapper windowAndroid) {
@@ -374,12 +371,6 @@ public class AwContents implements SmartClipProvider,
@Override
public void run() {
nativeDestroy(mNativeAwContents);
- mHasRun = true;
- }
-
- // TODO(boliu): Generalize this as a CleanupReference feature.
- public boolean hasRun() {
- return mHasRun;
}
}
@@ -1066,9 +1057,8 @@ public class AwContents implements SmartClipProvider,
// The native side object has been bound to this java instance, so now is the time to
// bind all the native->java relationships.
- mAwContentsDestroyRunnable =
- new AwContentsDestroyRunnable(mNativeAwContents, mWindowAndroid);
- mCleanupReference = new CleanupReference(this, mAwContentsDestroyRunnable);
+ mCleanupReference = new CleanupReference(
+ this, new AwContentsDestroyRunnable(mNativeAwContents, mWindowAndroid));
}
private void installWebContentsObserver() {
@@ -1230,7 +1220,7 @@ public class AwContents implements SmartClipProvider,
Log.w(TAG, "Application attempted to call on a destroyed WebView", new Throwable());
}
boolean destroyRunnableHasRun =
- mAwContentsDestroyRunnable != null && mAwContentsDestroyRunnable.hasRun();
+ mCleanupReference != null && mCleanupReference.hasCleanedUp();
if (TRACE && destroyRunnableHasRun && !mIsDestroyed) {
// Swallow the error. App developers are not going to do anything with an error msg.
Log.d(TAG, "AwContents is kept alive past CleanupReference by finalizer");
« no previous file with comments | « no previous file | android_webview/java/src/org/chromium/android_webview/CleanupReference.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698