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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java

Issue 11067002: Move ContentViewCore native ownership to WebContents (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: jcivelli feedback Created 8 years, 2 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
Index: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
index c81626eade73330fc59d937331fc81ac03bedaa6..4d9301568bd3b79c75bf37779b15f3347255e1ba 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
@@ -40,7 +40,6 @@ import org.chromium.base.WeakContext;
import org.chromium.content.app.AppResource;
import org.chromium.content.browser.ContentViewGestureHandler.MotionEventDelegate;
import org.chromium.content.browser.accessibility.AccessibilityInjector;
-import org.chromium.content.common.CleanupReference;
import org.chromium.content.common.TraceEvent;
import org.chromium.ui.gfx.NativeWindow;
@@ -132,19 +131,6 @@ public class ContentViewCore implements MotionEventDelegate {
boolean super_awakenScrollBars(int startDelay, boolean invalidate);
}
- private static final class DestroyRunnable implements Runnable {
- private final int mNativeContentViewCore;
- private DestroyRunnable(int nativeContentViewCore) {
- mNativeContentViewCore = nativeContentViewCore;
- }
- @Override
- public void run() {
- nativeDestroy(mNativeContentViewCore);
- }
- }
-
- private CleanupReference mCleanupReference;
-
private final Context mContext;
private ViewGroup mContainerView;
private InternalAccessDelegate mContainerViewInternals;
@@ -450,8 +436,6 @@ public class ContentViewCore implements MotionEventDelegate {
mContainerView = containerView;
mNativeContentViewCore = nativeInit(mHardwareAccelerated, nativeWebContents,
nativeWindow.getNativePointer());
- mCleanupReference = new CleanupReference(
- this, new DestroyRunnable(mNativeContentViewCore));
mContentSettings = new ContentSettings(
this, mNativeContentViewCore, isAccessFromFileURLsGrantedByDefault);
initializeContainerView(internalDispatcher);
@@ -478,6 +462,12 @@ public class ContentViewCore implements MotionEventDelegate {
};
}
+ @CalledByNative
+ void onNativeContentViewCoreDestroyed(int nativeContentViewCore) {
+ assert nativeContentViewCore == mNativeContentViewCore;
+ mNativeContentViewCore = 0;
+ }
+
/**
* Initializes the View that will contain all Views created by the ContentViewCore.
*
@@ -566,7 +556,9 @@ public class ContentViewCore implements MotionEventDelegate {
*/
public void destroy() {
hidePopupDialog();
- mCleanupReference.cleanupNow();
+ if (mNativeContentViewCore != 0) {
+ nativeOnJavaContentViewCoreDestroyed(mNativeContentViewCore);
+ }
mNativeContentViewCore = 0;
// Do not propagate the destroy() to settings, as the client may still hold a reference to
// that and could still be using it.
@@ -2075,7 +2067,7 @@ public class ContentViewCore implements MotionEventDelegate {
private native int nativeInit(boolean hardwareAccelerated, int webContentsPtr,
int windowAndroidPtr);
- private static native void nativeDestroy(int nativeContentViewCore);
+ private native void nativeOnJavaContentViewCoreDestroyed(int nativeContentViewCoreImpl);
private native void nativeLoadUrl(
int nativeContentViewCoreImpl,
« no previous file with comments | « content/browser/android/content_view_core_impl.cc ('k') | content/public/browser/android/content_view_core.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698