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