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: Created Sept. 26, 2017, 8:54 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
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;
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 engine.platform.setUpJsEngine(appInfo, v8IsolatePtr);
259 engine.platform.setUpFilterEngine(isAllowedConnectionCallback); 266 engine.platform.setUpFilterEngine(isAllowedConnectionCallback);
260 engine.filterEngine = engine.platform.getFilterEngine(); 267 engine.filterEngine = engine.platform.getFilterEngine();
261 } 268 }
262 } 269 }
263 270
264 public static Builder builder(AppInfo appInfo, String basePath) 271 public static Builder builder(AppInfo appInfo, String basePath)
265 { 272 {
266 return new Builder(appInfo, basePath); 273 return new Builder(appInfo, basePath);
267 } 274 }
268 275
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 public void setWhitelistedDomains(List<String> domains) 617 public void setWhitelistedDomains(List<String> domains)
611 { 618 {
612 this.whitelistedDomains = domains; 619 this.whitelistedDomains = domains;
613 } 620 }
614 621
615 public List<String> getWhitelistedDomains() 622 public List<String> getWhitelistedDomains()
616 { 623 {
617 return whitelistedDomains; 624 return whitelistedDomains;
618 } 625 }
619 } 626 }
OLDNEW

Powered by Google App Engine
This is Rietveld