| 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 6e40ae76fc1aafd9a6c84cd6c160741cbf707c44..28788ca906e62fb185e9c3b36f237f764c6254d0 100644
|
| --- a/android_webview/java/src/org/chromium/android_webview/AwContents.java
|
| +++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java
|
| @@ -77,6 +77,7 @@ import org.chromium.net.NetworkChangeNotifier;
|
| import org.chromium.ui.base.ActivityWindowAndroid;
|
| import org.chromium.ui.base.PageTransition;
|
| import org.chromium.ui.base.ViewAndroidDelegate;
|
| +import org.chromium.ui.base.ViewRoot;
|
| import org.chromium.ui.base.WindowAndroid;
|
| import org.chromium.ui.display.DisplayAndroid.DisplayAndroidObserver;
|
|
|
| @@ -361,21 +362,26 @@ public class AwContents implements SmartClipProvider, PostMessageSender.PostMess
|
|
|
| private static String sCurrentLocales = "";
|
|
|
| + private ViewRoot mViewRoot;
|
| +
|
| private static final class AwContentsDestroyRunnable implements Runnable {
|
| private final long mNativeAwContents;
|
| // 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 final ViewRoot mViewRoot;
|
|
|
| private AwContentsDestroyRunnable(
|
| - long nativeAwContents, WindowAndroidWrapper windowAndroid) {
|
| + long nativeAwContents, WindowAndroidWrapper windowAndroid, ViewRoot viewRoot) {
|
| mNativeAwContents = nativeAwContents;
|
| mWindowAndroid = windowAndroid;
|
| + mViewRoot = viewRoot;
|
| }
|
|
|
| @Override
|
| public void run() {
|
| nativeDestroy(mNativeAwContents);
|
| + mViewRoot.destroy();
|
| }
|
| }
|
|
|
| @@ -807,8 +813,8 @@ public class AwContents implements SmartClipProvider, PostMessageSender.PostMess
|
| Context context, ViewAndroidDelegate viewDelegate,
|
| InternalAccessDelegate internalDispatcher, WebContents webContents,
|
| GestureStateListener gestureStateListener, ContentViewClient contentViewClient,
|
| - WindowAndroid windowAndroid) {
|
| - contentViewCore.initialize(viewDelegate, internalDispatcher, webContents, windowAndroid);
|
| + ViewRoot viewRoot) {
|
| + contentViewCore.initialize(viewDelegate, internalDispatcher, webContents, viewRoot);
|
| contentViewCore.setActionModeCallback(
|
| new AwActionModeCallback(mContext, this,
|
| contentViewCore.getActionModeCallbackHelper()));
|
| @@ -1051,9 +1057,10 @@ public class AwContents implements SmartClipProvider, PostMessageSender.PostMess
|
| mContentViewCore = new ContentViewCore(mContext, PRODUCT_VERSION);
|
| mViewAndroidDelegate = new AwViewAndroidDelegate(mContainerView,
|
| mContentViewCore.getRenderCoordinates());
|
| + mViewRoot = ViewRoot.create(mWindowAndroid.getWindowAndroid());
|
| initializeContentViewCore(mContentViewCore, mContext, mViewAndroidDelegate,
|
| mInternalAccessAdapter, webContents, new AwGestureStateListener(),
|
| - mContentViewClient, mWindowAndroid.getWindowAndroid());
|
| + mContentViewClient, mViewRoot);
|
| nativeSetJavaPeers(mNativeAwContents, this, mWebContentsDelegate, mContentsClientBridge,
|
| mIoThreadClient, mInterceptNavigationDelegate);
|
| mWebContents = mContentViewCore.getWebContents();
|
| @@ -1069,7 +1076,7 @@ public class AwContents implements SmartClipProvider, PostMessageSender.PostMess
|
| // 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 AwContentsDestroyRunnable(mNativeAwContents, mWindowAndroid));
|
| + this, new AwContentsDestroyRunnable(mNativeAwContents, mWindowAndroid, mViewRoot));
|
| }
|
|
|
| private void installWebContentsObserver() {
|
| @@ -1210,6 +1217,7 @@ public class AwContents implements SmartClipProvider, PostMessageSender.PostMess
|
| mNativeAwContents = 0;
|
| mWebContents = null;
|
| mNavigationController = null;
|
| + mViewRoot = null;
|
|
|
| mCleanupReference.cleanupNow();
|
| mCleanupReference = null;
|
|
|