Index: include/AdblockPlus/JsEngine.h |
=================================================================== |
--- a/include/AdblockPlus/JsEngine.h |
+++ b/include/AdblockPlus/JsEngine.h |
@@ -52,16 +52,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. |
*/ |
@@ -115,23 +120,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. |
*/ |
@@ -253,29 +260,21 @@ |
* Converts v8 arguments to `JsValue` objects. |
* @param arguments `v8::Arguments` object containing the arguments to |
* convert. |
* @return List of arguments converted to `const JsValue` objects. |
*/ |
JsValueList ConvertArguments(const v8::Arguments& arguments); |
/** |
- * @see `SetFileSystem()`. |
+ * @return The asynchronous IFileSystem implementation. |
*/ |
FileSystemPtr GetFileSystem() const; |
/** |
- * 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. |
- * @param The `FileSystem` instance to use. |
- */ |
- void SetFileSystem(const FileSystemPtr& 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); |
/** |
@@ -310,17 +309,17 @@ |
/** |
* 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; |