Index: content/browser/web_contents/web_contents_android.cc |
diff --git a/content/browser/web_contents/web_contents_android.cc b/content/browser/web_contents/web_contents_android.cc |
index 91e6b373794a2abc55ef18894e5ec58ec823a460..d8e7e51988a7bc3ddd5df2f4797c7b3931e3c1f1 100644 |
--- a/content/browser/web_contents/web_contents_android.cc |
+++ b/content/browser/web_contents/web_contents_android.cc |
@@ -73,6 +73,22 @@ WebContents* WebContents::FromJavaWebContents( |
} |
// static |
+static void DestroyWebContents(JNIEnv* env, |
+ jclass clazz, |
+ jlong jweb_contents_android_ptr) { |
+ WebContentsAndroid* web_contents_android = |
+ reinterpret_cast<WebContentsAndroid*>(jweb_contents_android_ptr); |
Ted C
2015/01/21 20:45:42
-2 indent
David Trainor- moved to gerrit
2015/01/21 23:13:24
Done.
|
+ if (!web_contents_android) |
+ return; |
+ |
+ content::WebContents* web_contents = web_contents_android->web_contents(); |
+ if (!web_contents) |
+ return; |
+ |
+ delete web_contents; |
+} |
+ |
+// static |
bool WebContentsAndroid::Register(JNIEnv* env) { |
return RegisterNativesImpl(env); |
} |
@@ -90,7 +106,7 @@ WebContentsAndroid::WebContentsAndroid(WebContents* web_contents) |
} |
WebContentsAndroid::~WebContentsAndroid() { |
- Java_WebContentsImpl_destroy(AttachCurrentThread(), obj_.obj()); |
+ Java_WebContentsImpl_clearNativePtr(AttachCurrentThread(), obj_.obj()); |
} |
base::android::ScopedJavaLocalRef<jobject> |