| 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/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 #include "base/android/jni_int_wrapper.h" | 17 #include "base/android/jni_int_wrapper.h" |
| 18 | 18 |
| 19 // Step 1: forward declarations. | 19 // Step 1: forward declarations. |
| 20 namespace { | 20 namespace { |
| 21 const char kExampleClassPath[] = "com/test/jni_generator/Example"; | 21 const char kExampleClassPath[] = "com/test/jni_generator/Example"; |
| 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_Example_clazz = NULL; | 23 jclass g_Example_clazz = NULL; |
| 24 #define Example_clazz(env) g_Example_clazz | 24 #define Example_clazz(env) g_Example_clazz |
| 25 | 25 |
| 26 } // namespace | 26 } // namespace |
| 27 | 27 |
| 28 // Step 2: method stubs. | 28 // Step 2: method stubs. |
| 29 | 29 |
| 30 static void Test(JNIEnv* env, jclass jcaller, | 30 static void Test(JNIEnv* env, const JavaParamRef<jclass>& jcaller, |
| 31 jobject t); | 31 const JavaParamRef<jobject>& t); |
| 32 | 32 |
| 33 static void Java_com_test_jni_1generator_Example_nativeTest(JNIEnv* env, jclass | 33 static void Java_com_test_jni_1generator_Example_nativeTest(JNIEnv* env, jclass |
| 34 jcaller, | 34 jcaller, |
| 35 jobject t) { | 35 jobject t) { |
| 36 return Test(env, jcaller, t); | 36 return Test(env, JavaParamRef<jclass>(env, jcaller), |
| 37 JavaParamRef<jobject>(env, t)); |
| 37 } | 38 } |
| 38 | 39 |
| 39 static void Test2(JNIEnv* env, jclass jcaller, | 40 static void Test2(JNIEnv* env, const JavaParamRef<jclass>& jcaller, |
| 40 jobject t); | 41 const JavaParamRef<jobject>& t); |
| 41 | 42 |
| 42 static void Java_com_test_jni_1generator_Example_nativeTest2(JNIEnv* env, jclass | 43 static void Java_com_test_jni_1generator_Example_nativeTest2(JNIEnv* env, jclass |
| 43 jcaller, | 44 jcaller, |
| 44 jobject t) { | 45 jobject t) { |
| 45 return Test2(env, jcaller, t); | 46 return Test2(env, JavaParamRef<jclass>(env, jcaller), |
| 47 JavaParamRef<jobject>(env, t)); |
| 46 } | 48 } |
| 47 | 49 |
| 48 static void Test3(JNIEnv* env, jclass jcaller, | 50 static void Test3(JNIEnv* env, const JavaParamRef<jclass>& jcaller, |
| 49 jobject t); | 51 const JavaParamRef<jobject>& t); |
| 50 | 52 |
| 51 static void Java_com_test_jni_1generator_Example_nativeTest3(JNIEnv* env, jclass | 53 static void Java_com_test_jni_1generator_Example_nativeTest3(JNIEnv* env, jclass |
| 52 jcaller, | 54 jcaller, |
| 53 jobject t) { | 55 jobject t) { |
| 54 return Test3(env, jcaller, t); | 56 return Test3(env, JavaParamRef<jclass>(env, jcaller), |
| 57 JavaParamRef<jobject>(env, t)); |
| 55 } | 58 } |
| 56 | 59 |
| 57 static void Test4(JNIEnv* env, jclass jcaller, | 60 static void Test4(JNIEnv* env, const JavaParamRef<jclass>& jcaller, |
| 58 jobject t); | 61 const JavaParamRef<jobject>& t); |
| 59 | 62 |
| 60 static void Java_com_test_jni_1generator_Example_nativeTest4(JNIEnv* env, jclass | 63 static void Java_com_test_jni_1generator_Example_nativeTest4(JNIEnv* env, jclass |
| 61 jcaller, | 64 jcaller, |
| 62 jobject t) { | 65 jobject t) { |
| 63 return Test4(env, jcaller, t); | 66 return Test4(env, JavaParamRef<jclass>(env, jcaller), |
| 67 JavaParamRef<jobject>(env, t)); |
| 64 } | 68 } |
| 65 | 69 |
| 66 // Step 3: RegisterNatives. | 70 // Step 3: RegisterNatives. |
| 67 | 71 |
| 68 static const JNINativeMethod kMethodsExample[] = { | 72 static const JNINativeMethod kMethodsExample[] = { |
| 69 { "nativeTest", | 73 { "nativeTest", |
| 70 "(" | 74 "(" |
| 71 "Lorg/test2/Test;" | 75 "Lorg/test2/Test;" |
| 72 ")" | 76 ")" |
| 73 "V", reinterpret_cast<void*>(Java_com_test_jni_1generator_Example_nativeTest) }, | 77 "V", reinterpret_cast<void*>(Java_com_test_jni_1generator_Example_nativeTest) }, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 103 kMethodsExampleSize) < 0) { | 107 kMethodsExampleSize) < 0) { |
| 104 jni_generator::HandleRegistrationError( | 108 jni_generator::HandleRegistrationError( |
| 105 env, Example_clazz(env), __FILE__); | 109 env, Example_clazz(env), __FILE__); |
| 106 return false; | 110 return false; |
| 107 } | 111 } |
| 108 | 112 |
| 109 return true; | 113 return true; |
| 110 } | 114 } |
| 111 | 115 |
| 112 #endif // org_chromium_example_jni_generator_Example_JNI | 116 #endif // org_chromium_example_jni_generator_Example_JNI |
| OLD | NEW |