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

Unified Diff: base/android/scoped_java_ref.h

Issue 1481033002: jni: Allow nullptr to be converted to JavaParamRef. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add std:: prefix to make clang happy Created 5 years, 1 month 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 | no next file » | 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 cad63b75617a106c39b26fc02eed16c8293f804d..e5339ee59671e3e1bfc60bf7df50adbe304e31ff 100644
--- a/base/android/scoped_java_ref.h
+++ b/base/android/scoped_java_ref.h
@@ -106,6 +106,12 @@ class JavaParamRef : public JavaRef<T> {
// Does not assume ownership as parameters should not be deleted.
JavaParamRef(JNIEnv* env, T obj) : JavaRef<T>(env, obj) {}
+ // Allow nullptr to be converted to JavaParamRef. Some unit tests call JNI
+ // methods directly from C++ and pass null for objects which are not actually
+ // used by the implementation (e.g. the caller object); allow this to keep
+ // working.
+ JavaParamRef(std::nullptr_t) : JavaRef<T>() {}
+
~JavaParamRef() {}
// TODO(torne): remove this cast once we're using JavaRef consistently.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698