OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This file is autogenerated by | 5 // This file is autogenerated by |
6 // base/android/jni_generator/jni_generator.py | 6 // base/android/jni_generator/jni_generator.py |
7 // For | 7 // For |
8 // org/chromium/example/jni_generator/SampleForTests | 8 // org/chromium/example/jni_generator/SampleForTests |
9 | 9 |
10 #ifndef org_chromium_example_jni_generator_SampleForTests_JNI | 10 #ifndef org_chromium_example_jni_generator_SampleForTests_JNI |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 jstring ret = | 191 jstring ret = |
192 static_cast<jstring>(env->CallStaticObjectMethod(SampleForTests_clazz(env), | 192 static_cast<jstring>(env->CallStaticObjectMethod(SampleForTests_clazz(env), |
193 method_id)); | 193 method_id)); |
194 jni_generator::CheckException(env); | 194 jni_generator::CheckException(env); |
195 return base::android::ScopedJavaLocalRef<jstring>(env, ret); | 195 return base::android::ScopedJavaLocalRef<jstring>(env, ret); |
196 } | 196 } |
197 }; // extern "C" | 197 }; // extern "C" |
198 | 198 |
199 // Step 3: RegisterNatives. | 199 // Step 3: RegisterNatives. |
200 | 200 |
| 201 static const JNINativeMethod kMethodsMyOtherInnerClass[] = { |
| 202 { "nativeInit", |
| 203 "(" |
| 204 ")" |
| 205 "I", |
| 206 reinterpret_cast<void*>(Java_org_chromium_example_jni_1generator_SampleForTe
sts_00024MyOtherInnerClass_nativeInit) |
| 207 }, |
| 208 }; |
| 209 |
| 210 static const JNINativeMethod kMethodsMyInnerClass[] = { |
| 211 { "nativeInit", |
| 212 "(" |
| 213 ")" |
| 214 "I", |
| 215 reinterpret_cast<void*>(Java_org_chromium_example_jni_1generator_SampleForTe
sts_00024MyInnerClass_nativeInit) |
| 216 }, |
| 217 }; |
| 218 |
| 219 static const JNINativeMethod kMethodsSampleForTests[] = { |
| 220 { "nativeStaticMethod", |
| 221 "(" |
| 222 "J" |
| 223 "I" |
| 224 ")" |
| 225 "I", |
| 226 reinterpret_cast<void*>(Java_org_chromium_example_jni_1generator_SampleForTe
sts_nativeStaticMethod) |
| 227 }, |
| 228 { "nativeMethod", |
| 229 "(" |
| 230 "J" |
| 231 "I" |
| 232 ")" |
| 233 "I", |
| 234 reinterpret_cast<void*>(Java_org_chromium_example_jni_1generator_SampleForTe
sts_nativeMethod) |
| 235 }, |
| 236 }; |
| 237 |
201 static bool RegisterNativesImpl(JNIEnv* env, jclass clazz) { | 238 static bool RegisterNativesImpl(JNIEnv* env, jclass clazz) { |
| 239 if (base::android::IsManualJniRegistrationDisabled()) return true; |
202 base::subtle::Release_Store(&g_SampleForTests_clazz, | 240 base::subtle::Release_Store(&g_SampleForTests_clazz, |
203 static_cast<base::subtle::AtomicWord>(env->NewWeakGlobalRef(clazz)); | 241 static_cast<base::subtle::AtomicWord>(env->NewWeakGlobalRef(clazz)); |
204 | 242 |
| 243 const int kMethodsMyOtherInnerClassSize = |
| 244 arraysize(kMethodsMyOtherInnerClass); |
| 245 |
| 246 if (env->RegisterNatives(MyOtherInnerClass_clazz(env), |
| 247 kMethodsMyOtherInnerClass, |
| 248 kMethodsMyOtherInnerClassSize) < 0) { |
| 249 jni_generator::HandleRegistrationError( |
| 250 env, MyOtherInnerClass_clazz(env), __FILE__); |
| 251 return false; |
| 252 } |
| 253 |
| 254 const int kMethodsMyInnerClassSize = arraysize(kMethodsMyInnerClass); |
| 255 |
| 256 if (env->RegisterNatives(MyInnerClass_clazz(env), |
| 257 kMethodsMyInnerClass, |
| 258 kMethodsMyInnerClassSize) < 0) { |
| 259 jni_generator::HandleRegistrationError( |
| 260 env, MyInnerClass_clazz(env), __FILE__); |
| 261 return false; |
| 262 } |
| 263 |
| 264 const int kMethodsSampleForTestsSize = arraysize(kMethodsSampleForTests); |
| 265 |
| 266 if (env->RegisterNatives(SampleForTests_clazz(env), |
| 267 kMethodsSampleForTests, |
| 268 kMethodsSampleForTestsSize) < 0) { |
| 269 jni_generator::HandleRegistrationError( |
| 270 env, SampleForTests_clazz(env), __FILE__); |
| 271 return false; |
| 272 } |
| 273 |
205 return true; | 274 return true; |
206 } | 275 } |
207 | 276 |
208 extern "C" JNIEXPORT bool JNICALL | 277 extern "C" JNIEXPORT bool JNICALL |
209 Java_org_chromium_example_jni_1generator_SampleForTests_nativeInitNativeClass(JN
IEnv* | 278 Java_org_chromium_example_jni_1generator_SampleForTests_nativeInitNativeClass(JN
IEnv* |
210 env, jclass clazz) { | 279 env, jclass clazz) { |
211 return RegisterNativesImpl(env, clazz); | 280 return RegisterNativesImpl(env, clazz); |
212 } | 281 } |
213 | 282 |
214 #endif // org_chromium_example_jni_generator_SampleForTests_JNI | 283 #endif // org_chromium_example_jni_generator_SampleForTests_JNI |
OLD | NEW |