| 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/example/jni_generator/Example | 8 // org/chromium/example/jni_generator/Example |
| 9 | 9 |
| 10 #ifndef org_chromium_example_jni_generator_Example_JNI | 10 #ifndef org_chromium_example_jni_generator_Example_JNI |
| 11 #define org_chromium_example_jni_generator_Example_JNI | 11 #define org_chromium_example_jni_generator_Example_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 kExampleClassPath[] = "com/test/jni_generator/Example"; | |
| 20 // Leaking this jclass as we cannot use LazyInstance from some threads. | |
| 21 jclass g_Example_clazz = NULL; | |
| 22 | 19 |
| 23 } // namespace | 20 } // namespace |
| 24 | 21 |
| 22 extern "C"{ |
| 23 |
| 25 static void Test(JNIEnv* env, jclass jcaller, | 24 static void Test(JNIEnv* env, jclass jcaller, |
| 26 jobject t); | 25 jobject t); |
| 26 __attribute__((alias("Test"), visibility("default"))) void |
| 27 Java_com_test_jni_1generator_Example_nativeTest(JNIEnv* env, jclass jcaller, |
| 28 jobject t); |
| 27 | 29 |
| 28 // Step 2: method stubs. | 30 // Step 2: method stubs. |
| 29 | 31 |
| 32 }; |
| 33 |
| 30 // Step 3: RegisterNatives. | 34 // Step 3: RegisterNatives. |
| 31 | 35 |
| 32 static const JNINativeMethod kMethodsExample[] = { | |
| 33 { "nativeTest", | |
| 34 "(" | |
| 35 "Lorg/test2/org/chromium/example2/Test;" | |
| 36 ")" | |
| 37 "V", reinterpret_cast<void*>(Test) }, | |
| 38 }; | |
| 39 | |
| 40 static bool RegisterNativesImpl(JNIEnv* env) { | |
| 41 g_Example_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( | |
| 42 base::android::GetClass(env, kExampleClassPath).obj())); | |
| 43 | |
| 44 const int kMethodsExampleSize = arraysize(kMethodsExample); | |
| 45 | |
| 46 if (env->RegisterNatives(g_Example_clazz, | |
| 47 kMethodsExample, | |
| 48 kMethodsExampleSize) < 0) { | |
| 49 jni_generator::HandleRegistrationError( | |
| 50 env, g_Example_clazz, __FILE__); | |
| 51 return false; | |
| 52 } | |
| 53 | |
| 54 return true; | |
| 55 } | |
| 56 | |
| 57 #endif // org_chromium_example_jni_generator_Example_JNI | 36 #endif // org_chromium_example_jni_generator_Example_JNI |
| OLD | NEW |