Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: base/android/jni_generator/testNativeExportsOption.golden

Issue 147533004: Remove unneeded JNI registrations. (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: Fix exports in non-JNI shared libs. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/android/jni_generator/jni_generator_tests.py ('k') | build/android/android_exports.lst » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 // This file is autogenerated by
6 // base/android/jni_generator/jni_generator.py
7 // For
8 // org/chromium/example/jni_generator/SampleForTests
9
10 #ifndef org_chromium_example_jni_generator_SampleForTests_JNI
11 #define org_chromium_example_jni_generator_SampleForTests_JNI
12
13 #include <jni.h>
14
15 #include "base/android/jni_generator/jni_generator_helper.h"
16
17 #include "base/android/jni_int_wrapper.h"
18
19 // Step 1: forward declarations.
20 namespace {
21 const char kSampleForTestsClassPath[] =
22 "org/chromium/example/jni_generator/SampleForTests";
23 // Leaking this jclass as we cannot use LazyInstance from some threads.
24 jclass g_SampleForTests_clazz = NULL;
25
26 } // namespace
27
28 extern "C" {
29
30 static jint Init(JNIEnv* env, jobject jcaller);
31
32 __attribute__((visibility("default")))
33 jint
34 Java_org_chromium_example_jni_1generator_SampleForTests_00024MyInnerClass_na tiveInit(JNIEnv*
35 env, jobject jcaller) {
36 return Init(env, jcaller);
37 }
38
39 static jint Init(JNIEnv* env, jobject jcaller);
40
41 __attribute__((visibility("default")))
42 jint
43 Java_org_chromium_example_jni_1generator_SampleForTests_00024MyOtherInnerCla ss_nativeInit(JNIEnv*
44 env, jobject jcaller) {
45 return Init(env, jcaller);
46 }
47
48 }; // extern "C"
49
50 // Step 2: method stubs.
51
52 extern "C" {
53 __attribute__((visibility("default")))
54 jint
55 Java_org_chromium_example_jni_1generator_SampleForTests_nativeStaticMethod(J NIEnv*
56 env,
57 jobject jcaller,
58 jlong nativeTest,
59 jint arg1) {
60 Test* native = reinterpret_cast<Test*>(nativeTest);
61 CHECK_NATIVE_PTR(env, jcaller, native, "StaticMethod", 0);
62 return native->StaticMethod(env, jcaller, arg1);
63 }
64
65 __attribute__((visibility("default")))
66 jint
67 Java_org_chromium_example_jni_1generator_SampleForTests_nativeMethod(JNIEnv*
68 env,
69 jobject jcaller,
70 jlong nativeTest,
71 jint arg1) {
72 Test* native = reinterpret_cast<Test*>(nativeTest);
73 CHECK_NATIVE_PTR(env, jcaller, native, "Method", 0);
74 return native->Method(env, jcaller, arg1);
75 }
76
77 static base::subtle::AtomicWord g_SampleForTests_testMethodWithParam = 0;
78 static void Java_SampleForTests_testMethodWithParam(JNIEnv* env, jobject obj,
79 JniIntWrapper iParam) {
80 /* Must call RegisterNativesImpl() */
81 CHECK_CLAZZ(env, obj,
82 g_SampleForTests_clazz);
83 jmethodID method_id =
84 base::android::MethodID::LazyGet<
85 base::android::MethodID::TYPE_INSTANCE>(
86 env, g_SampleForTests_clazz,
87 "testMethodWithParam",
88
89 "("
90 "I"
91 ")"
92 "V",
93 &g_SampleForTests_testMethodWithParam);
94
95 env->CallVoidMethod(obj,
96 method_id, as_jint(iParam));
97 jni_generator::CheckException(env);
98
99 }
100
101 static base::subtle::AtomicWord g_SampleForTests_testMethodWithParamAndReturn =
102 0;
103 static base::android::ScopedJavaLocalRef<jstring>
104 Java_SampleForTests_testMethodWithParamAndReturn(JNIEnv* env, jobject obj,
105 JniIntWrapper iParam) {
106 /* Must call RegisterNativesImpl() */
107 CHECK_CLAZZ(env, obj,
108 g_SampleForTests_clazz, NULL);
109 jmethodID method_id =
110 base::android::MethodID::LazyGet<
111 base::android::MethodID::TYPE_INSTANCE>(
112 env, g_SampleForTests_clazz,
113 "testMethodWithParamAndReturn",
114
115 "("
116 "I"
117 ")"
118 "Ljava/lang/String;",
119 &g_SampleForTests_testMethodWithParamAndReturn);
120
121 jstring ret =
122 static_cast<jstring>(env->CallObjectMethod(obj,
123 method_id, as_jint(iParam)));
124 jni_generator::CheckException(env);
125 return base::android::ScopedJavaLocalRef<jstring>(env, ret);
126 }
127
128 static base::subtle::AtomicWord g_SampleForTests_testStaticMethodWithParam = 0;
129 static jint Java_SampleForTests_testStaticMethodWithParam(JNIEnv* env,
130 JniIntWrapper iParam) {
131 /* Must call RegisterNativesImpl() */
132 CHECK_CLAZZ(env, g_SampleForTests_clazz,
133 g_SampleForTests_clazz, 0);
134 jmethodID method_id =
135 base::android::MethodID::LazyGet<
136 base::android::MethodID::TYPE_STATIC>(
137 env, g_SampleForTests_clazz,
138 "testStaticMethodWithParam",
139
140 "("
141 "I"
142 ")"
143 "I",
144 &g_SampleForTests_testStaticMethodWithParam);
145
146 jint ret =
147 env->CallStaticIntMethod(g_SampleForTests_clazz,
148 method_id, as_jint(iParam));
149 jni_generator::CheckException(env);
150 return ret;
151 }
152
153 static base::subtle::AtomicWord g_SampleForTests_testMethodWithNoParam = 0;
154 static jdouble Java_SampleForTests_testMethodWithNoParam(JNIEnv* env) {
155 /* Must call RegisterNativesImpl() */
156 CHECK_CLAZZ(env, g_SampleForTests_clazz,
157 g_SampleForTests_clazz, 0);
158 jmethodID method_id =
159 base::android::MethodID::LazyGet<
160 base::android::MethodID::TYPE_STATIC>(
161 env, g_SampleForTests_clazz,
162 "testMethodWithNoParam",
163
164 "("
165 ")"
166 "D",
167 &g_SampleForTests_testMethodWithNoParam);
168
169 jdouble ret =
170 env->CallStaticDoubleMethod(g_SampleForTests_clazz,
171 method_id);
172 jni_generator::CheckException(env);
173 return ret;
174 }
175
176 static base::subtle::AtomicWord g_SampleForTests_testStaticMethodWithNoParam =
177 0;
178 static base::android::ScopedJavaLocalRef<jstring>
179 Java_SampleForTests_testStaticMethodWithNoParam(JNIEnv* env) {
180 /* Must call RegisterNativesImpl() */
181 CHECK_CLAZZ(env, g_SampleForTests_clazz,
182 g_SampleForTests_clazz, NULL);
183 jmethodID method_id =
184 base::android::MethodID::LazyGet<
185 base::android::MethodID::TYPE_STATIC>(
186 env, g_SampleForTests_clazz,
187 "testStaticMethodWithNoParam",
188
189 "("
190 ")"
191 "Ljava/lang/String;",
192 &g_SampleForTests_testStaticMethodWithNoParam);
193
194 jstring ret =
195 static_cast<jstring>(env->CallStaticObjectMethod(g_SampleForTests_clazz,
196 method_id));
197 jni_generator::CheckException(env);
198 return base::android::ScopedJavaLocalRef<jstring>(env, ret);
199 }
200 }; // extern "C"
201
202 // Step 3: RegisterNatives.
203
204 static bool RegisterNativesImpl(JNIEnv* env, jclass clazz) {
205 g_SampleForTests_clazz = static_cast<jclass>(env->NewWeakGlobalRef(clazz));
206
207 return true;
208 }
209
210 extern "C" JNIEXPORT bool JNICALL
211 Java_org_chromium_example_jni_1generator_SampleForTests_nativeInitNativeClass(JN IEnv*
212 env, jclass clazz) {
213 return RegisterNativesImpl(env, clazz);
214 }
215
216 #endif // org_chromium_example_jni_generator_SampleForTests_JNI
OLDNEW
« no previous file with comments | « base/android/jni_generator/jni_generator_tests.py ('k') | build/android/android_exports.lst » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698