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

Unified Diff: content/browser/web_contents/web_contents_android.cc

Issue 831523005: Remove most native WebContents references from Java (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Kept same error checking behavior for aw_contents.cc Created 5 years, 11 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/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>

Powered by Google App Engine
This is Rietveld 408576698