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

Side by Side Diff: libadblockplus-android/src/org/adblockplus/libadblockplus/android/AdblockEngine.java

Issue 29556582: Issue 5643 - Make v8::Isolate injectable into JsEngine (Closed)
Patch Set: Using JniLongToTypePtr for casting Created Sept. 28, 2017, 8:55 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « libadblockplus-android/src/org/adblockplus/libadblockplus/Platform.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present 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
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 */ 126 */
127 public static class Builder 127 public static class Builder
128 { 128 {
129 private Context context; 129 private Context context;
130 private Map<String, Integer> urlToResourceIdMap; 130 private Map<String, Integer> urlToResourceIdMap;
131 private AndroidWebRequestResourceWrapper.Storage resourceStorage; 131 private AndroidWebRequestResourceWrapper.Storage resourceStorage;
132 private AndroidWebRequest androidWebRequest; 132 private AndroidWebRequest androidWebRequest;
133 private AppInfo appInfo; 133 private AppInfo appInfo;
134 private String basePath; 134 private String basePath;
135 private IsAllowedConnectionCallback isAllowedConnectionCallback; 135 private IsAllowedConnectionCallback isAllowedConnectionCallback;
136 private Long v8IsolatePtr;
sergei 2017/09/28 09:34:49 I'm not sure about Long vs long here, but it seems
136 137
137 private AdblockEngine engine; 138 private AdblockEngine engine;
138 139
139 protected Builder(final AppInfo appInfo, final String basePath) 140 protected Builder(final AppInfo appInfo, final String basePath)
140 { 141 {
141 engine = new AdblockEngine(); 142 engine = new AdblockEngine();
142 engine.elemhideEnabled = true; 143 engine.elemhideEnabled = true;
143 144
144 // we can't create JsEngine and FilterEngine right now as it starts to dow nload subscriptions 145 // we can't create JsEngine and FilterEngine right now as it starts to dow nload subscriptions
145 // and requests (AndroidWebRequest and probbaly wrappers) are not specifie d yet 146 // and requests (AndroidWebRequest and probbaly wrappers) are not specifie d yet
(...skipping 16 matching lines...) Expand all
162 this.resourceStorage = storage; 163 this.resourceStorage = storage;
163 return this; 164 return this;
164 } 165 }
165 166
166 public Builder setIsAllowedConnectionCallback(IsAllowedConnectionCallback ca llback) 167 public Builder setIsAllowedConnectionCallback(IsAllowedConnectionCallback ca llback)
167 { 168 {
168 this.isAllowedConnectionCallback = callback; 169 this.isAllowedConnectionCallback = callback;
169 return this; 170 return this;
170 } 171 }
171 172
173 public Builder useV8Isolate(long v8IsolatePtr)
174 {
175 this.v8IsolatePtr = v8IsolatePtr;
176 return this;
177 }
178
172 public Builder setUpdateAvailableCallback(UpdateAvailableCallback callback) 179 public Builder setUpdateAvailableCallback(UpdateAvailableCallback callback)
173 { 180 {
174 engine.updateAvailableCallback = callback; 181 engine.updateAvailableCallback = callback;
175 return this; 182 return this;
176 } 183 }
177 184
178 public Builder setUpdateCheckDoneCallback(UpdateCheckDoneCallback callback) 185 public Builder setUpdateCheckDoneCallback(UpdateCheckDoneCallback callback)
179 { 186 {
180 engine.updateCheckDoneCallback = callback; 187 engine.updateCheckDoneCallback = callback;
181 return this; 188 return this;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 255
249 androidWebRequest.updateSubscriptionURLs(engine.filterEngine); 256 androidWebRequest.updateSubscriptionURLs(engine.filterEngine);
250 257
251 return engine; 258 return engine;
252 } 259 }
253 260
254 private void createEngines() 261 private void createEngines()
255 { 262 {
256 engine.logSystem = new AndroidLogSystem(); 263 engine.logSystem = new AndroidLogSystem();
257 engine.platform = new Platform(engine.logSystem, engine.webRequest, basePa th); 264 engine.platform = new Platform(engine.logSystem, engine.webRequest, basePa th);
258 engine.platform.setUpJsEngine(appInfo); 265 if (v8IsolatePtr != null)
266 {
267 engine.platform.setUpJsEngine(appInfo, v8IsolatePtr);
268 }
269 else
270 {
271 engine.platform.setUpJsEngine(appInfo);
272 }
259 engine.platform.setUpFilterEngine(isAllowedConnectionCallback); 273 engine.platform.setUpFilterEngine(isAllowedConnectionCallback);
260 engine.filterEngine = engine.platform.getFilterEngine(); 274 engine.filterEngine = engine.platform.getFilterEngine();
261 } 275 }
262 } 276 }
263 277
264 public static Builder builder(AppInfo appInfo, String basePath) 278 public static Builder builder(AppInfo appInfo, String basePath)
265 { 279 {
266 return new Builder(appInfo, basePath); 280 return new Builder(appInfo, basePath);
267 } 281 }
268 282
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 public void setWhitelistedDomains(List<String> domains) 624 public void setWhitelistedDomains(List<String> domains)
611 { 625 {
612 this.whitelistedDomains = domains; 626 this.whitelistedDomains = domains;
613 } 627 }
614 628
615 public List<String> getWhitelistedDomains() 629 public List<String> getWhitelistedDomains()
616 { 630 {
617 return whitelistedDomains; 631 return whitelistedDomains;
618 } 632 }
619 } 633 }
OLDNEW
« no previous file with comments | « libadblockplus-android/src/org/adblockplus/libadblockplus/Platform.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld