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/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 |
(...skipping 28 matching lines...) Expand all Loading... |
39 base::subtle::AtomicWord g_InnerStructB_clazz __attribute__((unused)) = 0; | 39 base::subtle::AtomicWord g_InnerStructB_clazz __attribute__((unused)) = 0; |
40 #define InnerStructB_clazz(env) base::android::LazyGetClass(env, kInnerStructBCl
assPath, &g_InnerStructB_clazz) | 40 #define InnerStructB_clazz(env) base::android::LazyGetClass(env, kInnerStructBCl
assPath, &g_InnerStructB_clazz) |
41 | 41 |
42 } // namespace | 42 } // namespace |
43 | 43 |
44 namespace base { | 44 namespace base { |
45 namespace android { | 45 namespace android { |
46 | 46 |
47 // Step 2: method stubs. | 47 // Step 2: method stubs. |
48 | 48 |
49 static jlong Init(JNIEnv* env, const JavaParamRef<jobject>& jcaller, | 49 static jlong Init(JNIEnv* env, const base::android::JavaParamRef<jobject>& |
50 const JavaParamRef<jstring>& param); | 50 jcaller, |
| 51 const base::android::JavaParamRef<jstring>& param); |
51 | 52 |
52 extern "C" __attribute__((visibility("default"))) | 53 extern "C" __attribute__((visibility("default"))) |
53 jlong Java_org_chromium_example_jni_1generator_SampleForTests_nativeInit(JNIEnv* | 54 jlong Java_org_chromium_example_jni_1generator_SampleForTests_nativeInit(JNIEnv* |
54 env, jobject jcaller, | 55 env, jobject jcaller, |
55 jstring param) { | 56 jstring param) { |
56 return Init(env, JavaParamRef<jobject>(env, jcaller), | 57 return Init(env, base::android::JavaParamRef<jobject>(env, jcaller), |
57 JavaParamRef<jstring>(env, param)); | 58 base::android::JavaParamRef<jstring>(env, param)); |
58 } | 59 } |
59 | 60 |
60 extern "C" __attribute__((visibility("default"))) | 61 extern "C" __attribute__((visibility("default"))) |
61 void | 62 void |
62 Java_org_chromium_example_jni_1generator_SampleForTests_nativeDestroy(JNIEnv
* | 63 Java_org_chromium_example_jni_1generator_SampleForTests_nativeDestroy(JNIEnv
* |
63 env, | 64 env, |
64 jobject jcaller, | 65 jobject jcaller, |
65 jlong nativeCPPClass) { | 66 jlong nativeCPPClass) { |
66 CPPClass* native = reinterpret_cast<CPPClass*>(nativeCPPClass); | 67 CPPClass* native = reinterpret_cast<CPPClass*>(nativeCPPClass); |
67 CHECK_NATIVE_PTR(env, jcaller, native, "Destroy"); | 68 CHECK_NATIVE_PTR(env, jcaller, native, "Destroy"); |
68 return native->Destroy(env, JavaParamRef<jobject>(env, jcaller)); | 69 return native->Destroy(env, base::android::JavaParamRef<jobject>(env, |
| 70 jcaller)); |
69 } | 71 } |
70 | 72 |
71 static jdouble GetDoubleFunction(JNIEnv* env, const JavaParamRef<jobject>& | 73 static jdouble GetDoubleFunction(JNIEnv* env, const |
72 jcaller); | 74 base::android::JavaParamRef<jobject>& jcaller); |
73 | 75 |
74 extern "C" __attribute__((visibility("default"))) | 76 extern "C" __attribute__((visibility("default"))) |
75 jdouble | 77 jdouble |
76 Java_org_chromium_example_jni_1generator_SampleForTests_nativeGetDoubleFunct
ion(JNIEnv* | 78 Java_org_chromium_example_jni_1generator_SampleForTests_nativeGetDoubleFunct
ion(JNIEnv* |
77 env, jobject jcaller) { | 79 env, jobject jcaller) { |
78 return GetDoubleFunction(env, JavaParamRef<jobject>(env, jcaller)); | 80 return GetDoubleFunction(env, base::android::JavaParamRef<jobject>(env, |
| 81 jcaller)); |
79 } | 82 } |
80 | 83 |
81 static jfloat GetFloatFunction(JNIEnv* env, const JavaParamRef<jclass>& | 84 static jfloat GetFloatFunction(JNIEnv* env, const |
82 jcaller); | 85 base::android::JavaParamRef<jclass>& jcaller); |
83 | 86 |
84 extern "C" __attribute__((visibility("default"))) | 87 extern "C" __attribute__((visibility("default"))) |
85 jfloat | 88 jfloat |
86 Java_org_chromium_example_jni_1generator_SampleForTests_nativeGetFloatFuncti
on(JNIEnv* | 89 Java_org_chromium_example_jni_1generator_SampleForTests_nativeGetFloatFuncti
on(JNIEnv* |
87 env, jclass jcaller) { | 90 env, jclass jcaller) { |
88 return GetFloatFunction(env, JavaParamRef<jclass>(env, jcaller)); | 91 return GetFloatFunction(env, base::android::JavaParamRef<jclass>(env, |
| 92 jcaller)); |
89 } | 93 } |
90 | 94 |
91 static void SetNonPODDatatype(JNIEnv* env, const JavaParamRef<jobject>& jcaller, | 95 static void SetNonPODDatatype(JNIEnv* env, const |
92 const JavaParamRef<jobject>& rect); | 96 base::android::JavaParamRef<jobject>& jcaller, |
| 97 const base::android::JavaParamRef<jobject>& rect); |
93 | 98 |
94 extern "C" __attribute__((visibility("default"))) | 99 extern "C" __attribute__((visibility("default"))) |
95 void | 100 void |
96 Java_org_chromium_example_jni_1generator_SampleForTests_nativeSetNonPODDatat
ype(JNIEnv* | 101 Java_org_chromium_example_jni_1generator_SampleForTests_nativeSetNonPODDatat
ype(JNIEnv* |
97 env, jobject jcaller, | 102 env, jobject jcaller, |
98 jobject rect) { | 103 jobject rect) { |
99 return SetNonPODDatatype(env, JavaParamRef<jobject>(env, jcaller), | 104 return SetNonPODDatatype(env, base::android::JavaParamRef<jobject>(env, |
100 JavaParamRef<jobject>(env, rect)); | 105 jcaller), base::android::JavaParamRef<jobject>(env, rect)); |
101 } | 106 } |
102 | 107 |
103 static ScopedJavaLocalRef<jobject> GetNonPODDatatype(JNIEnv* env, const | 108 static base::android::ScopedJavaLocalRef<jobject> GetNonPODDatatype(JNIEnv* env, |
104 JavaParamRef<jobject>& jcaller); | 109 const base::android::JavaParamRef<jobject>& jcaller); |
105 | 110 |
106 extern "C" __attribute__((visibility("default"))) | 111 extern "C" __attribute__((visibility("default"))) |
107 jobject | 112 jobject |
108 Java_org_chromium_example_jni_1generator_SampleForTests_nativeGetNonPODDatat
ype(JNIEnv* | 113 Java_org_chromium_example_jni_1generator_SampleForTests_nativeGetNonPODDatat
ype(JNIEnv* |
109 env, jobject jcaller) { | 114 env, jobject jcaller) { |
110 return GetNonPODDatatype(env, JavaParamRef<jobject>(env, jcaller)).Release(); | 115 return GetNonPODDatatype(env, base::android::JavaParamRef<jobject>(env, |
| 116 jcaller)).Release(); |
111 } | 117 } |
112 | 118 |
113 extern "C" __attribute__((visibility("default"))) | 119 extern "C" __attribute__((visibility("default"))) |
114 jint | 120 jint |
115 Java_org_chromium_example_jni_1generator_SampleForTests_nativeMethod(JNIEnv* | 121 Java_org_chromium_example_jni_1generator_SampleForTests_nativeMethod(JNIEnv* |
116 env, | 122 env, |
117 jobject jcaller, | 123 jobject jcaller, |
118 jlong nativeCPPClass) { | 124 jlong nativeCPPClass) { |
119 CPPClass* native = reinterpret_cast<CPPClass*>(nativeCPPClass); | 125 CPPClass* native = reinterpret_cast<CPPClass*>(nativeCPPClass); |
120 CHECK_NATIVE_PTR(env, jcaller, native, "Method", 0); | 126 CHECK_NATIVE_PTR(env, jcaller, native, "Method", 0); |
121 return native->Method(env, JavaParamRef<jobject>(env, jcaller)); | 127 return native->Method(env, base::android::JavaParamRef<jobject>(env, |
| 128 jcaller)); |
122 } | 129 } |
123 | 130 |
124 extern "C" __attribute__((visibility("default"))) | 131 extern "C" __attribute__((visibility("default"))) |
125 jdouble | 132 jdouble |
126 Java_org_chromium_example_jni_1generator_SampleForTests_nativeMethodOtherP0(
JNIEnv* | 133 Java_org_chromium_example_jni_1generator_SampleForTests_nativeMethodOtherP0(
JNIEnv* |
127 env, | 134 env, |
128 jobject jcaller, | 135 jobject jcaller, |
129 jlong nativePtr) { | 136 jlong nativePtr) { |
130 CPPClass::InnerClass* native = | 137 CPPClass::InnerClass* native = |
131 reinterpret_cast<CPPClass::InnerClass*>(nativePtr); | 138 reinterpret_cast<CPPClass::InnerClass*>(nativePtr); |
132 CHECK_NATIVE_PTR(env, jcaller, native, "MethodOtherP0", 0); | 139 CHECK_NATIVE_PTR(env, jcaller, native, "MethodOtherP0", 0); |
133 return native->MethodOtherP0(env, JavaParamRef<jobject>(env, jcaller)); | 140 return native->MethodOtherP0(env, base::android::JavaParamRef<jobject>(env, |
| 141 jcaller)); |
134 } | 142 } |
135 | 143 |
136 extern "C" __attribute__((visibility("default"))) | 144 extern "C" __attribute__((visibility("default"))) |
137 void | 145 void |
138 Java_org_chromium_example_jni_1generator_SampleForTests_nativeAddStructB(JNI
Env* | 146 Java_org_chromium_example_jni_1generator_SampleForTests_nativeAddStructB(JNI
Env* |
139 env, | 147 env, |
140 jobject jcaller, | 148 jobject jcaller, |
141 jlong nativeCPPClass, | 149 jlong nativeCPPClass, |
142 jobject b) { | 150 jobject b) { |
143 CPPClass* native = reinterpret_cast<CPPClass*>(nativeCPPClass); | 151 CPPClass* native = reinterpret_cast<CPPClass*>(nativeCPPClass); |
144 CHECK_NATIVE_PTR(env, jcaller, native, "AddStructB"); | 152 CHECK_NATIVE_PTR(env, jcaller, native, "AddStructB"); |
145 return native->AddStructB(env, JavaParamRef<jobject>(env, jcaller), | 153 return native->AddStructB(env, base::android::JavaParamRef<jobject>(env, |
146 JavaParamRef<jobject>(env, b)); | 154 jcaller), base::android::JavaParamRef<jobject>(env, b)); |
147 } | 155 } |
148 | 156 |
149 extern "C" __attribute__((visibility("default"))) | 157 extern "C" __attribute__((visibility("default"))) |
150 void | 158 void |
151 Java_org_chromium_example_jni_1generator_SampleForTests_nativeIterateAndDoSo
methingWithStructB(JNIEnv* | 159 Java_org_chromium_example_jni_1generator_SampleForTests_nativeIterateAndDoSo
methingWithStructB(JNIEnv* |
152 env, | 160 env, |
153 jobject jcaller, | 161 jobject jcaller, |
154 jlong nativeCPPClass) { | 162 jlong nativeCPPClass) { |
155 CPPClass* native = reinterpret_cast<CPPClass*>(nativeCPPClass); | 163 CPPClass* native = reinterpret_cast<CPPClass*>(nativeCPPClass); |
156 CHECK_NATIVE_PTR(env, jcaller, native, "IterateAndDoSomethingWithStructB"); | 164 CHECK_NATIVE_PTR(env, jcaller, native, "IterateAndDoSomethingWithStructB"); |
157 return native->IterateAndDoSomethingWithStructB(env, | 165 return native->IterateAndDoSomethingWithStructB(env, |
158 JavaParamRef<jobject>(env, jcaller)); | 166 base::android::JavaParamRef<jobject>(env, jcaller)); |
159 } | 167 } |
160 | 168 |
161 extern "C" __attribute__((visibility("default"))) | 169 extern "C" __attribute__((visibility("default"))) |
162 jstring | 170 jstring |
163 Java_org_chromium_example_jni_1generator_SampleForTests_nativeReturnAString(
JNIEnv* | 171 Java_org_chromium_example_jni_1generator_SampleForTests_nativeReturnAString(
JNIEnv* |
164 env, | 172 env, |
165 jobject jcaller, | 173 jobject jcaller, |
166 jlong nativeCPPClass) { | 174 jlong nativeCPPClass) { |
167 CPPClass* native = reinterpret_cast<CPPClass*>(nativeCPPClass); | 175 CPPClass* native = reinterpret_cast<CPPClass*>(nativeCPPClass); |
168 CHECK_NATIVE_PTR(env, jcaller, native, "ReturnAString", NULL); | 176 CHECK_NATIVE_PTR(env, jcaller, native, "ReturnAString", NULL); |
169 return native->ReturnAString(env, JavaParamRef<jobject>(env, | 177 return native->ReturnAString(env, base::android::JavaParamRef<jobject>(env, |
170 jcaller)).Release(); | 178 jcaller)).Release(); |
171 } | 179 } |
172 | 180 |
173 static jint GetInnerIntFunction(JNIEnv* env, const JavaParamRef<jclass>& | 181 static jint GetInnerIntFunction(JNIEnv* env, const |
174 jcaller); | 182 base::android::JavaParamRef<jclass>& jcaller); |
175 | 183 |
176 extern "C" __attribute__((visibility("default"))) | 184 extern "C" __attribute__((visibility("default"))) |
177 jint | 185 jint |
178 Java_org_chromium_example_jni_1generator_SampleForTests_00024InnerClass_nati
veGetInnerIntFunction(JNIEnv* | 186 Java_org_chromium_example_jni_1generator_SampleForTests_00024InnerClass_nati
veGetInnerIntFunction(JNIEnv* |
179 env, jclass jcaller) { | 187 env, jclass jcaller) { |
180 return GetInnerIntFunction(env, JavaParamRef<jclass>(env, jcaller)); | 188 return GetInnerIntFunction(env, base::android::JavaParamRef<jclass>(env, |
| 189 jcaller)); |
181 } | 190 } |
182 | 191 |
183 static base::subtle::AtomicWord g_SampleForTests_javaMethod = 0; | 192 static base::subtle::AtomicWord g_SampleForTests_javaMethod = 0; |
184 static jint Java_SampleForTests_javaMethod(JNIEnv* env, jobject obj, | 193 static jint Java_SampleForTests_javaMethod(JNIEnv* env, jobject obj, |
185 JniIntWrapper foo, | 194 JniIntWrapper foo, |
186 JniIntWrapper bar) { | 195 JniIntWrapper bar) { |
187 CHECK_CLAZZ(env, obj, | 196 CHECK_CLAZZ(env, obj, |
188 SampleForTests_clazz(env), 0); | 197 SampleForTests_clazz(env), 0); |
189 jmethodID method_id = | 198 jmethodID method_id = |
190 base::android::MethodID::LazyGet< | 199 base::android::MethodID::LazyGet< |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 ")" | 274 ")" |
266 "V", | 275 "V", |
267 &g_SampleForTests_methodThatThrowsException); | 276 &g_SampleForTests_methodThatThrowsException); |
268 | 277 |
269 env->CallVoidMethod(obj, | 278 env->CallVoidMethod(obj, |
270 method_id); | 279 method_id); |
271 | 280 |
272 } | 281 } |
273 | 282 |
274 static base::subtle::AtomicWord g_InnerStructA_create = 0; | 283 static base::subtle::AtomicWord g_InnerStructA_create = 0; |
275 static ScopedJavaLocalRef<jobject> Java_InnerStructA_create(JNIEnv* env, jlong | 284 static base::android::ScopedJavaLocalRef<jobject> |
276 l, | 285 Java_InnerStructA_create(JNIEnv* env, jlong l, |
277 JniIntWrapper i, | 286 JniIntWrapper i, |
278 jstring s) { | 287 jstring s) { |
279 CHECK_CLAZZ(env, InnerStructA_clazz(env), | 288 CHECK_CLAZZ(env, InnerStructA_clazz(env), |
280 InnerStructA_clazz(env), NULL); | 289 InnerStructA_clazz(env), NULL); |
281 jmethodID method_id = | 290 jmethodID method_id = |
282 base::android::MethodID::LazyGet< | 291 base::android::MethodID::LazyGet< |
283 base::android::MethodID::TYPE_STATIC>( | 292 base::android::MethodID::TYPE_STATIC>( |
284 env, InnerStructA_clazz(env), | 293 env, InnerStructA_clazz(env), |
285 "create", | 294 "create", |
286 | 295 |
287 "(" | 296 "(" |
288 "J" | 297 "J" |
289 "I" | 298 "I" |
290 "Ljava/lang/String;" | 299 "Ljava/lang/String;" |
291 ")" | 300 ")" |
292 "Lorg/chromium/example/jni_generator/SampleForTests$InnerStructA;", | 301 "Lorg/chromium/example/jni_generator/SampleForTests$InnerStructA;", |
293 &g_InnerStructA_create); | 302 &g_InnerStructA_create); |
294 | 303 |
295 jobject ret = | 304 jobject ret = |
296 env->CallStaticObjectMethod(InnerStructA_clazz(env), | 305 env->CallStaticObjectMethod(InnerStructA_clazz(env), |
297 method_id, l, as_jint(i), s); | 306 method_id, l, as_jint(i), s); |
298 jni_generator::CheckException(env); | 307 jni_generator::CheckException(env); |
299 return ScopedJavaLocalRef<jobject>(env, ret); | 308 return base::android::ScopedJavaLocalRef<jobject>(env, ret); |
300 } | 309 } |
301 | 310 |
302 static base::subtle::AtomicWord g_SampleForTests_addStructA = 0; | 311 static base::subtle::AtomicWord g_SampleForTests_addStructA = 0; |
303 static void Java_SampleForTests_addStructA(JNIEnv* env, jobject obj, jobject a) | 312 static void Java_SampleForTests_addStructA(JNIEnv* env, jobject obj, jobject a) |
304 { | 313 { |
305 CHECK_CLAZZ(env, obj, | 314 CHECK_CLAZZ(env, obj, |
306 SampleForTests_clazz(env)); | 315 SampleForTests_clazz(env)); |
307 jmethodID method_id = | 316 jmethodID method_id = |
308 base::android::MethodID::LazyGet< | 317 base::android::MethodID::LazyGet< |
309 base::android::MethodID::TYPE_INSTANCE>( | 318 base::android::MethodID::TYPE_INSTANCE>( |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 &g_InnerStructB_getKey); | 369 &g_InnerStructB_getKey); |
361 | 370 |
362 jlong ret = | 371 jlong ret = |
363 env->CallLongMethod(obj, | 372 env->CallLongMethod(obj, |
364 method_id); | 373 method_id); |
365 jni_generator::CheckException(env); | 374 jni_generator::CheckException(env); |
366 return ret; | 375 return ret; |
367 } | 376 } |
368 | 377 |
369 static base::subtle::AtomicWord g_InnerStructB_getValue = 0; | 378 static base::subtle::AtomicWord g_InnerStructB_getValue = 0; |
370 static ScopedJavaLocalRef<jstring> Java_InnerStructB_getValue(JNIEnv* env, | 379 static base::android::ScopedJavaLocalRef<jstring> |
371 jobject obj) { | 380 Java_InnerStructB_getValue(JNIEnv* env, jobject obj) { |
372 CHECK_CLAZZ(env, obj, | 381 CHECK_CLAZZ(env, obj, |
373 InnerStructB_clazz(env), NULL); | 382 InnerStructB_clazz(env), NULL); |
374 jmethodID method_id = | 383 jmethodID method_id = |
375 base::android::MethodID::LazyGet< | 384 base::android::MethodID::LazyGet< |
376 base::android::MethodID::TYPE_INSTANCE>( | 385 base::android::MethodID::TYPE_INSTANCE>( |
377 env, InnerStructB_clazz(env), | 386 env, InnerStructB_clazz(env), |
378 "getValue", | 387 "getValue", |
379 | 388 |
380 "(" | 389 "(" |
381 ")" | 390 ")" |
382 "Ljava/lang/String;", | 391 "Ljava/lang/String;", |
383 &g_InnerStructB_getValue); | 392 &g_InnerStructB_getValue); |
384 | 393 |
385 jstring ret = | 394 jstring ret = |
386 static_cast<jstring>(env->CallObjectMethod(obj, | 395 static_cast<jstring>(env->CallObjectMethod(obj, |
387 method_id)); | 396 method_id)); |
388 jni_generator::CheckException(env); | 397 jni_generator::CheckException(env); |
389 return ScopedJavaLocalRef<jstring>(env, ret); | 398 return base::android::ScopedJavaLocalRef<jstring>(env, ret); |
390 } | 399 } |
391 | 400 |
392 // Step 3: RegisterNatives. | 401 // Step 3: RegisterNatives. |
393 | 402 |
394 static const JNINativeMethod kMethodsInnerClass[] = { | 403 static const JNINativeMethod kMethodsInnerClass[] = { |
395 { "nativeGetInnerIntFunction", | 404 { "nativeGetInnerIntFunction", |
396 "(" | 405 "(" |
397 ")" | 406 ")" |
398 "I", | 407 "I", |
399 reinterpret_cast<void*>(Java_org_chromium_example_jni_1generator_SampleForTe
sts_00024InnerClass_nativeGetInnerIntFunction) | 408 reinterpret_cast<void*>(Java_org_chromium_example_jni_1generator_SampleForTe
sts_00024InnerClass_nativeGetInnerIntFunction) |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 return false; | 510 return false; |
502 } | 511 } |
503 | 512 |
504 return true; | 513 return true; |
505 } | 514 } |
506 | 515 |
507 } // namespace android | 516 } // namespace android |
508 } // namespace base | 517 } // namespace base |
509 | 518 |
510 #endif // org_chromium_example_jni_generator_SampleForTests_JNI | 519 #endif // org_chromium_example_jni_generator_SampleForTests_JNI |
OLD | NEW |