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

Unified Diff: include/AdblockPlus/JsEngine.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/JsEngine.h
===================================================================
--- a/include/AdblockPlus/JsEngine.h
+++ b/include/AdblockPlus/JsEngine.h
@@ -88,17 +88,17 @@
{
friend class JsValue;
friend class JsContext;
public:
/**
* Event callback function.
*/
- typedef std::function<void(const JsValueList& params)> EventCallback;
+ typedef std::function<void(const JsConstValueList& params)> EventCallback;
/**
* Callback function returning false when current connection is not allowed
* e.g. because it is a metered connection.
*/
typedef std::function<bool()> IsConnectionAllowedCallback;
/**
@@ -132,17 +132,17 @@
*/
void RemoveEventCallback(const std::string& eventName);
/**
* Triggers an event.
* @param eventName Event name.
* @param params Event parameters.
*/
- void TriggerEvent(const std::string& eventName, const JsValueList& params);
+ void TriggerEvent(const std::string& eventName, const JsConstValueList& params);
/**
* Evaluates a JavaScript expression.
* @param source JavaScript expression to evaluate.
* @param filename Optional file name for the expression, used in error
* messages.
* @return Result of the evaluated expression.
*/
@@ -210,19 +210,19 @@
* callback associated for global setTimeout method.
*/
static void ScheduleTimer(const v8::Arguments& arguments);
/**
* Converts v8 arguments to `JsValue` objects.
* @param arguments `v8::Arguments` object containing the arguments to
* convert.
- * @return List of arguments converted to `JsValue` objects.
+ * @return List of arguments converted to `const JsValue` objects.
*/
- JsValueList ConvertArguments(const v8::Arguments& arguments);
+ JsConstValueList ConvertArguments(const v8::Arguments& arguments);
/**
* @see `SetFileSystem()`.
*/
FileSystemPtr GetFileSystem() const;
/**
* Sets the `FileSystem` implementation used for all file I/O.
@@ -272,17 +272,17 @@
*/
void SetLogSystem(const LogSystemPtr& val);
/**
* Sets a global property that can be accessed by all the scripts.
* @param name Name of the property to set.
* @param value Value of the property to set.
*/
- void SetGlobalProperty(const std::string& name, const AdblockPlus::JsValuePtr& value);
+ void SetGlobalProperty(const std::string& name, const AdblockPlus::JsValue& value);
/**
* Returns a pointer to associated v8::Isolate.
*/
v8::Isolate* GetIsolate()
{
return isolate->Get();
}

Powered by Google App Engine
This is Rietveld