1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // This file is autogenerated by
6 // base/android/jni_generator/jni_generator.py
8 // org/chromium/example/jni_generator/Example
10 #ifndef org_chromium_example_jni_generator_Example_JNI
11 #define org_chromium_example_jni_generator_Example_JNI
15 #include "base/android/jni_generator/jni_generator_helper.h"
17 #include "base/android/jni_int_wrapper.h"
19 // Step 1: forward declarations.
21 const char kExampleClassPath[] = "com/test/jni_generator/Example";
22 // Leaking this jclass as we cannot use LazyInstance from some threads.
23 jclass g_Example_clazz = NULL;
27 static void Test(JNIEnv* env, jclass jcaller,
30 static void Test2(JNIEnv* env, jclass jcaller,
33 static void Test3(JNIEnv* env, jclass jcaller,
36 static void Test4(JNIEnv* env, jclass jcaller,
39 // Step 2: method stubs.
41 // Step 3: RegisterNatives.
43 static const JNINativeMethod kMethodsExample[] = {
48 "V", reinterpret_cast<void*>(Test) },
51 "Lorg/chromium/example3/PrefixFoo;"
53 "V", reinterpret_cast<void*>(Test2) },
58 "V", reinterpret_cast<void*>(Test3) },
61 "Lorg/test3/TestBar$Inner;"
63 "V", reinterpret_cast<void*>(Test4) },
66 static bool RegisterNativesImpl(JNIEnv* env) {
67 g_Example_clazz = reinterpret_cast<jclass>(env->NewGlobalRef(
68 base::android::GetClass(env, kExampleClassPath).obj()));
70 const int kMethodsExampleSize = arraysize(kMethodsExample);
72 if (env->RegisterNatives(g_Example_clazz,
74 kMethodsExampleSize) < 0) {
75 jni_generator::HandleRegistrationError(
76 env, g_Example_clazz, __FILE__);
83 #endif // org_chromium_example_jni_generator_Example_JNI