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

Unified Diff: include/AdblockPlus/JsValue.h

Issue 29410664: Issue 5013 - Use const JsValue and pass reference where applicable (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Created April 12, 2017, 3:24 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: include/AdblockPlus/JsValue.h
===================================================================
--- a/include/AdblockPlus/JsValue.h
+++ b/include/AdblockPlus/JsValue.h
@@ -93,17 +93,17 @@
/**
* Sets a property value if this is an object (see `IsObject()`).
* @param name Property name.
* @param val Property value.
*/
void SetProperty(const std::string& name, const std::string& val);
void SetProperty(const std::string& name, int64_t val);
void SetProperty(const std::string& name, bool val);
- void SetProperty(const std::string& name, const JsValuePtr& value);
+ void SetProperty(const std::string& name, const JsValue& value);
inline void SetProperty(const std::string& name, const char* val)
{
SetProperty(name, std::string(val));
}
inline void SetProperty(const std::string& name, int val)
{
SetProperty(name, static_cast<int64_t>(val));
}
@@ -131,16 +131,22 @@
* Invokes the value as a function (see `IsFunction()`) with single
* parameter.
* @param arg A single required parameter.
* @return Value returned by the function.
*/
JsValue Call(const JsValue& arg) const;
v8::Local<v8::Value> UnwrapValue() const;
+
+ /**
+ * Clone a this value to new one
+ * @return Value clone
sergei 2017/04/13 10:57:33 I think the comment should be different. It does n
hub 2017/04/13 12:06:24 ok.
+ */
+ JsValue Clone() const;
sergei 2017/04/13 10:57:33 Could you please change it to copy constructor but
protected:
JsEnginePtr jsEngine;
private:
JsValue(JsEnginePtr jsEngine, v8::Handle<v8::Value> value);
void SetProperty(const std::string& name, v8::Handle<v8::Value> val);
// Parameter args is not const because a pointer to its internal arrays is
// passed to v8::Function::Call but the latter does not expect a const pointer.
JsValue Call(std::vector<v8::Handle<v8::Value>>& args, v8::Local<v8::Object> thisObj) const;
« no previous file with comments | « include/AdblockPlus/JsEngine.h ('k') | src/AppInfoJsObject.h » ('j') | src/FilterEngine.cpp » ('J')

Powered by Google App Engine
This is Rietveld