OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file is autogenerated by | 5 // This file is autogenerated by |
6 // base/android/jni_generator/jni_generator.py | 6 // base/android/jni_generator/jni_generator.py |
7 // For | 7 // For |
8 // org/chromium/example/jni_generator/Example | 8 // org/chromium/example/jni_generator/Example |
9 | 9 |
10 #ifndef org_chromium_example_jni_generator_Example_JNI | 10 #ifndef org_chromium_example_jni_generator_Example_JNI |
11 #define org_chromium_example_jni_generator_Example_JNI | 11 #define org_chromium_example_jni_generator_Example_JNI |
12 | 12 |
13 #include <jni.h> | 13 #include <jni.h> |
14 | 14 |
15 #include "base/android/jni_generator/jni_generator_helper.h" | 15 #include "base/android/jni_generator/jni_generator_helper.h" |
16 | 16 |
17 #include "base/android/jni_int_wrapper.h" | 17 #include "base/android/jni_int_wrapper.h" |
18 | 18 |
19 // Step 1: forward declarations. | 19 // Step 1: forward declarations. |
20 namespace { | 20 namespace { |
21 const char kExampleClassPath[] = "com/test/jni_generator/Example"; | 21 const char kExampleClassPath[] = "com/test/jni_generator/Example"; |
22 // Leaking this jclass as we cannot use LazyInstance from some threads. | 22 // Leaking this jclass as we cannot use LazyInstance from some threads. |
23 jclass g_Example_clazz = NULL; | 23 jclass g_Example_clazz = NULL; |
24 | 24 |
25 } // namespace | 25 } // namespace |
26 | 26 |
27 static void Test(JNIEnv* env, jclass jcaller, | 27 static void Test(JNIEnv* env, jclass jcaller, |
28 jobject t); | 28 jobject t); |
29 | 29 |
| 30 static void Test2(JNIEnv* env, jclass jcaller, |
| 31 jobject t); |
| 32 |
| 33 static void Test3(JNIEnv* env, jclass jcaller, |
| 34 jobject t); |
| 35 |
| 36 static void Test4(JNIEnv* env, jclass jcaller, |
| 37 jobject t); |
| 38 |
30 // Step 2: method stubs. | 39 // Step 2: method stubs. |
31 | 40 |
32 // Step 3: RegisterNatives. | 41 // Step 3: RegisterNatives. |
33 | 42 |
34 static const JNINativeMethod kMethodsExample[] = { | 43 static const JNINativeMethod kMethodsExample[] = { |
35 { "nativeTest", | 44 { "nativeTest", |
36 "(" | 45 "(" |
37 "Lorg/test2/org/chromium/example2/Test;" | 46 "Lorg/test2/Test;" |
38 ")" | 47 ")" |
39 "V", reinterpret_cast<void*>(Test) }, | 48 "V", reinterpret_cast<void*>(Test) }, |
| 49 { "nativeTest2", |
| 50 "(" |
| 51 "Lorg/chromium/example3/PrefixFoo;" |
| 52 ")" |
| 53 "V", reinterpret_cast<void*>(Test2) }, |
| 54 { "nativeTest3", |
| 55 "(" |
| 56 "Lorg/test3/Test;" |
| 57 ")" |
| 58 "V", reinterpret_cast<void*>(Test3) }, |
| 59 { "nativeTest4", |
| 60 "(" |
| 61 "Lorg/test3/TestBar$Inner;" |
| 62 ")" |
| 63 "V", reinterpret_cast<void*>(Test4) }, |
40 }; | 64 }; |
41 | 65 |
42 static bool RegisterNativesImpl(JNIEnv* env) { | 66 static bool RegisterNativesImpl(JNIEnv* env) { |
43 g_Example_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( | 67 g_Example_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( |
44 base::android::GetClass(env, kExampleClassPath).obj())); | 68 base::android::GetClass(env, kExampleClassPath).obj())); |
45 | 69 |
46 const int kMethodsExampleSize = arraysize(kMethodsExample); | 70 const int kMethodsExampleSize = arraysize(kMethodsExample); |
47 | 71 |
48 if (env->RegisterNatives(g_Example_clazz, | 72 if (env->RegisterNatives(g_Example_clazz, |
49 kMethodsExample, | 73 kMethodsExample, |
50 kMethodsExampleSize) < 0) { | 74 kMethodsExampleSize) < 0) { |
51 jni_generator::HandleRegistrationError( | 75 jni_generator::HandleRegistrationError( |
52 env, g_Example_clazz, __FILE__); | 76 env, g_Example_clazz, __FILE__); |
53 return false; | 77 return false; |
54 } | 78 } |
55 | 79 |
56 return true; | 80 return true; |
57 } | 81 } |
58 | 82 |
59 #endif // org_chromium_example_jni_generator_Example_JNI | 83 #endif // org_chromium_example_jni_generator_Example_JNI |
OLD | NEW |