Index: base/android/jni_generator/testJNIAdditionalImport.golden |
diff --git a/base/android/jni_generator/testJNIAdditionalImport.golden b/base/android/jni_generator/testJNIAdditionalImport.golden |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e395657cf79bfc5b48642d54426b2d83a72c33c3 |
--- /dev/null |
+++ b/base/android/jni_generator/testJNIAdditionalImport.golden |
@@ -0,0 +1,82 @@ |
+// Copyright (c) 2012 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. |
+ |
+// This file is autogenerated by |
+// base/android/jni_generator/jni_generator.py |
+// For |
+// org/chromium/foo/Foo |
+ |
+#ifndef org_chromium_foo_Foo_JNI |
+#define org_chromium_foo_Foo_JNI |
+ |
+#include <jni.h> |
+ |
+#include "base/android/jni_generator/jni_generator_helper.h" |
+ |
+#include "base/android/jni_int_wrapper.h" |
+ |
+// Step 1: forward declarations. |
+namespace { |
+const char kFooClassPath[] = "org/chromium/foo/Foo"; |
+// Leaking this jclass as we cannot use LazyInstance from some threads. |
+jclass g_Foo_clazz = NULL; |
+ |
+} // namespace |
+ |
+static void DoSomething(JNIEnv* env, jclass jcaller, |
+ jobject callback); |
+ |
+// Step 2: method stubs. |
+ |
+static base::subtle::AtomicWord g_Foo_calledByNative = 0; |
+static void Java_Foo_calledByNative(JNIEnv* env, jobject callback) { |
+ /* Must call RegisterNativesImpl() */ |
+ CHECK_CLAZZ(env, g_Foo_clazz, |
+ g_Foo_clazz); |
+ jmethodID method_id = |
+ base::android::MethodID::LazyGet< |
+ base::android::MethodID::TYPE_STATIC>( |
+ env, g_Foo_clazz, |
+ "calledByNative", |
+ |
+"(" |
+"Lorg/chromium/foo/Bar$Callback;" |
+")" |
+"V", |
+ &g_Foo_calledByNative); |
+ |
+ env->CallStaticVoidMethod(g_Foo_clazz, |
+ method_id, callback); |
+ jni_generator::CheckException(env); |
+ |
+} |
+ |
+// Step 3: RegisterNatives. |
+ |
+static const JNINativeMethod kMethodsFoo[] = { |
+ { "nativeDoSomething", |
+"(" |
+"Lorg/chromium/foo/Bar$Callback;" |
+")" |
+"V", reinterpret_cast<void*>(DoSomething) }, |
+}; |
+ |
+static bool RegisterNativesImpl(JNIEnv* env) { |
+ g_Foo_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( |
+ base::android::GetClass(env, kFooClassPath).obj())); |
+ |
+ const int kMethodsFooSize = arraysize(kMethodsFoo); |
+ |
+ if (env->RegisterNatives(g_Foo_clazz, |
+ kMethodsFoo, |
+ kMethodsFooSize) < 0) { |
+ jni_generator::HandleRegistrationError( |
+ env, g_Foo_clazz, __FILE__); |
+ return false; |
+ } |
+ |
+ return true; |
+} |
+ |
+#endif // org_chromium_foo_Foo_JNI |