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

Side by Side Diff: include/AdblockPlus/Platform.h

Issue 29661564: Template out V8 and prepare for other JS engine implementations
Patch Set: Created Jan. 10, 2018, 1:29 p.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 | « include/AdblockPlus/JsValue.h ('k') | shell/src/GcCommand.h » ('j') | 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 13 matching lines...) Expand all
24 #include "IWebRequest.h" 24 #include "IWebRequest.h"
25 #include "AppInfo.h" 25 #include "AppInfo.h"
26 #include "Scheduler.h" 26 #include "Scheduler.h"
27 #include "FilterEngine.h" 27 #include "FilterEngine.h"
28 #include <mutex> 28 #include <mutex>
29 #include <future> 29 #include <future>
30 30
31 namespace AdblockPlus 31 namespace AdblockPlus
32 { 32 {
33 struct IV8IsolateProvider; 33 struct IV8IsolateProvider;
34 class JsEngine; 34
35 template <class T> class JsEngineTemplate;
36 #ifndef JSENGINEIMPL
37 #define JSENGINEIMPL JsEngineTemplate<JsEngineNamespaceImpl>
38 #endif // !JSENGINEIMPL
39 typedef JSENGINEIMPL JsEngine;
35 40
36 /** 41 /**
37 * AdblockPlus platform is the main component providing access to other 42 * AdblockPlus platform is the main component providing access to other
38 * modules. 43 * modules.
39 * 44 *
40 * It manages the functionality modules, e.g. JsEngine and FilterEngine as 45 * It manages the functionality modules, e.g. JsEngine and FilterEngine as
41 * well as allows to correctly work with asynchronous functionality. 46 * well as allows to correctly work with asynchronous functionality.
42 */ 47 */
43 class Platform 48 class Platform
44 { 49 {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 * @param appInfo Information about the app, 85 * @param appInfo Information about the app,
81 * @param isolate A provider of v8::Isolate, if the value is nullptr then 86 * @param isolate A provider of v8::Isolate, if the value is nullptr then
82 * a default implementation is used. 87 * a default implementation is used.
83 */ 88 */
84 void SetUpJsEngine(const AppInfo& appInfo = AppInfo(), std::unique_ptr<IV8Is olateProvider> isolate = nullptr); 89 void SetUpJsEngine(const AppInfo& appInfo = AppInfo(), std::unique_ptr<IV8Is olateProvider> isolate = nullptr);
85 90
86 /** 91 /**
87 * Retrieves the `JsEngine` instance. It calls SetUpJsEngine if JsEngine is 92 * Retrieves the `JsEngine` instance. It calls SetUpJsEngine if JsEngine is
88 * not initialized yet. 93 * not initialized yet.
89 */ 94 */
90 JsEngine& GetJsEngine(); 95 JsEngineTemplate<JsEngineNamespaceImpl>& GetJsEngine();
91 96
92 /** 97 /**
93 * Ensures that FilterEngine is constructed. Only the first call is effectiv e. 98 * Ensures that FilterEngine is constructed. Only the first call is effectiv e.
94 * 99 *
95 * @param parameters optional creation parameters. 100 * @param parameters optional creation parameters.
96 * @param onCreated A callback which is called when FilterEngine is ready 101 * @param onCreated A callback which is called when FilterEngine is ready
97 * for use. 102 * for use.
98 */ 103 */
99 void CreateFilterEngineAsync(const FilterEngine::CreationParameters& paramet ers = FilterEngine::CreationParameters(), 104 void CreateFilterEngineAsync(const FilterEngine::CreationParameters& paramet ers = FilterEngine::CreationParameters(),
100 const OnFilterEngineCreatedCallback& onCreated = OnFilterEngineCreatedCall back()); 105 const OnFilterEngineCreatedCallback& onCreated = OnFilterEngineCreatedCall back());
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 * when a corresponding field is nullptr and with a default Scheduler. 177 * when a corresponding field is nullptr and with a default Scheduler.
173 */ 178 */
174 std::unique_ptr<Platform> CreatePlatform(); 179 std::unique_ptr<Platform> CreatePlatform();
175 private: 180 private:
176 std::shared_ptr<Scheduler> asyncExecutor; 181 std::shared_ptr<Scheduler> asyncExecutor;
177 Scheduler defaultScheduler; 182 Scheduler defaultScheduler;
178 }; 183 };
179 } 184 }
180 185
181 #endif // ADBLOCK_PLUS_PLATFORM_H 186 #endif // ADBLOCK_PLUS_PLATFORM_H
OLDNEW
« no previous file with comments | « include/AdblockPlus/JsValue.h ('k') | shell/src/GcCommand.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld