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

Unified Diff: src/JsEngine.cpp

Issue 29498576: Issue 4832 - remove API allowing changing of LogSystem after Initialization of JsEngine (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git
Patch Set: address comment Created July 26, 2017, 4:48 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/ConsoleJsObject.cpp ('k') | test/BaseJsTest.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 79018c3f8df24a2f73cce82eb88f7e64cb7d8938..315f7ecf58a743597e079068b6b21337c7eb08ef 100644
--- a/src/JsEngine.cpp
+++ b/src/JsEngine.cpp
@@ -89,6 +89,11 @@ WebRequestPtr AdblockPlus::CreateDefaultWebRequest()
return WebRequestPtr(new DefaultWebRequest(std::unique_ptr<DefaultWebRequestSync>(new DefaultWebRequestSync())));
}
+LogSystemPtr AdblockPlus::CreateDefaultLogSystem()
+{
+ return LogSystemPtr(new DefaultLogSystem());
+}
+
AdblockPlus::ScopedV8Isolate::ScopedV8Isolate()
{
V8Initializer::Init();
@@ -144,20 +149,21 @@ void JsEngine::CallTimerTask(const JsWeakValuesID& timerParamsID)
}
AdblockPlus::JsEngine::JsEngine(TimerPtr timer, FileSystemPtr fileSystem,
- WebRequestPtr webRequest)
+ WebRequestPtr webRequest, LogSystemPtr logSystem)
: fileSystem(std::move(fileSystem))
- , logSystem(new DefaultLogSystem())
, timer(std::move(timer))
, webRequest(std::move(webRequest))
+ , logSystem(std::move(logSystem))
{
}
AdblockPlus::JsEnginePtr AdblockPlus::JsEngine::New(const AppInfo& appInfo,
- TimerPtr timer, FileSystemPtr fileSystem, WebRequestPtr webRequest)
+ TimerPtr timer, FileSystemPtr fileSystem, WebRequestPtr webRequest, LogSystemPtr logSystem)
{
JsEnginePtr result(new JsEngine(std::move(timer),
std::move(fileSystem),
- std::move(webRequest)));
+ std::move(webRequest),
+ std::move(logSystem)));
const v8::Locker locker(result->GetIsolate());
const v8::Isolate::Scope isolateScope(result->GetIsolate());
@@ -333,20 +339,11 @@ void AdblockPlus::JsEngine::SetFileSystem(const AdblockPlus::FileSystemSyncPtr&
fileSystem.reset(new DefaultFileSystem(val));
}
-AdblockPlus::LogSystemPtr AdblockPlus::JsEngine::GetLogSystem() const
+AdblockPlus::LogSystem& AdblockPlus::JsEngine::GetLogSystem()
{
- return logSystem;
+ return *logSystem;
}
-void AdblockPlus::JsEngine::SetLogSystem(const AdblockPlus::LogSystemPtr& val)
-{
- if (!val)
- throw std::runtime_error("LogSystem cannot be null");
-
- logSystem = val;
-}
-
-
void AdblockPlus::JsEngine::SetGlobalProperty(const std::string& name,
const AdblockPlus::JsValue& value)
{
« no previous file with comments | « src/ConsoleJsObject.cpp ('k') | test/BaseJsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld