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

Unified Diff: src/JsValue.cpp

Issue 29393589: Issue 5013 - Make more methods const.- introduced JsConstValuePtr and JsConstValueList- JsValue:… (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Rebased on master Created March 24, 2017, 2:40 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/FilterEngine.cpp ('k') | src/Notification.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/JsValue.cpp
===================================================================
--- a/src/JsValue.cpp
+++ b/src/JsValue.cpp
@@ -200,17 +200,17 @@ std::string AdblockPlus::JsValue::GetCla
if (!IsObject())
throw new std::runtime_error("Cannot get constructor of a non-object");
const JsContext context(jsEngine);
v8::Local<v8::Object> obj = v8::Local<v8::Object>::Cast(UnwrapValue());
return Utils::FromV8String(obj->GetConstructorName());
}
-AdblockPlus::JsValuePtr AdblockPlus::JsValue::Call(const JsValueList& params, JsValuePtr thisPtr) const
+AdblockPlus::JsValuePtr AdblockPlus::JsValue::Call(const JsConstValueList& params, JsValuePtr thisPtr) const
{
if (!IsFunction())
throw new std::runtime_error("Attempting to call a non-function");
const JsContext context(jsEngine);
if (!thisPtr)
{
v8::Local<v8::Context> localContext = v8::Local<v8::Context>::New(
@@ -231,15 +231,14 @@ AdblockPlus::JsValuePtr AdblockPlus::JsV
argv.size() ? &argv.front() : 0);
if (tryCatch.HasCaught())
throw JsError(tryCatch.Exception(), tryCatch.Message());
return JsValuePtr(new JsValue(jsEngine, result));
}
-AdblockPlus::JsValuePtr AdblockPlus::JsValue::Call(const JsValue& arg) const
+AdblockPlus::JsValuePtr AdblockPlus::JsValue::Call(const JsConstValuePtr& arg) const
{
- const JsContext context(jsEngine);
- JsValueList params;
- params.push_back(JsValuePtr(new JsValue(arg.jsEngine, arg.UnwrapValue())));
+ JsConstValueList params;
+ params.push_back(arg);
return Call(params);
}
« no previous file with comments | « src/FilterEngine.cpp ('k') | src/Notification.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld