Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: jni/JniJsEngine.cpp

Issue 6606493159784448: New JNI bindings (Closed)
Left Patch Set: Fixed wrong signature for getElementHidingSelectors. Created March 20, 2014, 12:17 p.m.
Right Patch Set: Removed TODO from AppInfo. Created April 11, 2014, 1:28 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « jni/JniFilterEngine.cpp ('k') | jni/JniJsValue.h » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <http://adblockplus.org/>, 2 * This file is part of Adblock Plus <http://adblockplus.org/>,
3 * Copyright (C) 2006-2014 Eyeo GmbH 3 * Copyright (C) 2006-2014 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 #include <AdblockPlus.h> 18 #include <AdblockPlus.h>
19 #include "Utils.h" 19 #include "Utils.h"
20 #include "JniCallbacks.h" 20 #include "JniCallbacks.h"
21 21
22 static void TransformAppInfo(JNIEnv* env, jobject jAppInfo, AdblockPlus::AppInfo & appInfo) 22 static void TransformAppInfo(JNIEnv* env, jobject jAppInfo, AdblockPlus::AppInfo & appInfo)
23 { 23 {
24 jclass clazz = env->GetObjectClass(jAppInfo); 24 jclass clazz = env->GetObjectClass(jAppInfo);
25 25
26 appInfo.application = AdblockPlus::Android::JniGetStringField(env, clazz, jApp Info, "application"); 26 appInfo.application = JniGetStringField(env, clazz, jAppInfo, "application");
27 appInfo.applicationVersion = AdblockPlus::Android::JniGetStringField(env, claz z, jAppInfo, "applicationVersion"); 27 appInfo.applicationVersion = JniGetStringField(env, clazz, jAppInfo, "applicat ionVersion");
28 appInfo.id = AdblockPlus::Android::JniGetStringField(env, clazz, jAppInfo, "id "); 28 appInfo.id = JniGetStringField(env, clazz, jAppInfo, "id");
29 appInfo.locale = AdblockPlus::Android::JniGetStringField(env, clazz, jAppInfo, "locale"); 29 appInfo.locale = JniGetStringField(env, clazz, jAppInfo, "locale");
30 appInfo.name = AdblockPlus::Android::JniGetStringField(env, clazz, jAppInfo, " name"); 30 appInfo.name = JniGetStringField(env, clazz, jAppInfo, "name");
31 appInfo.version = AdblockPlus::Android::JniGetStringField(env, clazz, jAppInfo , "version"); 31 appInfo.version = JniGetStringField(env, clazz, jAppInfo, "version");
32 32
33 appInfo.developmentBuild = AdblockPlus::Android::JniGetBooleanField(env, clazz , jAppInfo, "developmentBuild"); 33 appInfo.developmentBuild = JniGetBooleanField(env, clazz, jAppInfo, "developme ntBuild");
34 } 34 }
35 35
36 static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jobject jAppInfo) 36 static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jobject jAppInfo)
37 { 37 {
38 AdblockPlus::AppInfo appInfo; 38 AdblockPlus::AppInfo appInfo;
39 39
40 TransformAppInfo(env, jAppInfo, appInfo); 40 TransformAppInfo(env, jAppInfo, appInfo);
41 41
42 TRY 42 try
43 { 43 {
44 return AdblockPlus::Android::JniPtr2Long(new AdblockPlus::JsEnginePtr(Adbloc kPlus::JsEngine::New(appInfo))); 44 return JniPtrToLong(new AdblockPlus::JsEnginePtr(AdblockPlus::JsEngine::New( appInfo)));
45 } 45 }
46 CATCH_THROW_AND_RETURN(env, 0) 46 CATCH_THROW_AND_RETURN(env, 0)
47 } 47 }
48 48
49 static void JNICALL JniDtor(JNIEnv* env, jclass clazz, jlong ptr) 49 static void JNICALL JniDtor(JNIEnv* env, jclass clazz, jlong ptr)
50 { 50 {
51 delete AdblockPlus::Android::JniLong2TypePtr<AdblockPlus::JsEnginePtr>(ptr); 51 delete JniLongToTypePtr<AdblockPlus::JsEnginePtr>(ptr);
52 } 52 }
53 53
54 static void JNICALL JniSetEventCallback(JNIEnv* env, jclass clazz, jlong ptr, js tring jEventName, jlong jCallbackPtr) 54 static void JNICALL JniSetEventCallback(JNIEnv* env, jclass clazz, jlong ptr, js tring jEventName, jlong jCallbackPtr)
55 { 55 {
56 AdblockPlus::JsEnginePtr& engine = *AdblockPlus::Android::JniLong2TypePtr<Adbl ockPlus::JsEnginePtr>(ptr); 56 AdblockPlus::JsEnginePtr& engine = *JniLongToTypePtr<AdblockPlus::JsEnginePtr> (ptr);
57 57
58 AdblockPlus::Android::JniEventCallback* callback = AdblockPlus::Android::JniLo ng2TypePtr<AdblockPlus::Android::JniEventCallback>( 58 JniEventCallback* callback = JniLongToTypePtr<JniEventCallback>(jCallbackPtr);
59 jCallbackPtr); 59 std::string eventName = JniJavaToStdString(env, jEventName);
60 std::string eventName = AdblockPlus::Android::JniJava2StdString(env, jEventNam e); 60 AdblockPlus::JsEngine::EventCallback eCallback = std::tr1::bind(&JniEventCallb ack::Callback, callback, std::tr1::placeholders::_1);
61 AdblockPlus::JsEngine::EventCallback eCallback = std::tr1::bind(&AdblockPlus:: Android::JniEventCallback::Callback, callback, 61
62 std::tr1::placeholders::_1); 62 try
63
64 TRY
65 { 63 {
66 engine->SetEventCallback(eventName, eCallback); 64 engine->SetEventCallback(eventName, eCallback);
67 } 65 }
68 CATCH_AND_THROW(env) 66 CATCH_AND_THROW(env)
69 } 67 }
70 68
71 static void JNICALL JniRemoveEventCallback(JNIEnv* env, jclass clazz, jlong ptr, jstring jEventName) 69 static void JNICALL JniRemoveEventCallback(JNIEnv* env, jclass clazz, jlong ptr, jstring jEventName)
72 { 70 {
73 AdblockPlus::JsEnginePtr& engine = *AdblockPlus::Android::JniLong2TypePtr<Adbl ockPlus::JsEnginePtr>(ptr); 71 AdblockPlus::JsEnginePtr& engine = *JniLongToTypePtr<AdblockPlus::JsEnginePtr> (ptr);
74 72
75 std::string eventName = AdblockPlus::Android::JniJava2StdString(env, jEventNam e); 73 std::string eventName = JniJavaToStdString(env, jEventName);
76 74
77 TRY 75 try
78 { 76 {
79 engine->RemoveEventCallback(eventName); 77 engine->RemoveEventCallback(eventName);
80 } 78 }
81 CATCH_AND_THROW(env) 79 CATCH_AND_THROW(env)
82 } 80 }
83 81
84 static jobject JNICALL JniEvaluate(JNIEnv* env, jclass clazz, jlong ptr, jstring jSource, jstring jFilename) 82 static jobject JNICALL JniEvaluate(JNIEnv* env, jclass clazz, jlong ptr, jstring jSource, jstring jFilename)
85 { 83 {
86 AdblockPlus::JsEnginePtr& engine = *AdblockPlus::Android::JniLong2TypePtr<Adbl ockPlus::JsEnginePtr>(ptr); 84 AdblockPlus::JsEnginePtr& engine = *JniLongToTypePtr<AdblockPlus::JsEnginePtr> (ptr);
87 85
88 std::string source = AdblockPlus::Android::JniJava2StdString(env, jSource); 86 std::string source = JniJavaToStdString(env, jSource);
89 std::string filename = AdblockPlus::Android::JniJava2StdString(env, jFilename) ; 87 std::string filename = JniJavaToStdString(env, jFilename);
90 88
91 TRY 89 try
92 { 90 {
93 AdblockPlus::JsValuePtr jsValue = engine->Evaluate(source, filename); 91 AdblockPlus::JsValuePtr jsValue = engine->Evaluate(source, filename);
94 return AdblockPlus::Android::NewJniJsValue(env, jsValue); 92 return NewJniJsValue(env, jsValue);
95 } 93 }
96 CATCH_THROW_AND_RETURN(env, 0) 94 CATCH_THROW_AND_RETURN(env, 0)
97 } 95 }
98 96
99 static void JNICALL JniTriggerEvent(JNIEnv* env, jclass clazz, jlong ptr, jstrin g jEventName, jarray jJsPtrs) 97 static void JNICALL JniTriggerEvent(JNIEnv* env, jclass clazz, jlong ptr, jstrin g jEventName, jarray jJsPtrs)
100 { 98 {
101 AdblockPlus::JsEnginePtr& engine = *AdblockPlus::Android::JniLong2TypePtr<Adbl ockPlus::JsEnginePtr>(ptr); 99 AdblockPlus::JsEnginePtr& engine = *JniLongToTypePtr<AdblockPlus::JsEnginePtr> (ptr);
102 std::string eventName = AdblockPlus::Android::JniJava2StdString(env, jEventNam e); 100 std::string eventName = JniJavaToStdString(env, jEventName);
103 AdblockPlus::JsValueList args; 101 AdblockPlus::JsValueList args;
104 102
105 if (jJsPtrs) 103 if (jJsPtrs)
106 { 104 {
107 jlong* ptrs = (jlong*)env->GetPrimitiveArrayCritical(jJsPtrs, 0); 105 jlong* ptrs = (jlong*)env->GetPrimitiveArrayCritical(jJsPtrs, 0);
108 106
109 jsize length = env->GetArrayLength(jJsPtrs); 107 jsize length = env->GetArrayLength(jJsPtrs);
110 108
111 for (jsize i = 0; i < length; i++) 109 for (jsize i = 0; i < length; i++)
112 { 110 {
113 args.push_back(AdblockPlus::Android::JniGetJsValuePtr(ptrs[i])); 111 args.push_back(JniGetJsValuePtr(ptrs[i]));
114 } 112 }
115 113
116 env->ReleasePrimitiveArrayCritical(jJsPtrs, ptrs, JNI_ABORT); 114 env->ReleasePrimitiveArrayCritical(jJsPtrs, ptrs, JNI_ABORT);
117 } 115 }
118 116
119 TRY 117 try
120 { 118 {
121 engine->TriggerEvent(eventName, args); 119 engine->TriggerEvent(eventName, args);
122 } 120 }
123 CATCH_AND_THROW(env) 121 CATCH_AND_THROW(env)
124 } 122 }
125 123
126 static void JNICALL JniSetDefaultFileSystem(JNIEnv* env, jclass clazz, jlong ptr , jstring jBasePath) 124 static void JNICALL JniSetDefaultFileSystem(JNIEnv* env, jclass clazz, jlong ptr , jstring jBasePath)
127 { 125 {
128 AdblockPlus::JsEnginePtr& engine = *AdblockPlus::Android::JniLong2TypePtr<Adbl ockPlus::JsEnginePtr>(ptr); 126 AdblockPlus::JsEnginePtr& engine = *JniLongToTypePtr<AdblockPlus::JsEnginePtr> (ptr);
129 127
130 TRY 128 try
131 { 129 {
132 AdblockPlus::FileSystemPtr fileSystem(new AdblockPlus::DefaultFileSystem()); 130 AdblockPlus::FileSystemPtr fileSystem(new AdblockPlus::DefaultFileSystem());
133 131
134 std::string basePath = AdblockPlus::Android::JniJava2StdString(env, jBasePat h); 132 std::string basePath = JniJavaToStdString(env, jBasePath);
135 reinterpret_cast<AdblockPlus::DefaultFileSystem*>(fileSystem.get())->SetBase Path(basePath); 133 reinterpret_cast<AdblockPlus::DefaultFileSystem*>(fileSystem.get())->SetBase Path(basePath);
136 134
137 engine->SetFileSystem(fileSystem); 135 engine->SetFileSystem(fileSystem);
138 } 136 }
139 CATCH_AND_THROW(env) 137 CATCH_AND_THROW(env)
140 } 138 }
141 139
142 static void JNICALL JniSetDefaultWebRequest(JNIEnv* env, jclass clazz, jlong ptr ) 140 static void JNICALL JniSetDefaultWebRequest(JNIEnv* env, jclass clazz, jlong ptr )
143 { 141 {
144 AdblockPlus::JsEnginePtr& engine = *AdblockPlus::Android::JniLong2TypePtr<Adbl ockPlus::JsEnginePtr>(ptr); 142 AdblockPlus::JsEnginePtr& engine = *JniLongToTypePtr<AdblockPlus::JsEnginePtr> (ptr);
145 143
146 TRY 144 try
147 { 145 {
148 AdblockPlus::WebRequestPtr webRequest(new AdblockPlus::DefaultWebRequest()); 146 AdblockPlus::WebRequestPtr webRequest(new AdblockPlus::DefaultWebRequest());
149 147
150 engine->SetWebRequest(webRequest); 148 engine->SetWebRequest(webRequest);
151 } 149 }
152 CATCH_AND_THROW(env) 150 CATCH_AND_THROW(env)
153 } 151 }
154 152
155 static void JNICALL JniSetDefaultLogSystem(JNIEnv* env, jclass clazz, jlong ptr) 153 static void JNICALL JniSetDefaultLogSystem(JNIEnv* env, jclass clazz, jlong ptr)
156 { 154 {
157 AdblockPlus::JsEnginePtr& engine = *AdblockPlus::Android::JniLong2TypePtr<Adbl ockPlus::JsEnginePtr>(ptr); 155 AdblockPlus::JsEnginePtr& engine = *JniLongToTypePtr<AdblockPlus::JsEnginePtr> (ptr);
158 156
159 TRY 157 try
160 { 158 {
161 AdblockPlus::LogSystemPtr logSystem(new AdblockPlus::DefaultLogSystem()); 159 AdblockPlus::LogSystemPtr logSystem(new AdblockPlus::DefaultLogSystem());
162 160
163 engine->SetLogSystem(logSystem); 161 engine->SetLogSystem(logSystem);
164 } 162 }
165 CATCH_AND_THROW(env) 163 CATCH_AND_THROW(env)
166 } 164 }
167 165
168 static void JNICALL JniSetLogSystem(JNIEnv* env, jclass clazz, jlong ptr, jlong logSystemPtr) 166 static void JNICALL JniSetLogSystem(JNIEnv* env, jclass clazz, jlong ptr, jlong logSystemPtr)
169 { 167 {
170 AdblockPlus::JsEnginePtr& engine = *AdblockPlus::Android::JniLong2TypePtr<Adbl ockPlus::JsEnginePtr>(ptr); 168 AdblockPlus::JsEnginePtr& engine = *JniLongToTypePtr<AdblockPlus::JsEnginePtr> (ptr);
171 169
172 TRY 170 try
173 { 171 {
174 AdblockPlus::LogSystemPtr logSystem(AdblockPlus::Android::JniLong2TypePtr<Ad blockPlus::Android::JniLogSystemCallback>(logSystemPtr)); 172 AdblockPlus::LogSystemPtr logSystem(JniLongToTypePtr<JniLogSystemCallback>(l ogSystemPtr));
175 173
176 engine->SetLogSystem(logSystem); 174 engine->SetLogSystem(logSystem);
177 } 175 }
178 CATCH_AND_THROW(env) 176 CATCH_AND_THROW(env)
179 } 177 }
180 178
181 static void JNICALL JniSetWebRequest(JNIEnv* env, jclass clazz, jlong ptr, jlong webRequestPtr) 179 static void JNICALL JniSetWebRequest(JNIEnv* env, jclass clazz, jlong ptr, jlong webRequestPtr)
182 { 180 {
183 AdblockPlus::JsEnginePtr& engine = *AdblockPlus::Android::JniLong2TypePtr<Adbl ockPlus::JsEnginePtr>(ptr); 181 AdblockPlus::JsEnginePtr& engine = *JniLongToTypePtr<AdblockPlus::JsEnginePtr> (ptr);
184 182
185 TRY 183 try
186 { 184 {
187 AdblockPlus::WebRequestPtr& webRequest = *AdblockPlus::Android::JniLong2Type Ptr<AdblockPlus::WebRequestPtr>(webRequestPtr); 185 AdblockPlus::WebRequestPtr& webRequest = *JniLongToTypePtr<AdblockPlus::WebR equestPtr>(webRequestPtr);
188 186
189 engine->SetWebRequest(webRequest); 187 engine->SetWebRequest(webRequest);
190 } 188 }
191 CATCH_AND_THROW(env) 189 CATCH_AND_THROW(env)
192 } 190 }
193 191
194 static jobject JNICALL JniNewLongValue(JNIEnv* env, jclass clazz, jlong ptr, jlo ng value) 192 static jobject JNICALL JniNewLongValue(JNIEnv* env, jclass clazz, jlong ptr, jlo ng value)
195 { 193 {
196 AdblockPlus::JsEnginePtr& engine = *AdblockPlus::Android::JniLong2TypePtr<Adbl ockPlus::JsEnginePtr>(ptr); 194 AdblockPlus::JsEnginePtr& engine = *JniLongToTypePtr<AdblockPlus::JsEnginePtr> (ptr);
197 195
198 TRY 196 try
199 { 197 {
200 AdblockPlus::JsValuePtr jsValue = engine->NewValue(static_cast<int64_t>(valu e)); 198 AdblockPlus::JsValuePtr jsValue = engine->NewValue(static_cast<int64_t>(valu e));
201 return AdblockPlus::Android::NewJniJsValue(env, jsValue); 199 return NewJniJsValue(env, jsValue);
202 } 200 }
203 CATCH_THROW_AND_RETURN(env, 0) 201 CATCH_THROW_AND_RETURN(env, 0)
204 } 202 }
205 203
206 static jobject JNICALL JniNewBooleanValue(JNIEnv* env, jclass clazz, jlong ptr, jboolean value) 204 static jobject JNICALL JniNewBooleanValue(JNIEnv* env, jclass clazz, jlong ptr, jboolean value)
207 { 205 {
208 AdblockPlus::JsEnginePtr& engine = *AdblockPlus::Android::JniLong2TypePtr<Adbl ockPlus::JsEnginePtr>(ptr); 206 AdblockPlus::JsEnginePtr& engine = *JniLongToTypePtr<AdblockPlus::JsEnginePtr> (ptr);
209 207
210 TRY 208 try
211 { 209 {
212 AdblockPlus::JsValuePtr jsValue = engine->NewValue(value == JNI_TRUE ? true : false); 210 AdblockPlus::JsValuePtr jsValue = engine->NewValue(value == JNI_TRUE ? true : false);
213 return AdblockPlus::Android::NewJniJsValue(env, jsValue); 211 return NewJniJsValue(env, jsValue);
214 } 212 }
215 CATCH_THROW_AND_RETURN(env, 0) 213 CATCH_THROW_AND_RETURN(env, 0)
216 } 214 }
217 215
218 static jobject JNICALL JniNewStringValue(JNIEnv* env, jclass clazz, jlong ptr, j string value) 216 static jobject JNICALL JniNewStringValue(JNIEnv* env, jclass clazz, jlong ptr, j string value)
219 { 217 {
220 AdblockPlus::JsEnginePtr& engine = *AdblockPlus::Android::JniLong2TypePtr<Adbl ockPlus::JsEnginePtr>(ptr); 218 AdblockPlus::JsEnginePtr& engine = *JniLongToTypePtr<AdblockPlus::JsEnginePtr> (ptr);
221 219
222 TRY 220 try
223 { 221 {
224 std::string strValue = AdblockPlus::Android::JniJava2StdString(env, value); 222 std::string strValue = JniJavaToStdString(env, value);
225 AdblockPlus::JsValuePtr jsValue = engine->NewValue(strValue); 223 AdblockPlus::JsValuePtr jsValue = engine->NewValue(strValue);
226 return AdblockPlus::Android::NewJniJsValue(env, jsValue); 224 return NewJniJsValue(env, jsValue);
227 } 225 }
228 CATCH_THROW_AND_RETURN(env, 0) 226 CATCH_THROW_AND_RETURN(env, 0)
229 } 227 }
230 228
229 // TODO: List of functions that lack JNI bindings
231 //JsValuePtr NewObject(); 230 //JsValuePtr NewObject();
232 //JsValuePtr NewCallback(v8::InvocationCallback callback); 231 //JsValuePtr NewCallback(v8::InvocationCallback callback);
233 //static JsEnginePtr FromArguments(const v8::Arguments& arguments); 232 //static JsEnginePtr FromArguments(const v8::Arguments& arguments);
234 //JsValueList ConvertArguments(const v8::Arguments& arguments); 233 //JsValueList ConvertArguments(const v8::Arguments& arguments);
235 234
236 static JNINativeMethod methods[] = 235 static JNINativeMethod methods[] =
237 { 236 {
238 { (char*)"ctor", (char*)"(" TYP("AppInfo") ")J", (void*)JniCtor }, 237 { (char*)"ctor", (char*)"(" TYP("AppInfo") ")J", (void*)JniCtor },
239 { (char*)"dtor", (char*)"(J)V", (void*)JniDtor }, 238 { (char*)"dtor", (char*)"(J)V", (void*)JniDtor },
240 239
241 { (char*)"setEventCallback", (char*)"(JLjava/lang/String;J)V", (void*)JniSetEven tCallback }, 240 { (char*)"setEventCallback", (char*)"(JLjava/lang/String;J)V", (void*)JniSetEv entCallback },
242 { (char*)"removeEventCallback", (char*)"(JLjava/lang/String;)V", (void*)JniRemov eEventCallback }, 241 { (char*)"removeEventCallback", (char*)"(JLjava/lang/String;)V", (void*)JniRem oveEventCallback },
243 { (char*)"triggerEvent", (char*)"(JLjava/lang/String;[J)V", (void*)JniTriggerEve nt }, 242 { (char*)"triggerEvent", (char*)"(JLjava/lang/String;[J)V", (void*)JniTriggerE vent },
244 243
245 { (char*)"evaluate", (char*)"(JLjava/lang/String;Ljava/lang/String;)" TYP("JsVal ue"), (void*)JniEvaluate }, 244 { (char*)"evaluate", (char*)"(JLjava/lang/String;Ljava/lang/String;)" TYP("JsV alue"), (void*)JniEvaluate },
246 245
247 { (char*)"setDefaultFileSystem", (char*)"(JLjava/lang/String;)V", (void*)JniSetD efaultFileSystem }, 246 { (char*)"setDefaultFileSystem", (char*)"(JLjava/lang/String;)V", (void*)JniSe tDefaultFileSystem },
248 { (char*)"setLogSystem", (char*)"(JJ)V", (void*)JniSetLogSystem }, 247 { (char*)"setLogSystem", (char*)"(JJ)V", (void*)JniSetLogSystem },
249 { (char*)"setDefaultLogSystem", (char*)"(J)V", (void*)JniSetDefaultLogSystem }, 248 { (char*)"setDefaultLogSystem", (char*)"(J)V", (void*)JniSetDefaultLogSystem } ,
250 { (char*)"setWebRequest", (char*)"(JJ)V", (void*)JniSetWebRequest }, 249 { (char*)"setWebRequest", (char*)"(JJ)V", (void*)JniSetWebRequest },
251 { (char*)"setDefaultWebRequest", (char*)"(J)V", (void*)JniSetDefaultWebRequest } , 250 { (char*)"setDefaultWebRequest", (char*)"(J)V", (void*)JniSetDefaultWebRequest },
252 251
253 { (char*)"newValue", (char*)"(JJ)"TYP("JsValue"), (void*)JniNewLongValue }, 252 { (char*)"newValue", (char*)"(JJ)"TYP("JsValue"), (void*)JniNewLongValue },
254 { (char*)"newValue", (char*)"(JZ)"TYP("JsValue"), (void*)JniNewBooleanValue }, 253 { (char*)"newValue", (char*)"(JZ)"TYP("JsValue"), (void*)JniNewBooleanValue },
255 { (char*)"newValue", (char*)"(JLjava/lang/String;)"TYP("JsValue"), (void*)JniNew StringValue }, 254 { (char*)"newValue", (char*)"(JLjava/lang/String;)"TYP("JsValue"), (void*)JniN ewStringValue }
256
257 }; 255 };
258 256
259 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_android_api_JsEngine_regi sterNatives(JNIEnv *env, jclass clazz) 257 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_JsEngine_r egisterNatives(JNIEnv *env, jclass clazz)
260 { 258 {
261 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); 259 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0]));
262 } 260 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld