AdblockPlus platform is the main component providing access to other modules. More...
#include <Platform.h>
Classes | |
struct | CreationParameters |
Platform creation parameters. More... | |
Public Types | |
typedef std::function< void(const FilterEngine &)> | OnFilterEngineCreatedCallback |
Callback type invoked when FilterEngine is created. | |
typedef std::function< void(ITimer &)> | WithTimerCallback |
typedef std::function< void(IFileSystem &)> | WithFileSystemCallback |
typedef std::function< void(IWebRequest &)> | WithWebRequestCallback |
typedef std::function< void(LogSystem &)> | WithLogSystemCallback |
Public Member Functions | |
Platform (CreationParameters &&creationParameters=CreationParameters()) | |
Platform constructor. More... | |
void | SetUpJsEngine (const AppInfo &appInfo=AppInfo(), std::unique_ptr< IV8IsolateProvider > isolate=nullptr) |
Ensures that JsEngine is constructed. More... | |
JsEngine & | GetJsEngine () |
Retrieves the JsEngine instance. More... | |
void | CreateFilterEngineAsync (const FilterEngine::CreationParameters ¶meters=FilterEngine::CreationParameters(), const OnFilterEngineCreatedCallback &onCreated=OnFilterEngineCreatedCallback()) |
Ensures that FilterEngine is constructed. More... | |
FilterEngine & | GetFilterEngine () |
Synchronous equivalent of CreateFilterEngineAsync . More... | |
virtual void | WithTimer (const WithTimerCallback &) |
virtual void | WithFileSystem (const WithFileSystemCallback &) |
virtual void | WithWebRequest (const WithWebRequestCallback &) |
virtual void | WithLogSystem (const WithLogSystemCallback &) |
Protected Attributes | |
LogSystemPtr | logSystem |
TimerPtr | timer |
FileSystemPtr | fileSystem |
WebRequestPtr | webRequest |
AdblockPlus platform is the main component providing access to other modules.
It manages the functionality modules, e.g. JsEngine and FilterEngine as well as allows to correctly work with asynchronous functionality.
|
explicit |
Platform constructor.
When a parameter value is nullptr the corresponding default implementation is chosen.
void AdblockPlus::Platform::CreateFilterEngineAsync | ( | const FilterEngine::CreationParameters & | parameters = FilterEngine::CreationParameters() , |
const OnFilterEngineCreatedCallback & | onCreated = OnFilterEngineCreatedCallback() |
||
) |
Ensures that FilterEngine is constructed.
Only the first call is effective.
parameters | optional creation parameters. |
onCreated | A callback which is called when FilterEngine is ready for use. |
FilterEngine& AdblockPlus::Platform::GetFilterEngine | ( | ) |
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.
JsEngine& AdblockPlus::Platform::GetJsEngine | ( | ) |
void AdblockPlus::Platform::SetUpJsEngine | ( | const AppInfo & | appInfo = AppInfo() , |
std::unique_ptr< IV8IsolateProvider > | isolate = nullptr |
||
) |