| 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/Test | 8 // org/chromium/example/jni_generator/Test |
| 9 | 9 |
| 10 #ifndef org_chromium_example_jni_generator_Test_JNI | 10 #ifndef org_chromium_example_jni_generator_Test_JNI |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // Leaking this jclass as we cannot use LazyInstance from some threads. | 22 // Leaking this jclass as we cannot use LazyInstance from some threads. |
| 23 jclass g_Test_clazz = NULL; | 23 jclass g_Test_clazz = NULL; |
| 24 #define Test_clazz(env) g_Test_clazz | 24 #define Test_clazz(env) g_Test_clazz |
| 25 jmethodID g_Test_testMethodWithParam = NULL; | 25 jmethodID g_Test_testMethodWithParam = NULL; |
| 26 jmethodID g_Test_testStaticMethodWithParam = NULL; | 26 jmethodID g_Test_testStaticMethodWithParam = NULL; |
| 27 jmethodID g_Test_testMethodWithNoParam = NULL; | 27 jmethodID g_Test_testMethodWithNoParam = NULL; |
| 28 jmethodID g_Test_testStaticMethodWithNoParam = NULL; | 28 jmethodID g_Test_testStaticMethodWithNoParam = NULL; |
| 29 } // namespace | 29 } // namespace |
| 30 | 30 |
| 31 // Step 2: method stubs. | 31 // Step 2: method stubs. |
| 32 static jint Method(JNIEnv* env, jobject jcaller, | 32 static jint Java_org_chromium_example_jni_1generator_Test_nativeMethod(JNIEnv* |
| 33 env, |
| 34 jobject jcaller, |
| 33 jlong nativeTest, | 35 jlong nativeTest, |
| 34 jint arg1) { | 36 jint arg1) { |
| 35 Test* native = reinterpret_cast<Test*>(nativeTest); | 37 Test* native = reinterpret_cast<Test*>(nativeTest); |
| 36 CHECK_NATIVE_PTR(env, jcaller, native, "Method", 0); | 38 CHECK_NATIVE_PTR(env, jcaller, native, "Method", 0); |
| 37 return native->Method(env, jcaller, arg1); | 39 return native->Method(env, jcaller, arg1); |
| 38 } | 40 } |
| 39 | 41 |
| 40 namespace { | 42 namespace { |
| 41 | 43 |
| 42 static void testMethodWithParam(JNIEnv* env, jobject obj, JniIntWrapper iParam) | 44 static void testMethodWithParam(JNIEnv* env, jobject obj, JniIntWrapper iParam) |
| (...skipping 25 matching lines...) Expand all Loading... |
| 68 } // namespace | 70 } // namespace |
| 69 | 71 |
| 70 // Step 3: RegisterNatives. | 72 // Step 3: RegisterNatives. |
| 71 | 73 |
| 72 static const JNINativeMethod kMethodsTest[] = { | 74 static const JNINativeMethod kMethodsTest[] = { |
| 73 { "nativeMethod", | 75 { "nativeMethod", |
| 74 "(" | 76 "(" |
| 75 "J" | 77 "J" |
| 76 "I" | 78 "I" |
| 77 ")" | 79 ")" |
| 78 "I", reinterpret_cast<void*>(Method) }, | 80 "I", |
| 81 reinterpret_cast<void*>(Java_org_chromium_example_jni_1generator_Test_native
Method) |
| 82 }, |
| 79 }; | 83 }; |
| 80 | 84 |
| 81 static bool RegisterNativesImpl(JNIEnv* env, jclass clazz) { | 85 static bool RegisterNativesImpl(JNIEnv* env, jclass clazz) { |
| 82 | 86 |
| 83 g_Test_clazz = static_cast<jclass>(env->NewWeakGlobalRef(clazz)); | 87 g_Test_clazz = static_cast<jclass>(env->NewWeakGlobalRef(clazz)); |
| 84 | 88 |
| 85 const int kMethodsTestSize = arraysize(kMethodsTest); | 89 const int kMethodsTestSize = arraysize(kMethodsTest); |
| 86 | 90 |
| 87 if (env->RegisterNatives(Test_clazz(env), | 91 if (env->RegisterNatives(Test_clazz(env), |
| 88 kMethodsTest, | 92 kMethodsTest, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 return true; | 141 return true; |
| 138 } | 142 } |
| 139 | 143 |
| 140 extern "C" JNIEXPORT bool JNICALL | 144 extern "C" JNIEXPORT bool JNICALL |
| 141 Java_org_chromium_example_jni_generator_Test_nativeInitNativeClass(JNIEnv* env, | 145 Java_org_chromium_example_jni_generator_Test_nativeInitNativeClass(JNIEnv* env, |
| 142 jclass clazz) { | 146 jclass clazz) { |
| 143 return RegisterNativesImpl(env, clazz); | 147 return RegisterNativesImpl(env, clazz); |
| 144 } | 148 } |
| 145 | 149 |
| 146 #endif // org_chromium_example_jni_generator_Test_JNI | 150 #endif // org_chromium_example_jni_generator_Test_JNI |
| OLD | NEW |