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

Unified Diff: base/android/jni_generator/testMultipleJNIAdditionalImport.golden

Issue 472553002: Make class lookup lazy in jni_generator when using lazy method lookup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
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: base/android/jni_generator/testMultipleJNIAdditionalImport.golden
diff --git a/base/android/jni_generator/testMultipleJNIAdditionalImport.golden b/base/android/jni_generator/testMultipleJNIAdditionalImport.golden
index 9cc1256cbfe2b8c90b6021ab77be332d0c9c5479..49f510bf0e58cba321d67b1e5976ca4a9fd9b9e7 100644
--- a/base/android/jni_generator/testMultipleJNIAdditionalImport.golden
+++ b/base/android/jni_generator/testMultipleJNIAdditionalImport.golden
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -19,8 +19,16 @@
// Step 1: forward declarations.
namespace {
const char kFooClassPath[] = "org/chromium/foo/Foo";
+#if __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunused-function"
+#endif
// Leaking this jclass as we cannot use LazyInstance from some threads.
jclass g_Foo_clazz = NULL;
+jclass Foo_clazz(JNIEnv*) { return g_Foo_clazz; }
+#if __clang__
+#pragma clang diagnostic pop
+#endif
} // namespace
@@ -34,12 +42,12 @@ static base::subtle::AtomicWord g_Foo_calledByNative = 0;
static void Java_Foo_calledByNative(JNIEnv* env, jobject callback1,
jobject callback2) {
/* Must call RegisterNativesImpl() */
- CHECK_CLAZZ(env, g_Foo_clazz,
- g_Foo_clazz);
+ CHECK_CLAZZ(env, Foo_clazz(env),
+ Foo_clazz(env));
jmethodID method_id =
base::android::MethodID::LazyGet<
base::android::MethodID::TYPE_STATIC>(
- env, g_Foo_clazz,
+ env, Foo_clazz(env),
"calledByNative",
"("
@@ -49,7 +57,7 @@ static void Java_Foo_calledByNative(JNIEnv* env, jobject callback1,
"V",
&g_Foo_calledByNative);
- env->CallStaticVoidMethod(g_Foo_clazz,
+ env->CallStaticVoidMethod(Foo_clazz(env),
method_id, callback1, callback2);
jni_generator::CheckException(env);
@@ -72,11 +80,11 @@ static bool RegisterNativesImpl(JNIEnv* env) {
const int kMethodsFooSize = arraysize(kMethodsFoo);
- if (env->RegisterNatives(g_Foo_clazz,
+ if (env->RegisterNatives(Foo_clazz(env),
kMethodsFoo,
kMethodsFooSize) < 0) {
jni_generator::HandleRegistrationError(
- env, g_Foo_clazz, __FILE__);
+ env, Foo_clazz(env), __FILE__);
return false;
}
« no previous file with comments | « base/android/jni_generator/testJarJarRemapping.golden ('k') | base/android/jni_generator/testNativeExportsOption.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698