Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1379)

Side by Side Diff: base/android/jni_generator/golden_sample_for_tests_jni.h

Issue 1308363003: Revert of jni_generator: Make all object-returning natives return ScopedJavaLocalRef. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/android/field_trial_list.cc ('k') | base/android/jni_generator/jni_generator.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 ScopedJavaLocalRef<jobject> GetNonPODDatatype(JNIEnv* env, jobject 90 static jobject GetNonPODDatatype(JNIEnv* env, jobject jcaller);
91 jcaller);
92 91
93 static jobject 92 static jobject
94 Java_org_chromium_example_jni_1generator_SampleForTests_nativeGetNonPODDatat ype(JNIEnv* 93 Java_org_chromium_example_jni_1generator_SampleForTests_nativeGetNonPODDatat ype(JNIEnv*
95 env, jobject jcaller) { 94 env, jobject jcaller) {
96 return GetNonPODDatatype(env, jcaller).Release(); 95 return GetNonPODDatatype(env, jcaller);
97 } 96 }
98 97
99 static jint 98 static jint
100 Java_org_chromium_example_jni_1generator_SampleForTests_nativeMethod(JNIEnv* 99 Java_org_chromium_example_jni_1generator_SampleForTests_nativeMethod(JNIEnv*
101 env, 100 env,
102 jobject jcaller, 101 jobject jcaller,
103 jlong nativeCPPClass) { 102 jlong nativeCPPClass) {
104 CPPClass* native = reinterpret_cast<CPPClass*>(nativeCPPClass); 103 CPPClass* native = reinterpret_cast<CPPClass*>(nativeCPPClass);
105 CHECK_NATIVE_PTR(env, jcaller, native, "Method", 0); 104 CHECK_NATIVE_PTR(env, jcaller, native, "Method", 0);
106 return native->Method(env, jcaller); 105 return native->Method(env, jcaller);
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 ")" 236 ")"
238 "V", 237 "V",
239 &g_SampleForTests_methodThatThrowsException); 238 &g_SampleForTests_methodThatThrowsException);
240 239
241 env->CallVoidMethod(obj, 240 env->CallVoidMethod(obj,
242 method_id); 241 method_id);
243 242
244 } 243 }
245 244
246 static base::subtle::AtomicWord g_InnerStructA_create = 0; 245 static base::subtle::AtomicWord g_InnerStructA_create = 0;
247 static ScopedJavaLocalRef<jobject> Java_InnerStructA_create(JNIEnv* env, jlong 246 static base::android::ScopedJavaLocalRef<jobject>
248 l, 247 Java_InnerStructA_create(JNIEnv* env, jlong l,
249 JniIntWrapper i, 248 JniIntWrapper i,
250 jstring s) { 249 jstring s) {
251 /* Must call RegisterNativesImpl() */ 250 /* Must call RegisterNativesImpl() */
252 CHECK_CLAZZ(env, InnerStructA_clazz(env), 251 CHECK_CLAZZ(env, InnerStructA_clazz(env),
253 InnerStructA_clazz(env), NULL); 252 InnerStructA_clazz(env), NULL);
254 jmethodID method_id = 253 jmethodID method_id =
255 base::android::MethodID::LazyGet< 254 base::android::MethodID::LazyGet<
256 base::android::MethodID::TYPE_STATIC>( 255 base::android::MethodID::TYPE_STATIC>(
257 env, InnerStructA_clazz(env), 256 env, InnerStructA_clazz(env),
258 "create", 257 "create",
259 258
260 "(" 259 "("
261 "J" 260 "J"
262 "I" 261 "I"
263 "Ljava/lang/String;" 262 "Ljava/lang/String;"
264 ")" 263 ")"
265 "Lorg/chromium/example/jni_generator/SampleForTests$InnerStructA;", 264 "Lorg/chromium/example/jni_generator/SampleForTests$InnerStructA;",
266 &g_InnerStructA_create); 265 &g_InnerStructA_create);
267 266
268 jobject ret = 267 jobject ret =
269 env->CallStaticObjectMethod(InnerStructA_clazz(env), 268 env->CallStaticObjectMethod(InnerStructA_clazz(env),
270 method_id, l, as_jint(i), s); 269 method_id, l, as_jint(i), s);
271 jni_generator::CheckException(env); 270 jni_generator::CheckException(env);
272 return ScopedJavaLocalRef<jobject>(env, ret); 271 return base::android::ScopedJavaLocalRef<jobject>(env, ret);
273 } 272 }
274 273
275 static base::subtle::AtomicWord g_SampleForTests_addStructA = 0; 274 static base::subtle::AtomicWord g_SampleForTests_addStructA = 0;
276 static void Java_SampleForTests_addStructA(JNIEnv* env, jobject obj, jobject a) 275 static void Java_SampleForTests_addStructA(JNIEnv* env, jobject obj, jobject a)
277 { 276 {
278 /* Must call RegisterNativesImpl() */ 277 /* Must call RegisterNativesImpl() */
279 CHECK_CLAZZ(env, obj, 278 CHECK_CLAZZ(env, obj,
280 SampleForTests_clazz(env)); 279 SampleForTests_clazz(env));
281 jmethodID method_id = 280 jmethodID method_id =
282 base::android::MethodID::LazyGet< 281 base::android::MethodID::LazyGet<
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 &g_InnerStructB_getKey); 335 &g_InnerStructB_getKey);
337 336
338 jlong ret = 337 jlong ret =
339 env->CallLongMethod(obj, 338 env->CallLongMethod(obj,
340 method_id); 339 method_id);
341 jni_generator::CheckException(env); 340 jni_generator::CheckException(env);
342 return ret; 341 return ret;
343 } 342 }
344 343
345 static base::subtle::AtomicWord g_InnerStructB_getValue = 0; 344 static base::subtle::AtomicWord g_InnerStructB_getValue = 0;
346 static ScopedJavaLocalRef<jstring> Java_InnerStructB_getValue(JNIEnv* env, 345 static base::android::ScopedJavaLocalRef<jstring>
347 jobject obj) { 346 Java_InnerStructB_getValue(JNIEnv* env, jobject obj) {
348 /* Must call RegisterNativesImpl() */ 347 /* Must call RegisterNativesImpl() */
349 CHECK_CLAZZ(env, obj, 348 CHECK_CLAZZ(env, obj,
350 InnerStructB_clazz(env), NULL); 349 InnerStructB_clazz(env), NULL);
351 jmethodID method_id = 350 jmethodID method_id =
352 base::android::MethodID::LazyGet< 351 base::android::MethodID::LazyGet<
353 base::android::MethodID::TYPE_INSTANCE>( 352 base::android::MethodID::TYPE_INSTANCE>(
354 env, InnerStructB_clazz(env), 353 env, InnerStructB_clazz(env),
355 "getValue", 354 "getValue",
356 355
357 "(" 356 "("
358 ")" 357 ")"
359 "Ljava/lang/String;", 358 "Ljava/lang/String;",
360 &g_InnerStructB_getValue); 359 &g_InnerStructB_getValue);
361 360
362 jstring ret = 361 jstring ret =
363 static_cast<jstring>(env->CallObjectMethod(obj, 362 static_cast<jstring>(env->CallObjectMethod(obj,
364 method_id)); 363 method_id));
365 jni_generator::CheckException(env); 364 jni_generator::CheckException(env);
366 return ScopedJavaLocalRef<jstring>(env, ret); 365 return base::android::ScopedJavaLocalRef<jstring>(env, ret);
367 } 366 }
368 367
369 // Step 3: RegisterNatives. 368 // Step 3: RegisterNatives.
370 369
371 static const JNINativeMethod kMethodsSampleForTests[] = { 370 static const JNINativeMethod kMethodsSampleForTests[] = {
372 { "nativeInit", 371 { "nativeInit",
373 "(" 372 "("
374 "Ljava/lang/String;" 373 "Ljava/lang/String;"
375 ")" 374 ")"
376 "J", 375 "J",
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 return false; 464 return false;
466 } 465 }
467 466
468 return true; 467 return true;
469 } 468 }
470 469
471 } // namespace android 470 } // namespace android
472 } // namespace base 471 } // namespace base
473 472
474 #endif // org_chromium_example_jni_generator_SampleForTests_JNI 473 #endif // org_chromium_example_jni_generator_SampleForTests_JNI
OLDNEW
« no previous file with comments | « base/android/field_trial_list.cc ('k') | base/android/jni_generator/jni_generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698