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

Unified Diff: include/AdblockPlus/JsValue.h

Issue 29364548: Issue 4188 - Update libadblockplus-android to use the latest libadblockplus (Closed)
Patch Set: Created Nov. 25, 2016, 12:36 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 | « include/AdblockPlus/JsEngine.h ('k') | include/AdblockPlus/LogSystem.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/AdblockPlus/JsValue.h
===================================================================
--- a/include/AdblockPlus/JsValue.h
+++ b/include/AdblockPlus/JsValue.h
@@ -1,11 +1,11 @@
/*
* This file is part of Adblock Plus <https://adblockplus.org/>,
- * Copyright (C) 2006-2015 Eyeo GmbH
+ * Copyright (C) 2006-2016 Eyeo GmbH
*
* Adblock Plus is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* Adblock Plus is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -17,23 +17,23 @@
#ifndef ADBLOCK_PLUS_JS_VALUE_H
#define ADBLOCK_PLUS_JS_VALUE_H
#include <stdint.h>
#include <string>
#include <vector>
#include <memory>
-#include "V8ValueHolder.h"
namespace v8
{
class Value;
template<class T> class Handle;
template<class T> class Local;
+ template<class T> class Persistent;
}
namespace AdblockPlus
{
class JsValue;
class JsEngine;
typedef std::shared_ptr<JsEngine> JsEnginePtr;
@@ -51,16 +51,17 @@ namespace AdblockPlus
/**
* Wrapper for JavaScript values.
* See `JsEngine` for creating `JsValue` objects.
*/
class JsValue
{
friend class JsEngine;
public:
+ JsValue(JsValue&& src);
virtual ~JsValue();
bool IsUndefined() const;
bool IsNull() const;
bool IsString() const;
bool IsNumber() const;
bool IsBool() const;
bool IsObject() const;
@@ -118,20 +119,27 @@ namespace AdblockPlus
* Invokes the value as a function (see `IsFunction()`).
* @param params Optional list of parameters.
* @param thisPtr Optional `this` value.
* @return Value returned by the function.
*/
JsValuePtr Call(const JsValueList& params = JsValueList(),
AdblockPlus::JsValuePtr thisPtr = AdblockPlus::JsValuePtr()) const;
+ /**
+ * Invokes the value as a function (see `IsFunction()`) with single
+ * parameter.
+ * @param arg A single required parameter.
+ * @return Value returned by the function.
+ */
+ JsValuePtr Call(const JsValue& arg) const;
+
v8::Local<v8::Value> UnwrapValue() const;
protected:
- JsValue(JsValuePtr value);
JsEnginePtr jsEngine;
private:
JsValue(JsEnginePtr jsEngine, v8::Handle<v8::Value> value);
void SetProperty(const std::string& name, v8::Handle<v8::Value> val);
- V8ValueHolder<v8::Value> value;
+ std::unique_ptr<v8::Persistent<v8::Value>> value;
};
}
#endif
« no previous file with comments | « include/AdblockPlus/JsEngine.h ('k') | include/AdblockPlus/LogSystem.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld