OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/SampleForTests | 8 // org/chromium/example/jni_generator/SampleForTests |
9 | 9 |
10 #ifndef org_chromium_example_jni_generator_SampleForTests_JNI | 10 #ifndef org_chromium_example_jni_generator_SampleForTests_JNI |
11 #define org_chromium_example_jni_generator_SampleForTests_JNI | 11 #define org_chromium_example_jni_generator_SampleForTests_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" |
| 18 |
17 // Step 1: forward declarations. | 19 // Step 1: forward declarations. |
18 namespace { | 20 namespace { |
19 const char kInnerStructAClassPath[] = | 21 const char kInnerStructAClassPath[] = |
20 "org/chromium/example/jni_generator/SampleForTests$InnerStructA"; | 22 "org/chromium/example/jni_generator/SampleForTests$InnerStructA"; |
21 const char kSampleForTestsClassPath[] = | 23 const char kSampleForTestsClassPath[] = |
22 "org/chromium/example/jni_generator/SampleForTests"; | 24 "org/chromium/example/jni_generator/SampleForTests"; |
23 const char kInnerStructBClassPath[] = | 25 const char kInnerStructBClassPath[] = |
24 "org/chromium/example/jni_generator/SampleForTests$InnerStructB"; | 26 "org/chromium/example/jni_generator/SampleForTests$InnerStructB"; |
25 // Leaking this jclass as we cannot use LazyInstance from some threads. | 27 // Leaking this jclass as we cannot use LazyInstance from some threads. |
26 jclass g_InnerStructA_clazz = NULL; | 28 jclass g_InnerStructA_clazz = NULL; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 } | 87 } |
86 | 88 |
87 static jstring ReturnAString(JNIEnv* env, jobject jcaller, | 89 static jstring ReturnAString(JNIEnv* env, jobject jcaller, |
88 jlong nativeCPPClass) { | 90 jlong nativeCPPClass) { |
89 CPPClass* native = reinterpret_cast<CPPClass*>(nativeCPPClass); | 91 CPPClass* native = reinterpret_cast<CPPClass*>(nativeCPPClass); |
90 CHECK_NATIVE_PTR(env, jcaller, native, "ReturnAString", NULL); | 92 CHECK_NATIVE_PTR(env, jcaller, native, "ReturnAString", NULL); |
91 return native->ReturnAString(env, jcaller).Release(); | 93 return native->ReturnAString(env, jcaller).Release(); |
92 } | 94 } |
93 | 95 |
94 static base::subtle::AtomicWord g_SampleForTests_javaMethod = 0; | 96 static base::subtle::AtomicWord g_SampleForTests_javaMethod = 0; |
95 static jint Java_SampleForTests_javaMethod(JNIEnv* env, jobject obj, jint foo, | 97 static jint Java_SampleForTests_javaMethod(JNIEnv* env, jobject obj, |
96 jint bar) { | 98 jni_int_wrapper foo, |
| 99 jni_int_wrapper bar) { |
97 /* Must call RegisterNativesImpl() */ | 100 /* Must call RegisterNativesImpl() */ |
98 CHECK_CLAZZ(env, obj, | 101 CHECK_CLAZZ(env, obj, |
99 g_SampleForTests_clazz, 0); | 102 g_SampleForTests_clazz, 0); |
100 jmethodID method_id = | 103 jmethodID method_id = |
101 base::android::MethodID::LazyGet< | 104 base::android::MethodID::LazyGet< |
102 base::android::MethodID::TYPE_INSTANCE>( | 105 base::android::MethodID::TYPE_INSTANCE>( |
103 env, g_SampleForTests_clazz, | 106 env, g_SampleForTests_clazz, |
104 "javaMethod", | 107 "javaMethod", |
105 | 108 |
106 "(" | 109 "(" |
107 "I" | 110 "I" |
108 "I" | 111 "I" |
109 ")" | 112 ")" |
110 "I", | 113 "I", |
111 &g_SampleForTests_javaMethod); | 114 &g_SampleForTests_javaMethod); |
112 | 115 |
113 jint ret = | 116 jint ret = |
114 env->CallIntMethod(obj, | 117 env->CallIntMethod(obj, |
115 method_id, foo, bar); | 118 method_id, foo.asJint(), bar.asJint()); |
116 jni_generator::CheckException(env); | 119 jni_generator::CheckException(env); |
117 return ret; | 120 return ret; |
118 } | 121 } |
119 | 122 |
120 static base::subtle::AtomicWord g_SampleForTests_staticJavaMethod = 0; | 123 static base::subtle::AtomicWord g_SampleForTests_staticJavaMethod = 0; |
121 static jboolean Java_SampleForTests_staticJavaMethod(JNIEnv* env) { | 124 static jboolean Java_SampleForTests_staticJavaMethod(JNIEnv* env) { |
122 /* Must call RegisterNativesImpl() */ | 125 /* Must call RegisterNativesImpl() */ |
123 CHECK_CLAZZ(env, g_SampleForTests_clazz, | 126 CHECK_CLAZZ(env, g_SampleForTests_clazz, |
124 g_SampleForTests_clazz, false); | 127 g_SampleForTests_clazz, false); |
125 jmethodID method_id = | 128 jmethodID method_id = |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 &g_SampleForTests_methodThatThrowsException); | 184 &g_SampleForTests_methodThatThrowsException); |
182 | 185 |
183 env->CallVoidMethod(obj, | 186 env->CallVoidMethod(obj, |
184 method_id); | 187 method_id); |
185 | 188 |
186 } | 189 } |
187 | 190 |
188 static base::subtle::AtomicWord g_InnerStructA_create = 0; | 191 static base::subtle::AtomicWord g_InnerStructA_create = 0; |
189 static base::android::ScopedJavaLocalRef<jobject> | 192 static base::android::ScopedJavaLocalRef<jobject> |
190 Java_InnerStructA_create(JNIEnv* env, jlong l, | 193 Java_InnerStructA_create(JNIEnv* env, jlong l, |
191 jint i, | 194 jni_int_wrapper i, |
192 jstring s) { | 195 jstring s) { |
193 /* Must call RegisterNativesImpl() */ | 196 /* Must call RegisterNativesImpl() */ |
194 CHECK_CLAZZ(env, g_InnerStructA_clazz, | 197 CHECK_CLAZZ(env, g_InnerStructA_clazz, |
195 g_InnerStructA_clazz, NULL); | 198 g_InnerStructA_clazz, NULL); |
196 jmethodID method_id = | 199 jmethodID method_id = |
197 base::android::MethodID::LazyGet< | 200 base::android::MethodID::LazyGet< |
198 base::android::MethodID::TYPE_STATIC>( | 201 base::android::MethodID::TYPE_STATIC>( |
199 env, g_InnerStructA_clazz, | 202 env, g_InnerStructA_clazz, |
200 "create", | 203 "create", |
201 | 204 |
202 "(" | 205 "(" |
203 "J" | 206 "J" |
204 "I" | 207 "I" |
205 "Ljava/lang/String;" | 208 "Ljava/lang/String;" |
206 ")" | 209 ")" |
207 "Lorg/chromium/example/jni_generator/SampleForTests$InnerStructA;", | 210 "Lorg/chromium/example/jni_generator/SampleForTests$InnerStructA;", |
208 &g_InnerStructA_create); | 211 &g_InnerStructA_create); |
209 | 212 |
210 jobject ret = | 213 jobject ret = |
211 env->CallStaticObjectMethod(g_InnerStructA_clazz, | 214 env->CallStaticObjectMethod(g_InnerStructA_clazz, |
212 method_id, l, i, s); | 215 method_id, l, i.asJint(), s); |
213 jni_generator::CheckException(env); | 216 jni_generator::CheckException(env); |
214 return base::android::ScopedJavaLocalRef<jobject>(env, ret); | 217 return base::android::ScopedJavaLocalRef<jobject>(env, ret); |
215 } | 218 } |
216 | 219 |
217 static base::subtle::AtomicWord g_SampleForTests_addStructA = 0; | 220 static base::subtle::AtomicWord g_SampleForTests_addStructA = 0; |
218 static void Java_SampleForTests_addStructA(JNIEnv* env, jobject obj, jobject a) | 221 static void Java_SampleForTests_addStructA(JNIEnv* env, jobject obj, jobject a) |
219 { | 222 { |
220 /* Must call RegisterNativesImpl() */ | 223 /* Must call RegisterNativesImpl() */ |
221 CHECK_CLAZZ(env, obj, | 224 CHECK_CLAZZ(env, obj, |
222 g_SampleForTests_clazz); | 225 g_SampleForTests_clazz); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 return false; | 387 return false; |
385 } | 388 } |
386 | 389 |
387 return true; | 390 return true; |
388 } | 391 } |
389 | 392 |
390 } // namespace android | 393 } // namespace android |
391 } // namespace base | 394 } // namespace base |
392 | 395 |
393 #endif // org_chromium_example_jni_generator_SampleForTests_JNI | 396 #endif // org_chromium_example_jni_generator_SampleForTests_JNI |
OLD | NEW |