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

Unified Diff: trunk/src/base/android/jni_generator/testNativeExportsOption.golden

Issue 492713002: Revert 290810 "Make class lookup lazy in jni_generator when usin..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 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: trunk/src/base/android/jni_generator/testNativeExportsOption.golden
===================================================================
--- trunk/src/base/android/jni_generator/testNativeExportsOption.golden (revision 290812)
+++ trunk/src/base/android/jni_generator/testNativeExportsOption.golden (working copy)
@@ -20,19 +20,8 @@
namespace {
const char kSampleForTestsClassPath[] =
"org/chromium/example/jni_generator/SampleForTests";
-#if __clang__
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wunused-function"
-#endif
// Leaking this jclass as we cannot use LazyInstance from some threads.
-base::subtle::AtomicWord g_SampleForTests_clazz = 0;
-jclass SampleForTests_clazz(JNIEnv* env) {
- return base::android::LazyGetClass(env, kSampleForTestsClassPath,
- &g_SampleForTests_clazz);
-}
-#if __clang__
-#pragma clang diagnostic pop
-#endif
+jclass g_SampleForTests_clazz = NULL;
} // namespace
@@ -90,11 +79,11 @@
JniIntWrapper iParam) {
/* Must call RegisterNativesImpl() */
CHECK_CLAZZ(env, obj,
- SampleForTests_clazz(env));
+ g_SampleForTests_clazz);
jmethodID method_id =
base::android::MethodID::LazyGet<
base::android::MethodID::TYPE_INSTANCE>(
- env, SampleForTests_clazz(env),
+ env, g_SampleForTests_clazz,
"testMethodWithParam",
"("
@@ -116,11 +105,11 @@
JniIntWrapper iParam) {
/* Must call RegisterNativesImpl() */
CHECK_CLAZZ(env, obj,
- SampleForTests_clazz(env), NULL);
+ g_SampleForTests_clazz, NULL);
jmethodID method_id =
base::android::MethodID::LazyGet<
base::android::MethodID::TYPE_INSTANCE>(
- env, SampleForTests_clazz(env),
+ env, g_SampleForTests_clazz,
"testMethodWithParamAndReturn",
"("
@@ -140,12 +129,12 @@
static jint Java_SampleForTests_testStaticMethodWithParam(JNIEnv* env,
JniIntWrapper iParam) {
/* Must call RegisterNativesImpl() */
- CHECK_CLAZZ(env, SampleForTests_clazz(env),
- SampleForTests_clazz(env), 0);
+ CHECK_CLAZZ(env, g_SampleForTests_clazz,
+ g_SampleForTests_clazz, 0);
jmethodID method_id =
base::android::MethodID::LazyGet<
base::android::MethodID::TYPE_STATIC>(
- env, SampleForTests_clazz(env),
+ env, g_SampleForTests_clazz,
"testStaticMethodWithParam",
"("
@@ -155,7 +144,7 @@
&g_SampleForTests_testStaticMethodWithParam);
jint ret =
- env->CallStaticIntMethod(SampleForTests_clazz(env),
+ env->CallStaticIntMethod(g_SampleForTests_clazz,
method_id, as_jint(iParam));
jni_generator::CheckException(env);
return ret;
@@ -164,12 +153,12 @@
static base::subtle::AtomicWord g_SampleForTests_testMethodWithNoParam = 0;
static jdouble Java_SampleForTests_testMethodWithNoParam(JNIEnv* env) {
/* Must call RegisterNativesImpl() */
- CHECK_CLAZZ(env, SampleForTests_clazz(env),
- SampleForTests_clazz(env), 0);
+ CHECK_CLAZZ(env, g_SampleForTests_clazz,
+ g_SampleForTests_clazz, 0);
jmethodID method_id =
base::android::MethodID::LazyGet<
base::android::MethodID::TYPE_STATIC>(
- env, SampleForTests_clazz(env),
+ env, g_SampleForTests_clazz,
"testMethodWithNoParam",
"("
@@ -178,7 +167,7 @@
&g_SampleForTests_testMethodWithNoParam);
jdouble ret =
- env->CallStaticDoubleMethod(SampleForTests_clazz(env),
+ env->CallStaticDoubleMethod(g_SampleForTests_clazz,
method_id);
jni_generator::CheckException(env);
return ret;
@@ -189,12 +178,12 @@
static base::android::ScopedJavaLocalRef<jstring>
Java_SampleForTests_testStaticMethodWithNoParam(JNIEnv* env) {
/* Must call RegisterNativesImpl() */
- CHECK_CLAZZ(env, SampleForTests_clazz(env),
- SampleForTests_clazz(env), NULL);
+ CHECK_CLAZZ(env, g_SampleForTests_clazz,
+ g_SampleForTests_clazz, NULL);
jmethodID method_id =
base::android::MethodID::LazyGet<
base::android::MethodID::TYPE_STATIC>(
- env, SampleForTests_clazz(env),
+ env, g_SampleForTests_clazz,
"testStaticMethodWithNoParam",
"("
@@ -203,7 +192,7 @@
&g_SampleForTests_testStaticMethodWithNoParam);
jstring ret =
-static_cast<jstring>(env->CallStaticObjectMethod(SampleForTests_clazz(env),
+ static_cast<jstring>(env->CallStaticObjectMethod(g_SampleForTests_clazz,
method_id));
jni_generator::CheckException(env);
return base::android::ScopedJavaLocalRef<jstring>(env, ret);
@@ -213,8 +202,7 @@
// Step 3: RegisterNatives.
static bool RegisterNativesImpl(JNIEnv* env, jclass clazz) {
- base::subtle::Release_Store(&g_SampleForTests_clazz,
- static_cast<base::subtle::AtomicWord>(env->NewWeakGlobalRef(clazz));
+ g_SampleForTests_clazz = static_cast<jclass>(env->NewWeakGlobalRef(clazz));
return true;
}

Powered by Google App Engine
This is Rietveld 408576698