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

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: Rebased 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..aaae62e0dae24408436c6d91d802fd21ee46ac21 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);
+ 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