| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 * | 120 * |
| 121 */ | 121 */ |
| 122 class JsWeakValuesID | 122 class JsWeakValuesID |
| 123 { | 123 { |
| 124 friend class JsEngine; | 124 friend class JsEngine; |
| 125 JsWeakValuesLists::const_iterator iterator; | 125 JsWeakValuesLists::const_iterator iterator; |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 /** | 128 /** |
| 129 * Creates a new JavaScript engine instance. | 129 * Creates a new JavaScript engine instance. |
| 130 * |
| 131 * When a parameter value is nullptr the corresponding default |
| 132 * implementation is chosen. |
| 133 * |
| 130 * @param appInfo Information about the app. | 134 * @param appInfo Information about the app. |
| 131 * @param timer Implementation of timer. | 135 * @param timer Implementation of timer. |
| 132 * @param fileSystem Implementation of filesystem. | 136 * @param fileSystem Implementation of filesystem. |
| 133 * @param webRequest Implementation of web request. | 137 * @param webRequest Implementation of web request. |
| 134 * @param logSystem Implementation of log system. | 138 * @param logSystem Implementation of log system. |
| 135 * @return New `JsEngine` instance. | 139 * @return New `JsEngine` instance. |
| 136 */ | 140 */ |
| 137 static JsEnginePtr New(const AppInfo& appInfo = AppInfo(), | 141 static JsEnginePtr New(const AppInfo& appInfo = AppInfo(), |
| 138 TimerPtr timer = CreateDefaultTimer(), | 142 TimerPtr timer = nullptr, FileSystemPtr fileSystem = nullptr, |
| 139 FileSystemPtr fileSystem = CreateDefaultFileSystem(), | 143 WebRequestPtr webRequest = nullptr, LogSystemPtr logSystem = nullptr); |
| 140 WebRequestPtr webRequest = CreateDefaultWebRequest(), | |
| 141 LogSystemPtr logSystem = CreateDefaultLogSystem()); | |
| 142 | 144 |
| 143 /** | 145 /** |
| 144 * Registers the callback function for an event. | 146 * Registers the callback function for an event. |
| 145 * @param eventName Event name. Note that this can be any string - it's a | 147 * @param eventName Event name. Note that this can be any string - it's a |
| 146 * general purpose event handling mechanism. | 148 * general purpose event handling mechanism. |
| 147 * @param callback Event callback function. | 149 * @param callback Event callback function. |
| 148 */ | 150 */ |
| 149 void SetEventCallback(const std::string& eventName, const EventCallback& cal
lback); | 151 void SetEventCallback(const std::string& eventName, const EventCallback& cal
lback); |
| 150 | 152 |
| 151 /** | 153 /** |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 EventMap eventCallbacks; | 319 EventMap eventCallbacks; |
| 318 std::mutex eventCallbacksMutex; | 320 std::mutex eventCallbacksMutex; |
| 319 JsWeakValuesLists jsWeakValuesLists; | 321 JsWeakValuesLists jsWeakValuesLists; |
| 320 std::mutex jsWeakValuesListsMutex; | 322 std::mutex jsWeakValuesListsMutex; |
| 321 TimerPtr timer; | 323 TimerPtr timer; |
| 322 WebRequestPtr webRequest; | 324 WebRequestPtr webRequest; |
| 323 }; | 325 }; |
| 324 } | 326 } |
| 325 | 327 |
| 326 #endif | 328 #endif |
| OLD | NEW |