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

Unified Diff: base/android/scoped_java_ref.h

Issue 1294333002: Fix wrong usages of ScopedJavaLocalRef::Release(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment to Release() explaining it should not be used to call java methods 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: base/android/scoped_java_ref.h
diff --git a/base/android/scoped_java_ref.h b/base/android/scoped_java_ref.h
index 8047ee8c16725ab0470acc1b71dfb77f5594e439..0defd6f15513461ec051f153a30411aba3b7de16 100644
--- a/base/android/scoped_java_ref.h
+++ b/base/android/scoped_java_ref.h
@@ -154,7 +154,8 @@ class ScopedJavaLocalRef : public JavaRef<T> {
}
// Releases the local reference to the caller. The caller *must* delete the
- // local reference when it is done with it.
+ // local reference when it is done with it. Note that calling a Java method
+ // is *not* a transfer of ownership and Release() should not be used.
T Release() {
return static_cast<T>(this->ReleaseInternal());
}
@@ -205,7 +206,8 @@ class ScopedJavaGlobalRef : public JavaRef<T> {
}
// Releases the global reference to the caller. The caller *must* delete the
- // global reference when it is done with it.
+ // global reference when it is done with it. Note that calling a Java method
+ // is *not* a transfer of ownership and Release() should not be used.
T Release() {
return static_cast<T>(this->ReleaseInternal());
}
« no previous file with comments | « base/android/java_handler_thread.cc ('k') | chrome/browser/android/history_report/history_report_jni_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698