OLD | NEW |
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 /** | 43 /** |
44 * A factory to construct DefaultWebRequest. | 44 * A factory to construct DefaultWebRequest. |
45 */ | 45 */ |
46 WebRequestPtr CreateDefaultWebRequest(const Scheduler& scheduler); | 46 WebRequestPtr CreateDefaultWebRequest(const Scheduler& scheduler); |
47 | 47 |
48 /** | 48 /** |
49 * A factory to construct LogSystem. | 49 * A factory to construct LogSystem. |
50 */ | 50 */ |
51 LogSystemPtr CreateDefaultLogSystem(); | 51 LogSystemPtr CreateDefaultLogSystem(); |
52 | 52 |
| 53 class IV8IsolateProvider; |
53 class JsEngine; | 54 class JsEngine; |
54 | 55 |
55 /** | 56 /** |
56 * AdblockPlus platform is the main component providing access to other | 57 * AdblockPlus platform is the main component providing access to other |
57 * modules. | 58 * modules. |
58 * | 59 * |
59 * It manages the functionality modules, e.g. JsEngine and FilterEngine as | 60 * It manages the functionality modules, e.g. JsEngine and FilterEngine as |
60 * well as allows to correctly work with asynchronous functionality. | 61 * well as allows to correctly work with asynchronous functionality. |
61 */ | 62 */ |
62 class Platform | 63 class Platform |
(...skipping 23 matching lines...) Expand all Loading... |
86 /** | 87 /** |
87 * Platform constructor. | 88 * Platform constructor. |
88 * | 89 * |
89 * When a parameter value is nullptr the corresponding default | 90 * When a parameter value is nullptr the corresponding default |
90 * implementation is chosen. | 91 * implementation is chosen. |
91 */ | 92 */ |
92 explicit Platform(CreationParameters&& creationParameters = CreationParamete
rs()); | 93 explicit Platform(CreationParameters&& creationParameters = CreationParamete
rs()); |
93 ~Platform(); | 94 ~Platform(); |
94 | 95 |
95 /** | 96 /** |
96 * Ensures that JsEngine is constructed. | 97 * Ensures that JsEngine is constructed. If JsEngine is already present |
| 98 * then the parameters are ignored. |
97 * | 99 * |
98 * @param appInfo Information about the app, if jsEngine is already present | 100 * @param appInfo Information about the app, |
99 * then the value is ignored. | 101 * @param isolate A provider of v8::Isolate, if the value is nullptr then |
| 102 * a default implementation is used. |
100 */ | 103 */ |
101 void SetUpJsEngine(const AppInfo& appInfo = AppInfo()); | 104 void SetUpJsEngine(const AppInfo& appInfo = AppInfo(), std::unique_ptr<IV8Is
olateProvider> isolate = nullptr); |
102 | 105 |
103 /** | 106 /** |
104 * Retrieves the `JsEngine` instance. It calls SetUpJsEngine if JsEngine is | 107 * Retrieves the `JsEngine` instance. It calls SetUpJsEngine if JsEngine is |
105 * not initialized yet. | 108 * not initialized yet. |
106 */ | 109 */ |
107 JsEngine& GetJsEngine(); | 110 JsEngine& GetJsEngine(); |
108 | 111 |
109 /** | 112 /** |
110 * Ensures that FilterEngine is constructed. Only the first call is effectiv
e. | 113 * Ensures that FilterEngine is constructed. Only the first call is effectiv
e. |
111 * | 114 * |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 FileSystemPtr fileSystem; | 153 FileSystemPtr fileSystem; |
151 WebRequestPtr webRequest; | 154 WebRequestPtr webRequest; |
152 // used for creation and deletion of modules. | 155 // used for creation and deletion of modules. |
153 std::mutex modulesMutex; | 156 std::mutex modulesMutex; |
154 std::shared_ptr<JsEngine> jsEngine; | 157 std::shared_ptr<JsEngine> jsEngine; |
155 std::shared_future<FilterEnginePtr> filterEngine; | 158 std::shared_future<FilterEnginePtr> filterEngine; |
156 }; | 159 }; |
157 } | 160 } |
158 | 161 |
159 #endif // ADBLOCK_PLUS_PLATFORM_H | 162 #endif // ADBLOCK_PLUS_PLATFORM_H |
OLD | NEW |