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

Unified Diff: src/JsValue.cpp

Issue 29391775: Issue 5013 - Improve some const-correctness (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Created March 22, 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
Index: src/JsValue.cpp
===================================================================
--- a/src/JsValue.cpp
+++ b/src/JsValue.cpp
@@ -134,17 +134,17 @@ std::vector<std::string> AdblockPlus::Js
{
if (!IsObject())
throw new std::runtime_error("Attempting to get propert list for a non-object");
const JsContext context(jsEngine);
v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(UnwrapValue());
JsValueList properties = JsValuePtr(new JsValue(jsEngine, object->GetOwnPropertyNames()))->AsList();
std::vector<std::string> result;
- for (JsValueList::iterator it = properties.begin(); it != properties.end(); ++it)
+ for (auto it = properties.cbegin(); it != properties.cend(); ++it)
result.push_back((*it)->AsString());
return result;
}
AdblockPlus::JsValuePtr AdblockPlus::JsValue::GetProperty(const std::string& name) const
{
if (!IsObject())
@@ -217,17 +217,17 @@ AdblockPlus::JsValuePtr AdblockPlus::JsV
jsEngine->GetIsolate(), *jsEngine->context);
thisPtr = JsValuePtr(new JsValue(jsEngine, localContext->Global()));
}
if (!thisPtr->IsObject())
throw new std::runtime_error("`this` pointer has to be an object");
v8::Local<v8::Object> thisObj = v8::Local<v8::Object>::Cast(thisPtr->UnwrapValue());
std::vector<v8::Handle<v8::Value>> argv;
- for (JsValueList::const_iterator it = params.begin(); it != params.end(); ++it)
+ for (auto it = params.cbegin(); it != params.cend(); ++it)
argv.push_back((*it)->UnwrapValue());
const v8::TryCatch tryCatch;
v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(UnwrapValue());
v8::Local<v8::Value> result = func->Call(thisObj, argv.size(),
argv.size() ? &argv.front() : 0);
if (tryCatch.HasCaught())
« no previous file with comments | « src/FilterEngine.cpp ('k') | src/Notification.cpp » ('j') | src/WebRequestJsObject.cpp » ('J')

Powered by Google App Engine
This is Rietveld