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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 * Converts v8 arguments to `JsValue` objects. | 215 * Converts v8 arguments to `JsValue` objects. |
216 * @param arguments `v8::Arguments` object containing the arguments to | 216 * @param arguments `v8::Arguments` object containing the arguments to |
217 * convert. | 217 * convert. |
218 * @return List of arguments converted to `JsValue` objects. | 218 * @return List of arguments converted to `JsValue` objects. |
219 */ | 219 */ |
220 JsValueList ConvertArguments(const v8::Arguments& arguments); | 220 JsValueList ConvertArguments(const v8::Arguments& arguments); |
221 | 221 |
222 /** | 222 /** |
223 * @see `SetFileSystem()`. | 223 * @see `SetFileSystem()`. |
224 */ | 224 */ |
225 FileSystemPtr GetFileSystem(); | 225 FileSystemPtr GetFileSystem() const; |
226 | 226 |
227 /** | 227 /** |
228 * Sets the `FileSystem` implementation used for all file I/O. | 228 * Sets the `FileSystem` implementation used for all file I/O. |
229 * Setting this is optional, the engine will use a `DefaultFileSystem` | 229 * Setting this is optional, the engine will use a `DefaultFileSystem` |
230 * instance by default, which might be sufficient. | 230 * instance by default, which might be sufficient. |
231 * @param The `FileSystem` instance to use. | 231 * @param The `FileSystem` instance to use. |
232 */ | 232 */ |
233 void SetFileSystem(FileSystemPtr val); | 233 void SetFileSystem(FileSystemPtr val); |
234 | 234 |
235 /** | 235 /** |
236 * @see `SetWebRequest()`. | 236 * @see `SetWebRequest()`. |
237 */ | 237 */ |
238 WebRequestPtr GetWebRequest(); | 238 WebRequestPtr GetWebRequest() const; |
239 | 239 |
240 /** | 240 /** |
241 * Sets the `WebRequest` implementation used for XMLHttpRequests. | 241 * Sets the `WebRequest` implementation used for XMLHttpRequests. |
242 * Setting this is optional, the engine will use a `DefaultWebRequest` | 242 * Setting this is optional, the engine will use a `DefaultWebRequest` |
243 * instance by default, which might be sufficient. | 243 * instance by default, which might be sufficient. |
244 * @param The `WebRequest` instance to use. | 244 * @param The `WebRequest` instance to use. |
245 */ | 245 */ |
246 void SetWebRequest(WebRequestPtr val); | 246 void SetWebRequest(WebRequestPtr val); |
247 | 247 |
248 /** | 248 /** |
249 * Registers the callback function to check whether current connection is | 249 * Registers the callback function to check whether current connection is |
250 * allowed for network requests. | 250 * allowed for network requests. |
251 * @param callback callback function. | 251 * @param callback callback function. |
252 */ | 252 */ |
253 void SetIsConnectionAllowedCallback(const IsConnectionAllowedCallback& callb
ack); | 253 void SetIsConnectionAllowedCallback(const IsConnectionAllowedCallback& callb
ack); |
254 | 254 |
255 /** | 255 /** |
256 * Checks whether current connection is allowed. If | 256 * Checks whether current connection is allowed. If |
257 * IsConnectionAllowedCallback is not set then then it returns true. | 257 * IsConnectionAllowedCallback is not set then then it returns true. |
258 */ | 258 */ |
259 bool IsConnectionAllowed(); | 259 bool IsConnectionAllowed() const; |
260 | 260 |
261 /** | 261 /** |
262 * @see `SetLogSystem()`. | 262 * @see `SetLogSystem()`. |
263 */ | 263 */ |
264 LogSystemPtr GetLogSystem(); | 264 LogSystemPtr GetLogSystem() const; |
265 | 265 |
266 /** | 266 /** |
267 * Sets the `LogSystem` implementation used for logging (e.g. to handle | 267 * Sets the `LogSystem` implementation used for logging (e.g. to handle |
268 * `console.log()` calls from JavaScript). | 268 * `console.log()` calls from JavaScript). |
269 * Setting this is optional, the engine will use a `DefaultLogSystem` | 269 * Setting this is optional, the engine will use a `DefaultLogSystem` |
270 * instance by default, which might be sufficient. | 270 * instance by default, which might be sufficient. |
271 * @param The `LogSystem` instance to use. | 271 * @param The `LogSystem` instance to use. |
272 */ | 272 */ |
273 void SetLogSystem(LogSystemPtr val); | 273 void SetLogSystem(LogSystemPtr val); |
274 | 274 |
(...skipping 28 matching lines...) Expand all Loading... |
303 /// Isolate must be disposed only after disposing of all objects which are | 303 /// Isolate must be disposed only after disposing of all objects which are |
304 /// using it. | 304 /// using it. |
305 ScopedV8IsolatePtr isolate; | 305 ScopedV8IsolatePtr isolate; |
306 | 306 |
307 FileSystemPtr fileSystem; | 307 FileSystemPtr fileSystem; |
308 WebRequestPtr webRequest; | 308 WebRequestPtr webRequest; |
309 LogSystemPtr logSystem; | 309 LogSystemPtr logSystem; |
310 std::unique_ptr<v8::Persistent<v8::Context>> context; | 310 std::unique_ptr<v8::Persistent<v8::Context>> context; |
311 EventMap eventCallbacks; | 311 EventMap eventCallbacks; |
312 std::mutex eventCallbacksMutex; | 312 std::mutex eventCallbacksMutex; |
313 std::mutex isConnectionAllowedMutex; | 313 mutable std::mutex isConnectionAllowedMutex; |
314 IsConnectionAllowedCallback isConnectionAllowed; | 314 IsConnectionAllowedCallback isConnectionAllowed; |
315 TimerTasks timerTasks; | 315 TimerTasks timerTasks; |
316 TimerPtr timer; | 316 TimerPtr timer; |
317 }; | 317 }; |
318 } | 318 } |
319 | 319 |
320 #endif | 320 #endif |
OLD | NEW |