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

Delta Between Two Patch Sets: jni/JniFilterEngine.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/JniFilterChangeCallback.cpp ('k') | jni/JniJsEngine.cpp » ('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 jobject SubscriptionsToArrayList(JNIEnv* env, std::vector<AdblockPlus::Su bscriptionPtr>& subscriptions)
23 {
24 jobject list = NewJniArrayList(env);
25
26 for (std::vector<AdblockPlus::SubscriptionPtr>::iterator it = subscriptions.be gin(), end = subscriptions.end(); it != end; it++)
27 {
28 JniAddObjectToList(env, list, NewJniSubscription(env, *it));
29 }
30
31 return list;
32 }
33
22 static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jlong enginePtr) 34 static jlong JNICALL JniCtor(JNIEnv* env, jclass clazz, jlong enginePtr)
23 { 35 {
24 TRY 36 try
25 { 37 {
26 AdblockPlus::JsEnginePtr& jsEngine = *AdblockPlus::Android::JniLong2TypePtr< AdblockPlus::JsEnginePtr>(enginePtr); 38 AdblockPlus::JsEnginePtr& jsEngine = *JniLongToTypePtr<AdblockPlus::JsEngine Ptr>(enginePtr);
27 return AdblockPlus::Android::JniPtr2Long(new AdblockPlus::FilterEngine(jsEng ine)); 39 return JniPtrToLong(new AdblockPlus::FilterEngine(jsEngine));
28 } 40 }
29 CATCH_THROW_AND_RETURN(env, 0) 41 CATCH_THROW_AND_RETURN(env, 0)
30 } 42 }
31 43
32 static void JNICALL JniDtor(JNIEnv* env, jclass clazz, jlong ptr) 44 static void JNICALL JniDtor(JNIEnv* env, jclass clazz, jlong ptr)
33 { 45 {
34 delete AdblockPlus::Android::JniLong2TypePtr<AdblockPlus::FilterEngine>(ptr); 46 delete JniLongToTypePtr<AdblockPlus::FilterEngine>(ptr);
35 } 47 }
36 48
37 static jboolean JNICALL JniIsFirstRun(JNIEnv* env, jclass clazz, jlong ptr) 49 static jboolean JNICALL JniIsFirstRun(JNIEnv* env, jclass clazz, jlong ptr)
38 { 50 {
39 TRY 51 try
40 { 52 {
41 AdblockPlus::FilterEngine* engine = AdblockPlus::Android::JniLong2TypePtr<Ad blockPlus::FilterEngine>(ptr); 53 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngi ne>(ptr);
42 54
43 return engine->IsFirstRun() ? JNI_TRUE : JNI_FALSE; 55 return engine->IsFirstRun() ? JNI_TRUE : JNI_FALSE;
44 } 56 }
45 CATCH_THROW_AND_RETURN(env, JNI_FALSE); 57 CATCH_THROW_AND_RETURN(env, JNI_FALSE);
46 } 58 }
47 59
48 static jobject JNICALL JniGetFilter(JNIEnv* env, jclass clazz, jlong ptr, jstrin g jText) 60 static jobject JNICALL JniGetFilter(JNIEnv* env, jclass clazz, jlong ptr, jstrin g jText)
49 { 61 {
50 AdblockPlus::FilterEngine* engine = AdblockPlus::Android::JniLong2TypePtr<Adbl ockPlus::FilterEngine>(ptr); 62 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine >(ptr);
51 std::string text = AdblockPlus::Android::JniJava2StdString(env, jText); 63 std::string text = JniJavaToStdString(env, jText);
52 64
53 TRY 65 try
54 { 66 {
55 AdblockPlus::FilterPtr filter = engine->GetFilter(text); 67 AdblockPlus::FilterPtr filter = engine->GetFilter(text);
56 68
57 return AdblockPlus::Android::NewJniFilter(env, filter); 69 return NewJniFilter(env, filter);
58 } 70 }
59 CATCH_THROW_AND_RETURN(env, 0); 71 CATCH_THROW_AND_RETURN(env, 0);
60 } 72 }
61 73
62 static jobject JNICALL JniGetListedFilters(JNIEnv* env, jclass clazz, jlong ptr) 74 static jobject JNICALL JniGetListedFilters(JNIEnv* env, jclass clazz, jlong ptr)
63 { 75 {
64 AdblockPlus::FilterEngine* engine = AdblockPlus::Android::JniLong2TypePtr<Adbl ockPlus::FilterEngine>(ptr); 76 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine >(ptr);
65 77
66 TRY 78 try
67 { 79 {
68 std::vector<AdblockPlus::FilterPtr> filters = engine->GetListedFilters(); 80 std::vector<AdblockPlus::FilterPtr> filters = engine->GetListedFilters();
69 81
70 jobject list = AdblockPlus::Android::NewJniArrayList(env); 82 jobject list = NewJniArrayList(env);
71 83
72 for (std::vector<AdblockPlus::FilterPtr>::iterator it = filters.begin(), end = filters.end(); it != end; it++) 84 for (std::vector<AdblockPlus::FilterPtr>::iterator it = filters.begin(), end = filters.end(); it != end; it++)
73 { 85 {
74 AdblockPlus::Android::JniAddObjectToList(env, list, AdblockPlus::Android:: NewJniFilter(env, *it)); 86 JniAddObjectToList(env, list, NewJniFilter(env, *it));
75 } 87 }
76 88
77 return list; 89 return list;
78 } 90 }
79 CATCH_THROW_AND_RETURN(env, 0); 91 CATCH_THROW_AND_RETURN(env, 0);
80 } 92 }
81 93
82 static jobject JNICALL JniGetSubscription(JNIEnv* env, jclass clazz, jlong ptr, jstring jUrl) 94 static jobject JNICALL JniGetSubscription(JNIEnv* env, jclass clazz, jlong ptr, jstring jUrl)
83 { 95 {
84 AdblockPlus::FilterEngine* engine = AdblockPlus::Android::JniLong2TypePtr<Adbl ockPlus::FilterEngine>(ptr); 96 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine >(ptr);
85 std::string url = AdblockPlus::Android::JniJava2StdString(env, jUrl); 97 std::string url = JniJavaToStdString(env, jUrl);
86 98
87 TRY 99 try
88 { 100 {
89 AdblockPlus::SubscriptionPtr subscription = engine->GetSubscription(url); 101 AdblockPlus::SubscriptionPtr subscription = engine->GetSubscription(url);
90 102
91 return AdblockPlus::Android::NewJniSubscription(env, subscription); 103 return NewJniSubscription(env, subscription);
92 } 104 }
93 CATCH_THROW_AND_RETURN(env, 0); 105 CATCH_THROW_AND_RETURN(env, 0);
94 } 106 }
95 107
96 static jobject JNICALL JniGetListedSubscriptions(JNIEnv* env, jclass clazz, jlon g ptr) 108 static jobject JNICALL JniGetListedSubscriptions(JNIEnv* env, jclass clazz, jlon g ptr)
97 { 109 {
98 AdblockPlus::FilterEngine* engine = AdblockPlus::Android::JniLong2TypePtr<Adbl ockPlus::FilterEngine>(ptr); 110 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine >(ptr);
99 111
100 TRY 112 try
101 { 113 {
102 std::vector<AdblockPlus::SubscriptionPtr> filters = engine->GetListedSubscri ptions(); 114 std::vector<AdblockPlus::SubscriptionPtr> subscriptions = engine->GetListedS ubscriptions();
103 115
104 jobject list = AdblockPlus::Android::NewJniArrayList(env); 116 return SubscriptionsToArrayList(env, subscriptions);
105 117 }
106 for (std::vector<AdblockPlus::SubscriptionPtr>::iterator it = filters.begin( ), end = filters.end(); it != end; it++) 118 CATCH_THROW_AND_RETURN(env, 0);
107 { 119 }
108 AdblockPlus::Android::JniAddObjectToList(env, list, AdblockPlus::Android:: NewJniSubscription(env, *it)); 120
109 }
110
111 return list;
112 }
113 CATCH_THROW_AND_RETURN(env, 0);
114 }
115
116 // FIXME: Code duplication
117 static jobject JNICALL JniFetchAvailableSubscriptions(JNIEnv* env, jclass clazz, jlong ptr) 121 static jobject JNICALL JniFetchAvailableSubscriptions(JNIEnv* env, jclass clazz, jlong ptr)
118 { 122 {
119 AdblockPlus::FilterEngine* engine = AdblockPlus::Android::JniLong2TypePtr<Adbl ockPlus::FilterEngine>(ptr); 123 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine >(ptr);
120 124
121 TRY 125 try
122 { 126 {
123 std::vector<AdblockPlus::SubscriptionPtr> filters = engine->FetchAvailableSu bscriptions(); 127 std::vector<AdblockPlus::SubscriptionPtr> subscriptions = engine->FetchAvail ableSubscriptions();
124 128
125 jobject list = AdblockPlus::Android::NewJniArrayList(env); 129 return SubscriptionsToArrayList(env, subscriptions);
126
127 for (std::vector<AdblockPlus::SubscriptionPtr>::iterator it = filters.begin( ), end = filters.end(); it != end; it++)
128 {
129 AdblockPlus::Android::JniAddObjectToList(env, list, AdblockPlus::Android:: NewJniSubscription(env, *it));
130 }
131
132 return list;
133 } 130 }
134 CATCH_THROW_AND_RETURN(env, 0); 131 CATCH_THROW_AND_RETURN(env, 0);
135 } 132 }
136 133
137 static void JNICALL JniRemoveFilterChangeCallback(JNIEnv* env, jclass clazz, jlo ng ptr) 134 static void JNICALL JniRemoveFilterChangeCallback(JNIEnv* env, jclass clazz, jlo ng ptr)
138 { 135 {
139 AdblockPlus::FilterEngine* engine = AdblockPlus::Android::JniLong2TypePtr<Adbl ockPlus::FilterEngine>(ptr); 136 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine >(ptr);
140 137
141 TRY 138 try
142 { 139 {
143 engine->RemoveFilterChangeCallback(); 140 engine->RemoveFilterChangeCallback();
144 } 141 }
145 CATCH_AND_THROW(env) 142 CATCH_AND_THROW(env)
146 } 143 }
147 144
148 static void JNICALL JniSetFilterChangeCallback(JNIEnv* env, jclass clazz, jlong ptr, jlong filterPtr) 145 static void JNICALL JniSetFilterChangeCallback(JNIEnv* env, jclass clazz, jlong ptr, jlong filterPtr)
149 { 146 {
150 AdblockPlus::FilterEngine* engine = AdblockPlus::Android::JniLong2TypePtr<Adbl ockPlus::FilterEngine>(ptr); 147 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine >(ptr);
151 AdblockPlus::Android::JniFilterChangeCallback* callback = AdblockPlus::Android ::JniLong2TypePtr< 148 JniFilterChangeCallback* callback = JniLongToTypePtr<JniFilterChangeCallback>( filterPtr);
152 AdblockPlus::Android::JniFilterChangeCallback>(filterPtr); 149
153 150 AdblockPlus::FilterEngine::FilterChangeCallback filterCallback =
154 AdblockPlus::FilterEngine::FilterChangeCallback filterCallback = std::tr1::bin d(&AdblockPlus::Android::JniFilterChangeCallback::Callback, 151 std::tr1::bind(&JniFilterChangeCallback::Callback, callback, std::tr1::pla ceholders::_1, std::tr1::placeholders::_2);
155 callback, std::tr1::placeholders::_1, std::tr1::placeholders::_2); 152
156 153 try
157 TRY
158 { 154 {
159 engine->SetFilterChangeCallback(filterCallback); 155 engine->SetFilterChangeCallback(filterCallback);
160 } 156 }
161 CATCH_AND_THROW(env) 157 CATCH_AND_THROW(env)
162 } 158 }
163 159
164 static void JNICALL JniForceUpdateCheck(JNIEnv* env, jclass clazz, jlong ptr, jl ong updaterPtr) 160 static void JNICALL JniForceUpdateCheck(JNIEnv* env, jclass clazz, jlong ptr, jl ong updaterPtr)
165 { 161 {
166 AdblockPlus::FilterEngine* engine = AdblockPlus::Android::JniLong2TypePtr<Adbl ockPlus::FilterEngine>(ptr); 162 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine >(ptr);
167 AdblockPlus::Android::JniUpdaterCallback* callback = AdblockPlus::Android::Jni Long2TypePtr<AdblockPlus::Android::JniUpdaterCallback>( 163 JniUpdaterCallback* callback = JniLongToTypePtr<JniUpdaterCallback>(updaterPtr );
168 updaterPtr);
169 164
170 AdblockPlus::FilterEngine::UpdaterCallback updaterCallback = 0; 165 AdblockPlus::FilterEngine::UpdaterCallback updaterCallback = 0;
171 166
172 if (updaterPtr) 167 if (updaterPtr)
173 { 168 {
174 updaterCallback = std::tr1::bind(&AdblockPlus::Android::JniUpdaterCallback:: Callback, callback, std::tr1::placeholders::_1); 169 updaterCallback = std::tr1::bind(&JniUpdaterCallback::Callback, callback, st d::tr1::placeholders::_1);
175 } 170 }
176 171
177 TRY 172 try
178 { 173 {
179 engine->ForceUpdateCheck(updaterCallback); 174 engine->ForceUpdateCheck(updaterCallback);
180 } 175 }
181 CATCH_AND_THROW(env) 176 CATCH_AND_THROW(env)
182 } 177 }
183 178
184 static jobject JNICALL JniGetElementHidingSelectors(JNIEnv* env, jclass clazz, j long ptr, jstring jDomain) 179 static jobject JNICALL JniGetElementHidingSelectors(JNIEnv* env, jclass clazz, j long ptr, jstring jDomain)
185 { 180 {
186 AdblockPlus::FilterEngine* engine = AdblockPlus::Android::JniLong2TypePtr<Adbl ockPlus::FilterEngine>(ptr); 181 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine >(ptr);
187 182
188 std::string domain = AdblockPlus::Android::JniJava2StdString(env, jDomain); 183 std::string domain = JniJavaToStdString(env, jDomain);
189 184
190 TRY 185 try
191 { 186 {
192 std::vector<std::string> selectors = engine->GetElementHidingSelectors(domai n); 187 std::vector<std::string> selectors = engine->GetElementHidingSelectors(domai n);
193 188
194 jobject list = AdblockPlus::Android::NewJniArrayList(env); 189 jobject list = NewJniArrayList(env);
195 190
196 for (std::vector<std::string>::iterator it = selectors.begin(), end = select ors.end(); it != end; it++) 191 for (std::vector<std::string>::iterator it = selectors.begin(), end = select ors.end(); it != end; it++)
197 { 192 {
198 AdblockPlus::Android::JniAddObjectToList(env, list, env->NewStringUTF(it-> c_str())); 193 JniAddObjectToList(env, list, env->NewStringUTF(it->c_str()));
199 } 194 }
200 195
201 return list; 196 return list;
202 } 197 }
203 CATCH_THROW_AND_RETURN(env, 0) 198 CATCH_THROW_AND_RETURN(env, 0)
204 } 199 }
205 200
206 static jobject JNICALL JniMatches(JNIEnv* env, jclass clazz, jlong ptr, jstring jUrl, jstring jContentType, jstring jDocumentUrl) 201 static jobject JNICALL JniMatches(JNIEnv* env, jclass clazz, jlong ptr, jstring jUrl, jstring jContentType, jstring jDocumentUrl)
207 { 202 {
208 AdblockPlus::FilterEngine* engine = AdblockPlus::Android::JniLong2TypePtr<Adbl ockPlus::FilterEngine>(ptr); 203 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine >(ptr);
209 204
210 std::string url = AdblockPlus::Android::JniJava2StdString(env, jUrl); 205 std::string url = JniJavaToStdString(env, jUrl);
211 std::string contentType = AdblockPlus::Android::JniJava2StdString(env, jConten tType); 206 std::string contentType = JniJavaToStdString(env, jContentType);
212 std::string documentUrl = AdblockPlus::Android::JniJava2StdString(env, jDocume ntUrl); 207 std::string documentUrl = JniJavaToStdString(env, jDocumentUrl);
213 208
214 TRY 209 try
215 { 210 {
216 AdblockPlus::FilterPtr filter = engine->Matches(url, contentType, documentUr l); 211 AdblockPlus::FilterPtr filter = engine->Matches(url, contentType, documentUr l);
217 212
218 return AdblockPlus::Android::NewJniFilter(env, filter); 213 return NewJniFilter(env, filter);
219 } 214 }
220 CATCH_THROW_AND_RETURN(env, 0) 215 CATCH_THROW_AND_RETURN(env, 0)
221 } 216 }
222 217
223 static jobject JNICALL JniMatchesMany(JNIEnv* env, jclass clazz, jlong ptr, jstr ing jUrl, jstring jContentType, jobjectArray jDocumentUrls) 218 static jobject JNICALL JniMatchesMany(JNIEnv* env, jclass clazz, jlong ptr, jstr ing jUrl, jstring jContentType, jobjectArray jDocumentUrls)
224 { 219 {
225 AdblockPlus::FilterEngine* engine = AdblockPlus::Android::JniLong2TypePtr<Adbl ockPlus::FilterEngine>(ptr); 220 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine >(ptr);
226 221
227 std::string url = AdblockPlus::Android::JniJava2StdString(env, jUrl); 222 std::string url = JniJavaToStdString(env, jUrl);
228 std::string contentType = AdblockPlus::Android::JniJava2StdString(env, jConten tType); 223 std::string contentType = JniJavaToStdString(env, jContentType);
229 224
230 std::vector<std::string> documentUrls; 225 std::vector<std::string> documentUrls;
231 226
232 jsize len = env->GetArrayLength(jDocumentUrls); 227 jsize len = env->GetArrayLength(jDocumentUrls);
233 228
234 for (jsize i = 0; i < len; i++) 229 for (jsize i = 0; i < len; i++)
235 { 230 {
236 documentUrls.push_back( 231 documentUrls.push_back(JniJavaToStdString(env, static_cast<jstring>(env->Get ObjectArrayElement(jDocumentUrls, i))));
237 AdblockPlus::Android::JniJava2StdString(env, static_cast<jstring>(env->G etObjectArrayElement(jDocumentUrls, i)))); 232 }
238 } 233
239 234 try
240 TRY
241 { 235 {
242 AdblockPlus::FilterPtr filter = engine->Matches(url, contentType, documentUr ls); 236 AdblockPlus::FilterPtr filter = engine->Matches(url, contentType, documentUr ls);
243 237
244 return AdblockPlus::Android::NewJniFilter(env, filter); 238 return NewJniFilter(env, filter);
245 } 239 }
246 CATCH_THROW_AND_RETURN(env, 0) 240 CATCH_THROW_AND_RETURN(env, 0)
247 } 241 }
248 242
249 static jobject JNICALL JniGetPref(JNIEnv* env, jclass clazz, jlong ptr, jstring jPref) 243 static jobject JNICALL JniGetPref(JNIEnv* env, jclass clazz, jlong ptr, jstring jPref)
250 { 244 {
251 AdblockPlus::FilterEngine* engine = AdblockPlus::Android::JniLong2TypePtr<Adbl ockPlus::FilterEngine>(ptr); 245 AdblockPlus::FilterEngine* engine = JniLongToTypePtr < AdblockPlus::FilterEngi ne > (ptr);
252 246
253 std::string pref = AdblockPlus::Android::JniJava2StdString(env, jPref); 247 std::string pref = JniJavaToStdString(env, jPref);
254 248
255 TRY 249 try
256 { 250 {
257 AdblockPlus::JsValuePtr value = engine->GetPref(pref); 251 AdblockPlus::JsValuePtr value = engine->GetPref(pref);
258 252
259 return AdblockPlus::Android::NewJniJsValue(env, value); 253 return NewJniJsValue(env, value);
260 } 254 }
261 CATCH_THROW_AND_RETURN(env, 0) 255 CATCH_THROW_AND_RETURN(env, 0)
262 } 256 }
263 257
264 static void JNICALL JniSetPref(JNIEnv* env, jclass clazz, jlong ptr, jstring jPr ef, jlong jsValue) 258 static void JNICALL JniSetPref(JNIEnv* env, jclass clazz, jlong ptr, jstring jPr ef, jlong jsValue)
265 { 259 {
266 AdblockPlus::FilterEngine* engine = AdblockPlus::Android::JniLong2TypePtr<Adbl ockPlus::FilterEngine>(ptr); 260 AdblockPlus::FilterEngine* engine = JniLongToTypePtr<AdblockPlus::FilterEngine >(ptr);
267 261
268 std::string pref = AdblockPlus::Android::JniJava2StdString(env, jPref); 262 std::string pref = JniJavaToStdString(env, jPref);
269 AdblockPlus::JsValuePtr value = AdblockPlus::Android::JniGetJsValuePtr(jsValue ); 263 AdblockPlus::JsValuePtr value = JniGetJsValuePtr(jsValue);
270 264
271 TRY 265 try
272 { 266 {
273 engine->SetPref(pref, value); 267 engine->SetPref(pref, value);
274 } 268 }
275 CATCH_AND_THROW(env) 269 CATCH_AND_THROW(env)
276 } 270 }
277 271
278 static JNINativeMethod methods[] = 272 static JNINativeMethod methods[] =
279 { 273 {
280 { (char*)"ctor", (char*)"(J)J", (void*)JniCtor }, 274 { (char*)"ctor", (char*)"(J)J", (void*)JniCtor },
281 { (char*)"isFirstRun", (char*)"(J)Z", (void*)JniIsFirstRun }, 275 { (char*)"isFirstRun", (char*)"(J)Z", (void*)JniIsFirstRun },
282 { (char*)"getFilter", (char*)"(JLjava/lang/String;)" TYP("Filter"), (void*)JniGe tFilter }, 276 { (char*)"getFilter", (char*)"(JLjava/lang/String;)" TYP("Filter"), (void*)Jni GetFilter },
283 { (char*)"getListedFilters", (char*)"(J)Ljava/util/List;", (void*)JniGetListedFi lters }, 277 { (char*)"getListedFilters", (char*)"(J)Ljava/util/List;", (void*)JniGetListed Filters },
284 { (char*)"getSubscription", (char*)"(JLjava/lang/String;)" TYP("Subscription"), (void*)JniGetSubscription }, 278 { (char*)"getSubscription", (char*)"(JLjava/lang/String;)" TYP("Subscription") , (void*)JniGetSubscription },
285 { (char*)"getListedSubscriptions", (char*)"(J)Ljava/util/List;", (void*)JniGetLi stedSubscriptions }, 279 { (char*)"getListedSubscriptions", (char*)"(J)Ljava/util/List;", (void*)JniGet ListedSubscriptions },
286 { (char*)"fetchAvailableSubscriptions", (char*)"(J)Ljava/util/List;", (void*)Jni FetchAvailableSubscriptions }, 280 { (char*)"fetchAvailableSubscriptions", (char*)"(J)Ljava/util/List;", (void*)J niFetchAvailableSubscriptions },
287 { (char*)"setFilterChangeCallback", (char*)"(JJ)V", (void*)JniSetFilterChangeCal lback }, 281 { (char*)"setFilterChangeCallback", (char*)"(JJ)V", (void*)JniSetFilterChangeC allback },
288 { (char*)"removeFilterChangeCallback", (char*)"(J)V", (void*)JniRemoveFilterChan geCallback }, 282 { (char*)"removeFilterChangeCallback", (char*)"(J)V", (void*)JniRemoveFilterCh angeCallback },
289 { (char*)"forceUpdateCheck", (char*)"(JJ)V", (void*)JniForceUpdateCheck }, 283 { (char*)"forceUpdateCheck", (char*)"(JJ)V", (void*)JniForceUpdateCheck },
290 { (char*)"getElementHidingSelectors", (char*)"(JLjava/lang/String;)Ljava/util/Li st;", (void*)JniGetElementHidingSelectors }, 284 { (char*)"getElementHidingSelectors", (char*)"(JLjava/lang/String;)Ljava/util/ List;", (void*)JniGetElementHidingSelectors },
291 { (char*)"matches", (char*)"(JLjava/lang/String;Ljava/lang/String;Ljava/lang/Str ing;)" TYP("Filter"), (void*)JniMatches }, 285 { (char*)"matches", (char*)"(JLjava/lang/String;Ljava/lang/String;Ljava/lang/S tring;)" TYP("Filter"), (void*)JniMatches },
292 { (char*)"matches", (char*)"(JLjava/lang/String;Ljava/lang/String;[Ljava/lang/St ring;)" TYP("Filter"), (void*)JniMatchesMany }, 286 { (char*)"matches", (char*)"(JLjava/lang/String;Ljava/lang/String;[Ljava/lang/ String;)" TYP("Filter"), (void*)JniMatchesMany },
293 { (char*)"getPref", (char*)"(JLjava/lang/String;)" TYP("JsValue"), (void*)JniGet Pref }, 287 { (char*)"getPref", (char*)"(JLjava/lang/String;)" TYP("JsValue"), (void*)JniG etPref },
294 { (char*)"setPref", (char*)"(JLjava/lang/String;J)V", (void*)JniSetPref }, 288 { (char*)"setPref", (char*)"(JLjava/lang/String;J)V", (void*)JniSetPref },
295 { (char*)"dtor", (char*)"(J)V", (void*)JniDtor }, }; 289 { (char*)"dtor", (char*)"(J)V", (void*)JniDtor }
296 290 };
297 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_android_api_FilterEngine_ registerNatives(JNIEnv *env, jclass clazz) 291
292 extern "C" JNIEXPORT void JNICALL Java_org_adblockplus_libadblockplus_FilterEngi ne_registerNatives(JNIEnv *env, jclass clazz)
298 { 293 {
299 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0])); 294 env->RegisterNatives(clazz, methods, sizeof(methods) / sizeof(methods[0]));
300 } 295 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld