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

Unified Diff: src/FileSystemJsObject.cpp

Issue 29409580: Issue 5013 - Make parameter const ref when applicable. (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Pass ref or const ref instead of shared_ptr<> Created April 11, 2017, 3:37 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/FileSystemJsObject.h ('k') | src/FilterEngine.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/FileSystemJsObject.cpp
===================================================================
--- a/src/FileSystemJsObject.cpp
+++ b/src/FileSystemJsObject.cpp
@@ -94,19 +94,19 @@
{
}
void Run()
{
std::string error;
try
{
- std::shared_ptr<std::iostream> stream(new std::stringstream);
+ std::unique_ptr<std::iostream> stream(new std::stringstream);
*stream << content;
- fileSystem->Write(path, stream);
+ fileSystem->Write(path, *stream);
}
catch (std::exception& e)
{
error = e.what();
}
catch (...)
{
error = "Unknown error while writing to " + path;
@@ -344,18 +344,18 @@
std::string resolved = jsEngine->GetFileSystem()->Resolve(converted[0]->AsString());
return Utils::ToV8String(isolate, resolved);
}
}
-JsValuePtr FileSystemJsObject::Setup(JsEnginePtr jsEngine, JsValuePtr obj)
+JsValuePtr FileSystemJsObject::Setup(JsEngine& jsEngine, const JsValuePtr& obj)
{
- obj->SetProperty("read", jsEngine->NewCallback(::ReadCallback));
- obj->SetProperty("write", jsEngine->NewCallback(::WriteCallback));
- obj->SetProperty("move", jsEngine->NewCallback(::MoveCallback));
- obj->SetProperty("remove", jsEngine->NewCallback(::RemoveCallback));
- obj->SetProperty("stat", jsEngine->NewCallback(::StatCallback));
- obj->SetProperty("resolve", jsEngine->NewCallback(::ResolveCallback));
+ obj->SetProperty("read", jsEngine.NewCallback(::ReadCallback));
+ obj->SetProperty("write", jsEngine.NewCallback(::WriteCallback));
+ obj->SetProperty("move", jsEngine.NewCallback(::MoveCallback));
+ obj->SetProperty("remove", jsEngine.NewCallback(::RemoveCallback));
+ obj->SetProperty("stat", jsEngine.NewCallback(::StatCallback));
+ obj->SetProperty("resolve", jsEngine.NewCallback(::ResolveCallback));
return obj;
}
« no previous file with comments | « src/FileSystemJsObject.h ('k') | src/FilterEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld