Chromium Code Reviews| 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 2d15b2cb5c048e347d8184ba9915e87d335c8e26..f868572acdf78ff9beea53b8581a82c4d16136e4 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,6 +362,8 @@ 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 |
| @@ -1202,6 +1205,7 @@ public class AwContents implements SmartClipProvider, PostMessageSender.PostMess |
| mNativeAwContents = 0; |
| mWebContents = null; |
| mNavigationController = null; |
| + mViewRoot = null; |
|
Jinsuk Kim
2016/12/19 04:40:58
Added this line to fix a bug not cleaning up ViewR
boliu
2016/12/19 17:33:08
yep that's fine
|
| mCleanupReference.cleanupNow(); |
| mCleanupReference = null; |
| @@ -3205,7 +3209,7 @@ public class AwContents implements SmartClipProvider, PostMessageSender.PostMess |
| // to enter fixedLayoutSize mode is sent before the first resize |
| // update. |
| mLayoutSizer.onSizeChanged(w, h, ow, oh); |
| - mContentViewCore.onPhysicalBackingSizeChanged(w, h); |
| + getViewRoot().onPhysicalBackingSizeChanged(w, h); |
| mContentViewCore.onSizeChanged(w, h, ow, oh); |
| nativeOnSizeChanged(mNativeAwContents, w, h, ow, oh); |
| } |
| @@ -3281,6 +3285,13 @@ public class AwContents implements SmartClipProvider, PostMessageSender.PostMess |
| } |
| } |
| + private ViewRoot getViewRoot() { |
| + if (mViewRoot == null) { |
| + mViewRoot = nativeGetViewRoot(mNativeAwContents); |
| + } |
| + return mViewRoot; |
| + } |
| + |
| // Return true if the GeolocationPermissionAPI should be used. |
| @CalledByNative |
| private boolean useLegacyGeolocationPermissionAPI() { |
| @@ -3384,4 +3395,5 @@ public class AwContents implements SmartClipProvider, PostMessageSender.PostMess |
| private native void nativeGrantFileSchemeAccesstoChildProcess(long nativeAwContents); |
| private native void nativeResumeLoadingCreatedPopupWebContents(long nativeAwContents); |
| + private native ViewRoot nativeGetViewRoot(long nativeAwContents); |
| } |