Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: include/AdblockPlus/JsEngine.h

Issue 29449592: Issue 5183 - Provide async interface for FileSystem (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Rebase on master. Last changes. Created July 7, 2017, 1:36 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/AdblockPlus/IFileSystem.h ('k') | include/AdblockPlus/JsValue.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,29 @@
* 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()`.
+ * Private functionality.
+ * @return The asynchronous IFileSystem implementation.
*/
- FileSystemPtr GetFileSystem() const;
+ FileSystemPtr GetAsyncFileSystem() 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.
+ * Sets the synchronous `FileSystem` implementation used for all
+ * file I/O. Setting this is optional, the engine will use the
+ * implementation created by `CreateDefaultFileSystem()` by
+ * default, which might be 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,17 +318,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;
« no previous file with comments | « include/AdblockPlus/IFileSystem.h ('k') | include/AdblockPlus/JsValue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld