Index: include/AdblockPlus/JsEngine.h |
=================================================================== |
--- a/include/AdblockPlus/JsEngine.h |
+++ b/include/AdblockPlus/JsEngine.h |
@@ -51,16 +51,21 @@ |
typedef std::shared_ptr<JsEngine> JsEnginePtr; |
/** |
* A factory to construct DefaultTimer. |
*/ |
TimerPtr CreateDefaultTimer(); |
/** |
+ * A factory to construct DefaultFileSystem. |
+ */ |
+ FileSystemPtr CreateDefaultFileSystem(); |
+ |
+ /** |
* A factory to construct DefaultWebRequest. |
*/ |
WebRequestPtr CreateDefaultWebRequest(); |
/** |
* Scope based isolate manager. Creates a new isolate instance on |
* constructing and disposes it on destructing. |
*/ |
@@ -114,23 +119,25 @@ |
friend class JsEngine; |
JsWeakValuesLists::const_iterator iterator; |
}; |
/** |
* Creates a new JavaScript engine instance. |
* @param appInfo Information about the app. |
* @param timer Implementation of timer. |
+ * @param fileSystem Implementation of filesystem. |
* @param webRequest Implementation of web request. |
* @param isolate v8::Isolate wrapper. This parameter should be considered |
* as a temporary hack for tests, it will go away. Issue #3593. |
* @return New `JsEngine` instance. |
*/ |
static JsEnginePtr New(const AppInfo& appInfo = AppInfo(), |
TimerPtr timer = CreateDefaultTimer(), |
+ FileSystemPtr fileSystem = CreateDefaultFileSystem(), |
WebRequestPtr webRequest = CreateDefaultWebRequest()); |
/** |
* Registers the callback function for an event. |
* @param eventName Event name. Note that this can be any string - it's a |
* general purpose event handling mechanism. |
* @param callback Event callback function. |
*/ |
@@ -252,27 +259,28 @@ |
* Converts v8 arguments to `JsValue` objects. |
* @param arguments `v8::FunctionCallbackInfo` object containing the arguments to |
* convert. |
* @return List of arguments converted to `const JsValue` objects. |
*/ |
JsValueList ConvertArguments(const v8::FunctionCallbackInfo<v8::Value>& arguments); |
/** |
- * @see `SetFileSystem()`. |
+ * @return The asynchronous IFileSystem implementation. |
*/ |
- FileSystemPtr GetFileSystem() const; |
+ FileSystemPtr GetAsyncFileSystem() const; |
sergei
2017/07/03 09:25:54
From https://codereview.adblockplus.org/29449592/d
hub
2017/07/04 19:58:26
Acknowledged.
|
/** |
- * Sets the `FileSystem` implementation used for all file I/O. |
- * Setting this is optional, the engine will use a `DefaultFileSystem` |
- * instance by default, which might be sufficient. |
+ * Sets the synchronous `FileSystem` implementation used for all |
+ * file I/O. Setting this is optional, the engine will use a |
+ * `DefaultFileSystemSync` instance by default, which might be |
sergei
2017/07/03 09:25:54
I think the comment should be a bit adjusted. By d
hub
2017/07/04 19:58:26
Acknowledged.
|
+ * sufficient. |
* @param The `FileSystem` instance to use. |
*/ |
- void SetFileSystem(const FileSystemPtr& val); |
+ void SetFileSystem(const FileSystemSyncPtr& val); |
/** |
* Sets the `WebRequest` implementation used for XMLHttpRequests. |
* Setting this is optional, the engine will use a `DefaultWebRequest` |
* instance by default, which might be sufficient. |
* @param The `WebRequest` instance to use. |
*/ |
void SetWebRequest(const WebRequestSharedPtr& val); |
@@ -309,25 +317,26 @@ |
/** |
* Notifies JS engine about critically low memory what should cause a |
* garbage collection. |
*/ |
void NotifyLowMemory(); |
private: |
void CallTimerTask(const JsWeakValuesID& timerParamsID); |
- explicit JsEngine(TimerPtr timer, WebRequestPtr webRequest); |
+ explicit JsEngine(TimerPtr timer, FileSystemPtr fileSystem, WebRequestPtr webRequest); |
JsValue GetGlobalObject(); |
/// Isolate must be disposed only after disposing of all objects which are |
/// using it. |
ScopedV8Isolate isolate; |
FileSystemPtr fileSystem; |
+ FileSystemSyncPtr fileSystemLegacy; |
LogSystemPtr logSystem; |
std::unique_ptr<v8::Global<v8::Context>> context; |
EventMap eventCallbacks; |
std::mutex eventCallbacksMutex; |
JsWeakValuesLists jsWeakValuesLists; |
std::mutex jsWeakValuesListsMutex; |
TimerPtr timer; |
WebRequestPtr webRequest; |