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

Unified Diff: base/android/scoped_java_ref.h

Issue 1340683002: Remove base's implicit_cast. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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);
}

Powered by Google App Engine
This is Rietveld 408576698