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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 const OnFilterEngineCreatedCallback& onCreated = OnFilterEngineCreatedCall
back()); | 100 const OnFilterEngineCreatedCallback& onCreated = OnFilterEngineCreatedCall
back()); |
101 | 101 |
102 /** | 102 /** |
103 * Synchronous equivalent of `CreateFilterEngineAsync`. | 103 * Synchronous equivalent of `CreateFilterEngineAsync`. |
104 * Internally it blocks and waits for finishing of certain asynchronous | 104 * Internally it blocks and waits for finishing of certain asynchronous |
105 * operations, please ensure that provided implementation does not lead to | 105 * operations, please ensure that provided implementation does not lead to |
106 * a dead lock. | 106 * a dead lock. |
107 */ | 107 */ |
108 FilterEngine& GetFilterEngine(); | 108 FilterEngine& GetFilterEngine(); |
109 | 109 |
110 /** | 110 typedef std::function<void(ITimer&)> WithTimerCallback; |
111 * @return The asynchronous ITimer implementation. | 111 void WithTimer(const WithTimerCallback&); |
112 */ | |
113 ITimer& GetTimer(); | |
114 | 112 |
115 /** | 113 typedef std::function<void(IFileSystem&)> WithFileSystemCallback; |
116 * @return The asynchronous IFileSystem implementation. | 114 void WithFileSystem(const WithFileSystemCallback&); |
117 */ | |
118 IFileSystem& GetFileSystem(); | |
119 | 115 |
120 /** | 116 typedef std::function<void(IWebRequest&)> WithWebRequestCallback; |
121 * @return The asynchronous IWebRequest implementation. | 117 void WithWebRequest(const WithWebRequestCallback&); |
122 */ | |
123 IWebRequest& GetWebRequest(); | |
124 | 118 |
125 /** | 119 /** |
126 * @return The LogSystem implementation. | 120 * @return The LogSystem implementation. |
127 */ | 121 */ |
128 LogSystem& GetLogSystem(); | 122 LogSystem& GetLogSystem(); |
129 | 123 |
130 private: | 124 private: |
131 LogSystemPtr logSystem; | 125 LogSystemPtr logSystem; |
132 TimerPtr timer; | 126 TimerPtr timer; |
133 FileSystemPtr fileSystem; | 127 FileSystemPtr fileSystem; |
134 WebRequestPtr webRequest; | 128 WebRequestPtr webRequest; |
135 // used for creation and deletion of modules. | 129 // used for creation and deletion of modules. |
136 std::mutex modulesMutex; | 130 std::mutex modulesMutex; |
| 131 std::recursive_mutex interfacesMutex; |
137 std::shared_ptr<JsEngine> jsEngine; | 132 std::shared_ptr<JsEngine> jsEngine; |
138 std::shared_future<FilterEnginePtr> filterEngine; | 133 std::shared_future<FilterEnginePtr> filterEngine; |
139 }; | 134 }; |
140 | 135 |
141 /** | 136 /** |
142 * A helper class allowing to construct a default Platform and to obtain | 137 * A helper class allowing to construct a default Platform and to obtain |
143 * the Scheduler used by Platform before the latter is constructed. | 138 * the Scheduler used by Platform before the latter is constructed. |
144 */ | 139 */ |
145 class DefaultPlatformBuilder : public Platform::CreationParameters | 140 class DefaultPlatformBuilder : public Platform::CreationParameters |
146 { | 141 { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 * when a corresponding field is nullptr and with a default Scheduler. | 174 * when a corresponding field is nullptr and with a default Scheduler. |
180 */ | 175 */ |
181 std::unique_ptr<Platform> CreatePlatform(); | 176 std::unique_ptr<Platform> CreatePlatform(); |
182 private: | 177 private: |
183 std::shared_ptr<Scheduler> asyncExecutor; | 178 std::shared_ptr<Scheduler> asyncExecutor; |
184 Scheduler defaultScheduler; | 179 Scheduler defaultScheduler; |
185 }; | 180 }; |
186 } | 181 } |
187 | 182 |
188 #endif // ADBLOCK_PLUS_PLATFORM_H | 183 #endif // ADBLOCK_PLUS_PLATFORM_H |
OLD | NEW |