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

Delta Between Two Patch Sets: src/JsValue.cpp

Issue 29410664: Issue 5013 - Use const JsValue and pass reference where applicable (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Left Patch Set: Created April 12, 2017, 3:24 p.m.
Right Patch Set: Fixed comment Created April 13, 2017, 3:45 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/JsEngine.cpp ('k') | src/WebRequestJsObject.cpp » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 const JsContext context(jsEngine); 183 const JsContext context(jsEngine);
184 SetProperty(name, Utils::ToV8String(jsEngine->GetIsolate(), val)); 184 SetProperty(name, Utils::ToV8String(jsEngine->GetIsolate(), val));
185 } 185 }
186 186
187 void AdblockPlus::JsValue::SetProperty(const std::string& name, int64_t val) 187 void AdblockPlus::JsValue::SetProperty(const std::string& name, int64_t val)
188 { 188 {
189 const JsContext context(jsEngine); 189 const JsContext context(jsEngine);
190 SetProperty(name, v8::Number::New(jsEngine->GetIsolate(), val)); 190 SetProperty(name, v8::Number::New(jsEngine->GetIsolate(), val));
191 } 191 }
192 192
193 void AdblockPlus::JsValue::SetProperty(const std::string& name, const JsValue& v al) 193 void AdblockPlus::JsValue::SetProperty(const std::string& name, const JsValuePtr & val)
194 { 194 {
195 const JsContext context(jsEngine); 195 const JsContext context(jsEngine);
196 SetProperty(name, val.UnwrapValue()); 196 SetProperty(name, val->UnwrapValue());
197 } 197 }
198 198
199 void AdblockPlus::JsValue::SetProperty(const std::string& name, bool val) 199 void AdblockPlus::JsValue::SetProperty(const std::string& name, bool val)
200 { 200 {
201 const JsContext context(jsEngine); 201 const JsContext context(jsEngine);
202 SetProperty(name, v8::Boolean::New(val)); 202 SetProperty(name, v8::Boolean::New(val));
203 } 203 }
204 204
205 std::string AdblockPlus::JsValue::GetClass() const 205 std::string AdblockPlus::JsValue::GetClass() const
206 { 206 {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 const v8::TryCatch tryCatch; 248 const v8::TryCatch tryCatch;
249 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(UnwrapValue()); 249 v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(UnwrapValue());
250 v8::Local<v8::Value> result = func->Call(thisObj, args.size(), 250 v8::Local<v8::Value> result = func->Call(thisObj, args.size(),
251 args.size() ? &args[0] : nullptr); 251 args.size() ? &args[0] : nullptr);
252 252
253 if (tryCatch.HasCaught()) 253 if (tryCatch.HasCaught())
254 throw JsError(tryCatch.Exception(), tryCatch.Message()); 254 throw JsError(tryCatch.Exception(), tryCatch.Message());
255 255
256 return JsValue(jsEngine, result); 256 return JsValue(jsEngine, result);
257 } 257 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld