OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_android.h" | 15 #include "base/android/jni_generator/jni_generator_helper.h" |
16 #include "base/android/scoped_java_ref.h" | |
17 #include "base/basictypes.h" | |
18 #include "base/logging.h" | |
19 | |
20 using base::android::ScopedJavaLocalRef; | |
21 | 16 |
22 // Step 1: forward declarations. | 17 // Step 1: forward declarations. |
23 namespace { | 18 namespace { |
24 const char kTestJniClassPath[] = "org/chromium/TestJni"; | 19 const char kTestJniClassPath[] = "org/chromium/TestJni"; |
25 const char kInfoBarClassPath[] = "org/chromium/TestJni$InfoBar"; | 20 const char kInfoBarClassPath[] = "org/chromium/TestJni$InfoBar"; |
26 // Leaking this jclass as we cannot use LazyInstance from some threads. | 21 // Leaking this jclass as we cannot use LazyInstance from some threads. |
27 jclass g_TestJni_clazz = NULL; | 22 jclass g_TestJni_clazz = NULL; |
28 // Leaking this jclass as we cannot use LazyInstance from some threads. | 23 // Leaking this jclass as we cannot use LazyInstance from some threads. |
29 jclass g_InfoBar_clazz = NULL; | 24 jclass g_InfoBar_clazz = NULL; |
| 25 |
30 } // namespace | 26 } // namespace |
31 | 27 |
32 // Step 2: method stubs. | 28 // Step 2: method stubs. |
33 | 29 |
34 static base::subtle::AtomicWord g_TestJni_showConfirmInfoBar = 0; | 30 static base::subtle::AtomicWord g_TestJni_showConfirmInfoBar = 0; |
35 static ScopedJavaLocalRef<jobject> Java_TestJni_showConfirmInfoBar(JNIEnv* env, | 31 static base::android::ScopedJavaLocalRef<jobject> |
36 jobject obj, jint nativeInfoBar, | 32 Java_TestJni_showConfirmInfoBar(JNIEnv* env, jobject obj, jint |
| 33 nativeInfoBar, |
37 jstring buttonOk, | 34 jstring buttonOk, |
38 jstring buttonCancel, | 35 jstring buttonCancel, |
39 jstring title, | 36 jstring title, |
40 jobject icon) { | 37 jobject icon) { |
41 /* Must call RegisterNativesImpl() */ | 38 /* Must call RegisterNativesImpl() */ |
42 DCHECK(g_TestJni_clazz); | 39 DCHECK_CLAZZ(g_TestJni_clazz, NULL); |
43 jmethodID method_id = | 40 jmethodID method_id = |
44 base::android::MethodID::LazyGet< | 41 base::android::MethodID::LazyGet< |
45 base::android::MethodID::TYPE_INSTANCE>( | 42 base::android::MethodID::TYPE_INSTANCE>( |
46 env, g_TestJni_clazz, | 43 env, g_TestJni_clazz, |
47 "showConfirmInfoBar", | 44 "showConfirmInfoBar", |
48 | 45 |
49 "(" | 46 "(" |
50 "I" | 47 "I" |
51 "Ljava/lang/String;" | 48 "Ljava/lang/String;" |
52 "Ljava/lang/String;" | 49 "Ljava/lang/String;" |
53 "Ljava/lang/String;" | 50 "Ljava/lang/String;" |
54 "Landroid/graphics/Bitmap;" | 51 "Landroid/graphics/Bitmap;" |
55 ")" | 52 ")" |
56 "Lorg/chromium/Foo$InnerClass;", | 53 "Lorg/chromium/Foo$InnerClass;", |
57 &g_TestJni_showConfirmInfoBar); | 54 &g_TestJni_showConfirmInfoBar); |
58 | 55 |
59 jobject ret = | 56 jobject ret = |
60 env->CallObjectMethod(obj, | 57 env->CallObjectMethod(obj, |
61 method_id, nativeInfoBar, buttonOk, buttonCancel, title, icon); | 58 method_id, nativeInfoBar, buttonOk, buttonCancel, title, icon); |
62 base::android::CheckException(env); | 59 jni_generator::CheckException(env); |
63 return ScopedJavaLocalRef<jobject>(env, ret); | 60 return base::android::ScopedJavaLocalRef<jobject>(env, ret); |
64 } | 61 } |
65 | 62 |
66 static base::subtle::AtomicWord g_TestJni_showAutoLoginInfoBar = 0; | 63 static base::subtle::AtomicWord g_TestJni_showAutoLoginInfoBar = 0; |
67 static ScopedJavaLocalRef<jobject> Java_TestJni_showAutoLoginInfoBar(JNIEnv* | 64 static base::android::ScopedJavaLocalRef<jobject> |
68 env, jobject obj, jint nativeInfoBar, | 65 Java_TestJni_showAutoLoginInfoBar(JNIEnv* env, jobject obj, jint |
| 66 nativeInfoBar, |
69 jstring realm, | 67 jstring realm, |
70 jstring account, | 68 jstring account, |
71 jstring args) { | 69 jstring args) { |
72 /* Must call RegisterNativesImpl() */ | 70 /* Must call RegisterNativesImpl() */ |
73 DCHECK(g_TestJni_clazz); | 71 DCHECK_CLAZZ(g_TestJni_clazz, NULL); |
74 jmethodID method_id = | 72 jmethodID method_id = |
75 base::android::MethodID::LazyGet< | 73 base::android::MethodID::LazyGet< |
76 base::android::MethodID::TYPE_INSTANCE>( | 74 base::android::MethodID::TYPE_INSTANCE>( |
77 env, g_TestJni_clazz, | 75 env, g_TestJni_clazz, |
78 "showAutoLoginInfoBar", | 76 "showAutoLoginInfoBar", |
79 | 77 |
80 "(" | 78 "(" |
81 "I" | 79 "I" |
82 "Ljava/lang/String;" | 80 "Ljava/lang/String;" |
83 "Ljava/lang/String;" | 81 "Ljava/lang/String;" |
84 "Ljava/lang/String;" | 82 "Ljava/lang/String;" |
85 ")" | 83 ")" |
86 "Lorg/chromium/Foo$InnerClass;", | 84 "Lorg/chromium/Foo$InnerClass;", |
87 &g_TestJni_showAutoLoginInfoBar); | 85 &g_TestJni_showAutoLoginInfoBar); |
88 | 86 |
89 jobject ret = | 87 jobject ret = |
90 env->CallObjectMethod(obj, | 88 env->CallObjectMethod(obj, |
91 method_id, nativeInfoBar, realm, account, args); | 89 method_id, nativeInfoBar, realm, account, args); |
92 base::android::CheckException(env); | 90 jni_generator::CheckException(env); |
93 return ScopedJavaLocalRef<jobject>(env, ret); | 91 return base::android::ScopedJavaLocalRef<jobject>(env, ret); |
94 } | 92 } |
95 | 93 |
96 static base::subtle::AtomicWord g_InfoBar_dismiss = 0; | 94 static base::subtle::AtomicWord g_InfoBar_dismiss = 0; |
97 static void Java_InfoBar_dismiss(JNIEnv* env, jobject obj) { | 95 static void Java_InfoBar_dismiss(JNIEnv* env, jobject obj) { |
98 /* Must call RegisterNativesImpl() */ | 96 /* Must call RegisterNativesImpl() */ |
99 DCHECK(g_InfoBar_clazz); | 97 DCHECK_CLAZZ(g_InfoBar_clazz); |
100 jmethodID method_id = | 98 jmethodID method_id = |
101 base::android::MethodID::LazyGet< | 99 base::android::MethodID::LazyGet< |
102 base::android::MethodID::TYPE_INSTANCE>( | 100 base::android::MethodID::TYPE_INSTANCE>( |
103 env, g_InfoBar_clazz, | 101 env, g_InfoBar_clazz, |
104 "dismiss", | 102 "dismiss", |
105 | 103 |
106 "(" | 104 "(" |
107 ")" | 105 ")" |
108 "V", | 106 "V", |
109 &g_InfoBar_dismiss); | 107 &g_InfoBar_dismiss); |
110 | 108 |
111 env->CallVoidMethod(obj, | 109 env->CallVoidMethod(obj, |
112 method_id); | 110 method_id); |
113 base::android::CheckException(env); | 111 jni_generator::CheckException(env); |
114 | 112 |
115 } | 113 } |
116 | 114 |
117 static base::subtle::AtomicWord g_TestJni_shouldShowAutoLogin = 0; | 115 static base::subtle::AtomicWord g_TestJni_shouldShowAutoLogin = 0; |
118 static jboolean Java_TestJni_shouldShowAutoLogin(JNIEnv* env, jobject view, | 116 static jboolean Java_TestJni_shouldShowAutoLogin(JNIEnv* env, jobject view, |
119 jstring realm, | 117 jstring realm, |
120 jstring account, | 118 jstring account, |
121 jstring args) { | 119 jstring args) { |
122 /* Must call RegisterNativesImpl() */ | 120 /* Must call RegisterNativesImpl() */ |
123 DCHECK(g_TestJni_clazz); | 121 DCHECK_CLAZZ(g_TestJni_clazz, false); |
124 jmethodID method_id = | 122 jmethodID method_id = |
125 base::android::MethodID::LazyGet< | 123 base::android::MethodID::LazyGet< |
126 base::android::MethodID::TYPE_STATIC>( | 124 base::android::MethodID::TYPE_STATIC>( |
127 env, g_TestJni_clazz, | 125 env, g_TestJni_clazz, |
128 "shouldShowAutoLogin", | 126 "shouldShowAutoLogin", |
129 | 127 |
130 "(" | 128 "(" |
131 "Landroid/view/View;" | 129 "Landroid/view/View;" |
132 "Ljava/lang/String;" | 130 "Ljava/lang/String;" |
133 "Ljava/lang/String;" | 131 "Ljava/lang/String;" |
134 "Ljava/lang/String;" | 132 "Ljava/lang/String;" |
135 ")" | 133 ")" |
136 "Z", | 134 "Z", |
137 &g_TestJni_shouldShowAutoLogin); | 135 &g_TestJni_shouldShowAutoLogin); |
138 | 136 |
139 jboolean ret = | 137 jboolean ret = |
140 env->CallStaticBooleanMethod(g_TestJni_clazz, | 138 env->CallStaticBooleanMethod(g_TestJni_clazz, |
141 method_id, view, realm, account, args); | 139 method_id, view, realm, account, args); |
142 base::android::CheckException(env); | 140 jni_generator::CheckException(env); |
143 return ret; | 141 return ret; |
144 } | 142 } |
145 | 143 |
146 static base::subtle::AtomicWord g_TestJni_openUrl = 0; | 144 static base::subtle::AtomicWord g_TestJni_openUrl = 0; |
147 static ScopedJavaLocalRef<jobject> Java_TestJni_openUrl(JNIEnv* env, jstring | 145 static base::android::ScopedJavaLocalRef<jobject> Java_TestJni_openUrl(JNIEnv* |
148 url) { | 146 env, jstring url) { |
149 /* Must call RegisterNativesImpl() */ | 147 /* Must call RegisterNativesImpl() */ |
150 DCHECK(g_TestJni_clazz); | 148 DCHECK_CLAZZ(g_TestJni_clazz, NULL); |
151 jmethodID method_id = | 149 jmethodID method_id = |
152 base::android::MethodID::LazyGet< | 150 base::android::MethodID::LazyGet< |
153 base::android::MethodID::TYPE_STATIC>( | 151 base::android::MethodID::TYPE_STATIC>( |
154 env, g_TestJni_clazz, | 152 env, g_TestJni_clazz, |
155 "openUrl", | 153 "openUrl", |
156 | 154 |
157 "(" | 155 "(" |
158 "Ljava/lang/String;" | 156 "Ljava/lang/String;" |
159 ")" | 157 ")" |
160 "Ljava/io/InputStream;", | 158 "Ljava/io/InputStream;", |
161 &g_TestJni_openUrl); | 159 &g_TestJni_openUrl); |
162 | 160 |
163 jobject ret = | 161 jobject ret = |
164 env->CallStaticObjectMethod(g_TestJni_clazz, | 162 env->CallStaticObjectMethod(g_TestJni_clazz, |
165 method_id, url); | 163 method_id, url); |
166 base::android::CheckException(env); | 164 jni_generator::CheckException(env); |
167 return ScopedJavaLocalRef<jobject>(env, ret); | 165 return base::android::ScopedJavaLocalRef<jobject>(env, ret); |
168 } | 166 } |
169 | 167 |
170 static base::subtle::AtomicWord g_TestJni_activateHardwareAcceleration = 0; | 168 static base::subtle::AtomicWord g_TestJni_activateHardwareAcceleration = 0; |
171 static void Java_TestJni_activateHardwareAcceleration(JNIEnv* env, jobject obj, | 169 static void Java_TestJni_activateHardwareAcceleration(JNIEnv* env, jobject obj, |
172 jboolean activated, | 170 jboolean activated, |
173 jint iPid, | 171 jint iPid, |
174 jint iType, | 172 jint iType, |
175 jint iPrimaryID, | 173 jint iPrimaryID, |
176 jint iSecondaryID) { | 174 jint iSecondaryID) { |
177 /* Must call RegisterNativesImpl() */ | 175 /* Must call RegisterNativesImpl() */ |
178 DCHECK(g_TestJni_clazz); | 176 DCHECK_CLAZZ(g_TestJni_clazz); |
179 jmethodID method_id = | 177 jmethodID method_id = |
180 base::android::MethodID::LazyGet< | 178 base::android::MethodID::LazyGet< |
181 base::android::MethodID::TYPE_INSTANCE>( | 179 base::android::MethodID::TYPE_INSTANCE>( |
182 env, g_TestJni_clazz, | 180 env, g_TestJni_clazz, |
183 "activateHardwareAcceleration", | 181 "activateHardwareAcceleration", |
184 | 182 |
185 "(" | 183 "(" |
186 "Z" | 184 "Z" |
187 "I" | 185 "I" |
188 "I" | 186 "I" |
189 "I" | 187 "I" |
190 "I" | 188 "I" |
191 ")" | 189 ")" |
192 "V", | 190 "V", |
193 &g_TestJni_activateHardwareAcceleration); | 191 &g_TestJni_activateHardwareAcceleration); |
194 | 192 |
195 env->CallVoidMethod(obj, | 193 env->CallVoidMethod(obj, |
196 method_id, activated, iPid, iType, iPrimaryID, iSecondaryID); | 194 method_id, activated, iPid, iType, iPrimaryID, iSecondaryID); |
197 base::android::CheckException(env); | 195 jni_generator::CheckException(env); |
198 | 196 |
199 } | 197 } |
200 | 198 |
201 static base::subtle::AtomicWord g_TestJni_uncheckedCall = 0; | 199 static base::subtle::AtomicWord g_TestJni_uncheckedCall = 0; |
202 static void Java_TestJni_uncheckedCall(JNIEnv* env, jobject obj, jint iParam) { | 200 static void Java_TestJni_uncheckedCall(JNIEnv* env, jobject obj, jint iParam) { |
203 /* Must call RegisterNativesImpl() */ | 201 /* Must call RegisterNativesImpl() */ |
204 DCHECK(g_TestJni_clazz); | 202 DCHECK_CLAZZ(g_TestJni_clazz); |
205 jmethodID method_id = | 203 jmethodID method_id = |
206 base::android::MethodID::LazyGet< | 204 base::android::MethodID::LazyGet< |
207 base::android::MethodID::TYPE_INSTANCE>( | 205 base::android::MethodID::TYPE_INSTANCE>( |
208 env, g_TestJni_clazz, | 206 env, g_TestJni_clazz, |
209 "uncheckedCall", | 207 "uncheckedCall", |
210 | 208 |
211 "(" | 209 "(" |
212 "I" | 210 "I" |
213 ")" | 211 ")" |
214 "V", | 212 "V", |
215 &g_TestJni_uncheckedCall); | 213 &g_TestJni_uncheckedCall); |
216 | 214 |
217 env->CallVoidMethod(obj, | 215 env->CallVoidMethod(obj, |
218 method_id, iParam); | 216 method_id, iParam); |
219 | 217 |
220 } | 218 } |
221 | 219 |
222 static base::subtle::AtomicWord g_TestJni_returnByteArray = 0; | 220 static base::subtle::AtomicWord g_TestJni_returnByteArray = 0; |
223 static ScopedJavaLocalRef<jbyteArray> Java_TestJni_returnByteArray(JNIEnv* env, | 221 static base::android::ScopedJavaLocalRef<jbyteArray> |
224 jobject obj) { | 222 Java_TestJni_returnByteArray(JNIEnv* env, jobject obj) { |
225 /* Must call RegisterNativesImpl() */ | 223 /* Must call RegisterNativesImpl() */ |
226 DCHECK(g_TestJni_clazz); | 224 DCHECK_CLAZZ(g_TestJni_clazz, NULL); |
227 jmethodID method_id = | 225 jmethodID method_id = |
228 base::android::MethodID::LazyGet< | 226 base::android::MethodID::LazyGet< |
229 base::android::MethodID::TYPE_INSTANCE>( | 227 base::android::MethodID::TYPE_INSTANCE>( |
230 env, g_TestJni_clazz, | 228 env, g_TestJni_clazz, |
231 "returnByteArray", | 229 "returnByteArray", |
232 | 230 |
233 "(" | 231 "(" |
234 ")" | 232 ")" |
235 "[B", | 233 "[B", |
236 &g_TestJni_returnByteArray); | 234 &g_TestJni_returnByteArray); |
237 | 235 |
238 jbyteArray ret = | 236 jbyteArray ret = |
239 static_cast<jbyteArray>(env->CallObjectMethod(obj, | 237 static_cast<jbyteArray>(env->CallObjectMethod(obj, |
240 method_id)); | 238 method_id)); |
241 base::android::CheckException(env); | 239 jni_generator::CheckException(env); |
242 return ScopedJavaLocalRef<jbyteArray>(env, ret); | 240 return base::android::ScopedJavaLocalRef<jbyteArray>(env, ret); |
243 } | 241 } |
244 | 242 |
245 static base::subtle::AtomicWord g_TestJni_returnBooleanArray = 0; | 243 static base::subtle::AtomicWord g_TestJni_returnBooleanArray = 0; |
246 static ScopedJavaLocalRef<jbooleanArray> Java_TestJni_returnBooleanArray(JNIEnv* | 244 static base::android::ScopedJavaLocalRef<jbooleanArray> |
247 env, jobject obj) { | 245 Java_TestJni_returnBooleanArray(JNIEnv* env, jobject obj) { |
248 /* Must call RegisterNativesImpl() */ | 246 /* Must call RegisterNativesImpl() */ |
249 DCHECK(g_TestJni_clazz); | 247 DCHECK_CLAZZ(g_TestJni_clazz, NULL); |
250 jmethodID method_id = | 248 jmethodID method_id = |
251 base::android::MethodID::LazyGet< | 249 base::android::MethodID::LazyGet< |
252 base::android::MethodID::TYPE_INSTANCE>( | 250 base::android::MethodID::TYPE_INSTANCE>( |
253 env, g_TestJni_clazz, | 251 env, g_TestJni_clazz, |
254 "returnBooleanArray", | 252 "returnBooleanArray", |
255 | 253 |
256 "(" | 254 "(" |
257 ")" | 255 ")" |
258 "[Z", | 256 "[Z", |
259 &g_TestJni_returnBooleanArray); | 257 &g_TestJni_returnBooleanArray); |
260 | 258 |
261 jbooleanArray ret = | 259 jbooleanArray ret = |
262 static_cast<jbooleanArray>(env->CallObjectMethod(obj, | 260 static_cast<jbooleanArray>(env->CallObjectMethod(obj, |
263 method_id)); | 261 method_id)); |
264 base::android::CheckException(env); | 262 jni_generator::CheckException(env); |
265 return ScopedJavaLocalRef<jbooleanArray>(env, ret); | 263 return base::android::ScopedJavaLocalRef<jbooleanArray>(env, ret); |
266 } | 264 } |
267 | 265 |
268 static base::subtle::AtomicWord g_TestJni_returnCharArray = 0; | 266 static base::subtle::AtomicWord g_TestJni_returnCharArray = 0; |
269 static ScopedJavaLocalRef<jcharArray> Java_TestJni_returnCharArray(JNIEnv* env, | 267 static base::android::ScopedJavaLocalRef<jcharArray> |
270 jobject obj) { | 268 Java_TestJni_returnCharArray(JNIEnv* env, jobject obj) { |
271 /* Must call RegisterNativesImpl() */ | 269 /* Must call RegisterNativesImpl() */ |
272 DCHECK(g_TestJni_clazz); | 270 DCHECK_CLAZZ(g_TestJni_clazz, NULL); |
273 jmethodID method_id = | 271 jmethodID method_id = |
274 base::android::MethodID::LazyGet< | 272 base::android::MethodID::LazyGet< |
275 base::android::MethodID::TYPE_INSTANCE>( | 273 base::android::MethodID::TYPE_INSTANCE>( |
276 env, g_TestJni_clazz, | 274 env, g_TestJni_clazz, |
277 "returnCharArray", | 275 "returnCharArray", |
278 | 276 |
279 "(" | 277 "(" |
280 ")" | 278 ")" |
281 "[C", | 279 "[C", |
282 &g_TestJni_returnCharArray); | 280 &g_TestJni_returnCharArray); |
283 | 281 |
284 jcharArray ret = | 282 jcharArray ret = |
285 static_cast<jcharArray>(env->CallObjectMethod(obj, | 283 static_cast<jcharArray>(env->CallObjectMethod(obj, |
286 method_id)); | 284 method_id)); |
287 base::android::CheckException(env); | 285 jni_generator::CheckException(env); |
288 return ScopedJavaLocalRef<jcharArray>(env, ret); | 286 return base::android::ScopedJavaLocalRef<jcharArray>(env, ret); |
289 } | 287 } |
290 | 288 |
291 static base::subtle::AtomicWord g_TestJni_returnShortArray = 0; | 289 static base::subtle::AtomicWord g_TestJni_returnShortArray = 0; |
292 static ScopedJavaLocalRef<jshortArray> Java_TestJni_returnShortArray(JNIEnv* | 290 static base::android::ScopedJavaLocalRef<jshortArray> |
293 env, jobject obj) { | 291 Java_TestJni_returnShortArray(JNIEnv* env, jobject obj) { |
294 /* Must call RegisterNativesImpl() */ | 292 /* Must call RegisterNativesImpl() */ |
295 DCHECK(g_TestJni_clazz); | 293 DCHECK_CLAZZ(g_TestJni_clazz, NULL); |
296 jmethodID method_id = | 294 jmethodID method_id = |
297 base::android::MethodID::LazyGet< | 295 base::android::MethodID::LazyGet< |
298 base::android::MethodID::TYPE_INSTANCE>( | 296 base::android::MethodID::TYPE_INSTANCE>( |
299 env, g_TestJni_clazz, | 297 env, g_TestJni_clazz, |
300 "returnShortArray", | 298 "returnShortArray", |
301 | 299 |
302 "(" | 300 "(" |
303 ")" | 301 ")" |
304 "[S", | 302 "[S", |
305 &g_TestJni_returnShortArray); | 303 &g_TestJni_returnShortArray); |
306 | 304 |
307 jshortArray ret = | 305 jshortArray ret = |
308 static_cast<jshortArray>(env->CallObjectMethod(obj, | 306 static_cast<jshortArray>(env->CallObjectMethod(obj, |
309 method_id)); | 307 method_id)); |
310 base::android::CheckException(env); | 308 jni_generator::CheckException(env); |
311 return ScopedJavaLocalRef<jshortArray>(env, ret); | 309 return base::android::ScopedJavaLocalRef<jshortArray>(env, ret); |
312 } | 310 } |
313 | 311 |
314 static base::subtle::AtomicWord g_TestJni_returnIntArray = 0; | 312 static base::subtle::AtomicWord g_TestJni_returnIntArray = 0; |
315 static ScopedJavaLocalRef<jintArray> Java_TestJni_returnIntArray(JNIEnv* env, | 313 static base::android::ScopedJavaLocalRef<jintArray> |
316 jobject obj) { | 314 Java_TestJni_returnIntArray(JNIEnv* env, jobject obj) { |
317 /* Must call RegisterNativesImpl() */ | 315 /* Must call RegisterNativesImpl() */ |
318 DCHECK(g_TestJni_clazz); | 316 DCHECK_CLAZZ(g_TestJni_clazz, NULL); |
319 jmethodID method_id = | 317 jmethodID method_id = |
320 base::android::MethodID::LazyGet< | 318 base::android::MethodID::LazyGet< |
321 base::android::MethodID::TYPE_INSTANCE>( | 319 base::android::MethodID::TYPE_INSTANCE>( |
322 env, g_TestJni_clazz, | 320 env, g_TestJni_clazz, |
323 "returnIntArray", | 321 "returnIntArray", |
324 | 322 |
325 "(" | 323 "(" |
326 ")" | 324 ")" |
327 "[I", | 325 "[I", |
328 &g_TestJni_returnIntArray); | 326 &g_TestJni_returnIntArray); |
329 | 327 |
330 jintArray ret = | 328 jintArray ret = |
331 static_cast<jintArray>(env->CallObjectMethod(obj, | 329 static_cast<jintArray>(env->CallObjectMethod(obj, |
332 method_id)); | 330 method_id)); |
333 base::android::CheckException(env); | 331 jni_generator::CheckException(env); |
334 return ScopedJavaLocalRef<jintArray>(env, ret); | 332 return base::android::ScopedJavaLocalRef<jintArray>(env, ret); |
335 } | 333 } |
336 | 334 |
337 static base::subtle::AtomicWord g_TestJni_returnLongArray = 0; | 335 static base::subtle::AtomicWord g_TestJni_returnLongArray = 0; |
338 static ScopedJavaLocalRef<jlongArray> Java_TestJni_returnLongArray(JNIEnv* env, | 336 static base::android::ScopedJavaLocalRef<jlongArray> |
339 jobject obj) { | 337 Java_TestJni_returnLongArray(JNIEnv* env, jobject obj) { |
340 /* Must call RegisterNativesImpl() */ | 338 /* Must call RegisterNativesImpl() */ |
341 DCHECK(g_TestJni_clazz); | 339 DCHECK_CLAZZ(g_TestJni_clazz, NULL); |
342 jmethodID method_id = | 340 jmethodID method_id = |
343 base::android::MethodID::LazyGet< | 341 base::android::MethodID::LazyGet< |
344 base::android::MethodID::TYPE_INSTANCE>( | 342 base::android::MethodID::TYPE_INSTANCE>( |
345 env, g_TestJni_clazz, | 343 env, g_TestJni_clazz, |
346 "returnLongArray", | 344 "returnLongArray", |
347 | 345 |
348 "(" | 346 "(" |
349 ")" | 347 ")" |
350 "[J", | 348 "[J", |
351 &g_TestJni_returnLongArray); | 349 &g_TestJni_returnLongArray); |
352 | 350 |
353 jlongArray ret = | 351 jlongArray ret = |
354 static_cast<jlongArray>(env->CallObjectMethod(obj, | 352 static_cast<jlongArray>(env->CallObjectMethod(obj, |
355 method_id)); | 353 method_id)); |
356 base::android::CheckException(env); | 354 jni_generator::CheckException(env); |
357 return ScopedJavaLocalRef<jlongArray>(env, ret); | 355 return base::android::ScopedJavaLocalRef<jlongArray>(env, ret); |
358 } | 356 } |
359 | 357 |
360 static base::subtle::AtomicWord g_TestJni_returnDoubleArray = 0; | 358 static base::subtle::AtomicWord g_TestJni_returnDoubleArray = 0; |
361 static ScopedJavaLocalRef<jdoubleArray> Java_TestJni_returnDoubleArray(JNIEnv* | 359 static base::android::ScopedJavaLocalRef<jdoubleArray> |
362 env, jobject obj) { | 360 Java_TestJni_returnDoubleArray(JNIEnv* env, jobject obj) { |
363 /* Must call RegisterNativesImpl() */ | 361 /* Must call RegisterNativesImpl() */ |
364 DCHECK(g_TestJni_clazz); | 362 DCHECK_CLAZZ(g_TestJni_clazz, NULL); |
365 jmethodID method_id = | 363 jmethodID method_id = |
366 base::android::MethodID::LazyGet< | 364 base::android::MethodID::LazyGet< |
367 base::android::MethodID::TYPE_INSTANCE>( | 365 base::android::MethodID::TYPE_INSTANCE>( |
368 env, g_TestJni_clazz, | 366 env, g_TestJni_clazz, |
369 "returnDoubleArray", | 367 "returnDoubleArray", |
370 | 368 |
371 "(" | 369 "(" |
372 ")" | 370 ")" |
373 "[D", | 371 "[D", |
374 &g_TestJni_returnDoubleArray); | 372 &g_TestJni_returnDoubleArray); |
375 | 373 |
376 jdoubleArray ret = | 374 jdoubleArray ret = |
377 static_cast<jdoubleArray>(env->CallObjectMethod(obj, | 375 static_cast<jdoubleArray>(env->CallObjectMethod(obj, |
378 method_id)); | 376 method_id)); |
379 base::android::CheckException(env); | 377 jni_generator::CheckException(env); |
380 return ScopedJavaLocalRef<jdoubleArray>(env, ret); | 378 return base::android::ScopedJavaLocalRef<jdoubleArray>(env, ret); |
381 } | 379 } |
382 | 380 |
383 static base::subtle::AtomicWord g_TestJni_returnObjectArray = 0; | 381 static base::subtle::AtomicWord g_TestJni_returnObjectArray = 0; |
384 static ScopedJavaLocalRef<jobjectArray> Java_TestJni_returnObjectArray(JNIEnv* | 382 static base::android::ScopedJavaLocalRef<jobjectArray> |
385 env, jobject obj) { | 383 Java_TestJni_returnObjectArray(JNIEnv* env, jobject obj) { |
386 /* Must call RegisterNativesImpl() */ | 384 /* Must call RegisterNativesImpl() */ |
387 DCHECK(g_TestJni_clazz); | 385 DCHECK_CLAZZ(g_TestJni_clazz, NULL); |
388 jmethodID method_id = | 386 jmethodID method_id = |
389 base::android::MethodID::LazyGet< | 387 base::android::MethodID::LazyGet< |
390 base::android::MethodID::TYPE_INSTANCE>( | 388 base::android::MethodID::TYPE_INSTANCE>( |
391 env, g_TestJni_clazz, | 389 env, g_TestJni_clazz, |
392 "returnObjectArray", | 390 "returnObjectArray", |
393 | 391 |
394 "(" | 392 "(" |
395 ")" | 393 ")" |
396 "[Ljava/lang/Object;", | 394 "[Ljava/lang/Object;", |
397 &g_TestJni_returnObjectArray); | 395 &g_TestJni_returnObjectArray); |
398 | 396 |
399 jobjectArray ret = | 397 jobjectArray ret = |
400 static_cast<jobjectArray>(env->CallObjectMethod(obj, | 398 static_cast<jobjectArray>(env->CallObjectMethod(obj, |
401 method_id)); | 399 method_id)); |
402 base::android::CheckException(env); | 400 jni_generator::CheckException(env); |
403 return ScopedJavaLocalRef<jobjectArray>(env, ret); | 401 return base::android::ScopedJavaLocalRef<jobjectArray>(env, ret); |
404 } | 402 } |
405 | 403 |
406 static base::subtle::AtomicWord g_TestJni_returnArrayOfByteArray = 0; | 404 static base::subtle::AtomicWord g_TestJni_returnArrayOfByteArray = 0; |
407 static ScopedJavaLocalRef<jobjectArray> | 405 static base::android::ScopedJavaLocalRef<jobjectArray> |
408 Java_TestJni_returnArrayOfByteArray(JNIEnv* env, jobject obj) { | 406 Java_TestJni_returnArrayOfByteArray(JNIEnv* env, jobject obj) { |
409 /* Must call RegisterNativesImpl() */ | 407 /* Must call RegisterNativesImpl() */ |
410 DCHECK(g_TestJni_clazz); | 408 DCHECK_CLAZZ(g_TestJni_clazz, NULL); |
411 jmethodID method_id = | 409 jmethodID method_id = |
412 base::android::MethodID::LazyGet< | 410 base::android::MethodID::LazyGet< |
413 base::android::MethodID::TYPE_INSTANCE>( | 411 base::android::MethodID::TYPE_INSTANCE>( |
414 env, g_TestJni_clazz, | 412 env, g_TestJni_clazz, |
415 "returnArrayOfByteArray", | 413 "returnArrayOfByteArray", |
416 | 414 |
417 "(" | 415 "(" |
418 ")" | 416 ")" |
419 "[[B", | 417 "[[B", |
420 &g_TestJni_returnArrayOfByteArray); | 418 &g_TestJni_returnArrayOfByteArray); |
421 | 419 |
422 jobjectArray ret = | 420 jobjectArray ret = |
423 static_cast<jobjectArray>(env->CallObjectMethod(obj, | 421 static_cast<jobjectArray>(env->CallObjectMethod(obj, |
424 method_id)); | 422 method_id)); |
425 base::android::CheckException(env); | 423 jni_generator::CheckException(env); |
426 return ScopedJavaLocalRef<jobjectArray>(env, ret); | 424 return base::android::ScopedJavaLocalRef<jobjectArray>(env, ret); |
427 } | 425 } |
428 | 426 |
429 static base::subtle::AtomicWord g_TestJni_getCompressFormat = 0; | 427 static base::subtle::AtomicWord g_TestJni_getCompressFormat = 0; |
430 static ScopedJavaLocalRef<jobject> Java_TestJni_getCompressFormat(JNIEnv* env, | 428 static base::android::ScopedJavaLocalRef<jobject> |
431 jobject obj) { | 429 Java_TestJni_getCompressFormat(JNIEnv* env, jobject obj) { |
432 /* Must call RegisterNativesImpl() */ | 430 /* Must call RegisterNativesImpl() */ |
433 DCHECK(g_TestJni_clazz); | 431 DCHECK_CLAZZ(g_TestJni_clazz, NULL); |
434 jmethodID method_id = | 432 jmethodID method_id = |
435 base::android::MethodID::LazyGet< | 433 base::android::MethodID::LazyGet< |
436 base::android::MethodID::TYPE_INSTANCE>( | 434 base::android::MethodID::TYPE_INSTANCE>( |
437 env, g_TestJni_clazz, | 435 env, g_TestJni_clazz, |
438 "getCompressFormat", | 436 "getCompressFormat", |
439 | 437 |
440 "(" | 438 "(" |
441 ")" | 439 ")" |
442 "Landroid/graphics/Bitmap$CompressFormat;", | 440 "Landroid/graphics/Bitmap$CompressFormat;", |
443 &g_TestJni_getCompressFormat); | 441 &g_TestJni_getCompressFormat); |
444 | 442 |
445 jobject ret = | 443 jobject ret = |
446 env->CallObjectMethod(obj, | 444 env->CallObjectMethod(obj, |
447 method_id); | 445 method_id); |
448 base::android::CheckException(env); | 446 jni_generator::CheckException(env); |
449 return ScopedJavaLocalRef<jobject>(env, ret); | 447 return base::android::ScopedJavaLocalRef<jobject>(env, ret); |
450 } | 448 } |
451 | 449 |
452 static base::subtle::AtomicWord g_TestJni_getCompressFormatList = 0; | 450 static base::subtle::AtomicWord g_TestJni_getCompressFormatList = 0; |
453 static ScopedJavaLocalRef<jobject> Java_TestJni_getCompressFormatList(JNIEnv* | 451 static base::android::ScopedJavaLocalRef<jobject> |
454 env, jobject obj) { | 452 Java_TestJni_getCompressFormatList(JNIEnv* env, jobject obj) { |
455 /* Must call RegisterNativesImpl() */ | 453 /* Must call RegisterNativesImpl() */ |
456 DCHECK(g_TestJni_clazz); | 454 DCHECK_CLAZZ(g_TestJni_clazz, NULL); |
457 jmethodID method_id = | 455 jmethodID method_id = |
458 base::android::MethodID::LazyGet< | 456 base::android::MethodID::LazyGet< |
459 base::android::MethodID::TYPE_INSTANCE>( | 457 base::android::MethodID::TYPE_INSTANCE>( |
460 env, g_TestJni_clazz, | 458 env, g_TestJni_clazz, |
461 "getCompressFormatList", | 459 "getCompressFormatList", |
462 | 460 |
463 "(" | 461 "(" |
464 ")" | 462 ")" |
465 "Ljava/util/List;", | 463 "Ljava/util/List;", |
466 &g_TestJni_getCompressFormatList); | 464 &g_TestJni_getCompressFormatList); |
467 | 465 |
468 jobject ret = | 466 jobject ret = |
469 env->CallObjectMethod(obj, | 467 env->CallObjectMethod(obj, |
470 method_id); | 468 method_id); |
471 base::android::CheckException(env); | 469 jni_generator::CheckException(env); |
472 return ScopedJavaLocalRef<jobject>(env, ret); | 470 return base::android::ScopedJavaLocalRef<jobject>(env, ret); |
473 } | 471 } |
474 | 472 |
475 // Step 3: RegisterNatives. | 473 // Step 3: RegisterNatives. |
476 | 474 |
477 static bool RegisterNativesImpl(JNIEnv* env) { | 475 static bool RegisterNativesImpl(JNIEnv* env) { |
478 | |
479 g_TestJni_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( | 476 g_TestJni_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( |
480 base::android::GetClass(env, kTestJniClassPath).obj())); | 477 base::android::GetClass(env, kTestJniClassPath).obj())); |
481 g_InfoBar_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( | 478 g_InfoBar_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( |
482 base::android::GetClass(env, kInfoBarClassPath).obj())); | 479 base::android::GetClass(env, kInfoBarClassPath).obj())); |
| 480 |
483 return true; | 481 return true; |
484 } | 482 } |
485 | 483 |
486 #endif // org_chromium_TestJni_JNI | 484 #endif // org_chromium_TestJni_JNI |
OLD | NEW |