| 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/SampleForTests | 8 // org/chromium/example/jni_generator/SampleForTests |
| 9 | 9 |
| 10 #ifndef org_chromium_example_jni_generator_SampleForTests_JNI | 10 #ifndef org_chromium_example_jni_generator_SampleForTests_JNI |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 extern "C" __attribute__((visibility("default"))) | 65 extern "C" __attribute__((visibility("default"))) |
| 66 jint | 66 jint |
| 67 Java_org_chromium_example_jni_1generator_SampleForTests_00024MyOtherInnerCla
ss_nativeInit(JNIEnv* | 67 Java_org_chromium_example_jni_1generator_SampleForTests_00024MyOtherInnerCla
ss_nativeInit(JNIEnv* |
| 68 env, jobject jcaller) { | 68 env, jobject jcaller) { |
| 69 return Init(env, JavaParamRef<jobject>(env, jcaller)); | 69 return Init(env, JavaParamRef<jobject>(env, jcaller)); |
| 70 } | 70 } |
| 71 | 71 |
| 72 static base::subtle::AtomicWord g_SampleForTests_testMethodWithParam = 0; | 72 static base::subtle::AtomicWord g_SampleForTests_testMethodWithParam = 0; |
| 73 static void Java_SampleForTests_testMethodWithParam(JNIEnv* env, jobject obj, | 73 static void Java_SampleForTests_testMethodWithParam(JNIEnv* env, jobject obj, |
| 74 JniIntWrapper iParam) { | 74 JniIntWrapper iParam) { |
| 75 /* Must call RegisterNativesImpl() */ | |
| 76 CHECK_CLAZZ(env, obj, | 75 CHECK_CLAZZ(env, obj, |
| 77 SampleForTests_clazz(env)); | 76 SampleForTests_clazz(env)); |
| 78 jmethodID method_id = | 77 jmethodID method_id = |
| 79 base::android::MethodID::LazyGet< | 78 base::android::MethodID::LazyGet< |
| 80 base::android::MethodID::TYPE_INSTANCE>( | 79 base::android::MethodID::TYPE_INSTANCE>( |
| 81 env, SampleForTests_clazz(env), | 80 env, SampleForTests_clazz(env), |
| 82 "testMethodWithParam", | 81 "testMethodWithParam", |
| 83 | 82 |
| 84 "(" | 83 "(" |
| 85 "I" | 84 "I" |
| 86 ")" | 85 ")" |
| 87 "V", | 86 "V", |
| 88 &g_SampleForTests_testMethodWithParam); | 87 &g_SampleForTests_testMethodWithParam); |
| 89 | 88 |
| 90 env->CallVoidMethod(obj, | 89 env->CallVoidMethod(obj, |
| 91 method_id, as_jint(iParam)); | 90 method_id, as_jint(iParam)); |
| 92 jni_generator::CheckException(env); | 91 jni_generator::CheckException(env); |
| 93 | 92 |
| 94 } | 93 } |
| 95 | 94 |
| 96 static base::subtle::AtomicWord g_SampleForTests_testMethodWithParamAndReturn = | 95 static base::subtle::AtomicWord g_SampleForTests_testMethodWithParamAndReturn = |
| 97 0; | 96 0; |
| 98 static ScopedJavaLocalRef<jstring> | 97 static ScopedJavaLocalRef<jstring> |
| 99 Java_SampleForTests_testMethodWithParamAndReturn(JNIEnv* env, jobject obj, | 98 Java_SampleForTests_testMethodWithParamAndReturn(JNIEnv* env, jobject obj, |
| 100 JniIntWrapper iParam) { | 99 JniIntWrapper iParam) { |
| 101 /* Must call RegisterNativesImpl() */ | |
| 102 CHECK_CLAZZ(env, obj, | 100 CHECK_CLAZZ(env, obj, |
| 103 SampleForTests_clazz(env), NULL); | 101 SampleForTests_clazz(env), NULL); |
| 104 jmethodID method_id = | 102 jmethodID method_id = |
| 105 base::android::MethodID::LazyGet< | 103 base::android::MethodID::LazyGet< |
| 106 base::android::MethodID::TYPE_INSTANCE>( | 104 base::android::MethodID::TYPE_INSTANCE>( |
| 107 env, SampleForTests_clazz(env), | 105 env, SampleForTests_clazz(env), |
| 108 "testMethodWithParamAndReturn", | 106 "testMethodWithParamAndReturn", |
| 109 | 107 |
| 110 "(" | 108 "(" |
| 111 "I" | 109 "I" |
| 112 ")" | 110 ")" |
| 113 "Ljava/lang/String;", | 111 "Ljava/lang/String;", |
| 114 &g_SampleForTests_testMethodWithParamAndReturn); | 112 &g_SampleForTests_testMethodWithParamAndReturn); |
| 115 | 113 |
| 116 jstring ret = | 114 jstring ret = |
| 117 static_cast<jstring>(env->CallObjectMethod(obj, | 115 static_cast<jstring>(env->CallObjectMethod(obj, |
| 118 method_id, as_jint(iParam))); | 116 method_id, as_jint(iParam))); |
| 119 jni_generator::CheckException(env); | 117 jni_generator::CheckException(env); |
| 120 return ScopedJavaLocalRef<jstring>(env, ret); | 118 return ScopedJavaLocalRef<jstring>(env, ret); |
| 121 } | 119 } |
| 122 | 120 |
| 123 static base::subtle::AtomicWord g_SampleForTests_testStaticMethodWithParam = 0; | 121 static base::subtle::AtomicWord g_SampleForTests_testStaticMethodWithParam = 0; |
| 124 static jint Java_SampleForTests_testStaticMethodWithParam(JNIEnv* env, | 122 static jint Java_SampleForTests_testStaticMethodWithParam(JNIEnv* env, |
| 125 JniIntWrapper iParam) { | 123 JniIntWrapper iParam) { |
| 126 /* Must call RegisterNativesImpl() */ | |
| 127 CHECK_CLAZZ(env, SampleForTests_clazz(env), | 124 CHECK_CLAZZ(env, SampleForTests_clazz(env), |
| 128 SampleForTests_clazz(env), 0); | 125 SampleForTests_clazz(env), 0); |
| 129 jmethodID method_id = | 126 jmethodID method_id = |
| 130 base::android::MethodID::LazyGet< | 127 base::android::MethodID::LazyGet< |
| 131 base::android::MethodID::TYPE_STATIC>( | 128 base::android::MethodID::TYPE_STATIC>( |
| 132 env, SampleForTests_clazz(env), | 129 env, SampleForTests_clazz(env), |
| 133 "testStaticMethodWithParam", | 130 "testStaticMethodWithParam", |
| 134 | 131 |
| 135 "(" | 132 "(" |
| 136 "I" | 133 "I" |
| 137 ")" | 134 ")" |
| 138 "I", | 135 "I", |
| 139 &g_SampleForTests_testStaticMethodWithParam); | 136 &g_SampleForTests_testStaticMethodWithParam); |
| 140 | 137 |
| 141 jint ret = | 138 jint ret = |
| 142 env->CallStaticIntMethod(SampleForTests_clazz(env), | 139 env->CallStaticIntMethod(SampleForTests_clazz(env), |
| 143 method_id, as_jint(iParam)); | 140 method_id, as_jint(iParam)); |
| 144 jni_generator::CheckException(env); | 141 jni_generator::CheckException(env); |
| 145 return ret; | 142 return ret; |
| 146 } | 143 } |
| 147 | 144 |
| 148 static base::subtle::AtomicWord g_SampleForTests_testMethodWithNoParam = 0; | 145 static base::subtle::AtomicWord g_SampleForTests_testMethodWithNoParam = 0; |
| 149 static jdouble Java_SampleForTests_testMethodWithNoParam(JNIEnv* env) { | 146 static jdouble Java_SampleForTests_testMethodWithNoParam(JNIEnv* env) { |
| 150 /* Must call RegisterNativesImpl() */ | |
| 151 CHECK_CLAZZ(env, SampleForTests_clazz(env), | 147 CHECK_CLAZZ(env, SampleForTests_clazz(env), |
| 152 SampleForTests_clazz(env), 0); | 148 SampleForTests_clazz(env), 0); |
| 153 jmethodID method_id = | 149 jmethodID method_id = |
| 154 base::android::MethodID::LazyGet< | 150 base::android::MethodID::LazyGet< |
| 155 base::android::MethodID::TYPE_STATIC>( | 151 base::android::MethodID::TYPE_STATIC>( |
| 156 env, SampleForTests_clazz(env), | 152 env, SampleForTests_clazz(env), |
| 157 "testMethodWithNoParam", | 153 "testMethodWithNoParam", |
| 158 | 154 |
| 159 "(" | 155 "(" |
| 160 ")" | 156 ")" |
| 161 "D", | 157 "D", |
| 162 &g_SampleForTests_testMethodWithNoParam); | 158 &g_SampleForTests_testMethodWithNoParam); |
| 163 | 159 |
| 164 jdouble ret = | 160 jdouble ret = |
| 165 env->CallStaticDoubleMethod(SampleForTests_clazz(env), | 161 env->CallStaticDoubleMethod(SampleForTests_clazz(env), |
| 166 method_id); | 162 method_id); |
| 167 jni_generator::CheckException(env); | 163 jni_generator::CheckException(env); |
| 168 return ret; | 164 return ret; |
| 169 } | 165 } |
| 170 | 166 |
| 171 static base::subtle::AtomicWord g_SampleForTests_testStaticMethodWithNoParam = | 167 static base::subtle::AtomicWord g_SampleForTests_testStaticMethodWithNoParam = |
| 172 0; | 168 0; |
| 173 static ScopedJavaLocalRef<jstring> | 169 static ScopedJavaLocalRef<jstring> |
| 174 Java_SampleForTests_testStaticMethodWithNoParam(JNIEnv* env) { | 170 Java_SampleForTests_testStaticMethodWithNoParam(JNIEnv* env) { |
| 175 /* Must call RegisterNativesImpl() */ | |
| 176 CHECK_CLAZZ(env, SampleForTests_clazz(env), | 171 CHECK_CLAZZ(env, SampleForTests_clazz(env), |
| 177 SampleForTests_clazz(env), NULL); | 172 SampleForTests_clazz(env), NULL); |
| 178 jmethodID method_id = | 173 jmethodID method_id = |
| 179 base::android::MethodID::LazyGet< | 174 base::android::MethodID::LazyGet< |
| 180 base::android::MethodID::TYPE_STATIC>( | 175 base::android::MethodID::TYPE_STATIC>( |
| 181 env, SampleForTests_clazz(env), | 176 env, SampleForTests_clazz(env), |
| 182 "testStaticMethodWithNoParam", | 177 "testStaticMethodWithNoParam", |
| 183 | 178 |
| 184 "(" | 179 "(" |
| 185 ")" | 180 ")" |
| 186 "Ljava/lang/String;", | 181 "Ljava/lang/String;", |
| 187 &g_SampleForTests_testStaticMethodWithNoParam); | 182 &g_SampleForTests_testStaticMethodWithNoParam); |
| 188 | 183 |
| 189 jstring ret = | 184 jstring ret = |
| 190 static_cast<jstring>(env->CallStaticObjectMethod(SampleForTests_clazz(env), | 185 static_cast<jstring>(env->CallStaticObjectMethod(SampleForTests_clazz(env), |
| 191 method_id)); | 186 method_id)); |
| 192 jni_generator::CheckException(env); | 187 jni_generator::CheckException(env); |
| 193 return ScopedJavaLocalRef<jstring>(env, ret); | 188 return ScopedJavaLocalRef<jstring>(env, ret); |
| 194 } | 189 } |
| 195 | 190 |
| 196 // Step 3: RegisterNatives. | 191 // Step 3: RegisterNatives. |
| 197 | 192 |
| 193 static bool RegisterNativesImpl(JNIEnv* env) __attribute__((unused)); |
| 198 static bool RegisterNativesImpl(JNIEnv* env) { | 194 static bool RegisterNativesImpl(JNIEnv* env) { |
| 199 | 195 |
| 200 return true; | 196 return true; |
| 201 } | 197 } |
| 202 | 198 |
| 203 #endif // org_chromium_example_jni_generator_SampleForTests_JNI | 199 #endif // org_chromium_example_jni_generator_SampleForTests_JNI |
| OLD | NEW |