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

Side by Side Diff: base/android/jni_generator/testCalledByNatives.golden

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, 4 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
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/TestJni 8 // org/chromium/TestJni
9 9
10 #ifndef org_chromium_TestJni_JNI 10 #ifndef org_chromium_TestJni_JNI
(...skipping 14 matching lines...) Expand all
25 #define TestJni_clazz(env) g_TestJni_clazz 25 #define TestJni_clazz(env) g_TestJni_clazz
26 // Leaking this jclass as we cannot use LazyInstance from some threads. 26 // Leaking this jclass as we cannot use LazyInstance from some threads.
27 jclass g_InfoBar_clazz = NULL; 27 jclass g_InfoBar_clazz = NULL;
28 #define InfoBar_clazz(env) g_InfoBar_clazz 28 #define InfoBar_clazz(env) g_InfoBar_clazz
29 29
30 } // namespace 30 } // namespace
31 31
32 // Step 2: method stubs. 32 // Step 2: method stubs.
33 33
34 static base::subtle::AtomicWord g_TestJni_showConfirmInfoBar = 0; 34 static base::subtle::AtomicWord g_TestJni_showConfirmInfoBar = 0;
35 static ScopedJavaLocalRef<jobject> Java_TestJni_showConfirmInfoBar(JNIEnv* env, 35 static base::android::ScopedJavaLocalRef<jobject>
36 jobject obj, JniIntWrapper nativeInfoBar, 36 Java_TestJni_showConfirmInfoBar(JNIEnv* env, jobject obj, JniIntWrapper
37 nativeInfoBar,
37 jstring buttonOk, 38 jstring buttonOk,
38 jstring buttonCancel, 39 jstring buttonCancel,
39 jstring title, 40 jstring title,
40 jobject icon) { 41 jobject icon) {
41 /* Must call RegisterNativesImpl() */ 42 /* Must call RegisterNativesImpl() */
42 CHECK_CLAZZ(env, obj, 43 CHECK_CLAZZ(env, obj,
43 TestJni_clazz(env), NULL); 44 TestJni_clazz(env), NULL);
44 jmethodID method_id = 45 jmethodID method_id =
45 base::android::MethodID::LazyGet< 46 base::android::MethodID::LazyGet<
46 base::android::MethodID::TYPE_INSTANCE>( 47 base::android::MethodID::TYPE_INSTANCE>(
47 env, TestJni_clazz(env), 48 env, TestJni_clazz(env),
48 "showConfirmInfoBar", 49 "showConfirmInfoBar",
49 50
50 "(" 51 "("
51 "I" 52 "I"
52 "Ljava/lang/String;" 53 "Ljava/lang/String;"
53 "Ljava/lang/String;" 54 "Ljava/lang/String;"
54 "Ljava/lang/String;" 55 "Ljava/lang/String;"
55 "Landroid/graphics/Bitmap;" 56 "Landroid/graphics/Bitmap;"
56 ")" 57 ")"
57 "Lorg/chromium/Foo$InnerClass;", 58 "Lorg/chromium/Foo$InnerClass;",
58 &g_TestJni_showConfirmInfoBar); 59 &g_TestJni_showConfirmInfoBar);
59 60
60 jobject ret = 61 jobject ret =
61 env->CallObjectMethod(obj, 62 env->CallObjectMethod(obj,
62 method_id, as_jint(nativeInfoBar), buttonOk, buttonCancel, title, 63 method_id, as_jint(nativeInfoBar), buttonOk, buttonCancel, title,
63 icon); 64 icon);
64 jni_generator::CheckException(env); 65 jni_generator::CheckException(env);
65 return ScopedJavaLocalRef<jobject>(env, ret); 66 return base::android::ScopedJavaLocalRef<jobject>(env, ret);
66 } 67 }
67 68
68 static base::subtle::AtomicWord g_TestJni_showAutoLoginInfoBar = 0; 69 static base::subtle::AtomicWord g_TestJni_showAutoLoginInfoBar = 0;
69 static ScopedJavaLocalRef<jobject> Java_TestJni_showAutoLoginInfoBar(JNIEnv* 70 static base::android::ScopedJavaLocalRef<jobject>
70 env, jobject obj, JniIntWrapper nativeInfoBar, 71 Java_TestJni_showAutoLoginInfoBar(JNIEnv* env, jobject obj, JniIntWrapper
72 nativeInfoBar,
71 jstring realm, 73 jstring realm,
72 jstring account, 74 jstring account,
73 jstring args) { 75 jstring args) {
74 /* Must call RegisterNativesImpl() */ 76 /* Must call RegisterNativesImpl() */
75 CHECK_CLAZZ(env, obj, 77 CHECK_CLAZZ(env, obj,
76 TestJni_clazz(env), NULL); 78 TestJni_clazz(env), NULL);
77 jmethodID method_id = 79 jmethodID method_id =
78 base::android::MethodID::LazyGet< 80 base::android::MethodID::LazyGet<
79 base::android::MethodID::TYPE_INSTANCE>( 81 base::android::MethodID::TYPE_INSTANCE>(
80 env, TestJni_clazz(env), 82 env, TestJni_clazz(env),
81 "showAutoLoginInfoBar", 83 "showAutoLoginInfoBar",
82 84
83 "(" 85 "("
84 "I" 86 "I"
85 "Ljava/lang/String;" 87 "Ljava/lang/String;"
86 "Ljava/lang/String;" 88 "Ljava/lang/String;"
87 "Ljava/lang/String;" 89 "Ljava/lang/String;"
88 ")" 90 ")"
89 "Lorg/chromium/Foo$InnerClass;", 91 "Lorg/chromium/Foo$InnerClass;",
90 &g_TestJni_showAutoLoginInfoBar); 92 &g_TestJni_showAutoLoginInfoBar);
91 93
92 jobject ret = 94 jobject ret =
93 env->CallObjectMethod(obj, 95 env->CallObjectMethod(obj,
94 method_id, as_jint(nativeInfoBar), realm, account, args); 96 method_id, as_jint(nativeInfoBar), realm, account, args);
95 jni_generator::CheckException(env); 97 jni_generator::CheckException(env);
96 return ScopedJavaLocalRef<jobject>(env, ret); 98 return base::android::ScopedJavaLocalRef<jobject>(env, ret);
97 } 99 }
98 100
99 static base::subtle::AtomicWord g_InfoBar_dismiss = 0; 101 static base::subtle::AtomicWord g_InfoBar_dismiss = 0;
100 static void Java_InfoBar_dismiss(JNIEnv* env, jobject obj) { 102 static void Java_InfoBar_dismiss(JNIEnv* env, jobject obj) {
101 /* Must call RegisterNativesImpl() */ 103 /* Must call RegisterNativesImpl() */
102 CHECK_CLAZZ(env, obj, 104 CHECK_CLAZZ(env, obj,
103 InfoBar_clazz(env)); 105 InfoBar_clazz(env));
104 jmethodID method_id = 106 jmethodID method_id =
105 base::android::MethodID::LazyGet< 107 base::android::MethodID::LazyGet<
106 base::android::MethodID::TYPE_INSTANCE>( 108 base::android::MethodID::TYPE_INSTANCE>(
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 &g_TestJni_shouldShowAutoLogin); 144 &g_TestJni_shouldShowAutoLogin);
143 145
144 jboolean ret = 146 jboolean ret =
145 env->CallStaticBooleanMethod(TestJni_clazz(env), 147 env->CallStaticBooleanMethod(TestJni_clazz(env),
146 method_id, view, realm, account, args); 148 method_id, view, realm, account, args);
147 jni_generator::CheckException(env); 149 jni_generator::CheckException(env);
148 return ret; 150 return ret;
149 } 151 }
150 152
151 static base::subtle::AtomicWord g_TestJni_openUrl = 0; 153 static base::subtle::AtomicWord g_TestJni_openUrl = 0;
152 static ScopedJavaLocalRef<jobject> Java_TestJni_openUrl(JNIEnv* env, jstring 154 static base::android::ScopedJavaLocalRef<jobject> Java_TestJni_openUrl(JNIEnv*
153 url) { 155 env, jstring url) {
154 /* Must call RegisterNativesImpl() */ 156 /* Must call RegisterNativesImpl() */
155 CHECK_CLAZZ(env, TestJni_clazz(env), 157 CHECK_CLAZZ(env, TestJni_clazz(env),
156 TestJni_clazz(env), NULL); 158 TestJni_clazz(env), NULL);
157 jmethodID method_id = 159 jmethodID method_id =
158 base::android::MethodID::LazyGet< 160 base::android::MethodID::LazyGet<
159 base::android::MethodID::TYPE_STATIC>( 161 base::android::MethodID::TYPE_STATIC>(
160 env, TestJni_clazz(env), 162 env, TestJni_clazz(env),
161 "openUrl", 163 "openUrl",
162 164
163 "(" 165 "("
164 "Ljava/lang/String;" 166 "Ljava/lang/String;"
165 ")" 167 ")"
166 "Ljava/io/InputStream;", 168 "Ljava/io/InputStream;",
167 &g_TestJni_openUrl); 169 &g_TestJni_openUrl);
168 170
169 jobject ret = 171 jobject ret =
170 env->CallStaticObjectMethod(TestJni_clazz(env), 172 env->CallStaticObjectMethod(TestJni_clazz(env),
171 method_id, url); 173 method_id, url);
172 jni_generator::CheckException(env); 174 jni_generator::CheckException(env);
173 return ScopedJavaLocalRef<jobject>(env, ret); 175 return base::android::ScopedJavaLocalRef<jobject>(env, ret);
174 } 176 }
175 177
176 static base::subtle::AtomicWord g_TestJni_activateHardwareAcceleration = 0; 178 static base::subtle::AtomicWord g_TestJni_activateHardwareAcceleration = 0;
177 static void Java_TestJni_activateHardwareAcceleration(JNIEnv* env, jobject obj, 179 static void Java_TestJni_activateHardwareAcceleration(JNIEnv* env, jobject obj,
178 jboolean activated, 180 jboolean activated,
179 JniIntWrapper iPid, 181 JniIntWrapper iPid,
180 JniIntWrapper iType, 182 JniIntWrapper iType,
181 JniIntWrapper iPrimaryID, 183 JniIntWrapper iPrimaryID,
182 JniIntWrapper iSecondaryID) { 184 JniIntWrapper iSecondaryID) {
183 /* Must call RegisterNativesImpl() */ 185 /* Must call RegisterNativesImpl() */
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 ")" 225 ")"
224 "V", 226 "V",
225 &g_TestJni_uncheckedCall); 227 &g_TestJni_uncheckedCall);
226 228
227 env->CallVoidMethod(obj, 229 env->CallVoidMethod(obj,
228 method_id, as_jint(iParam)); 230 method_id, as_jint(iParam));
229 231
230 } 232 }
231 233
232 static base::subtle::AtomicWord g_TestJni_returnByteArray = 0; 234 static base::subtle::AtomicWord g_TestJni_returnByteArray = 0;
233 static ScopedJavaLocalRef<jbyteArray> Java_TestJni_returnByteArray(JNIEnv* env, 235 static base::android::ScopedJavaLocalRef<jbyteArray>
234 jobject obj) { 236 Java_TestJni_returnByteArray(JNIEnv* env, jobject obj) {
235 /* Must call RegisterNativesImpl() */ 237 /* Must call RegisterNativesImpl() */
236 CHECK_CLAZZ(env, obj, 238 CHECK_CLAZZ(env, obj,
237 TestJni_clazz(env), NULL); 239 TestJni_clazz(env), NULL);
238 jmethodID method_id = 240 jmethodID method_id =
239 base::android::MethodID::LazyGet< 241 base::android::MethodID::LazyGet<
240 base::android::MethodID::TYPE_INSTANCE>( 242 base::android::MethodID::TYPE_INSTANCE>(
241 env, TestJni_clazz(env), 243 env, TestJni_clazz(env),
242 "returnByteArray", 244 "returnByteArray",
243 245
244 "(" 246 "("
245 ")" 247 ")"
246 "[B", 248 "[B",
247 &g_TestJni_returnByteArray); 249 &g_TestJni_returnByteArray);
248 250
249 jbyteArray ret = 251 jbyteArray ret =
250 static_cast<jbyteArray>(env->CallObjectMethod(obj, 252 static_cast<jbyteArray>(env->CallObjectMethod(obj,
251 method_id)); 253 method_id));
252 jni_generator::CheckException(env); 254 jni_generator::CheckException(env);
253 return ScopedJavaLocalRef<jbyteArray>(env, ret); 255 return base::android::ScopedJavaLocalRef<jbyteArray>(env, ret);
254 } 256 }
255 257
256 static base::subtle::AtomicWord g_TestJni_returnBooleanArray = 0; 258 static base::subtle::AtomicWord g_TestJni_returnBooleanArray = 0;
257 static ScopedJavaLocalRef<jbooleanArray> Java_TestJni_returnBooleanArray(JNIEnv* 259 static base::android::ScopedJavaLocalRef<jbooleanArray>
258 env, jobject obj) { 260 Java_TestJni_returnBooleanArray(JNIEnv* env, jobject obj) {
259 /* Must call RegisterNativesImpl() */ 261 /* Must call RegisterNativesImpl() */
260 CHECK_CLAZZ(env, obj, 262 CHECK_CLAZZ(env, obj,
261 TestJni_clazz(env), NULL); 263 TestJni_clazz(env), NULL);
262 jmethodID method_id = 264 jmethodID method_id =
263 base::android::MethodID::LazyGet< 265 base::android::MethodID::LazyGet<
264 base::android::MethodID::TYPE_INSTANCE>( 266 base::android::MethodID::TYPE_INSTANCE>(
265 env, TestJni_clazz(env), 267 env, TestJni_clazz(env),
266 "returnBooleanArray", 268 "returnBooleanArray",
267 269
268 "(" 270 "("
269 ")" 271 ")"
270 "[Z", 272 "[Z",
271 &g_TestJni_returnBooleanArray); 273 &g_TestJni_returnBooleanArray);
272 274
273 jbooleanArray ret = 275 jbooleanArray ret =
274 static_cast<jbooleanArray>(env->CallObjectMethod(obj, 276 static_cast<jbooleanArray>(env->CallObjectMethod(obj,
275 method_id)); 277 method_id));
276 jni_generator::CheckException(env); 278 jni_generator::CheckException(env);
277 return ScopedJavaLocalRef<jbooleanArray>(env, ret); 279 return base::android::ScopedJavaLocalRef<jbooleanArray>(env, ret);
278 } 280 }
279 281
280 static base::subtle::AtomicWord g_TestJni_returnCharArray = 0; 282 static base::subtle::AtomicWord g_TestJni_returnCharArray = 0;
281 static ScopedJavaLocalRef<jcharArray> Java_TestJni_returnCharArray(JNIEnv* env, 283 static base::android::ScopedJavaLocalRef<jcharArray>
282 jobject obj) { 284 Java_TestJni_returnCharArray(JNIEnv* env, jobject obj) {
283 /* Must call RegisterNativesImpl() */ 285 /* Must call RegisterNativesImpl() */
284 CHECK_CLAZZ(env, obj, 286 CHECK_CLAZZ(env, obj,
285 TestJni_clazz(env), NULL); 287 TestJni_clazz(env), NULL);
286 jmethodID method_id = 288 jmethodID method_id =
287 base::android::MethodID::LazyGet< 289 base::android::MethodID::LazyGet<
288 base::android::MethodID::TYPE_INSTANCE>( 290 base::android::MethodID::TYPE_INSTANCE>(
289 env, TestJni_clazz(env), 291 env, TestJni_clazz(env),
290 "returnCharArray", 292 "returnCharArray",
291 293
292 "(" 294 "("
293 ")" 295 ")"
294 "[C", 296 "[C",
295 &g_TestJni_returnCharArray); 297 &g_TestJni_returnCharArray);
296 298
297 jcharArray ret = 299 jcharArray ret =
298 static_cast<jcharArray>(env->CallObjectMethod(obj, 300 static_cast<jcharArray>(env->CallObjectMethod(obj,
299 method_id)); 301 method_id));
300 jni_generator::CheckException(env); 302 jni_generator::CheckException(env);
301 return ScopedJavaLocalRef<jcharArray>(env, ret); 303 return base::android::ScopedJavaLocalRef<jcharArray>(env, ret);
302 } 304 }
303 305
304 static base::subtle::AtomicWord g_TestJni_returnShortArray = 0; 306 static base::subtle::AtomicWord g_TestJni_returnShortArray = 0;
305 static ScopedJavaLocalRef<jshortArray> Java_TestJni_returnShortArray(JNIEnv* 307 static base::android::ScopedJavaLocalRef<jshortArray>
306 env, jobject obj) { 308 Java_TestJni_returnShortArray(JNIEnv* env, jobject obj) {
307 /* Must call RegisterNativesImpl() */ 309 /* Must call RegisterNativesImpl() */
308 CHECK_CLAZZ(env, obj, 310 CHECK_CLAZZ(env, obj,
309 TestJni_clazz(env), NULL); 311 TestJni_clazz(env), NULL);
310 jmethodID method_id = 312 jmethodID method_id =
311 base::android::MethodID::LazyGet< 313 base::android::MethodID::LazyGet<
312 base::android::MethodID::TYPE_INSTANCE>( 314 base::android::MethodID::TYPE_INSTANCE>(
313 env, TestJni_clazz(env), 315 env, TestJni_clazz(env),
314 "returnShortArray", 316 "returnShortArray",
315 317
316 "(" 318 "("
317 ")" 319 ")"
318 "[S", 320 "[S",
319 &g_TestJni_returnShortArray); 321 &g_TestJni_returnShortArray);
320 322
321 jshortArray ret = 323 jshortArray ret =
322 static_cast<jshortArray>(env->CallObjectMethod(obj, 324 static_cast<jshortArray>(env->CallObjectMethod(obj,
323 method_id)); 325 method_id));
324 jni_generator::CheckException(env); 326 jni_generator::CheckException(env);
325 return ScopedJavaLocalRef<jshortArray>(env, ret); 327 return base::android::ScopedJavaLocalRef<jshortArray>(env, ret);
326 } 328 }
327 329
328 static base::subtle::AtomicWord g_TestJni_returnIntArray = 0; 330 static base::subtle::AtomicWord g_TestJni_returnIntArray = 0;
329 static ScopedJavaLocalRef<jintArray> Java_TestJni_returnIntArray(JNIEnv* env, 331 static base::android::ScopedJavaLocalRef<jintArray>
330 jobject obj) { 332 Java_TestJni_returnIntArray(JNIEnv* env, jobject obj) {
331 /* Must call RegisterNativesImpl() */ 333 /* Must call RegisterNativesImpl() */
332 CHECK_CLAZZ(env, obj, 334 CHECK_CLAZZ(env, obj,
333 TestJni_clazz(env), NULL); 335 TestJni_clazz(env), NULL);
334 jmethodID method_id = 336 jmethodID method_id =
335 base::android::MethodID::LazyGet< 337 base::android::MethodID::LazyGet<
336 base::android::MethodID::TYPE_INSTANCE>( 338 base::android::MethodID::TYPE_INSTANCE>(
337 env, TestJni_clazz(env), 339 env, TestJni_clazz(env),
338 "returnIntArray", 340 "returnIntArray",
339 341
340 "(" 342 "("
341 ")" 343 ")"
342 "[I", 344 "[I",
343 &g_TestJni_returnIntArray); 345 &g_TestJni_returnIntArray);
344 346
345 jintArray ret = 347 jintArray ret =
346 static_cast<jintArray>(env->CallObjectMethod(obj, 348 static_cast<jintArray>(env->CallObjectMethod(obj,
347 method_id)); 349 method_id));
348 jni_generator::CheckException(env); 350 jni_generator::CheckException(env);
349 return ScopedJavaLocalRef<jintArray>(env, ret); 351 return base::android::ScopedJavaLocalRef<jintArray>(env, ret);
350 } 352 }
351 353
352 static base::subtle::AtomicWord g_TestJni_returnLongArray = 0; 354 static base::subtle::AtomicWord g_TestJni_returnLongArray = 0;
353 static ScopedJavaLocalRef<jlongArray> Java_TestJni_returnLongArray(JNIEnv* env, 355 static base::android::ScopedJavaLocalRef<jlongArray>
354 jobject obj) { 356 Java_TestJni_returnLongArray(JNIEnv* env, jobject obj) {
355 /* Must call RegisterNativesImpl() */ 357 /* Must call RegisterNativesImpl() */
356 CHECK_CLAZZ(env, obj, 358 CHECK_CLAZZ(env, obj,
357 TestJni_clazz(env), NULL); 359 TestJni_clazz(env), NULL);
358 jmethodID method_id = 360 jmethodID method_id =
359 base::android::MethodID::LazyGet< 361 base::android::MethodID::LazyGet<
360 base::android::MethodID::TYPE_INSTANCE>( 362 base::android::MethodID::TYPE_INSTANCE>(
361 env, TestJni_clazz(env), 363 env, TestJni_clazz(env),
362 "returnLongArray", 364 "returnLongArray",
363 365
364 "(" 366 "("
365 ")" 367 ")"
366 "[J", 368 "[J",
367 &g_TestJni_returnLongArray); 369 &g_TestJni_returnLongArray);
368 370
369 jlongArray ret = 371 jlongArray ret =
370 static_cast<jlongArray>(env->CallObjectMethod(obj, 372 static_cast<jlongArray>(env->CallObjectMethod(obj,
371 method_id)); 373 method_id));
372 jni_generator::CheckException(env); 374 jni_generator::CheckException(env);
373 return ScopedJavaLocalRef<jlongArray>(env, ret); 375 return base::android::ScopedJavaLocalRef<jlongArray>(env, ret);
374 } 376 }
375 377
376 static base::subtle::AtomicWord g_TestJni_returnDoubleArray = 0; 378 static base::subtle::AtomicWord g_TestJni_returnDoubleArray = 0;
377 static ScopedJavaLocalRef<jdoubleArray> Java_TestJni_returnDoubleArray(JNIEnv* 379 static base::android::ScopedJavaLocalRef<jdoubleArray>
378 env, jobject obj) { 380 Java_TestJni_returnDoubleArray(JNIEnv* env, jobject obj) {
379 /* Must call RegisterNativesImpl() */ 381 /* Must call RegisterNativesImpl() */
380 CHECK_CLAZZ(env, obj, 382 CHECK_CLAZZ(env, obj,
381 TestJni_clazz(env), NULL); 383 TestJni_clazz(env), NULL);
382 jmethodID method_id = 384 jmethodID method_id =
383 base::android::MethodID::LazyGet< 385 base::android::MethodID::LazyGet<
384 base::android::MethodID::TYPE_INSTANCE>( 386 base::android::MethodID::TYPE_INSTANCE>(
385 env, TestJni_clazz(env), 387 env, TestJni_clazz(env),
386 "returnDoubleArray", 388 "returnDoubleArray",
387 389
388 "(" 390 "("
389 ")" 391 ")"
390 "[D", 392 "[D",
391 &g_TestJni_returnDoubleArray); 393 &g_TestJni_returnDoubleArray);
392 394
393 jdoubleArray ret = 395 jdoubleArray ret =
394 static_cast<jdoubleArray>(env->CallObjectMethod(obj, 396 static_cast<jdoubleArray>(env->CallObjectMethod(obj,
395 method_id)); 397 method_id));
396 jni_generator::CheckException(env); 398 jni_generator::CheckException(env);
397 return ScopedJavaLocalRef<jdoubleArray>(env, ret); 399 return base::android::ScopedJavaLocalRef<jdoubleArray>(env, ret);
398 } 400 }
399 401
400 static base::subtle::AtomicWord g_TestJni_returnObjectArray = 0; 402 static base::subtle::AtomicWord g_TestJni_returnObjectArray = 0;
401 static ScopedJavaLocalRef<jobjectArray> Java_TestJni_returnObjectArray(JNIEnv* 403 static base::android::ScopedJavaLocalRef<jobjectArray>
402 env, jobject obj) { 404 Java_TestJni_returnObjectArray(JNIEnv* env, jobject obj) {
403 /* Must call RegisterNativesImpl() */ 405 /* Must call RegisterNativesImpl() */
404 CHECK_CLAZZ(env, obj, 406 CHECK_CLAZZ(env, obj,
405 TestJni_clazz(env), NULL); 407 TestJni_clazz(env), NULL);
406 jmethodID method_id = 408 jmethodID method_id =
407 base::android::MethodID::LazyGet< 409 base::android::MethodID::LazyGet<
408 base::android::MethodID::TYPE_INSTANCE>( 410 base::android::MethodID::TYPE_INSTANCE>(
409 env, TestJni_clazz(env), 411 env, TestJni_clazz(env),
410 "returnObjectArray", 412 "returnObjectArray",
411 413
412 "(" 414 "("
413 ")" 415 ")"
414 "[Ljava/lang/Object;", 416 "[Ljava/lang/Object;",
415 &g_TestJni_returnObjectArray); 417 &g_TestJni_returnObjectArray);
416 418
417 jobjectArray ret = 419 jobjectArray ret =
418 static_cast<jobjectArray>(env->CallObjectMethod(obj, 420 static_cast<jobjectArray>(env->CallObjectMethod(obj,
419 method_id)); 421 method_id));
420 jni_generator::CheckException(env); 422 jni_generator::CheckException(env);
421 return ScopedJavaLocalRef<jobjectArray>(env, ret); 423 return base::android::ScopedJavaLocalRef<jobjectArray>(env, ret);
422 } 424 }
423 425
424 static base::subtle::AtomicWord g_TestJni_returnArrayOfByteArray = 0; 426 static base::subtle::AtomicWord g_TestJni_returnArrayOfByteArray = 0;
425 static ScopedJavaLocalRef<jobjectArray> 427 static base::android::ScopedJavaLocalRef<jobjectArray>
426 Java_TestJni_returnArrayOfByteArray(JNIEnv* env, jobject obj) { 428 Java_TestJni_returnArrayOfByteArray(JNIEnv* env, jobject obj) {
427 /* Must call RegisterNativesImpl() */ 429 /* Must call RegisterNativesImpl() */
428 CHECK_CLAZZ(env, obj, 430 CHECK_CLAZZ(env, obj,
429 TestJni_clazz(env), NULL); 431 TestJni_clazz(env), NULL);
430 jmethodID method_id = 432 jmethodID method_id =
431 base::android::MethodID::LazyGet< 433 base::android::MethodID::LazyGet<
432 base::android::MethodID::TYPE_INSTANCE>( 434 base::android::MethodID::TYPE_INSTANCE>(
433 env, TestJni_clazz(env), 435 env, TestJni_clazz(env),
434 "returnArrayOfByteArray", 436 "returnArrayOfByteArray",
435 437
436 "(" 438 "("
437 ")" 439 ")"
438 "[[B", 440 "[[B",
439 &g_TestJni_returnArrayOfByteArray); 441 &g_TestJni_returnArrayOfByteArray);
440 442
441 jobjectArray ret = 443 jobjectArray ret =
442 static_cast<jobjectArray>(env->CallObjectMethod(obj, 444 static_cast<jobjectArray>(env->CallObjectMethod(obj,
443 method_id)); 445 method_id));
444 jni_generator::CheckException(env); 446 jni_generator::CheckException(env);
445 return ScopedJavaLocalRef<jobjectArray>(env, ret); 447 return base::android::ScopedJavaLocalRef<jobjectArray>(env, ret);
446 } 448 }
447 449
448 static base::subtle::AtomicWord g_TestJni_getCompressFormat = 0; 450 static base::subtle::AtomicWord g_TestJni_getCompressFormat = 0;
449 static ScopedJavaLocalRef<jobject> Java_TestJni_getCompressFormat(JNIEnv* env, 451 static base::android::ScopedJavaLocalRef<jobject>
450 jobject obj) { 452 Java_TestJni_getCompressFormat(JNIEnv* env, jobject obj) {
451 /* Must call RegisterNativesImpl() */ 453 /* Must call RegisterNativesImpl() */
452 CHECK_CLAZZ(env, obj, 454 CHECK_CLAZZ(env, obj,
453 TestJni_clazz(env), NULL); 455 TestJni_clazz(env), NULL);
454 jmethodID method_id = 456 jmethodID method_id =
455 base::android::MethodID::LazyGet< 457 base::android::MethodID::LazyGet<
456 base::android::MethodID::TYPE_INSTANCE>( 458 base::android::MethodID::TYPE_INSTANCE>(
457 env, TestJni_clazz(env), 459 env, TestJni_clazz(env),
458 "getCompressFormat", 460 "getCompressFormat",
459 461
460 "(" 462 "("
461 ")" 463 ")"
462 "Landroid/graphics/Bitmap$CompressFormat;", 464 "Landroid/graphics/Bitmap$CompressFormat;",
463 &g_TestJni_getCompressFormat); 465 &g_TestJni_getCompressFormat);
464 466
465 jobject ret = 467 jobject ret =
466 env->CallObjectMethod(obj, 468 env->CallObjectMethod(obj,
467 method_id); 469 method_id);
468 jni_generator::CheckException(env); 470 jni_generator::CheckException(env);
469 return ScopedJavaLocalRef<jobject>(env, ret); 471 return base::android::ScopedJavaLocalRef<jobject>(env, ret);
470 } 472 }
471 473
472 static base::subtle::AtomicWord g_TestJni_getCompressFormatList = 0; 474 static base::subtle::AtomicWord g_TestJni_getCompressFormatList = 0;
473 static ScopedJavaLocalRef<jobject> Java_TestJni_getCompressFormatList(JNIEnv* 475 static base::android::ScopedJavaLocalRef<jobject>
474 env, jobject obj) { 476 Java_TestJni_getCompressFormatList(JNIEnv* env, jobject obj) {
475 /* Must call RegisterNativesImpl() */ 477 /* Must call RegisterNativesImpl() */
476 CHECK_CLAZZ(env, obj, 478 CHECK_CLAZZ(env, obj,
477 TestJni_clazz(env), NULL); 479 TestJni_clazz(env), NULL);
478 jmethodID method_id = 480 jmethodID method_id =
479 base::android::MethodID::LazyGet< 481 base::android::MethodID::LazyGet<
480 base::android::MethodID::TYPE_INSTANCE>( 482 base::android::MethodID::TYPE_INSTANCE>(
481 env, TestJni_clazz(env), 483 env, TestJni_clazz(env),
482 "getCompressFormatList", 484 "getCompressFormatList",
483 485
484 "(" 486 "("
485 ")" 487 ")"
486 "Ljava/util/List;", 488 "Ljava/util/List;",
487 &g_TestJni_getCompressFormatList); 489 &g_TestJni_getCompressFormatList);
488 490
489 jobject ret = 491 jobject ret =
490 env->CallObjectMethod(obj, 492 env->CallObjectMethod(obj,
491 method_id); 493 method_id);
492 jni_generator::CheckException(env); 494 jni_generator::CheckException(env);
493 return ScopedJavaLocalRef<jobject>(env, ret); 495 return base::android::ScopedJavaLocalRef<jobject>(env, ret);
494 } 496 }
495 497
496 // Step 3: RegisterNatives. 498 // Step 3: RegisterNatives.
497 499
498 static bool RegisterNativesImpl(JNIEnv* env) { 500 static bool RegisterNativesImpl(JNIEnv* env) {
499 501
500 g_TestJni_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( 502 g_TestJni_clazz = reinterpret_cast<jclass>(env->NewGlobalRef(
501 base::android::GetClass(env, kTestJniClassPath).obj())); 503 base::android::GetClass(env, kTestJniClassPath).obj()));
502 g_InfoBar_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( 504 g_InfoBar_clazz = reinterpret_cast<jclass>(env->NewGlobalRef(
503 base::android::GetClass(env, kInfoBarClassPath).obj())); 505 base::android::GetClass(env, kInfoBarClassPath).obj()));
504 506
505 return true; 507 return true;
506 } 508 }
507 509
508 #endif // org_chromium_TestJni_JNI 510 #endif // org_chromium_TestJni_JNI
OLDNEW
« no previous file with comments | « base/android/jni_generator/sample_for_tests.cc ('k') | base/android/jni_generator/testConstantsFromJavaP.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698