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

Unified Diff: include/AdblockPlus/Platform.h

Issue 29543810: Issue 5118 - Lock the platform interfaces before use (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Added missing LogSystem Created Sept. 13, 2017, 5:46 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 | « no previous file | src/ConsoleJsObject.cpp » ('j') | src/Platform.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/AdblockPlus/Platform.h
===================================================================
--- a/include/AdblockPlus/Platform.h
+++ b/include/AdblockPlus/Platform.h
@@ -102,43 +102,36 @@
/**
* Synchronous equivalent of `CreateFilterEngineAsync`.
* Internally it blocks and waits for finishing of certain asynchronous
* operations, please ensure that provided implementation does not lead to
* a dead lock.
*/
FilterEngine& GetFilterEngine();
- /**
- * @return The asynchronous ITimer implementation.
- */
- ITimer& GetTimer();
+ typedef std::function<void(ITimer&)> WithTimerCallback;
+ void WithTimer(const WithTimerCallback&);
- /**
- * @return The asynchronous IFileSystem implementation.
- */
- IFileSystem& GetFileSystem();
+ typedef std::function<void(IFileSystem&)> WithFileSystemCallback;
+ void WithFileSystem(const WithFileSystemCallback&);
- /**
- * @return The asynchronous IWebRequest implementation.
- */
- IWebRequest& GetWebRequest();
+ typedef std::function<void(IWebRequest&)> WithWebRequestCallback;
+ void WithWebRequest(const WithWebRequestCallback&);
- /**
- * @return The LogSystem implementation.
- */
- LogSystem& GetLogSystem();
+ typedef std::function<void(LogSystem&)> WithLogSystemCallback;
+ void WithLogSystem(const WithLogSystemCallback&);
private:
LogSystemPtr logSystem;
TimerPtr timer;
FileSystemPtr fileSystem;
WebRequestPtr webRequest;
// used for creation and deletion of modules.
std::mutex modulesMutex;
+ std::recursive_mutex interfacesMutex;
sergei 2017/09/13 19:20:53 What do you think about making the methods WithSom
hub 2017/09/13 19:50:49 I can do that.
std::shared_ptr<JsEngine> jsEngine;
std::shared_future<FilterEnginePtr> filterEngine;
};
/**
* A helper class allowing to construct a default Platform and to obtain
* the Scheduler used by Platform before the latter is constructed.
*/
« no previous file with comments | « no previous file | src/ConsoleJsObject.cpp » ('j') | src/Platform.cpp » ('J')

Powered by Google App Engine
This is Rietveld