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

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

Issue 1279163006: jni_generator: Wrap all native methods in stubs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 jclass g_TestJni_clazz = NULL; 23 jclass g_TestJni_clazz = NULL;
24 #define TestJni_clazz(env) g_TestJni_clazz 24 #define TestJni_clazz(env) g_TestJni_clazz
25 25
26 } // namespace 26 } // namespace
27 27
28 static jint Init(JNIEnv* env, jobject jcaller); 28 static jint Init(JNIEnv* env, jobject jcaller);
29 29
30 static jint Java_org_chromium_TestJni_nativeInit(JNIEnv* env, jobject jcaller) {
31 return Init(env, jcaller);
32 }
33
30 static jstring GetDomainAndRegistry(JNIEnv* env, jclass jcaller, 34 static jstring GetDomainAndRegistry(JNIEnv* env, jclass jcaller,
31 jstring url); 35 jstring url);
32 36
37 static jstring Java_org_chromium_TestJni_nativeGetDomainAndRegistry(JNIEnv* env,
38 jclass jcaller,
39 jstring url) {
40 return GetDomainAndRegistry(env, jcaller, url);
41 }
42
33 static void CreateHistoricalTabFromState(JNIEnv* env, jclass jcaller, 43 static void CreateHistoricalTabFromState(JNIEnv* env, jclass jcaller,
34 jbyteArray state, 44 jbyteArray state,
35 jint tab_index); 45 jint tab_index);
36 46
47 static void Java_org_chromium_TestJni_nativeCreateHistoricalTabFromState(JNIEnv*
48 env, jclass jcaller,
49 jbyteArray state,
50 jint tab_index) {
51 return CreateHistoricalTabFromState(env, jcaller, state, tab_index);
52 }
53
37 static jbyteArray GetStateAsByteArray(JNIEnv* env, jobject jcaller, 54 static jbyteArray GetStateAsByteArray(JNIEnv* env, jobject jcaller,
38 jobject view); 55 jobject view);
39 56
57 static jbyteArray Java_org_chromium_TestJni_nativeGetStateAsByteArray(JNIEnv*
58 env, jobject jcaller,
59 jobject view) {
60 return GetStateAsByteArray(env, jcaller, view);
61 }
62
40 static jobjectArray GetAutofillProfileGUIDs(JNIEnv* env, jclass jcaller); 63 static jobjectArray GetAutofillProfileGUIDs(JNIEnv* env, jclass jcaller);
41 64
65 static jobjectArray
66 Java_org_chromium_TestJni_nativeGetAutofillProfileGUIDs(JNIEnv* env, jclass
67 jcaller) {
68 return GetAutofillProfileGUIDs(env, jcaller);
69 }
70
42 static void SetRecognitionResults(JNIEnv* env, jobject jcaller, 71 static void SetRecognitionResults(JNIEnv* env, jobject jcaller,
43 jint sessionId, 72 jint sessionId,
44 jobjectArray results); 73 jobjectArray results);
45 74
75 static void Java_org_chromium_TestJni_nativeSetRecognitionResults(JNIEnv* env,
76 jobject jcaller,
77 jint sessionId,
78 jobjectArray results) {
79 return SetRecognitionResults(env, jcaller, sessionId, results);
80 }
81
46 static jint FindAll(JNIEnv* env, jobject jcaller, 82 static jint FindAll(JNIEnv* env, jobject jcaller,
47 jstring find); 83 jstring find);
48 84
85 static jint Java_org_chromium_TestJni_nativeFindAll(JNIEnv* env, jobject
86 jcaller,
87 jstring find) {
88 return FindAll(env, jcaller, find);
89 }
90
49 static jobject GetInnerClass(JNIEnv* env, jclass jcaller); 91 static jobject GetInnerClass(JNIEnv* env, jclass jcaller);
50 92
93 static jobject Java_org_chromium_TestJni_nativeGetInnerClass(JNIEnv* env, jclass
94 jcaller) {
95 return GetInnerClass(env, jcaller);
96 }
97
51 // Step 2: method stubs. 98 // Step 2: method stubs.
52 static void Destroy(JNIEnv* env, jobject jcaller, 99 static void Java_org_chromium_TestJni_nativeDestroy(JNIEnv* env,
100 jobject jcaller,
53 jint nativeChromeBrowserProvider) { 101 jint nativeChromeBrowserProvider) {
54 ChromeBrowserProvider* native = 102 ChromeBrowserProvider* native =
55 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider); 103 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
56 CHECK_NATIVE_PTR(env, jcaller, native, "Destroy"); 104 CHECK_NATIVE_PTR(env, jcaller, native, "Destroy");
57 return native->Destroy(env, jcaller); 105 return native->Destroy(env, jcaller);
58 } 106 }
59 107
60 static jlong AddBookmark(JNIEnv* env, jobject jcaller, 108 static jlong Java_org_chromium_TestJni_nativeAddBookmark(JNIEnv* env,
109 jobject jcaller,
61 jint nativeChromeBrowserProvider, 110 jint nativeChromeBrowserProvider,
62 jstring url, 111 jstring url,
63 jstring title, 112 jstring title,
64 jboolean isFolder, 113 jboolean isFolder,
65 jlong parentId) { 114 jlong parentId) {
66 ChromeBrowserProvider* native = 115 ChromeBrowserProvider* native =
67 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider); 116 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
68 CHECK_NATIVE_PTR(env, jcaller, native, "AddBookmark", 0); 117 CHECK_NATIVE_PTR(env, jcaller, native, "AddBookmark", 0);
69 return native->AddBookmark(env, jcaller, url, title, isFolder, parentId); 118 return native->AddBookmark(env, jcaller, url, title, isFolder, parentId);
70 } 119 }
71 120
72 static jlong AddBookmarkFromAPI(JNIEnv* env, jobject jcaller, 121 static jlong Java_org_chromium_TestJni_nativeAddBookmarkFromAPI(JNIEnv* env,
122 jobject jcaller,
73 jint nativeChromeBrowserProvider, 123 jint nativeChromeBrowserProvider,
74 jstring url, 124 jstring url,
75 jobject created, 125 jobject created,
76 jobject isBookmark, 126 jobject isBookmark,
77 jobject date, 127 jobject date,
78 jbyteArray favicon, 128 jbyteArray favicon,
79 jstring title, 129 jstring title,
80 jobject visits) { 130 jobject visits) {
81 ChromeBrowserProvider* native = 131 ChromeBrowserProvider* native =
82 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider); 132 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
83 CHECK_NATIVE_PTR(env, jcaller, native, "AddBookmarkFromAPI", 0); 133 CHECK_NATIVE_PTR(env, jcaller, native, "AddBookmarkFromAPI", 0);
84 return native->AddBookmarkFromAPI(env, jcaller, url, created, isBookmark, 134 return native->AddBookmarkFromAPI(env, jcaller, url, created, isBookmark,
85 date, favicon, title, visits); 135 date, favicon, title, visits);
86 } 136 }
87 137
88 static jobject QueryBitmap(JNIEnv* env, jobject jcaller, 138 static jobject Java_org_chromium_TestJni_nativeQueryBitmap(JNIEnv* env,
139 jobject jcaller,
89 jint nativeChromeBrowserProvider, 140 jint nativeChromeBrowserProvider,
90 jobjectArray projection, 141 jobjectArray projection,
91 jstring selection, 142 jstring selection,
92 jobjectArray selectionArgs, 143 jobjectArray selectionArgs,
93 jstring sortOrder) { 144 jstring sortOrder) {
94 ChromeBrowserProvider* native = 145 ChromeBrowserProvider* native =
95 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider); 146 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
96 CHECK_NATIVE_PTR(env, jcaller, native, "QueryBitmap", NULL); 147 CHECK_NATIVE_PTR(env, jcaller, native, "QueryBitmap", NULL);
97 return native->QueryBitmap(env, jcaller, projection, selection, selectionArgs, 148 return native->QueryBitmap(env, jcaller, projection, selection, selectionArgs,
98 sortOrder).Release(); 149 sortOrder).Release();
99 } 150 }
100 151
101 static void GotOrientation(JNIEnv* env, jobject jcaller, 152 static void Java_org_chromium_TestJni_nativeGotOrientation(JNIEnv* env,
153 jobject jcaller,
102 jint nativeDataFetcherImplAndroid, 154 jint nativeDataFetcherImplAndroid,
103 jdouble alpha, 155 jdouble alpha,
104 jdouble beta, 156 jdouble beta,
105 jdouble gamma) { 157 jdouble gamma) {
106 DataFetcherImplAndroid* native = 158 DataFetcherImplAndroid* native =
107 reinterpret_cast<DataFetcherImplAndroid*>(nativeDataFetcherImplAndroid); 159 reinterpret_cast<DataFetcherImplAndroid*>(nativeDataFetcherImplAndroid);
108 CHECK_NATIVE_PTR(env, jcaller, native, "GotOrientation"); 160 CHECK_NATIVE_PTR(env, jcaller, native, "GotOrientation");
109 return native->GotOrientation(env, jcaller, alpha, beta, gamma); 161 return native->GotOrientation(env, jcaller, alpha, beta, gamma);
110 } 162 }
111 163
112 // Step 3: RegisterNatives. 164 // Step 3: RegisterNatives.
113 165
114 static const JNINativeMethod kMethodsTestJni[] = { 166 static const JNINativeMethod kMethodsTestJni[] = {
115 { "nativeInit", 167 { "nativeInit",
116 "(" 168 "("
117 ")" 169 ")"
118 "I", reinterpret_cast<void*>(Init) }, 170 "I", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeInit) },
119 { "nativeDestroy", 171 { "nativeDestroy",
120 "(" 172 "("
121 "I" 173 "I"
122 ")" 174 ")"
123 "V", reinterpret_cast<void*>(Destroy) }, 175 "V", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeDestroy) },
124 { "nativeAddBookmark", 176 { "nativeAddBookmark",
125 "(" 177 "("
126 "I" 178 "I"
127 "Ljava/lang/String;" 179 "Ljava/lang/String;"
128 "Ljava/lang/String;" 180 "Ljava/lang/String;"
129 "Z" 181 "Z"
130 "J" 182 "J"
131 ")" 183 ")"
132 "J", reinterpret_cast<void*>(AddBookmark) }, 184 "J", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeAddBookmark) },
133 { "nativeGetDomainAndRegistry", 185 { "nativeGetDomainAndRegistry",
134 "(" 186 "("
135 "Ljava/lang/String;" 187 "Ljava/lang/String;"
136 ")" 188 ")"
137 "Ljava/lang/String;", reinterpret_cast<void*>(GetDomainAndRegistry) }, 189 "Ljava/lang/String;",
190 reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeGetDomainAndRegistry )
191 },
138 { "nativeCreateHistoricalTabFromState", 192 { "nativeCreateHistoricalTabFromState",
139 "(" 193 "("
140 "[B" 194 "[B"
141 "I" 195 "I"
142 ")" 196 ")"
143 "V", reinterpret_cast<void*>(CreateHistoricalTabFromState) }, 197 "V",
198 reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeCreateHistoricalTabF romState)
199 },
144 { "nativeGetStateAsByteArray", 200 { "nativeGetStateAsByteArray",
145 "(" 201 "("
146 "Landroid/view/View;" 202 "Landroid/view/View;"
147 ")" 203 ")"
148 "[B", reinterpret_cast<void*>(GetStateAsByteArray) }, 204 "[B",
205 reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeGetStateAsByteArray)
206 },
149 { "nativeGetAutofillProfileGUIDs", 207 { "nativeGetAutofillProfileGUIDs",
150 "(" 208 "("
151 ")" 209 ")"
152 "[Ljava/lang/String;", reinterpret_cast<void*>(GetAutofillProfileGUIDs) }, 210 "[Ljava/lang/String;",
211 reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeGetAutofillProfileGU IDs)
212 },
153 { "nativeSetRecognitionResults", 213 { "nativeSetRecognitionResults",
154 "(" 214 "("
155 "I" 215 "I"
156 "[Ljava/lang/String;" 216 "[Ljava/lang/String;"
157 ")" 217 ")"
158 "V", reinterpret_cast<void*>(SetRecognitionResults) }, 218 "V",
219 reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeSetRecognitionResult s)
220 },
159 { "nativeAddBookmarkFromAPI", 221 { "nativeAddBookmarkFromAPI",
160 "(" 222 "("
161 "I" 223 "I"
162 "Ljava/lang/String;" 224 "Ljava/lang/String;"
163 "Ljava/lang/Long;" 225 "Ljava/lang/Long;"
164 "Ljava/lang/Boolean;" 226 "Ljava/lang/Boolean;"
165 "Ljava/lang/Long;" 227 "Ljava/lang/Long;"
166 "[B" 228 "[B"
167 "Ljava/lang/String;" 229 "Ljava/lang/String;"
168 "Ljava/lang/Integer;" 230 "Ljava/lang/Integer;"
169 ")" 231 ")"
170 "J", reinterpret_cast<void*>(AddBookmarkFromAPI) }, 232 "J", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeAddBookmarkFromAPI)
233 },
171 { "nativeFindAll", 234 { "nativeFindAll",
172 "(" 235 "("
173 "Ljava/lang/String;" 236 "Ljava/lang/String;"
174 ")" 237 ")"
175 "I", reinterpret_cast<void*>(FindAll) }, 238 "I", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeFindAll) },
176 { "nativeGetInnerClass", 239 { "nativeGetInnerClass",
177 "(" 240 "("
178 ")" 241 ")"
179 "Lorg/chromium/example/jni_generator/SampleForTests$OnFrameAvailableListener;", 242 "Lorg/chromium/example/jni_generator/SampleForTests$OnFrameAvailableListener;",
180 reinterpret_cast<void*>(GetInnerClass) }, 243 reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeGetInnerClass) },
181 { "nativeQueryBitmap", 244 { "nativeQueryBitmap",
182 "(" 245 "("
183 "I" 246 "I"
184 "[Ljava/lang/String;" 247 "[Ljava/lang/String;"
185 "Ljava/lang/String;" 248 "Ljava/lang/String;"
186 "[Ljava/lang/String;" 249 "[Ljava/lang/String;"
187 "Ljava/lang/String;" 250 "Ljava/lang/String;"
188 ")" 251 ")"
189 "Landroid/graphics/Bitmap;", reinterpret_cast<void*>(QueryBitmap) }, 252 "Landroid/graphics/Bitmap;",
253 reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeQueryBitmap) },
190 { "nativeGotOrientation", 254 { "nativeGotOrientation",
191 "(" 255 "("
192 "I" 256 "I"
193 "D" 257 "D"
194 "D" 258 "D"
195 "D" 259 "D"
196 ")" 260 ")"
197 "V", reinterpret_cast<void*>(GotOrientation) }, 261 "V", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeGotOrientation) },
198 }; 262 };
199 263
200 static bool RegisterNativesImpl(JNIEnv* env) { 264 static bool RegisterNativesImpl(JNIEnv* env) {
201 265
202 g_TestJni_clazz = reinterpret_cast<jclass>(env->NewGlobalRef( 266 g_TestJni_clazz = reinterpret_cast<jclass>(env->NewGlobalRef(
203 base::android::GetClass(env, kTestJniClassPath).obj())); 267 base::android::GetClass(env, kTestJniClassPath).obj()));
204 268
205 const int kMethodsTestJniSize = arraysize(kMethodsTestJni); 269 const int kMethodsTestJniSize = arraysize(kMethodsTestJni);
206 270
207 if (env->RegisterNatives(TestJni_clazz(env), 271 if (env->RegisterNatives(TestJni_clazz(env),
208 kMethodsTestJni, 272 kMethodsTestJni,
209 kMethodsTestJniSize) < 0) { 273 kMethodsTestJniSize) < 0) {
210 jni_generator::HandleRegistrationError( 274 jni_generator::HandleRegistrationError(
211 env, TestJni_clazz(env), __FILE__); 275 env, TestJni_clazz(env), __FILE__);
212 return false; 276 return false;
213 } 277 }
214 278
215 return true; 279 return true;
216 } 280 }
217 281
218 #endif // org_chromium_TestJni_JNI 282 #endif // org_chromium_TestJni_JNI
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698