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

Unified Diff: src/JsEngine.cpp

Issue 29428650: Issue 5180 - introduce asynchronous web request (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git
Patch Set: Created May 3, 2017, 2:21 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 | « src/DefaultWebRequestWinInet.cpp ('k') | src/WebRequestJsObject.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/JsEngine.cpp
diff --git a/src/JsEngine.cpp b/src/JsEngine.cpp
index 4604b041823d7543ab29faecb2acccdaec4e94a0..d9b77228053edd5c27d6f753cd0aa534c71e984a 100644
--- a/src/JsEngine.cpp
+++ b/src/JsEngine.cpp
@@ -72,6 +72,11 @@ TimerPtr AdblockPlus::CreateDefaultTimer()
return TimerPtr(new DefaultTimer());
}
+WebRequestPtr AdblockPlus::CreateDefaultWebRequest()
+{
+ return WebRequestPtr(new DefaultWebRequest(std::make_shared<DefaultWebRequestSync>()));
+}
+
AdblockPlus::ScopedV8Isolate::ScopedV8Isolate()
{
V8Initializer::Init();
@@ -120,20 +125,21 @@ void JsEngine::CallTimerTask(const JsWeakValuesID& timerParamsID)
callback.Call(timerParams);
}
-AdblockPlus::JsEngine::JsEngine(const ScopedV8IsolatePtr& isolate, TimerPtr timer)
+AdblockPlus::JsEngine::JsEngine(const ScopedV8IsolatePtr& isolate,
+ TimerPtr timer, WebRequestPtr webRequest)
: isolate(isolate)
, fileSystem(new DefaultFileSystem())
- , webRequest(new DefaultWebRequest())
, logSystem(new DefaultLogSystem())
, timer(std::move(timer))
+ , webRequest(std::move(webRequest))
{
}
AdblockPlus::JsEnginePtr AdblockPlus::JsEngine::New(const AppInfo& appInfo,
- TimerPtr timer,
+ TimerPtr timer, WebRequestPtr webRequest,
const ScopedV8IsolatePtr& isolate)
{
- JsEnginePtr result(new JsEngine(isolate, std::move(timer)));
+ JsEnginePtr result(new JsEngine(isolate, std::move(timer), std::move(webRequest)));
const v8::Locker locker(result->GetIsolate());
const v8::Isolate::Scope isolateScope(result->GetIsolate());
@@ -309,17 +315,12 @@ void AdblockPlus::JsEngine::SetFileSystem(const AdblockPlus::FileSystemPtr& val)
fileSystem = val;
}
-WebRequestSharedPtr AdblockPlus::JsEngine::GetWebRequest() const
-{
- return webRequest;
-}
-
void AdblockPlus::JsEngine::SetWebRequest(const AdblockPlus::WebRequestSharedPtr& val)
{
if (!val)
throw std::runtime_error("WebRequest cannot be null");
- webRequest = val;
+ webRequestLegacy = val;
}
AdblockPlus::LogSystemPtr AdblockPlus::JsEngine::GetLogSystem() const
« no previous file with comments | « src/DefaultWebRequestWinInet.cpp ('k') | src/WebRequestJsObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld