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