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

Delta Between Two Patch Sets: include/AdblockPlus/FilterEngine.h

Issue 29377064: Issue 4944 - Make creation of FilterEngine asynchronous. (Closed)
Left Patch Set: Created Feb. 28, 2017, 2:21 p.m.
Right Patch Set: rebase and address comments Created March 16, 2017, 3:47 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 | « README.md ('k') | shell/src/Main.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 <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 209
210 /** 210 /**
211 * Callback type invoked when a new notification should be shown. 211 * Callback type invoked when a new notification should be shown.
212 * The parameter is the Notification object to be shown. 212 * The parameter is the Notification object to be shown.
213 */ 213 */
214 typedef std::function<void(const NotificationPtr&)> ShowNotificationCallback ; 214 typedef std::function<void(const NotificationPtr&)> ShowNotificationCallback ;
215 215
216 /** 216 /**
217 * FilterEngine creation parameters. 217 * FilterEngine creation parameters.
218 */ 218 */
219 struct CreateParameters 219 struct CreationParameters
Oleksandr 2017/03/16 15:05:25 Nit: How about CreationParameters. One might assum
sergei 2017/03/16 15:50:03 Agree, done.
220 { 220 {
221 /** 221 /**
222 * `AdblockPlus::FilterEngine::Prefs` name - value list of preconfigured 222 * `AdblockPlus::FilterEngine::Prefs` name - value list of preconfigured
223 * prefs. 223 * prefs.
224 */ 224 */
225 Prefs preconfiguredPrefs; 225 Prefs preconfiguredPrefs;
226 }; 226 };
227 227
228 /** 228 /**
229 * Callback type invoked when FilterEngine is created. 229 * Callback type invoked when FilterEngine is created.
230 */ 230 */
231 typedef std::function<void(const FilterEnginePtr&)> OnCreatedCallback; 231 typedef std::function<void(const FilterEnginePtr&)> OnCreatedCallback;
232 232
233 /** 233 /**
234 * Asynchronously constructs FilterEngine. 234 * Asynchronously constructs FilterEngine.
235 * @param jsEngine `JsEngine` instance used to run JavaScript code 235 * @param jsEngine `JsEngine` instance used to run JavaScript code
236 * internally. 236 * internally.
237 * @param onCreated A callback which is called when FilterEngine is ready 237 * @param onCreated A callback which is called when FilterEngine is ready
238 * for use. 238 * for use.
239 * @param parameters optional creation parameters. 239 * @param parameters optional creation parameters.
240 */ 240 */
241 static void CreateAsync(const JsEnginePtr& jsEngine, 241 static void CreateAsync(const JsEnginePtr& jsEngine,
Eric 2017/02/28 17:04:50 (1) C++ has <future>. (2) This is new code. This
sergei 2017/02/28 22:18:27 Sorry, but what is the aim of this message? We cur
Oleksandr 2017/03/16 15:05:25 It does not look like we'll be able to move to a n
242 const OnCreatedCallback& onCreated, 242 const OnCreatedCallback& onCreated,
243 const CreateParameters& parameters = CreateParameters()); 243 const CreationParameters& parameters = CreationParameters());
244 244
245 /** 245 /**
246 * Synchronous interface to construct FilterEngine. For details see 246 * Synchronous interface to construct FilterEngine. For details see
247 * asynchronous version CreateAsync. 247 * asynchronous version CreateAsync.
248 */ 248 */
249 static FilterEnginePtr Create(const JsEnginePtr& jsEngine, 249 static FilterEnginePtr Create(const JsEnginePtr& jsEngine,
250 const CreateParameters& params = CreateParameters()); 250 const CreationParameters& params = CreationParameters());
251 251
252 /** 252 /**
253 * Retrieves the `JsEngine` instance associated with this `FilterEngine` 253 * Retrieves the `JsEngine` instance associated with this `FilterEngine`
254 * instance. 254 * instance.
255 */ 255 */
256 JsEnginePtr GetJsEngine() const { return jsEngine; } 256 JsEnginePtr GetJsEngine() const { return jsEngine; }
257 257
258 /** 258 /**
259 * Checks if this is the first run of the application. 259 * Checks if this is the first run of the application.
260 * @return `true` if the application is running for the first time. 260 * @return `true` if the application is running for the first time.
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 const JsValueList& params); 485 const JsValueList& params);
486 FilterPtr GetWhitelistingFilter(const std::string& url, 486 FilterPtr GetWhitelistingFilter(const std::string& url,
487 ContentTypeMask contentTypeMask, const std::string& documentUrl) const; 487 ContentTypeMask contentTypeMask, const std::string& documentUrl) const;
488 FilterPtr GetWhitelistingFilter(const std::string& url, 488 FilterPtr GetWhitelistingFilter(const std::string& url,
489 ContentTypeMask contentTypeMask, 489 ContentTypeMask contentTypeMask,
490 const std::vector<std::string>& documentUrls) const; 490 const std::vector<std::string>& documentUrls) const;
491 }; 491 };
492 } 492 }
493 493
494 #endif 494 #endif
LEFTRIGHT

Powered by Google App Engine
This is Rietveld