| OLD | NEW |
| 1 // Copyright (c) 2012 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_generator/jni_generator_helper.h" | 15 #include "base/android/jni_generator/jni_generator_helper.h" |
| 16 | 16 |
| 17 // Step 1: forward declarations. | 17 // Step 1: forward declarations. |
| 18 namespace { | 18 namespace { |
| 19 const char kMyOtherInnerClassClassPath[] = | |
| 20 "org/chromium/TestJni$MyOtherInnerClass"; | |
| 21 const char kTestJniClassPath[] = "org/chromium/TestJni"; | |
| 22 // Leaking this jclass as we cannot use LazyInstance from some threads. | |
| 23 jclass g_TestJni_clazz = NULL; | |
| 24 | 19 |
| 25 } // namespace | 20 } // namespace |
| 26 | 21 |
| 27 static jint Init(JNIEnv* env, jobject jcaller); | 22 extern "C"{ |
| 28 | 23 |
| 29 static jint Init(JNIEnv* env, jobject jcaller); | 24 static jint Init(JNIEnv* env, jobject jcaller); |
| 25 __attribute__((alias("Init"), visibility("default"))) jint |
| 26 Java_org_chromium_TestJni_nativeInit(JNIEnv* env, jobject jcaller); |
| 27 |
| 28 static jint Init(JNIEnv* env, jobject jcaller); |
| 29 __attribute__((alias("Init"), visibility("default"))) jint |
| 30 Java_org_chromium_TestJni_00024MyOtherInnerClass_nativeInit(JNIEnv* env, |
| 31 jobject jcaller); |
| 30 | 32 |
| 31 // Step 2: method stubs. | 33 // Step 2: method stubs. |
| 32 | 34 |
| 35 }; |
| 36 |
| 33 // Step 3: RegisterNatives. | 37 // Step 3: RegisterNatives. |
| 34 | 38 |
| 35 static const JNINativeMethod kMethodsMyOtherInnerClass[] = { | |
| 36 { "nativeInit", | |
| 37 "(" | |
| 38 ")" | |
| 39 "I", reinterpret_cast<void*>(Init) }, | |
| 40 }; | |
| 41 | |
| 42 static const JNINativeMethod kMethodsTestJni[] = { | |
| 43 { "nativeInit", | |
| 44 "(" | |
| 45 ")" | |
| 46 "I", reinterpret_cast<void*>(Init) }, | |
| 47 }; | |
| 48 | |
| 49 static bool RegisterNativesImpl(JNIEnv* env) { | |
| 50 g_TestJni_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( | |
| 51 base::android::GetClass(env, kTestJniClassPath).obj())); | |
| 52 | |
| 53 const int kMethodsMyOtherInnerClassSize = | |
| 54 arraysize(kMethodsMyOtherInnerClass); | |
| 55 | |
| 56 if (env->RegisterNatives(g_MyOtherInnerClass_clazz, | |
| 57 kMethodsMyOtherInnerClass, | |
| 58 kMethodsMyOtherInnerClassSize) < 0) { | |
| 59 jni_generator::HandleRegistrationError( | |
| 60 env, g_MyOtherInnerClass_clazz, __FILE__); | |
| 61 return false; | |
| 62 } | |
| 63 | |
| 64 const int kMethodsTestJniSize = arraysize(kMethodsTestJni); | |
| 65 | |
| 66 if (env->RegisterNatives(g_TestJni_clazz, | |
| 67 kMethodsTestJni, | |
| 68 kMethodsTestJniSize) < 0) { | |
| 69 jni_generator::HandleRegistrationError( | |
| 70 env, g_TestJni_clazz, __FILE__); | |
| 71 return false; | |
| 72 } | |
| 73 | |
| 74 return true; | |
| 75 } | |
| 76 | |
| 77 #endif // org_chromium_TestJni_JNI | 39 #endif // org_chromium_TestJni_JNI |
| OLD | NEW |