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

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

Issue 29416579: Issue 5034 - Part 1: Pass a JsValue directly to SetProperty() and return from GetProperty() (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Remove JsValue test Created April 19, 2017, 2:46 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
« no previous file with comments | « include/AdblockPlus/JsEngine.h ('k') | shell/src/FiltersCommand.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
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 * @return List of property names. 80 * @return List of property names.
81 */ 81 */
82 std::vector<std::string> GetOwnPropertyNames() const; 82 std::vector<std::string> GetOwnPropertyNames() const;
83 83
84 /** 84 /**
85 * Returns a property value if this is an object (see `IsObject()`). 85 * Returns a property value if this is an object (see `IsObject()`).
86 * @param name Property name. 86 * @param name Property name.
87 * @return Property value, undefined (see `IsUndefined()`) if the property 87 * @return Property value, undefined (see `IsUndefined()`) if the property
88 * does not exist. 88 * does not exist.
89 */ 89 */
90 JsValuePtr GetProperty(const std::string& name) const; 90 JsValue GetProperty(const std::string& name) const;
91 91
92 //@{ 92 //@{
93 /** 93 /**
94 * Sets a property value if this is an object (see `IsObject()`). 94 * Sets a property value if this is an object (see `IsObject()`).
95 * @param name Property name. 95 * @param name Property name.
96 * @param val Property value. 96 * @param val Property value.
97 */ 97 */
98 void SetProperty(const std::string& name, const std::string& val); 98 void SetProperty(const std::string& name, const std::string& val);
99 void SetProperty(const std::string& name, int64_t val); 99 void SetProperty(const std::string& name, int64_t val);
100 void SetProperty(const std::string& name, bool val); 100 void SetProperty(const std::string& name, bool val);
101 void SetProperty(const std::string& name, const JsValuePtr& value); 101 void SetProperty(const std::string& name, const JsValue& value);
102 inline void SetProperty(const std::string& name, const char* val) 102 inline void SetProperty(const std::string& name, const char* val)
103 { 103 {
104 SetProperty(name, std::string(val)); 104 SetProperty(name, std::string(val));
105 } 105 }
106 inline void SetProperty(const std::string& name, int val) 106 inline void SetProperty(const std::string& name, int val)
107 { 107 {
108 SetProperty(name, static_cast<int64_t>(val)); 108 SetProperty(name, static_cast<int64_t>(val));
109 } 109 }
110 //@} 110 //@}
111 111
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 void SetProperty(const std::string& name, v8::Handle<v8::Value> val); 149 void SetProperty(const std::string& name, v8::Handle<v8::Value> val);
150 // Parameter args is not const because a pointer to its internal arrays is 150 // Parameter args is not const because a pointer to its internal arrays is
151 // passed to v8::Function::Call but the latter does not expect a const point er. 151 // passed to v8::Function::Call but the latter does not expect a const point er.
152 JsValue Call(std::vector<v8::Handle<v8::Value>>& args, v8::Local<v8::Object> thisObj) const; 152 JsValue Call(std::vector<v8::Handle<v8::Value>>& args, v8::Local<v8::Object> thisObj) const;
153 153
154 std::unique_ptr<v8::Persistent<v8::Value>> value; 154 std::unique_ptr<v8::Persistent<v8::Value>> value;
155 }; 155 };
156 } 156 }
157 157
158 #endif 158 #endif
OLDNEW
« no previous file with comments | « include/AdblockPlus/JsEngine.h ('k') | shell/src/FiltersCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld