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: Last details Created Sept. 13, 2017, 8:17 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') | no next file with comments »
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,41 +102,34 @@
/**
* 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;
+ virtual void WithTimer(const WithTimerCallback&);
- /**
- * @return The asynchronous IFileSystem implementation.
- */
- IFileSystem& GetFileSystem();
+ typedef std::function<void(IFileSystem&)> WithFileSystemCallback;
+ virtual void WithFileSystem(const WithFileSystemCallback&);
- /**
- * @return The asynchronous IWebRequest implementation.
- */
- IWebRequest& GetWebRequest();
+ typedef std::function<void(IWebRequest&)> WithWebRequestCallback;
+ virtual void WithWebRequest(const WithWebRequestCallback&);
- /**
- * @return The LogSystem implementation.
- */
- LogSystem& GetLogSystem();
+ typedef std::function<void(LogSystem&)> WithLogSystemCallback;
+ virtual void WithLogSystem(const WithLogSystemCallback&);
- private:
+ protected:
LogSystemPtr logSystem;
TimerPtr timer;
FileSystemPtr fileSystem;
WebRequestPtr webRequest;
+ private:
// used for creation and deletion of modules.
std::mutex modulesMutex;
std::shared_ptr<JsEngine> jsEngine;
std::shared_future<FilterEnginePtr> filterEngine;
};
/**
* A helper class allowing to construct a default Platform and to obtain
« no previous file with comments | « no previous file | src/ConsoleJsObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld