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

Unified Diff: src/JsEngine.cpp

Issue 29499621: Issue 4983 - Get rid of Sleep() in the WebRequest test (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git
Patch Set: Created July 27, 2017, 10:18 a.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/DefaultWebRequest.cpp ('k') | test/WebRequest.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 da2e40e3b2a8b88b69d9d543ccb4e6f1cb9c4348..558a03dd9d9d9bc11b7bd8b3ac6759e29ccbc264 100644
--- a/src/JsEngine.cpp
+++ b/src/JsEngine.cpp
@@ -71,6 +71,11 @@ namespace
static V8Initializer initializer;
}
};
+
+ void DummyScheduler(const AdblockPlus::SchedulerTask& task)
+ {
+ std::thread(task).detach();
+ }
}
using namespace AdblockPlus;
@@ -85,9 +90,9 @@ FileSystemPtr AdblockPlus::CreateDefaultFileSystem()
return FileSystemPtr(new DefaultFileSystem(std::unique_ptr<DefaultFileSystemSync>(new DefaultFileSystemSync())));
}
-WebRequestPtr AdblockPlus::CreateDefaultWebRequest()
+WebRequestPtr AdblockPlus::CreateDefaultWebRequest(const Scheduler& scheduler)
{
- return WebRequestPtr(new DefaultWebRequest(std::unique_ptr<DefaultWebRequestSync>(new DefaultWebRequestSync())));
+ return WebRequestPtr(new DefaultWebRequest(scheduler, std::unique_ptr<DefaultWebRequestSync>(new DefaultWebRequestSync())));
}
LogSystemPtr AdblockPlus::CreateDefaultLogSystem()
@@ -163,7 +168,7 @@ AdblockPlus::JsEnginePtr AdblockPlus::JsEngine::New(const AppInfo& appInfo,
{
JsEnginePtr result(new JsEngine(timer ? std::move(timer) : CreateDefaultTimer(),
fileSystem ? std::move(fileSystem) : CreateDefaultFileSystem(),
- webRequest ? std::move(webRequest) : CreateDefaultWebRequest(),
+ webRequest ? std::move(webRequest) : CreateDefaultWebRequest(::DummyScheduler),
logSystem ? std::move(logSystem) : CreateDefaultLogSystem()));
const v8::Locker locker(result->GetIsolate());
« no previous file with comments | « src/DefaultWebRequest.cpp ('k') | test/WebRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld