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

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

Issue 1034593002: Fix WindowAndroid leak in Android WebView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 | ui/android/window_android.h » ('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 0f8974aaedc9d139b0c7207c9b3a2e1a290f5de2..40a277d37000683ce0b86ac4797c6e228b744f23 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
@@ -286,12 +286,16 @@ public class AwContents implements SmartClipProvider,
private static final class DestroyRunnable implements Runnable {
private final long mNativeAwContents;
- private DestroyRunnable(long nativeAwContents) {
+ private final WindowAndroid mWindowAndroid;
+
+ private DestroyRunnable(long nativeAwContents, WindowAndroid windowAndroid) {
mNativeAwContents = nativeAwContents;
+ mWindowAndroid = windowAndroid;
}
@Override
public void run() {
nativeDestroy(mNativeAwContents);
+ mWindowAndroid.destroy();
}
}
@@ -863,10 +867,6 @@ public class AwContents implements SmartClipProvider,
// each other, we should update |mBrowserContext| according to the newly received native
// WebContent's browser context.
- // The native side object has been bound to this java instance, so now is the time to
- // bind all the native->java relationships.
- mCleanupReference = new CleanupReference(this, new DestroyRunnable(mNativeAwContents));
-
WebContents webContents = nativeGetWebContents(mNativeAwContents);
Activity activity = ContentViewCore.activityFromContext(mContext);
@@ -884,6 +884,11 @@ public class AwContents implements SmartClipProvider,
mSettings.setWebContents(webContents);
nativeSetDipScale(mNativeAwContents, (float) mDIPScale);
mContentViewCore.onShow();
+
+ // The native side object has been bound to this java instance, so now is the time to
+ // bind all the native->java relationships.
+ mCleanupReference =
+ new CleanupReference(this, new DestroyRunnable(mNativeAwContents, mWindowAndroid));
}
private void installWebContentsObserver() {
« no previous file with comments | « no previous file | ui/android/window_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698