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

Unified Diff: base/android/scoped_java_ref.h

Issue 1326763009: jni: Forbid inappropriate JNI parameter conversions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix GN-only mojo, and chromecast Created 5 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/android/feedback/connectivity_checker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/android/scoped_java_ref.h
diff --git a/base/android/scoped_java_ref.h b/base/android/scoped_java_ref.h
index d6a81fa637f3b1214593f50d0a5d5e6989c42632..6d441954a4e902f0781a9f1bc54cd5a7bafeb87e 100644
--- a/base/android/scoped_java_ref.h
+++ b/base/android/scoped_java_ref.h
@@ -193,6 +193,13 @@ class ScopedJavaLocalRef : public JavaRef<T> {
// This class is only good for use on the thread it was created on so
// it's safe to cache the non-threadsafe JNIEnv* inside this object.
JNIEnv* env_;
+
+ // Prevent ScopedJavaLocalRef(JNIEnv*, T obj) from being used to take
+ // ownership of a JavaParamRef's underlying object - parameters are not
+ // allowed to be deleted and so should not be owned by ScopedJavaLocalRef.
+ // TODO(torne): this can be removed once JavaParamRef no longer has an
+ // implicit conversion back to T.
+ ScopedJavaLocalRef(JNIEnv* env, const JavaParamRef<T>& other);
};
// Holds a global reference to a Java object. The global reference is scoped
« no previous file with comments | « no previous file | chrome/browser/android/feedback/connectivity_checker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698