Chromium Code Reviews| Index: base/android/scoped_java_ref.h |
| diff --git a/base/android/scoped_java_ref.h b/base/android/scoped_java_ref.h |
| index 6d441954a4e902f0781a9f1bc54cd5a7bafeb87e..e7c9482dbb12138271bbd12f17e95e1442e01be4 100644 |
| --- a/base/android/scoped_java_ref.h |
| +++ b/base/android/scoped_java_ref.h |
| @@ -11,6 +11,7 @@ |
| #include "base/base_export.h" |
| #include "base/basictypes.h" |
| #include "base/logging.h" |
| +#include "base/template_util.h" |
| namespace base { |
| namespace android { |
| @@ -178,7 +179,7 @@ class ScopedJavaLocalRef : public JavaRef<T> { |
| template<typename U> |
| void Reset(JNIEnv* env, U obj) { |
| - implicit_cast<T>(obj); // Ensure U is assignable to T |
|
danakj
2015/09/11 20:44:20
This says "assignable" but implicit_cast does a co
|
| + static_assert(is_convertible<U, T>(obj)); |
| env_ = this->SetNewLocalRef(env, obj); |
| } |
| @@ -242,7 +243,7 @@ class ScopedJavaGlobalRef : public JavaRef<T> { |
| template<typename U> |
| void Reset(JNIEnv* env, U obj) { |
| - implicit_cast<T>(obj); // Ensure U is assignable to T |
| + static_assert(is_convertible<U, T>(obj)); |
| this->SetNewGlobalRef(env, obj); |
| } |