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

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

Issue 1288183004: jni_generator: Make all object-returning natives return ScopedJavaLocalRef. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add some newlines for readability Created 5 years, 4 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 76d2d39b090bae76cda534c8c3da1024436574ee..0131bf997260b8095ea9637b96a5e35d36d1fd85 100644
--- a/content/browser/web_contents/web_contents_android.cc
+++ b/content/browser/web_contents/web_contents_android.cc
@@ -171,22 +171,22 @@ static void DestroyWebContents(JNIEnv* env,
}
// static
-jobject FromNativePtr(JNIEnv* env,
- jclass clazz,
- jlong web_contents_ptr) {
+ScopedJavaLocalRef<jobject> FromNativePtr(JNIEnv* env,
+ jclass clazz,
+ jlong web_contents_ptr) {
WebContentsAndroid* web_contents_android =
reinterpret_cast<WebContentsAndroid*>(web_contents_ptr);
if (!web_contents_android)
- return 0;
+ return ScopedJavaLocalRef<jobject>();
// Check to make sure this object hasn't been destroyed.
if (g_allocated_web_contents_androids.Get().find(web_contents_android) ==
g_allocated_web_contents_androids.Get().end()) {
- return 0;
+ return ScopedJavaLocalRef<jobject>();
}
- return web_contents_android->GetJavaObject().Release();
+ return web_contents_android->GetJavaObject();
}
// static

Powered by Google App Engine
This is Rietveld 408576698