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

Side by Side Diff: include/AdblockPlus/JsValue.h

Issue 29334678: Issue 3589 - Change return type of AdblockPlus::JsValue::Call from pointer to r-value object. (Closed)
Patch Set: rebase Created March 27, 2017, 9:47 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/FilterEngine.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
16 */ 16 */
17 17
18 #ifndef ADBLOCK_PLUS_JS_VALUE_H 18 #ifndef ADBLOCK_PLUS_JS_VALUE_H
19 #define ADBLOCK_PLUS_JS_VALUE_H 19 #define ADBLOCK_PLUS_JS_VALUE_H
20 20
21 #include <stdint.h> 21 #include <stdint.h>
22 #include <string> 22 #include <string>
23 #include <vector> 23 #include <vector>
24 #include <memory> 24 #include <memory>
25 25
26 namespace v8 26 namespace v8
27 { 27 {
28 class Value; 28 class Value;
29 class Object;
29 template<class T> class Handle; 30 template<class T> class Handle;
30 template<class T> class Local; 31 template<class T> class Local;
31 template<class T> class Persistent; 32 template<class T> class Persistent;
32 } 33 }
33 34
34 namespace AdblockPlus 35 namespace AdblockPlus
35 { 36 {
36 class JsValue; 37 class JsValue;
37 class JsEngine; 38 class JsEngine;
38 39
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 * @return Class name of the value. 117 * @return Class name of the value.
117 */ 118 */
118 std::string GetClass() const; 119 std::string GetClass() const;
119 120
120 /** 121 /**
121 * Invokes the value as a function (see `IsFunction()`). 122 * Invokes the value as a function (see `IsFunction()`).
122 * @param params Optional list of parameters. 123 * @param params Optional list of parameters.
123 * @param thisPtr Optional `this` value. 124 * @param thisPtr Optional `this` value.
124 * @return Value returned by the function. 125 * @return Value returned by the function.
125 */ 126 */
126 JsValuePtr Call(const JsConstValueList& params = JsConstValueList(), 127 JsValue Call(const JsConstValueList& params = JsConstValueList(),
127 AdblockPlus::JsValuePtr thisPtr = AdblockPlus::JsValuePtr()) const; 128 AdblockPlus::JsValuePtr thisPtr = AdblockPlus::JsValuePtr()) const;
128 129
129 /** 130 /**
130 * Invokes the value as a function (see `IsFunction()`) with single 131 * Invokes the value as a function (see `IsFunction()`) with single
131 * parameter. 132 * parameter.
132 * @param arg A single required parameter. 133 * @param arg A single required parameter.
133 * @return Value returned by the function. 134 * @return Value returned by the function.
134 */ 135 */
135 JsValuePtr Call(const JsConstValuePtr& arg) const; 136 JsValue Call(const JsValue& arg) const;
136 137
137 v8::Local<v8::Value> UnwrapValue() const; 138 v8::Local<v8::Value> UnwrapValue() const;
138 protected: 139 protected:
139 JsEnginePtr jsEngine; 140 JsEnginePtr jsEngine;
140 private: 141 private:
141 JsValue(JsEnginePtr jsEngine, v8::Handle<v8::Value> value); 142 JsValue(JsEnginePtr jsEngine, v8::Handle<v8::Value> value);
142 void SetProperty(const std::string& name, v8::Handle<v8::Value> val); 143 void SetProperty(const std::string& name, v8::Handle<v8::Value> val);
144 // Parameter args is not const because a pointer to its internal arrays is
145 // passed to v8::Function::Call but the latter does not expect a const point er.
146 JsValue Call(std::vector<v8::Handle<v8::Value>>& args, v8::Local<v8::Object> thisObj) const;
147
143 std::unique_ptr<v8::Persistent<v8::Value>> value; 148 std::unique_ptr<v8::Persistent<v8::Value>> value;
144 }; 149 };
145 } 150 }
146 151
147 #endif 152 #endif
OLDNEW
« no previous file with comments | « no previous file | src/FilterEngine.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld