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 29600561: Issue 6001 - Pass IV8IsolateProvider to Helper (Closed)
Patch Set: Created Nov. 7, 2017, 7:42 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 */ 124 */
125 public static class Builder 125 public static class Builder
126 { 126 {
127 private Context context; 127 private Context context;
128 private Map<String, Integer> urlToResourceIdMap; 128 private Map<String, Integer> urlToResourceIdMap;
129 private AndroidWebRequestResourceWrapper.Storage resourceStorage; 129 private AndroidWebRequestResourceWrapper.Storage resourceStorage;
130 private AndroidWebRequest androidWebRequest; 130 private AndroidWebRequest androidWebRequest;
131 private AppInfo appInfo; 131 private AppInfo appInfo;
132 private String basePath; 132 private String basePath;
133 private IsAllowedConnectionCallback isAllowedConnectionCallback; 133 private IsAllowedConnectionCallback isAllowedConnectionCallback;
134 private Long v8IsolatePtr; 134 private Long v8IsolateProviderPtr;
135 135
136 private AdblockEngine engine; 136 private AdblockEngine engine;
137 137
138 protected Builder(final AppInfo appInfo, final String basePath) 138 protected Builder(final AppInfo appInfo, final String basePath)
139 { 139 {
140 engine = new AdblockEngine(); 140 engine = new AdblockEngine();
141 engine.elemhideEnabled = true; 141 engine.elemhideEnabled = true;
142 142
143 // we can't create JsEngine and FilterEngine right now as it starts to dow nload subscriptions 143 // we can't create JsEngine and FilterEngine right now as it starts to dow nload subscriptions
144 // and requests (AndroidWebRequest and probbaly wrappers) are not specifie d yet 144 // and requests (AndroidWebRequest and probbaly wrappers) are not specifie d yet
(...skipping 16 matching lines...) Expand all
161 this.resourceStorage = storage; 161 this.resourceStorage = storage;
162 return this; 162 return this;
163 } 163 }
164 164
165 public Builder setIsAllowedConnectionCallback(IsAllowedConnectionCallback ca llback) 165 public Builder setIsAllowedConnectionCallback(IsAllowedConnectionCallback ca llback)
166 { 166 {
167 this.isAllowedConnectionCallback = callback; 167 this.isAllowedConnectionCallback = callback;
168 return this; 168 return this;
169 } 169 }
170 170
171 public Builder useV8Isolate(long v8IsolatePtr) 171 public Builder useV8IsolateProvider(long v8IsolateProviderPtr)
172 { 172 {
173 this.v8IsolatePtr = v8IsolatePtr; 173 this.v8IsolateProviderPtr = v8IsolateProviderPtr;
174 return this; 174 return this;
175 } 175 }
176 176
177 public Builder setUpdateAvailableCallback(UpdateAvailableCallback callback) 177 public Builder setUpdateAvailableCallback(UpdateAvailableCallback callback)
178 { 178 {
179 engine.updateAvailableCallback = callback; 179 engine.updateAvailableCallback = callback;
180 return this; 180 return this;
181 } 181 }
182 182
183 public Builder setUpdateCheckDoneCallback(UpdateCheckDoneCallback callback) 183 public Builder setUpdateCheckDoneCallback(UpdateCheckDoneCallback callback)
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 androidWebRequest.updateSubscriptionURLs(engine.filterEngine); 256 androidWebRequest.updateSubscriptionURLs(engine.filterEngine);
257 } 257 }
258 258
259 return engine; 259 return engine;
260 } 260 }
261 261
262 private void createEngines() 262 private void createEngines()
263 { 263 {
264 engine.logSystem = new AndroidLogSystem(); 264 engine.logSystem = new AndroidLogSystem();
265 engine.platform = new Platform(engine.logSystem, engine.webRequest, basePa th); 265 engine.platform = new Platform(engine.logSystem, engine.webRequest, basePa th);
266 if (v8IsolatePtr != null) 266 if (v8IsolateProviderPtr != null)
267 { 267 {
268 engine.platform.setUpJsEngine(appInfo, v8IsolatePtr); 268 engine.platform.setUpJsEngine(appInfo, v8IsolateProviderPtr);
269 } 269 }
270 else 270 else
271 { 271 {
272 engine.platform.setUpJsEngine(appInfo); 272 engine.platform.setUpJsEngine(appInfo);
273 } 273 }
274 engine.platform.setUpFilterEngine(isAllowedConnectionCallback); 274 engine.platform.setUpFilterEngine(isAllowedConnectionCallback);
275 engine.filterEngine = engine.platform.getFilterEngine(); 275 engine.filterEngine = engine.platform.getFilterEngine();
276 } 276 }
277 } 277 }
278 278
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 public void setWhitelistedDomains(List<String> domains) 635 public void setWhitelistedDomains(List<String> domains)
636 { 636 {
637 this.whitelistedDomains = domains; 637 this.whitelistedDomains = domains;
638 } 638 }
639 639
640 public List<String> getWhitelistedDomains() 640 public List<String> getWhitelistedDomains()
641 { 641 {
642 return whitelistedDomains; 642 return whitelistedDomains;
643 } 643 }
644 } 644 }
OLDNEW

Powered by Google App Engine
This is Rietveld