| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 static void SetNonPODDatatype(JNIEnv* env, jobject jcaller, | 80 static void SetNonPODDatatype(JNIEnv* env, jobject jcaller, |
| 81 jobject rect); | 81 jobject rect); |
| 82 | 82 |
| 83 static void | 83 static void |
| 84 Java_org_chromium_example_jni_1generator_SampleForTests_nativeSetNonPODDatat
ype(JNIEnv* | 84 Java_org_chromium_example_jni_1generator_SampleForTests_nativeSetNonPODDatat
ype(JNIEnv* |
| 85 env, jobject jcaller, | 85 env, jobject jcaller, |
| 86 jobject rect) { | 86 jobject rect) { |
| 87 return SetNonPODDatatype(env, jcaller, rect); | 87 return SetNonPODDatatype(env, jcaller, rect); |
| 88 } | 88 } |
| 89 | 89 |
| 90 static jobject GetNonPODDatatype(JNIEnv* env, jobject jcaller); | 90 static ScopedJavaLocalRef<jobject> GetNonPODDatatype(JNIEnv* env, jobject |
| 91 jcaller); |
| 91 | 92 |
| 92 static jobject | 93 static jobject |
| 93 Java_org_chromium_example_jni_1generator_SampleForTests_nativeGetNonPODDatat
ype(JNIEnv* | 94 Java_org_chromium_example_jni_1generator_SampleForTests_nativeGetNonPODDatat
ype(JNIEnv* |
| 94 env, jobject jcaller) { | 95 env, jobject jcaller) { |
| 95 return GetNonPODDatatype(env, jcaller); | 96 return GetNonPODDatatype(env, jcaller).Release(); |
| 96 } | 97 } |
| 97 | 98 |
| 98 static jint | 99 static jint |
| 99 Java_org_chromium_example_jni_1generator_SampleForTests_nativeMethod(JNIEnv* | 100 Java_org_chromium_example_jni_1generator_SampleForTests_nativeMethod(JNIEnv* |
| 100 env, | 101 env, |
| 101 jobject jcaller, | 102 jobject jcaller, |
| 102 jlong nativeCPPClass) { | 103 jlong nativeCPPClass) { |
| 103 CPPClass* native = reinterpret_cast<CPPClass*>(nativeCPPClass); | 104 CPPClass* native = reinterpret_cast<CPPClass*>(nativeCPPClass); |
| 104 CHECK_NATIVE_PTR(env, jcaller, native, "Method", 0); | 105 CHECK_NATIVE_PTR(env, jcaller, native, "Method", 0); |
| 105 return native->Method(env, jcaller); | 106 return native->Method(env, jcaller); |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 ")" | 237 ")" |
| 237 "V", | 238 "V", |
| 238 &g_SampleForTests_methodThatThrowsException); | 239 &g_SampleForTests_methodThatThrowsException); |
| 239 | 240 |
| 240 env->CallVoidMethod(obj, | 241 env->CallVoidMethod(obj, |
| 241 method_id); | 242 method_id); |
| 242 | 243 |
| 243 } | 244 } |
| 244 | 245 |
| 245 static base::subtle::AtomicWord g_InnerStructA_create = 0; | 246 static base::subtle::AtomicWord g_InnerStructA_create = 0; |
| 246 static base::android::ScopedJavaLocalRef<jobject> | 247 static ScopedJavaLocalRef<jobject> Java_InnerStructA_create(JNIEnv* env, jlong |
| 247 Java_InnerStructA_create(JNIEnv* env, jlong l, | 248 l, |
| 248 JniIntWrapper i, | 249 JniIntWrapper i, |
| 249 jstring s) { | 250 jstring s) { |
| 250 /* Must call RegisterNativesImpl() */ | 251 /* Must call RegisterNativesImpl() */ |
| 251 CHECK_CLAZZ(env, InnerStructA_clazz(env), | 252 CHECK_CLAZZ(env, InnerStructA_clazz(env), |
| 252 InnerStructA_clazz(env), NULL); | 253 InnerStructA_clazz(env), NULL); |
| 253 jmethodID method_id = | 254 jmethodID method_id = |
| 254 base::android::MethodID::LazyGet< | 255 base::android::MethodID::LazyGet< |
| 255 base::android::MethodID::TYPE_STATIC>( | 256 base::android::MethodID::TYPE_STATIC>( |
| 256 env, InnerStructA_clazz(env), | 257 env, InnerStructA_clazz(env), |
| 257 "create", | 258 "create", |
| 258 | 259 |
| 259 "(" | 260 "(" |
| 260 "J" | 261 "J" |
| 261 "I" | 262 "I" |
| 262 "Ljava/lang/String;" | 263 "Ljava/lang/String;" |
| 263 ")" | 264 ")" |
| 264 "Lorg/chromium/example/jni_generator/SampleForTests$InnerStructA;", | 265 "Lorg/chromium/example/jni_generator/SampleForTests$InnerStructA;", |
| 265 &g_InnerStructA_create); | 266 &g_InnerStructA_create); |
| 266 | 267 |
| 267 jobject ret = | 268 jobject ret = |
| 268 env->CallStaticObjectMethod(InnerStructA_clazz(env), | 269 env->CallStaticObjectMethod(InnerStructA_clazz(env), |
| 269 method_id, l, as_jint(i), s); | 270 method_id, l, as_jint(i), s); |
| 270 jni_generator::CheckException(env); | 271 jni_generator::CheckException(env); |
| 271 return base::android::ScopedJavaLocalRef<jobject>(env, ret); | 272 return ScopedJavaLocalRef<jobject>(env, ret); |
| 272 } | 273 } |
| 273 | 274 |
| 274 static base::subtle::AtomicWord g_SampleForTests_addStructA = 0; | 275 static base::subtle::AtomicWord g_SampleForTests_addStructA = 0; |
| 275 static void Java_SampleForTests_addStructA(JNIEnv* env, jobject obj, jobject a) | 276 static void Java_SampleForTests_addStructA(JNIEnv* env, jobject obj, jobject a) |
| 276 { | 277 { |
| 277 /* Must call RegisterNativesImpl() */ | 278 /* Must call RegisterNativesImpl() */ |
| 278 CHECK_CLAZZ(env, obj, | 279 CHECK_CLAZZ(env, obj, |
| 279 SampleForTests_clazz(env)); | 280 SampleForTests_clazz(env)); |
| 280 jmethodID method_id = | 281 jmethodID method_id = |
| 281 base::android::MethodID::LazyGet< | 282 base::android::MethodID::LazyGet< |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 &g_InnerStructB_getKey); | 336 &g_InnerStructB_getKey); |
| 336 | 337 |
| 337 jlong ret = | 338 jlong ret = |
| 338 env->CallLongMethod(obj, | 339 env->CallLongMethod(obj, |
| 339 method_id); | 340 method_id); |
| 340 jni_generator::CheckException(env); | 341 jni_generator::CheckException(env); |
| 341 return ret; | 342 return ret; |
| 342 } | 343 } |
| 343 | 344 |
| 344 static base::subtle::AtomicWord g_InnerStructB_getValue = 0; | 345 static base::subtle::AtomicWord g_InnerStructB_getValue = 0; |
| 345 static base::android::ScopedJavaLocalRef<jstring> | 346 static ScopedJavaLocalRef<jstring> Java_InnerStructB_getValue(JNIEnv* env, |
| 346 Java_InnerStructB_getValue(JNIEnv* env, jobject obj) { | 347 jobject obj) { |
| 347 /* Must call RegisterNativesImpl() */ | 348 /* Must call RegisterNativesImpl() */ |
| 348 CHECK_CLAZZ(env, obj, | 349 CHECK_CLAZZ(env, obj, |
| 349 InnerStructB_clazz(env), NULL); | 350 InnerStructB_clazz(env), NULL); |
| 350 jmethodID method_id = | 351 jmethodID method_id = |
| 351 base::android::MethodID::LazyGet< | 352 base::android::MethodID::LazyGet< |
| 352 base::android::MethodID::TYPE_INSTANCE>( | 353 base::android::MethodID::TYPE_INSTANCE>( |
| 353 env, InnerStructB_clazz(env), | 354 env, InnerStructB_clazz(env), |
| 354 "getValue", | 355 "getValue", |
| 355 | 356 |
| 356 "(" | 357 "(" |
| 357 ")" | 358 ")" |
| 358 "Ljava/lang/String;", | 359 "Ljava/lang/String;", |
| 359 &g_InnerStructB_getValue); | 360 &g_InnerStructB_getValue); |
| 360 | 361 |
| 361 jstring ret = | 362 jstring ret = |
| 362 static_cast<jstring>(env->CallObjectMethod(obj, | 363 static_cast<jstring>(env->CallObjectMethod(obj, |
| 363 method_id)); | 364 method_id)); |
| 364 jni_generator::CheckException(env); | 365 jni_generator::CheckException(env); |
| 365 return base::android::ScopedJavaLocalRef<jstring>(env, ret); | 366 return ScopedJavaLocalRef<jstring>(env, ret); |
| 366 } | 367 } |
| 367 | 368 |
| 368 // Step 3: RegisterNatives. | 369 // Step 3: RegisterNatives. |
| 369 | 370 |
| 370 static const JNINativeMethod kMethodsSampleForTests[] = { | 371 static const JNINativeMethod kMethodsSampleForTests[] = { |
| 371 { "nativeInit", | 372 { "nativeInit", |
| 372 "(" | 373 "(" |
| 373 "Ljava/lang/String;" | 374 "Ljava/lang/String;" |
| 374 ")" | 375 ")" |
| 375 "J", | 376 "J", |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 return false; | 465 return false; |
| 465 } | 466 } |
| 466 | 467 |
| 467 return true; | 468 return true; |
| 468 } | 469 } |
| 469 | 470 |
| 470 } // namespace android | 471 } // namespace android |
| 471 } // namespace base | 472 } // namespace base |
| 472 | 473 |
| 473 #endif // org_chromium_example_jni_generator_SampleForTests_JNI | 474 #endif // org_chromium_example_jni_generator_SampleForTests_JNI |
| OLD | NEW |