OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 // This file is autogenerated by | |
6 // base/android/jni_generator/jni_generator.py | |
7 // For | |
8 // org/chromium/example/jni_generator/Example | |
9 | |
10 #ifndef org_chromium_example_jni_generator_Example_JNI | |
11 #define org_chromium_example_jni_generator_Example_JNI | |
12 | |
13 #include <jni.h> | |
14 | |
15 #include "base/android/jni_generator/jni_generator_helper.h" | |
16 | |
17 #include "base/android/jni_int_wrapper.h" | |
18 | |
19 // Step 1: forward declarations. | |
20 namespace { | |
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; | |
24 #define Example_clazz(env) g_Example_clazz | |
25 | |
26 } // namespace | |
27 | |
28 // Step 2: method stubs. | |
29 | |
30 static void Test(JNIEnv* env, const JavaParamRef<jclass>& jcaller, | |
31 const JavaParamRef<jobject>& t); | |
32 | |
33 static void Java_com_test_jni_1generator_Example_nativeTest(JNIEnv* env, jclass | |
34 jcaller, | |
35 jobject t) { | |
36 return Test(env, JavaParamRef<jclass>(env, jcaller), | |
37 JavaParamRef<jobject>(env, t)); | |
38 } | |
39 | |
40 static void Test2(JNIEnv* env, const JavaParamRef<jclass>& jcaller, | |
41 const JavaParamRef<jobject>& t); | |
42 | |
43 static void Java_com_test_jni_1generator_Example_nativeTest2(JNIEnv* env, jclass | |
44 jcaller, | |
45 jobject t) { | |
46 return Test2(env, JavaParamRef<jclass>(env, jcaller), | |
47 JavaParamRef<jobject>(env, t)); | |
48 } | |
49 | |
50 static void Test3(JNIEnv* env, const JavaParamRef<jclass>& jcaller, | |
51 const JavaParamRef<jobject>& t); | |
52 | |
53 static void Java_com_test_jni_1generator_Example_nativeTest3(JNIEnv* env, jclass | |
54 jcaller, | |
55 jobject t) { | |
56 return Test3(env, JavaParamRef<jclass>(env, jcaller), | |
57 JavaParamRef<jobject>(env, t)); | |
58 } | |
59 | |
60 static void Test4(JNIEnv* env, const JavaParamRef<jclass>& jcaller, | |
61 const JavaParamRef<jobject>& t); | |
62 | |
63 static void Java_com_test_jni_1generator_Example_nativeTest4(JNIEnv* env, jclass | |
64 jcaller, | |
65 jobject t) { | |
66 return Test4(env, JavaParamRef<jclass>(env, jcaller), | |
67 JavaParamRef<jobject>(env, t)); | |
68 } | |
69 | |
70 // Step 3: RegisterNatives. | |
71 | |
72 static const JNINativeMethod kMethodsExample[] = { | |
73 { "nativeTest", | |
74 "(" | |
75 "Lorg/test2/Test;" | |
76 ")" | |
77 "V", reinterpret_cast<void*>(Java_com_test_jni_1generator_Example_nativeTest) }, | |
78 { "nativeTest2", | |
79 "(" | |
80 "Lorg/chromium/example3/PrefixFoo;" | |
81 ")" | |
82 "V", reinterpret_cast<void*>(Java_com_test_jni_1generator_Example_nativeTest2) | |
83 }, | |
84 { "nativeTest3", | |
85 "(" | |
86 "Lorg/test3/Test;" | |
87 ")" | |
88 "V", reinterpret_cast<void*>(Java_com_test_jni_1generator_Example_nativeTest3) | |
89 }, | |
90 { "nativeTest4", | |
91 "(" | |
92 "Lorg/test3/TestBar$Inner;" | |
93 ")" | |
94 "V", reinterpret_cast<void*>(Java_com_test_jni_1generator_Example_nativeTest4) | |
95 }, | |
96 }; | |
97 | |
98 static bool RegisterNativesImpl(JNIEnv* env) { | |
99 | |
100 g_Example_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( | |
101 base::android::GetClass(env, kExampleClassPath).obj())); | |
102 | |
103 const int kMethodsExampleSize = arraysize(kMethodsExample); | |
104 | |
105 if (env->RegisterNatives(Example_clazz(env), | |
106 kMethodsExample, | |
107 kMethodsExampleSize) < 0) { | |
108 jni_generator::HandleRegistrationError( | |
109 env, Example_clazz(env), __FILE__); | |
110 return false; | |
111 } | |
112 | |
113 return true; | |
114 } | |
115 | |
116 #endif // org_chromium_example_jni_generator_Example_JNI | |
OLD | NEW |