LEFT | RIGHT |
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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 isolate->Dispose(); | 88 isolate->Dispose(); |
89 isolate = nullptr; | 89 isolate = nullptr; |
90 } | 90 } |
91 | 91 |
92 JsEngine::JsWeakValuesList::~JsWeakValuesList() | 92 JsEngine::JsWeakValuesList::~JsWeakValuesList() |
93 { | 93 { |
94 for (auto& value : values) | 94 for (auto& value : values) |
95 value->Dispose(); | 95 value->Dispose(); |
96 } | 96 } |
97 | 97 |
| 98 void JsEngine::NotifyLowMemory() |
| 99 { |
| 100 const JsContext context(*this); |
| 101 v8::V8::LowMemoryNotification(); |
| 102 } |
| 103 |
98 void JsEngine::ScheduleTimer(const v8::Arguments& arguments) | 104 void JsEngine::ScheduleTimer(const v8::Arguments& arguments) |
99 { | 105 { |
100 auto jsEngine = FromArguments(arguments); | 106 auto jsEngine = FromArguments(arguments); |
101 if (arguments.Length() < 2) | 107 if (arguments.Length() < 2) |
102 throw std::runtime_error("setTimeout requires at least 2 parameters"); | 108 throw std::runtime_error("setTimeout requires at least 2 parameters"); |
103 | 109 |
104 if (!arguments[0]->IsFunction()) | 110 if (!arguments[0]->IsFunction()) |
105 throw std::runtime_error("First argument to setTimeout must be a function"); | 111 throw std::runtime_error("First argument to setTimeout must be a function"); |
106 | 112 |
107 auto jsValueArguments = jsEngine->ConvertArguments(arguments); | 113 auto jsValueArguments = jsEngine->ConvertArguments(arguments); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 logSystem = val; | 339 logSystem = val; |
334 } | 340 } |
335 | 341 |
336 | 342 |
337 void AdblockPlus::JsEngine::SetGlobalProperty(const std::string& name, | 343 void AdblockPlus::JsEngine::SetGlobalProperty(const std::string& name, |
338 const AdblockPlus::JsValue& value) | 344 const AdblockPlus::JsValue& value) |
339 { | 345 { |
340 auto global = GetGlobalObject(); | 346 auto global = GetGlobalObject(); |
341 global.SetProperty(name, value); | 347 global.SetProperty(name, value); |
342 } | 348 } |
LEFT | RIGHT |