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

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

Issue 29409580: Issue 5013 - Make parameter const ref when applicable. (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Created April 11, 2017, 1:58 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
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
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 */ 118 */
119 std::string GetClass() const; 119 std::string GetClass() const;
120 120
121 /** 121 /**
122 * Invokes the value as a function (see `IsFunction()`). 122 * Invokes the value as a function (see `IsFunction()`).
123 * @param params Optional list of parameters. 123 * @param params Optional list of parameters.
124 * @param thisPtr Optional `this` value. 124 * @param thisPtr Optional `this` value.
125 * @return Value returned by the function. 125 * @return Value returned by the function.
126 */ 126 */
127 JsValue Call(const JsConstValueList& params = JsConstValueList(), 127 JsValue Call(const JsConstValueList& params = JsConstValueList(),
128 AdblockPlus::JsValuePtr thisPtr = AdblockPlus::JsValuePtr()) const; 128 const AdblockPlus::JsValuePtr& thisPtr = AdblockPlus::JsValuePtr()) cons t;
129 129
130 /** 130 /**
131 * Invokes the value as a function (see `IsFunction()`) with single 131 * Invokes the value as a function (see `IsFunction()`) with single
132 * parameter. 132 * parameter.
133 * @param arg A single required parameter. 133 * @param arg A single required parameter.
134 * @return Value returned by the function. 134 * @return Value returned by the function.
135 */ 135 */
136 JsValue Call(const JsValue& arg) const; 136 JsValue Call(const JsValue& arg) const;
137 137
138 v8::Local<v8::Value> UnwrapValue() const; 138 v8::Local<v8::Value> UnwrapValue() const;
139 protected: 139 protected:
140 JsEnginePtr jsEngine; 140 JsEnginePtr jsEngine;
141 private: 141 private:
142 JsValue(JsEnginePtr jsEngine, v8::Handle<v8::Value> value); 142 JsValue(JsEnginePtr jsEngine, v8::Handle<v8::Value> value);
143 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 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. 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; 146 JsValue Call(std::vector<v8::Handle<v8::Value>>& args, v8::Local<v8::Object> thisObj) const;
147 147
148 std::unique_ptr<v8::Persistent<v8::Value>> value; 148 std::unique_ptr<v8::Persistent<v8::Value>> value;
149 }; 149 };
150 } 150 }
151 151
152 #endif 152 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld