| OLD | NEW |
| 1 // Copyright (c) 2012 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 |
| 11 #define org_chromium_TestJni_JNI | 11 #define org_chromium_TestJni_JNI |
| 12 | 12 |
| 13 #include <jni.h> | 13 #include <jni.h> |
| 14 | 14 |
| 15 #include "base/android/jni_generator/jni_generator_helper.h" | 15 #include "base/android/jni_generator/jni_generator_helper.h" |
| 16 | 16 |
| 17 #include "base/android/jni_int_wrapper.h" | 17 #include "base/android/jni_int_wrapper.h" |
| 18 | 18 |
| 19 // Step 1: forward declarations. | 19 // Step 1: forward declarations. |
| 20 namespace { | 20 namespace { |
| 21 const char kTestJniClassPath[] = "org/chromium/TestJni"; | 21 const char kTestJniClassPath[] = "org/chromium/TestJni"; |
| 22 const char kInfoBarClassPath[] = "org/chromium/TestJni$InfoBar"; | 22 const char kInfoBarClassPath[] = "org/chromium/TestJni$InfoBar"; |
| 23 // Leaking this jclass as we cannot use LazyInstance from some threads. | 23 // Leaking this jclass as we cannot use LazyInstance from some threads. |
| 24 jclass g_TestJni_clazz = NULL; | 24 jclass g_TestJni_clazz = NULL; |
| 25 #define TestJni_clazz(env) g_TestJni_clazz |
| 25 // Leaking this jclass as we cannot use LazyInstance from some threads. | 26 // Leaking this jclass as we cannot use LazyInstance from some threads. |
| 26 jclass g_InfoBar_clazz = NULL; | 27 jclass g_InfoBar_clazz = NULL; |
| 28 #define InfoBar_clazz(env) g_InfoBar_clazz |
| 27 | 29 |
| 28 } // namespace | 30 } // namespace |
| 29 | 31 |
| 30 // Step 2: method stubs. | 32 // Step 2: method stubs. |
| 31 | 33 |
| 32 static base::subtle::AtomicWord g_TestJni_showConfirmInfoBar = 0; | 34 static base::subtle::AtomicWord g_TestJni_showConfirmInfoBar = 0; |
| 33 static base::android::ScopedJavaLocalRef<jobject> | 35 static base::android::ScopedJavaLocalRef<jobject> |
| 34 Java_TestJni_showConfirmInfoBar(JNIEnv* env, jobject obj, JniIntWrapper | 36 Java_TestJni_showConfirmInfoBar(JNIEnv* env, jobject obj, JniIntWrapper |
| 35 nativeInfoBar, | 37 nativeInfoBar, |
| 36 jstring buttonOk, | 38 jstring buttonOk, |
| 37 jstring buttonCancel, | 39 jstring buttonCancel, |
| 38 jstring title, | 40 jstring title, |
| 39 jobject icon) { | 41 jobject icon) { |
| 40 /* Must call RegisterNativesImpl() */ | 42 /* Must call RegisterNativesImpl() */ |
| 41 CHECK_CLAZZ(env, obj, | 43 CHECK_CLAZZ(env, obj, |
| 42 g_TestJni_clazz, NULL); | 44 TestJni_clazz(env), NULL); |
| 43 jmethodID method_id = | 45 jmethodID method_id = |
| 44 base::android::MethodID::LazyGet< | 46 base::android::MethodID::LazyGet< |
| 45 base::android::MethodID::TYPE_INSTANCE>( | 47 base::android::MethodID::TYPE_INSTANCE>( |
| 46 env, g_TestJni_clazz, | 48 env, TestJni_clazz(env), |
| 47 "showConfirmInfoBar", | 49 "showConfirmInfoBar", |
| 48 | 50 |
| 49 "(" | 51 "(" |
| 50 "I" | 52 "I" |
| 51 "Ljava/lang/String;" | 53 "Ljava/lang/String;" |
| 52 "Ljava/lang/String;" | 54 "Ljava/lang/String;" |
| 53 "Ljava/lang/String;" | 55 "Ljava/lang/String;" |
| 54 "Landroid/graphics/Bitmap;" | 56 "Landroid/graphics/Bitmap;" |
| 55 ")" | 57 ")" |
| 56 "Lorg/chromium/Foo$InnerClass;", | 58 "Lorg/chromium/Foo$InnerClass;", |
| 57 &g_TestJni_showConfirmInfoBar); | 59 &g_TestJni_showConfirmInfoBar); |
| 58 | 60 |
| 59 jobject ret = | 61 jobject ret = |
| 60 env->CallObjectMethod(obj, | 62 env->CallObjectMethod(obj, |
| 61 method_id, as_jint(nativeInfoBar), buttonOk, buttonCancel, title, | 63 method_id, as_jint(nativeInfoBar), buttonOk, buttonCancel, title, |
| 62 icon); | 64 icon); |
| 63 jni_generator::CheckException(env); | 65 jni_generator::CheckException(env); |
| 64 return base::android::ScopedJavaLocalRef<jobject>(env, ret); | 66 return base::android::ScopedJavaLocalRef<jobject>(env, ret); |
| 65 } | 67 } |
| 66 | 68 |
| 67 static base::subtle::AtomicWord g_TestJni_showAutoLoginInfoBar = 0; | 69 static base::subtle::AtomicWord g_TestJni_showAutoLoginInfoBar = 0; |
| 68 static base::android::ScopedJavaLocalRef<jobject> | 70 static base::android::ScopedJavaLocalRef<jobject> |
| 69 Java_TestJni_showAutoLoginInfoBar(JNIEnv* env, jobject obj, JniIntWrapper | 71 Java_TestJni_showAutoLoginInfoBar(JNIEnv* env, jobject obj, JniIntWrapper |
| 70 nativeInfoBar, | 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 g_TestJni_clazz, 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, g_TestJni_clazz, | 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 base::android::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 g_InfoBar_clazz); | 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>( |
| 107 env, g_InfoBar_clazz, | 109 env, InfoBar_clazz(env), |
| 108 "dismiss", | 110 "dismiss", |
| 109 | 111 |
| 110 "(" | 112 "(" |
| 111 ")" | 113 ")" |
| 112 "V", | 114 "V", |
| 113 &g_InfoBar_dismiss); | 115 &g_InfoBar_dismiss); |
| 114 | 116 |
| 115 env->CallVoidMethod(obj, | 117 env->CallVoidMethod(obj, |
| 116 method_id); | 118 method_id); |
| 117 jni_generator::CheckException(env); | 119 jni_generator::CheckException(env); |
| 118 | 120 |
| 119 } | 121 } |
| 120 | 122 |
| 121 static base::subtle::AtomicWord g_TestJni_shouldShowAutoLogin = 0; | 123 static base::subtle::AtomicWord g_TestJni_shouldShowAutoLogin = 0; |
| 122 static jboolean Java_TestJni_shouldShowAutoLogin(JNIEnv* env, jobject view, | 124 static jboolean Java_TestJni_shouldShowAutoLogin(JNIEnv* env, jobject view, |
| 123 jstring realm, | 125 jstring realm, |
| 124 jstring account, | 126 jstring account, |
| 125 jstring args) { | 127 jstring args) { |
| 126 /* Must call RegisterNativesImpl() */ | 128 /* Must call RegisterNativesImpl() */ |
| 127 CHECK_CLAZZ(env, g_TestJni_clazz, | 129 CHECK_CLAZZ(env, TestJni_clazz(env), |
| 128 g_TestJni_clazz, false); | 130 TestJni_clazz(env), false); |
| 129 jmethodID method_id = | 131 jmethodID method_id = |
| 130 base::android::MethodID::LazyGet< | 132 base::android::MethodID::LazyGet< |
| 131 base::android::MethodID::TYPE_STATIC>( | 133 base::android::MethodID::TYPE_STATIC>( |
| 132 env, g_TestJni_clazz, | 134 env, TestJni_clazz(env), |
| 133 "shouldShowAutoLogin", | 135 "shouldShowAutoLogin", |
| 134 | 136 |
| 135 "(" | 137 "(" |
| 136 "Landroid/view/View;" | 138 "Landroid/view/View;" |
| 137 "Ljava/lang/String;" | 139 "Ljava/lang/String;" |
| 138 "Ljava/lang/String;" | 140 "Ljava/lang/String;" |
| 139 "Ljava/lang/String;" | 141 "Ljava/lang/String;" |
| 140 ")" | 142 ")" |
| 141 "Z", | 143 "Z", |
| 142 &g_TestJni_shouldShowAutoLogin); | 144 &g_TestJni_shouldShowAutoLogin); |
| 143 | 145 |
| 144 jboolean ret = | 146 jboolean ret = |
| 145 env->CallStaticBooleanMethod(g_TestJni_clazz, | 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 base::android::ScopedJavaLocalRef<jobject> Java_TestJni_openUrl(JNIEnv* | 154 static base::android::ScopedJavaLocalRef<jobject> Java_TestJni_openUrl(JNIEnv* |
| 153 env, jstring url) { | 155 env, jstring url) { |
| 154 /* Must call RegisterNativesImpl() */ | 156 /* Must call RegisterNativesImpl() */ |
| 155 CHECK_CLAZZ(env, g_TestJni_clazz, | 157 CHECK_CLAZZ(env, TestJni_clazz(env), |
| 156 g_TestJni_clazz, 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, g_TestJni_clazz, | 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(g_TestJni_clazz, | 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 base::android::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() */ |
| 184 CHECK_CLAZZ(env, obj, | 186 CHECK_CLAZZ(env, obj, |
| 185 g_TestJni_clazz); | 187 TestJni_clazz(env)); |
| 186 jmethodID method_id = | 188 jmethodID method_id = |
| 187 base::android::MethodID::LazyGet< | 189 base::android::MethodID::LazyGet< |
| 188 base::android::MethodID::TYPE_INSTANCE>( | 190 base::android::MethodID::TYPE_INSTANCE>( |
| 189 env, g_TestJni_clazz, | 191 env, TestJni_clazz(env), |
| 190 "activateHardwareAcceleration", | 192 "activateHardwareAcceleration", |
| 191 | 193 |
| 192 "(" | 194 "(" |
| 193 "Z" | 195 "Z" |
| 194 "I" | 196 "I" |
| 195 "I" | 197 "I" |
| 196 "I" | 198 "I" |
| 197 "I" | 199 "I" |
| 198 ")" | 200 ")" |
| 199 "V", | 201 "V", |
| 200 &g_TestJni_activateHardwareAcceleration); | 202 &g_TestJni_activateHardwareAcceleration); |
| 201 | 203 |
| 202 env->CallVoidMethod(obj, | 204 env->CallVoidMethod(obj, |
| 203 method_id, activated, as_jint(iPid), as_jint(iType), | 205 method_id, activated, as_jint(iPid), as_jint(iType), |
| 204 as_jint(iPrimaryID), as_jint(iSecondaryID)); | 206 as_jint(iPrimaryID), as_jint(iSecondaryID)); |
| 205 jni_generator::CheckException(env); | 207 jni_generator::CheckException(env); |
| 206 | 208 |
| 207 } | 209 } |
| 208 | 210 |
| 209 static base::subtle::AtomicWord g_TestJni_uncheckedCall = 0; | 211 static base::subtle::AtomicWord g_TestJni_uncheckedCall = 0; |
| 210 static void Java_TestJni_uncheckedCall(JNIEnv* env, jobject obj, JniIntWrapper | 212 static void Java_TestJni_uncheckedCall(JNIEnv* env, jobject obj, JniIntWrapper |
| 211 iParam) { | 213 iParam) { |
| 212 /* Must call RegisterNativesImpl() */ | 214 /* Must call RegisterNativesImpl() */ |
| 213 CHECK_CLAZZ(env, obj, | 215 CHECK_CLAZZ(env, obj, |
| 214 g_TestJni_clazz); | 216 TestJni_clazz(env)); |
| 215 jmethodID method_id = | 217 jmethodID method_id = |
| 216 base::android::MethodID::LazyGet< | 218 base::android::MethodID::LazyGet< |
| 217 base::android::MethodID::TYPE_INSTANCE>( | 219 base::android::MethodID::TYPE_INSTANCE>( |
| 218 env, g_TestJni_clazz, | 220 env, TestJni_clazz(env), |
| 219 "uncheckedCall", | 221 "uncheckedCall", |
| 220 | 222 |
| 221 "(" | 223 "(" |
| 222 "I" | 224 "I" |
| 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 base::android::ScopedJavaLocalRef<jbyteArray> | 235 static base::android::ScopedJavaLocalRef<jbyteArray> |
| 234 Java_TestJni_returnByteArray(JNIEnv* env, 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 g_TestJni_clazz, 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, g_TestJni_clazz, | 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 base::android::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 base::android::ScopedJavaLocalRef<jbooleanArray> | 259 static base::android::ScopedJavaLocalRef<jbooleanArray> |
| 258 Java_TestJni_returnBooleanArray(JNIEnv* 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 g_TestJni_clazz, 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, g_TestJni_clazz, | 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 base::android::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 base::android::ScopedJavaLocalRef<jcharArray> | 283 static base::android::ScopedJavaLocalRef<jcharArray> |
| 282 Java_TestJni_returnCharArray(JNIEnv* env, 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 g_TestJni_clazz, 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, g_TestJni_clazz, | 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 base::android::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 base::android::ScopedJavaLocalRef<jshortArray> | 307 static base::android::ScopedJavaLocalRef<jshortArray> |
| 306 Java_TestJni_returnShortArray(JNIEnv* 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 g_TestJni_clazz, 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, g_TestJni_clazz, | 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 base::android::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 base::android::ScopedJavaLocalRef<jintArray> | 331 static base::android::ScopedJavaLocalRef<jintArray> |
| 330 Java_TestJni_returnIntArray(JNIEnv* env, 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 g_TestJni_clazz, 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, g_TestJni_clazz, | 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 base::android::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 base::android::ScopedJavaLocalRef<jlongArray> | 355 static base::android::ScopedJavaLocalRef<jlongArray> |
| 354 Java_TestJni_returnLongArray(JNIEnv* env, 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 g_TestJni_clazz, 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, g_TestJni_clazz, | 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 base::android::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 base::android::ScopedJavaLocalRef<jdoubleArray> | 379 static base::android::ScopedJavaLocalRef<jdoubleArray> |
| 378 Java_TestJni_returnDoubleArray(JNIEnv* 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 g_TestJni_clazz, 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, g_TestJni_clazz, | 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 base::android::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 base::android::ScopedJavaLocalRef<jobjectArray> | 403 static base::android::ScopedJavaLocalRef<jobjectArray> |
| 402 Java_TestJni_returnObjectArray(JNIEnv* 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 g_TestJni_clazz, 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, g_TestJni_clazz, | 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 base::android::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 base::android::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 g_TestJni_clazz, 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, g_TestJni_clazz, | 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 base::android::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 base::android::ScopedJavaLocalRef<jobject> | 451 static base::android::ScopedJavaLocalRef<jobject> |
| 450 Java_TestJni_getCompressFormat(JNIEnv* env, 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 g_TestJni_clazz, 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, g_TestJni_clazz, | 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 base::android::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 base::android::ScopedJavaLocalRef<jobject> | 475 static base::android::ScopedJavaLocalRef<jobject> |
| 474 Java_TestJni_getCompressFormatList(JNIEnv* 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 g_TestJni_clazz, 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, g_TestJni_clazz, | 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 base::android::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 g_TestJni_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( | 501 g_TestJni_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( |
| 500 base::android::GetClass(env, kTestJniClassPath).obj())); | 502 base::android::GetClass(env, kTestJniClassPath).obj())); |
| 501 g_InfoBar_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( | 503 g_InfoBar_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( |
| 502 base::android::GetClass(env, kInfoBarClassPath).obj())); | 504 base::android::GetClass(env, kInfoBarClassPath).obj())); |
| 503 | 505 |
| 504 return true; | 506 return true; |
| 505 } | 507 } |
| 506 | 508 |
| 507 #endif // org_chromium_TestJni_JNI | 509 #endif // org_chromium_TestJni_JNI |
| OLD | NEW |