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

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

Issue 115103002: Android: sync up latest JNI generator changes from downstream. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adds missing files Created 7 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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_android.h" 15 #include "base/android/jni_generator/jni_generator_helper.h"
16 #include "base/android/scoped_java_ref.h"
17 #include "base/basictypes.h"
18 #include "base/logging.h"
19
20 using base::android::ScopedJavaLocalRef;
21 16
22 // Step 1: forward declarations. 17 // Step 1: forward declarations.
23 namespace { 18 namespace {
24 const char kTestJniClassPath[] = "org/chromium/TestJni"; 19 const char kTestJniClassPath[] = "org/chromium/TestJni";
25 // Leaking this jclass as we cannot use LazyInstance from some threads. 20 // Leaking this jclass as we cannot use LazyInstance from some threads.
26 jclass g_TestJni_clazz = NULL; 21 jclass g_TestJni_clazz = NULL;
22
27 } // namespace 23 } // namespace
28 24
29 static jint Init(JNIEnv* env, jobject obj); 25 static jint Init(JNIEnv* env, jobject obj);
30 26
31 static jstring GetDomainAndRegistry(JNIEnv* env, jclass clazz, 27 static jstring GetDomainAndRegistry(JNIEnv* env, jclass clazz,
32 jstring url); 28 jstring url);
33 29
34 static void CreateHistoricalTabFromState(JNIEnv* env, jclass clazz, 30 static void CreateHistoricalTabFromState(JNIEnv* env, jclass clazz,
35 jbyteArray state, 31 jbyteArray state,
36 jint tab_index); 32 jint tab_index);
37 33
38 static jbyteArray GetStateAsByteArray(JNIEnv* env, jobject obj, 34 static jbyteArray GetStateAsByteArray(JNIEnv* env, jobject obj,
39 jobject view); 35 jobject view);
40 36
41 static jobjectArray GetAutofillProfileGUIDs(JNIEnv* env, jclass clazz); 37 static jobjectArray GetAutofillProfileGUIDs(JNIEnv* env, jclass clazz);
42 38
43 static void SetRecognitionResults(JNIEnv* env, jobject obj, 39 static void SetRecognitionResults(JNIEnv* env, jobject obj,
44 jint sessionId, 40 jint sessionId,
45 jobjectArray results); 41 jobjectArray results);
46 42
47 static jint FindAll(JNIEnv* env, jobject obj, 43 static jint FindAll(JNIEnv* env, jobject obj,
48 jstring find); 44 jstring find);
49 45
50 static jobject GetInnerClass(JNIEnv* env, jclass clazz); 46 static jobject GetInnerClass(JNIEnv* env, jclass clazz);
51 47
52 // Step 2: method stubs. 48 // Step 2: method stubs.
53 static void Destroy(JNIEnv* env, jobject obj, 49 static void Destroy(JNIEnv* env, jobject obj,
54 jint nativeChromeBrowserProvider) { 50 jint nativeChromeBrowserProvider) {
55 DCHECK(nativeChromeBrowserProvider) << "Destroy";
56 ChromeBrowserProvider* native = 51 ChromeBrowserProvider* native =
57 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider); 52 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
53 DCHECK_NATIVE_PTR(native, "Destroy");
58 return native->Destroy(env, obj); 54 return native->Destroy(env, obj);
59 } 55 }
60 56
61 static jlong AddBookmark(JNIEnv* env, jobject obj, 57 static jlong AddBookmark(JNIEnv* env, jobject obj,
62 jint nativeChromeBrowserProvider, 58 jint nativeChromeBrowserProvider,
63 jstring url, 59 jstring url,
64 jstring title, 60 jstring title,
65 jboolean isFolder, 61 jboolean isFolder,
66 jlong parentId) { 62 jlong parentId) {
67 DCHECK(nativeChromeBrowserProvider) << "AddBookmark";
68 ChromeBrowserProvider* native = 63 ChromeBrowserProvider* native =
69 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider); 64 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
65 DCHECK_NATIVE_PTR(native, "AddBookmark", 0);
70 return native->AddBookmark(env, obj, url, title, isFolder, parentId); 66 return native->AddBookmark(env, obj, url, title, isFolder, parentId);
71 } 67 }
72 68
73 static jlong AddBookmarkFromAPI(JNIEnv* env, jobject obj, 69 static jlong AddBookmarkFromAPI(JNIEnv* env, jobject obj,
74 jint nativeChromeBrowserProvider, 70 jint nativeChromeBrowserProvider,
75 jstring url, 71 jstring url,
76 jobject created, 72 jobject created,
77 jobject isBookmark, 73 jobject isBookmark,
78 jobject date, 74 jobject date,
79 jbyteArray favicon, 75 jbyteArray favicon,
80 jstring title, 76 jstring title,
81 jobject visits) { 77 jobject visits) {
82 DCHECK(nativeChromeBrowserProvider) << "AddBookmarkFromAPI";
83 ChromeBrowserProvider* native = 78 ChromeBrowserProvider* native =
84 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider); 79 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
80 DCHECK_NATIVE_PTR(native, "AddBookmarkFromAPI", 0);
85 return native->AddBookmarkFromAPI(env, obj, url, created, isBookmark, date, 81 return native->AddBookmarkFromAPI(env, obj, url, created, isBookmark, date,
86 favicon, title, visits); 82 favicon, title, visits);
87 } 83 }
88 84
89 static jobject QueryBitmap(JNIEnv* env, jobject obj, 85 static jobject QueryBitmap(JNIEnv* env, jobject obj,
90 jint nativeChromeBrowserProvider, 86 jint nativeChromeBrowserProvider,
91 jobjectArray projection, 87 jobjectArray projection,
92 jstring selection, 88 jstring selection,
93 jobjectArray selectionArgs, 89 jobjectArray selectionArgs,
94 jstring sortOrder) { 90 jstring sortOrder) {
95 DCHECK(nativeChromeBrowserProvider) << "QueryBitmap";
96 ChromeBrowserProvider* native = 91 ChromeBrowserProvider* native =
97 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider); 92 reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
93 DCHECK_NATIVE_PTR(native, "QueryBitmap", NULL);
98 return native->QueryBitmap(env, obj, projection, selection, selectionArgs, 94 return native->QueryBitmap(env, obj, projection, selection, selectionArgs,
99 sortOrder).Release(); 95 sortOrder).Release();
100 } 96 }
101 97
102 static void GotOrientation(JNIEnv* env, jobject obj, 98 static void GotOrientation(JNIEnv* env, jobject obj,
103 jint nativeDataFetcherImplAndroid, 99 jint nativeDataFetcherImplAndroid,
104 jdouble alpha, 100 jdouble alpha,
105 jdouble beta, 101 jdouble beta,
106 jdouble gamma) { 102 jdouble gamma) {
107 DCHECK(nativeDataFetcherImplAndroid) << "GotOrientation";
108 DataFetcherImplAndroid* native = 103 DataFetcherImplAndroid* native =
109 reinterpret_cast<DataFetcherImplAndroid*>(nativeDataFetcherImplAndroid); 104 reinterpret_cast<DataFetcherImplAndroid*>(nativeDataFetcherImplAndroid);
105 DCHECK_NATIVE_PTR(native, "GotOrientation");
110 return native->GotOrientation(env, obj, alpha, beta, gamma); 106 return native->GotOrientation(env, obj, alpha, beta, gamma);
111 } 107 }
112 108
113 // Step 3: RegisterNatives. 109 // Step 3: RegisterNatives.
114 110
115 static bool RegisterNativesImpl(JNIEnv* env) { 111 static const JNINativeMethod kMethodsTestJni[] = {
116
117 g_TestJni_clazz = reinterpret_cast<jclass>(env->NewGlobalRef(
118 base::android::GetClass(env, kTestJniClassPath).obj()));
119 static const JNINativeMethod kMethodsTestJni[] = {
120 { "nativeInit", 112 { "nativeInit",
121 "(" 113 "("
122 ")" 114 ")"
123 "I", reinterpret_cast<void*>(Init) }, 115 "I", reinterpret_cast<void*>(Init) },
124 { "nativeDestroy", 116 { "nativeDestroy",
125 "(" 117 "("
126 "I" 118 "I"
127 ")" 119 ")"
128 "V", reinterpret_cast<void*>(Destroy) }, 120 "V", reinterpret_cast<void*>(Destroy) },
129 { "nativeAddBookmark", 121 { "nativeAddBookmark",
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 ")" 185 ")"
194 "Landroid/graphics/Bitmap;", reinterpret_cast<void*>(QueryBitmap) }, 186 "Landroid/graphics/Bitmap;", reinterpret_cast<void*>(QueryBitmap) },
195 { "nativeGotOrientation", 187 { "nativeGotOrientation",
196 "(" 188 "("
197 "I" 189 "I"
198 "D" 190 "D"
199 "D" 191 "D"
200 "D" 192 "D"
201 ")" 193 ")"
202 "V", reinterpret_cast<void*>(GotOrientation) }, 194 "V", reinterpret_cast<void*>(GotOrientation) },
203 }; 195 };
196
197 static bool RegisterNativesImpl(JNIEnv* env) {
198 g_TestJni_clazz = reinterpret_cast<jclass>(env->NewGlobalRef(
199 base::android::GetClass(env, kTestJniClassPath).obj()));
200
204 const int kMethodsTestJniSize = arraysize(kMethodsTestJni); 201 const int kMethodsTestJniSize = arraysize(kMethodsTestJni);
205 202
206 if (env->RegisterNatives(g_TestJni_clazz, 203 if (env->RegisterNatives(g_TestJni_clazz,
207 kMethodsTestJni, 204 kMethodsTestJni,
208 kMethodsTestJniSize) < 0) { 205 kMethodsTestJniSize) < 0) {
209 LOG(ERROR) << "RegisterNatives failed in " << __FILE__; 206 jni_generator::HandleRegistrationError(
207 env, g_TestJni_clazz, __FILE__);
210 return false; 208 return false;
211 } 209 }
212 210
213 return true; 211 return true;
214 } 212 }
215 213
216 #endif // org_chromium_TestJni_JNI 214 #endif // org_chromium_TestJni_JNI
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698