OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 |
(...skipping 10 matching lines...) Expand all Loading... |
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 #define Example_clazz(env) g_Example_clazz | 24 #define Example_clazz(env) g_Example_clazz |
25 | 25 |
26 } // namespace | 26 } // namespace |
27 | 27 |
28 static void Test(JNIEnv* env, jclass jcaller, | 28 static void Test(JNIEnv* env, jclass jcaller, |
29 jobject t); | 29 jobject t); |
30 | 30 |
| 31 static void Java_com_test_jni_1generator_Example_nativeTest(JNIEnv* env, jclass |
| 32 jcaller, |
| 33 jobject t) { |
| 34 return Test(env, jcaller, t); |
| 35 } |
| 36 |
31 static void Test2(JNIEnv* env, jclass jcaller, | 37 static void Test2(JNIEnv* env, jclass jcaller, |
32 jobject t); | 38 jobject t); |
33 | 39 |
| 40 static void Java_com_test_jni_1generator_Example_nativeTest2(JNIEnv* env, jclass |
| 41 jcaller, |
| 42 jobject t) { |
| 43 return Test2(env, jcaller, t); |
| 44 } |
| 45 |
34 static void Test3(JNIEnv* env, jclass jcaller, | 46 static void Test3(JNIEnv* env, jclass jcaller, |
35 jobject t); | 47 jobject t); |
36 | 48 |
| 49 static void Java_com_test_jni_1generator_Example_nativeTest3(JNIEnv* env, jclass |
| 50 jcaller, |
| 51 jobject t) { |
| 52 return Test3(env, jcaller, t); |
| 53 } |
| 54 |
37 static void Test4(JNIEnv* env, jclass jcaller, | 55 static void Test4(JNIEnv* env, jclass jcaller, |
38 jobject t); | 56 jobject t); |
39 | 57 |
| 58 static void Java_com_test_jni_1generator_Example_nativeTest4(JNIEnv* env, jclass |
| 59 jcaller, |
| 60 jobject t) { |
| 61 return Test4(env, jcaller, t); |
| 62 } |
| 63 |
40 // Step 2: method stubs. | 64 // Step 2: method stubs. |
41 | 65 |
42 // Step 3: RegisterNatives. | 66 // Step 3: RegisterNatives. |
43 | 67 |
44 static const JNINativeMethod kMethodsExample[] = { | 68 static const JNINativeMethod kMethodsExample[] = { |
45 { "nativeTest", | 69 { "nativeTest", |
46 "(" | 70 "(" |
47 "Lorg/test2/Test;" | 71 "Lorg/test2/Test;" |
48 ")" | 72 ")" |
49 "V", reinterpret_cast<void*>(Test) }, | 73 "V", reinterpret_cast<void*>(Java_com_test_jni_1generator_Example_nativeTest) }, |
50 { "nativeTest2", | 74 { "nativeTest2", |
51 "(" | 75 "(" |
52 "Lorg/chromium/example3/PrefixFoo;" | 76 "Lorg/chromium/example3/PrefixFoo;" |
53 ")" | 77 ")" |
54 "V", reinterpret_cast<void*>(Test2) }, | 78 "V", reinterpret_cast<void*>(Java_com_test_jni_1generator_Example_nativeTest2) |
| 79 }, |
55 { "nativeTest3", | 80 { "nativeTest3", |
56 "(" | 81 "(" |
57 "Lorg/test3/Test;" | 82 "Lorg/test3/Test;" |
58 ")" | 83 ")" |
59 "V", reinterpret_cast<void*>(Test3) }, | 84 "V", reinterpret_cast<void*>(Java_com_test_jni_1generator_Example_nativeTest3) |
| 85 }, |
60 { "nativeTest4", | 86 { "nativeTest4", |
61 "(" | 87 "(" |
62 "Lorg/test3/TestBar$Inner;" | 88 "Lorg/test3/TestBar$Inner;" |
63 ")" | 89 ")" |
64 "V", reinterpret_cast<void*>(Test4) }, | 90 "V", reinterpret_cast<void*>(Java_com_test_jni_1generator_Example_nativeTest4) |
| 91 }, |
65 }; | 92 }; |
66 | 93 |
67 static bool RegisterNativesImpl(JNIEnv* env) { | 94 static bool RegisterNativesImpl(JNIEnv* env) { |
68 | 95 |
69 g_Example_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( | 96 g_Example_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( |
70 base::android::GetClass(env, kExampleClassPath).obj())); | 97 base::android::GetClass(env, kExampleClassPath).obj())); |
71 | 98 |
72 const int kMethodsExampleSize = arraysize(kMethodsExample); | 99 const int kMethodsExampleSize = arraysize(kMethodsExample); |
73 | 100 |
74 if (env->RegisterNatives(Example_clazz(env), | 101 if (env->RegisterNatives(Example_clazz(env), |
75 kMethodsExample, | 102 kMethodsExample, |
76 kMethodsExampleSize) < 0) { | 103 kMethodsExampleSize) < 0) { |
77 jni_generator::HandleRegistrationError( | 104 jni_generator::HandleRegistrationError( |
78 env, Example_clazz(env), __FILE__); | 105 env, Example_clazz(env), __FILE__); |
79 return false; | 106 return false; |
80 } | 107 } |
81 | 108 |
82 return true; | 109 return true; |
83 } | 110 } |
84 | 111 |
85 #endif // org_chromium_example_jni_generator_Example_JNI | 112 #endif // org_chromium_example_jni_generator_Example_JNI |
OLD | NEW |