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

Unified Diff: include/AdblockPlus/JsEngine.h

Issue 29417605: Issue 5034 - Part 3: Create plain JsValue instead of JsValuePtr (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: FIxed JsContext bug and a few others. Created April 19, 2017, 9:55 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 JsConstValueList& params)> EventCallback;
+ typedef std::function<void(const JsValueList& 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 JsConstValueList& params);
+ void TriggerEvent(const std::string& eventName, const JsValueList& 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.
*/
@@ -155,40 +155,40 @@
void Gc();
//@{
/**
* Creates a new JavaScript value.
* @param val Value to convert.
* @return New `JsValue` instance.
*/
- JsValuePtr NewValue(const std::string& val);
- JsValuePtr NewValue(int64_t val);
- JsValuePtr NewValue(bool val);
- inline JsValuePtr NewValue(const char* val)
+ JsValue NewValue(const std::string& val);
+ JsValue NewValue(int64_t val);
+ JsValue NewValue(bool val);
+ inline JsValue NewValue(const char* val)
{
return NewValue(std::string(val));
}
- inline JsValuePtr NewValue(int val)
+ inline JsValue NewValue(int val)
{
return NewValue(static_cast<int64_t>(val));
}
#ifdef __APPLE__
- inline JsValuePtr NewValue(long val)
+ inline JsValue NewValue(long val)
{
return NewValue(static_cast<int64_t>(val));
}
#endif
//@}
/**
* Creates a new JavaScript object.
* @return New `JsValue` instance.
*/
- JsValuePtr NewObject();
+ JsValue NewObject();
/**
* Creates a JavaScript function that invokes a C++ callback.
* @param callback C++ callback to invoke. The callback receives a
* `v8::Arguments` object and can use `FromArguments()` to retrieve
* the current `JsEngine`.
* @return New `JsValue` instance.
*/
@@ -212,17 +212,17 @@
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 `const JsValue` objects.
*/
- JsConstValueList ConvertArguments(const v8::Arguments& arguments);
+ JsValueList ConvertArguments(const v8::Arguments& arguments);
/**
* @see `SetFileSystem()`.
*/
FileSystemPtr GetFileSystem() const;
/**
* Sets the `FileSystem` implementation used for all file I/O.

Powered by Google App Engine
This is Rietveld