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

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

Issue 2213963002: Stop relying on using statements in the JNI generator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
OLDNEW
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/TestJni 8 // org/chromium/TestJni
9 9
10 #ifndef org_chromium_TestJni_JNI 10 #ifndef org_chromium_TestJni_JNI
11 #define org_chromium_TestJni_JNI 11 #define org_chromium_TestJni_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 kTestJniClassPath[] = "org/chromium/TestJni"; 21 const char kTestJniClassPath[] = "org/chromium/TestJni";
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 base::subtle::AtomicWord g_TestJni_clazz __attribute__((unused)) = 0; 23 base::subtle::AtomicWord g_TestJni_clazz __attribute__((unused)) = 0;
24 #define TestJni_clazz(env) base::android::LazyGetClass(env, kTestJniClassPath, & g_TestJni_clazz) 24 #define TestJni_clazz(env) base::android::LazyGetClass(env, kTestJniClassPath, & g_TestJni_clazz)
25 25
26 } // namespace 26 } // namespace
27 27
28 // Step 2: method stubs. 28 // Step 2: method stubs.
29 29
30 static jint Init(JNIEnv* env, const JavaParamRef<jobject>& jcaller); 30 static jint Init(JNIEnv* env, const base::android::JavaParamRef<jobject>&
31 jcaller);
31 32
32 extern "C" __attribute__((visibility("default"))) 33 extern "C" __attribute__((visibility("default")))
33 jint Java_org_chromium_TestJni_nativeInit(JNIEnv* env, jobject jcaller) { 34 jint Java_org_chromium_TestJni_nativeInit(JNIEnv* env, jobject jcaller) {
34 return Init(env, JavaParamRef<jobject>(env, jcaller)); 35 return Init(env, base::android::JavaParamRef<jobject>(env, jcaller));
35 } 36 }
36 37
37 extern "C" __attribute__((visibility("default"))) 38 extern "C" __attribute__((visibility("default")))
38 void Java_org_chromium_TestJni_nativeDestroy(JNIEnv* env, 39 void Java_org_chromium_TestJni_nativeDestroy(JNIEnv* env,
39 jobject jcaller, 40 jobject jcaller,
40 jint nativeChromeBrowserProvider) { 41 jint nativeChromeBrowserProvider) {
41 ChromeBrowserProvider* native = 42 ChromeBrowserProvider* native =
42 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider); 43 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
43 CHECK_NATIVE_PTR(env, jcaller, native, "Destroy"); 44 CHECK_NATIVE_PTR(env, jcaller, native, "Destroy");
44 return native->Destroy(env, JavaParamRef<jobject>(env, jcaller)); 45 return native->Destroy(env, base::android::JavaParamRef<jobject>(env,
46 jcaller));
45 } 47 }
46 48
47 extern "C" __attribute__((visibility("default"))) 49 extern "C" __attribute__((visibility("default")))
48 jlong Java_org_chromium_TestJni_nativeAddBookmark(JNIEnv* env, 50 jlong Java_org_chromium_TestJni_nativeAddBookmark(JNIEnv* env,
49 jobject jcaller, 51 jobject jcaller,
50 jint nativeChromeBrowserProvider, 52 jint nativeChromeBrowserProvider,
51 jstring url, 53 jstring url,
52 jstring title, 54 jstring title,
53 jboolean isFolder, 55 jboolean isFolder,
54 jlong parentId) { 56 jlong parentId) {
55 ChromeBrowserProvider* native = 57 ChromeBrowserProvider* native =
56 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider); 58 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
57 CHECK_NATIVE_PTR(env, jcaller, native, "AddBookmark", 0); 59 CHECK_NATIVE_PTR(env, jcaller, native, "AddBookmark", 0);
58 return native->AddBookmark(env, JavaParamRef<jobject>(env, jcaller), 60 return native->AddBookmark(env, base::android::JavaParamRef<jobject>(env,
59 JavaParamRef<jstring>(env, url), JavaParamRef<jstring>(env, title), 61 jcaller), base::android::JavaParamRef<jstring>(env, url),
60 isFolder, parentId); 62 base::android::JavaParamRef<jstring>(env, title), isFolder, parentId);
61 } 63 }
62 64
63 static ScopedJavaLocalRef<jstring> GetDomainAndRegistry(JNIEnv* env, const 65 static base::android::ScopedJavaLocalRef<jstring> GetDomainAndRegistry(JNIEnv*
64 JavaParamRef<jclass>& jcaller, 66 env, const base::android::JavaParamRef<jclass>& jcaller,
65 const JavaParamRef<jstring>& url); 67 const base::android::JavaParamRef<jstring>& url);
66 68
67 extern "C" __attribute__((visibility("default"))) 69 extern "C" __attribute__((visibility("default")))
68 jstring Java_org_chromium_TestJni_nativeGetDomainAndRegistry(JNIEnv* env, jclass 70 jstring Java_org_chromium_TestJni_nativeGetDomainAndRegistry(JNIEnv* env, jclass
69 jcaller, 71 jcaller,
70 jstring url) { 72 jstring url) {
71 return GetDomainAndRegistry(env, JavaParamRef<jclass>(env, jcaller), 73 return GetDomainAndRegistry(env, base::android::JavaParamRef<jclass>(env,
72 JavaParamRef<jstring>(env, url)).Release(); 74 jcaller), base::android::JavaParamRef<jstring>(env, url)).Release();
73 } 75 }
74 76
75 static void CreateHistoricalTabFromState(JNIEnv* env, const 77 static void CreateHistoricalTabFromState(JNIEnv* env, const
76 JavaParamRef<jclass>& jcaller, 78 base::android::JavaParamRef<jclass>& jcaller,
77 const JavaParamRef<jbyteArray>& state, 79 const base::android::JavaParamRef<jbyteArray>& state,
78 jint tab_index); 80 jint tab_index);
79 81
80 extern "C" __attribute__((visibility("default"))) 82 extern "C" __attribute__((visibility("default")))
81 void Java_org_chromium_TestJni_nativeCreateHistoricalTabFromState(JNIEnv* env, 83 void Java_org_chromium_TestJni_nativeCreateHistoricalTabFromState(JNIEnv* env,
82 jclass jcaller, 84 jclass jcaller,
83 jbyteArray state, 85 jbyteArray state,
84 jint tab_index) { 86 jint tab_index) {
85 return CreateHistoricalTabFromState(env, JavaParamRef<jclass>(env, jcaller), 87 return CreateHistoricalTabFromState(env,
86 JavaParamRef<jbyteArray>(env, state), tab_index); 88 base::android::JavaParamRef<jclass>(env, jcaller),
89 base::android::JavaParamRef<jbyteArray>(env, state), tab_index);
87 } 90 }
88 91
89 static ScopedJavaLocalRef<jbyteArray> GetStateAsByteArray(JNIEnv* env, const 92 static base::android::ScopedJavaLocalRef<jbyteArray> GetStateAsByteArray(JNIEnv*
90 JavaParamRef<jobject>& jcaller, 93 env, const base::android::JavaParamRef<jobject>& jcaller,
91 const JavaParamRef<jobject>& view); 94 const base::android::JavaParamRef<jobject>& view);
92 95
93 extern "C" __attribute__((visibility("default"))) 96 extern "C" __attribute__((visibility("default")))
94 jbyteArray Java_org_chromium_TestJni_nativeGetStateAsByteArray(JNIEnv* env, 97 jbyteArray Java_org_chromium_TestJni_nativeGetStateAsByteArray(JNIEnv* env,
95 jobject jcaller, 98 jobject jcaller,
96 jobject view) { 99 jobject view) {
97 return GetStateAsByteArray(env, JavaParamRef<jobject>(env, jcaller), 100 return GetStateAsByteArray(env, base::android::JavaParamRef<jobject>(env,
98 JavaParamRef<jobject>(env, view)).Release(); 101 jcaller), base::android::JavaParamRef<jobject>(env, view)).Release();
99 } 102 }
100 103
101 static ScopedJavaLocalRef<jobjectArray> GetAutofillProfileGUIDs(JNIEnv* env, 104 static base::android::ScopedJavaLocalRef<jobjectArray>
102 const JavaParamRef<jclass>& jcaller); 105 GetAutofillProfileGUIDs(JNIEnv* env, const
106 base::android::JavaParamRef<jclass>& jcaller);
103 107
104 extern "C" __attribute__((visibility("default"))) 108 extern "C" __attribute__((visibility("default")))
105 jobjectArray Java_org_chromium_TestJni_nativeGetAutofillProfileGUIDs(JNIEnv* 109 jobjectArray Java_org_chromium_TestJni_nativeGetAutofillProfileGUIDs(JNIEnv*
106 env, jclass jcaller) { 110 env, jclass jcaller) {
107 return GetAutofillProfileGUIDs(env, JavaParamRef<jclass>(env, 111 return GetAutofillProfileGUIDs(env, base::android::JavaParamRef<jclass>(env,
108 jcaller)).Release(); 112 jcaller)).Release();
109 } 113 }
110 114
111 static void SetRecognitionResults(JNIEnv* env, const JavaParamRef<jobject>& 115 static void SetRecognitionResults(JNIEnv* env, const
112 jcaller, 116 base::android::JavaParamRef<jobject>& jcaller,
113 jint sessionId, 117 jint sessionId,
114 const JavaParamRef<jobjectArray>& results); 118 const base::android::JavaParamRef<jobjectArray>& results);
115 119
116 extern "C" __attribute__((visibility("default"))) 120 extern "C" __attribute__((visibility("default")))
117 void Java_org_chromium_TestJni_nativeSetRecognitionResults(JNIEnv* env, jobject 121 void Java_org_chromium_TestJni_nativeSetRecognitionResults(JNIEnv* env, jobject
118 jcaller, 122 jcaller,
119 jint sessionId, 123 jint sessionId,
120 jobjectArray results) { 124 jobjectArray results) {
121 return SetRecognitionResults(env, JavaParamRef<jobject>(env, jcaller), 125 return SetRecognitionResults(env, base::android::JavaParamRef<jobject>(env,
122 sessionId, JavaParamRef<jobjectArray>(env, results)); 126 jcaller), sessionId, base::android::JavaParamRef<jobjectArray>(env,
127 results));
123 } 128 }
124 129
125 extern "C" __attribute__((visibility("default"))) 130 extern "C" __attribute__((visibility("default")))
126 jlong Java_org_chromium_TestJni_nativeAddBookmarkFromAPI(JNIEnv* env, 131 jlong Java_org_chromium_TestJni_nativeAddBookmarkFromAPI(JNIEnv* env,
127 jobject jcaller, 132 jobject jcaller,
128 jint nativeChromeBrowserProvider, 133 jint nativeChromeBrowserProvider,
129 jstring url, 134 jstring url,
130 jobject created, 135 jobject created,
131 jobject isBookmark, 136 jobject isBookmark,
132 jobject date, 137 jobject date,
133 jbyteArray favicon, 138 jbyteArray favicon,
134 jstring title, 139 jstring title,
135 jobject visits) { 140 jobject visits) {
136 ChromeBrowserProvider* native = 141 ChromeBrowserProvider* native =
137 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider); 142 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
138 CHECK_NATIVE_PTR(env, jcaller, native, "AddBookmarkFromAPI", 0); 143 CHECK_NATIVE_PTR(env, jcaller, native, "AddBookmarkFromAPI", 0);
139 return native->AddBookmarkFromAPI(env, JavaParamRef<jobject>(env, jcaller), 144 return native->AddBookmarkFromAPI(env,
140 JavaParamRef<jstring>(env, url), JavaParamRef<jobject>(env, created), 145 base::android::JavaParamRef<jobject>(env, jcaller),
141 JavaParamRef<jobject>(env, isBookmark), JavaParamRef<jobject>(env, date), 146 base::android::JavaParamRef<jstring>(env, url),
142 JavaParamRef<jbyteArray>(env, favicon), JavaParamRef<jstring>(env, title), 147 base::android::JavaParamRef<jobject>(env, created),
143 JavaParamRef<jobject>(env, visits)); 148 base::android::JavaParamRef<jobject>(env, isBookmark),
149 base::android::JavaParamRef<jobject>(env, date),
150 base::android::JavaParamRef<jbyteArray>(env, favicon),
151 base::android::JavaParamRef<jstring>(env, title),
152 base::android::JavaParamRef<jobject>(env, visits));
144 } 153 }
145 154
146 static jint FindAll(JNIEnv* env, const JavaParamRef<jobject>& jcaller, 155 static jint FindAll(JNIEnv* env, const base::android::JavaParamRef<jobject>&
147 const JavaParamRef<jstring>& find); 156 jcaller,
157 const base::android::JavaParamRef<jstring>& find);
148 158
149 extern "C" __attribute__((visibility("default"))) 159 extern "C" __attribute__((visibility("default")))
150 jint Java_org_chromium_TestJni_nativeFindAll(JNIEnv* env, jobject jcaller, 160 jint Java_org_chromium_TestJni_nativeFindAll(JNIEnv* env, jobject jcaller,
151 jstring find) { 161 jstring find) {
152 return FindAll(env, JavaParamRef<jobject>(env, jcaller), 162 return FindAll(env, base::android::JavaParamRef<jobject>(env, jcaller),
153 JavaParamRef<jstring>(env, find)); 163 base::android::JavaParamRef<jstring>(env, find));
154 } 164 }
155 165
156 static ScopedJavaLocalRef<jobject> GetInnerClass(JNIEnv* env, const 166 static base::android::ScopedJavaLocalRef<jobject> GetInnerClass(JNIEnv* env,
157 JavaParamRef<jclass>& jcaller); 167 const base::android::JavaParamRef<jclass>& jcaller);
158 168
159 extern "C" __attribute__((visibility("default"))) 169 extern "C" __attribute__((visibility("default")))
160 jobject Java_org_chromium_TestJni_nativeGetInnerClass(JNIEnv* env, jclass 170 jobject Java_org_chromium_TestJni_nativeGetInnerClass(JNIEnv* env, jclass
161 jcaller) { 171 jcaller) {
162 return GetInnerClass(env, JavaParamRef<jclass>(env, jcaller)).Release(); 172 return GetInnerClass(env, base::android::JavaParamRef<jclass>(env,
173 jcaller)).Release();
163 } 174 }
164 175
165 extern "C" __attribute__((visibility("default"))) 176 extern "C" __attribute__((visibility("default")))
166 jobject Java_org_chromium_TestJni_nativeQueryBitmap(JNIEnv* env, 177 jobject Java_org_chromium_TestJni_nativeQueryBitmap(JNIEnv* env,
167 jobject jcaller, 178 jobject jcaller,
168 jint nativeChromeBrowserProvider, 179 jint nativeChromeBrowserProvider,
169 jobjectArray projection, 180 jobjectArray projection,
170 jstring selection, 181 jstring selection,
171 jobjectArray selectionArgs, 182 jobjectArray selectionArgs,
172 jstring sortOrder) { 183 jstring sortOrder) {
173 ChromeBrowserProvider* native = 184 ChromeBrowserProvider* native =
174 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider); 185 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
175 CHECK_NATIVE_PTR(env, jcaller, native, "QueryBitmap", NULL); 186 CHECK_NATIVE_PTR(env, jcaller, native, "QueryBitmap", NULL);
176 return native->QueryBitmap(env, JavaParamRef<jobject>(env, jcaller), 187 return native->QueryBitmap(env, base::android::JavaParamRef<jobject>(env,
177 JavaParamRef<jobjectArray>(env, projection), JavaParamRef<jstring>(env, 188 jcaller), base::android::JavaParamRef<jobjectArray>(env, projection),
178 selection), JavaParamRef<jobjectArray>(env, selectionArgs), 189 base::android::JavaParamRef<jstring>(env, selection),
179 JavaParamRef<jstring>(env, sortOrder)).Release(); 190 base::android::JavaParamRef<jobjectArray>(env, selectionArgs),
191 base::android::JavaParamRef<jstring>(env, sortOrder)).Release();
180 } 192 }
181 193
182 extern "C" __attribute__((visibility("default"))) 194 extern "C" __attribute__((visibility("default")))
183 void Java_org_chromium_TestJni_nativeGotOrientation(JNIEnv* env, 195 void Java_org_chromium_TestJni_nativeGotOrientation(JNIEnv* env,
184 jobject jcaller, 196 jobject jcaller,
185 jint nativeDataFetcherImplAndroid, 197 jint nativeDataFetcherImplAndroid,
186 jdouble alpha, 198 jdouble alpha,
187 jdouble beta, 199 jdouble beta,
188 jdouble gamma) { 200 jdouble gamma) {
189 DataFetcherImplAndroid* native = 201 DataFetcherImplAndroid* native =
190 reinterpret_cast<DataFetcherImplAndroid*>(nativeDataFetcherImplAndroid); 202 reinterpret_cast<DataFetcherImplAndroid*>(nativeDataFetcherImplAndroid);
191 CHECK_NATIVE_PTR(env, jcaller, native, "GotOrientation"); 203 CHECK_NATIVE_PTR(env, jcaller, native, "GotOrientation");
192 return native->GotOrientation(env, JavaParamRef<jobject>(env, jcaller), alpha, 204 return native->GotOrientation(env, base::android::JavaParamRef<jobject>(env,
193 beta, gamma); 205 jcaller), alpha, beta, gamma);
194 } 206 }
195 207
196 static ScopedJavaLocalRef<jthrowable> MessWithJavaException(JNIEnv* env, const 208 static base::android::ScopedJavaLocalRef<jthrowable>
197 JavaParamRef<jclass>& jcaller, 209 MessWithJavaException(JNIEnv* env, const
198 const JavaParamRef<jthrowable>& e); 210 base::android::JavaParamRef<jclass>& jcaller,
211 const base::android::JavaParamRef<jthrowable>& e);
199 212
200 extern "C" __attribute__((visibility("default"))) 213 extern "C" __attribute__((visibility("default")))
201 jthrowable Java_org_chromium_TestJni_nativeMessWithJavaException(JNIEnv* env, 214 jthrowable Java_org_chromium_TestJni_nativeMessWithJavaException(JNIEnv* env,
202 jclass jcaller, 215 jclass jcaller,
203 jthrowable e) { 216 jthrowable e) {
204 return MessWithJavaException(env, JavaParamRef<jclass>(env, jcaller), 217 return MessWithJavaException(env, base::android::JavaParamRef<jclass>(env,
205 JavaParamRef<jthrowable>(env, e)).Release(); 218 jcaller), base::android::JavaParamRef<jthrowable>(env, e)).Release();
206 } 219 }
207 220
208 // Step 3: RegisterNatives. 221 // Step 3: RegisterNatives.
209 222
210 static const JNINativeMethod kMethodsTestJni[] = { 223 static const JNINativeMethod kMethodsTestJni[] = {
211 { "nativeInit", 224 { "nativeInit",
212 "(" 225 "("
213 ")" 226 ")"
214 "I", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeInit) }, 227 "I", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeInit) },
215 { "nativeDestroy", 228 { "nativeDestroy",
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 kMethodsTestJniSize) < 0) { 335 kMethodsTestJniSize) < 0) {
323 jni_generator::HandleRegistrationError( 336 jni_generator::HandleRegistrationError(
324 env, TestJni_clazz(env), __FILE__); 337 env, TestJni_clazz(env), __FILE__);
325 return false; 338 return false;
326 } 339 }
327 340
328 return true; 341 return true;
329 } 342 }
330 343
331 #endif // org_chromium_TestJni_JNI 344 #endif // org_chromium_TestJni_JNI
OLDNEW
« no previous file with comments | « base/android/jni_generator/testNativeExportsOnlyOption.golden ('k') | base/android/jni_generator/testNativesLong.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698