| OLD | NEW |
| 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-present eyeo GmbH | 3 * Copyright (C) 2006-present 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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 retValue.emplace_back(JsValue(shared_from_this(), v8::Local<v8::Value>::Ne
w(GetIsolate(), v8Value))); | 314 retValue.emplace_back(JsValue(shared_from_this(), v8::Local<v8::Value>::Ne
w(GetIsolate(), v8Value))); |
| 315 } | 315 } |
| 316 } | 316 } |
| 317 { | 317 { |
| 318 std::lock_guard<std::mutex> lock(jsWeakValuesListsMutex); | 318 std::lock_guard<std::mutex> lock(jsWeakValuesListsMutex); |
| 319 jsWeakValuesLists.erase(id.iterator); | 319 jsWeakValuesLists.erase(id.iterator); |
| 320 } | 320 } |
| 321 return retValue; | 321 return retValue; |
| 322 } | 322 } |
| 323 | 323 |
| 324 JsValueList JsEngine::GetJsValues(const JsWeakValuesID& id) |
| 325 { |
| 326 JsValueList retValue; |
| 327 JsContext context(*this); |
| 328 for (const auto& v8Value : id.iterator->values) |
| 329 { |
| 330 retValue.emplace_back(JsValue(shared_from_this(), v8::Local<v8::Value>::New(
GetIsolate(), v8Value))); |
| 331 } |
| 332 return retValue; |
| 333 } |
| 334 |
| 324 AdblockPlus::JsValueList AdblockPlus::JsEngine::ConvertArguments(const v8::Funct
ionCallbackInfo<v8::Value>& arguments) | 335 AdblockPlus::JsValueList AdblockPlus::JsEngine::ConvertArguments(const v8::Funct
ionCallbackInfo<v8::Value>& arguments) |
| 325 { | 336 { |
| 326 const JsContext context(*this); | 337 const JsContext context(*this); |
| 327 JsValueList list; | 338 JsValueList list; |
| 328 for (int i = 0; i < arguments.Length(); i++) | 339 for (int i = 0; i < arguments.Length(); i++) |
| 329 list.push_back(JsValue(shared_from_this(), arguments[i])); | 340 list.push_back(JsValue(shared_from_this(), arguments[i])); |
| 330 return list; | 341 return list; |
| 331 } | 342 } |
| 332 | 343 |
| 333 void AdblockPlus::JsEngine::SetGlobalProperty(const std::string& name, | 344 void AdblockPlus::JsEngine::SetGlobalProperty(const std::string& name, |
| 334 const AdblockPlus::JsValue& value) | 345 const AdblockPlus::JsValue& value) |
| 335 { | 346 { |
| 336 auto global = GetGlobalObject(); | 347 auto global = GetGlobalObject(); |
| 337 global.SetProperty(name, value); | 348 global.SetProperty(name, value); |
| 338 } | 349 } |
| OLD | NEW |