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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 void SetGlobalProperty(const std::string& name, const AdblockPlus::JsValue&
value); | 300 void SetGlobalProperty(const std::string& name, const AdblockPlus::JsValue&
value); |
301 | 301 |
302 /** | 302 /** |
303 * Returns a pointer to associated v8::Isolate. | 303 * Returns a pointer to associated v8::Isolate. |
304 */ | 304 */ |
305 v8::Isolate* GetIsolate() | 305 v8::Isolate* GetIsolate() |
306 { | 306 { |
307 return isolate.Get(); | 307 return isolate.Get(); |
308 } | 308 } |
309 | 309 |
| 310 /** |
| 311 * Notifies JS engine about critically low memory what should cause a |
| 312 * garbage collection. |
| 313 */ |
| 314 void NotifyLowMemory(); |
310 private: | 315 private: |
311 void CallTimerTask(const JsWeakValuesID& timerParamsID); | 316 void CallTimerTask(const JsWeakValuesID& timerParamsID); |
312 | 317 |
313 explicit JsEngine(TimerPtr timer, WebRequestPtr webRequest); | 318 explicit JsEngine(TimerPtr timer, WebRequestPtr webRequest); |
314 | 319 |
315 JsValue GetGlobalObject(); | 320 JsValue GetGlobalObject(); |
316 | 321 |
317 /// Isolate must be disposed only after disposing of all objects which are | 322 /// Isolate must be disposed only after disposing of all objects which are |
318 /// using it. | 323 /// using it. |
319 ScopedV8Isolate isolate; | 324 ScopedV8Isolate isolate; |
320 | 325 |
321 FileSystemPtr fileSystem; | 326 FileSystemPtr fileSystem; |
322 LogSystemPtr logSystem; | 327 LogSystemPtr logSystem; |
323 std::unique_ptr<v8::Persistent<v8::Context>> context; | 328 std::unique_ptr<v8::Persistent<v8::Context>> context; |
324 EventMap eventCallbacks; | 329 EventMap eventCallbacks; |
325 std::mutex eventCallbacksMutex; | 330 std::mutex eventCallbacksMutex; |
326 JsWeakValuesLists jsWeakValuesLists; | 331 JsWeakValuesLists jsWeakValuesLists; |
327 std::mutex jsWeakValuesListsMutex; | 332 std::mutex jsWeakValuesListsMutex; |
328 TimerPtr timer; | 333 TimerPtr timer; |
329 WebRequestPtr webRequest; | 334 WebRequestPtr webRequest; |
330 WebRequestSharedPtr webRequestLegacy; | 335 WebRequestSharedPtr webRequestLegacy; |
331 }; | 336 }; |
332 } | 337 } |
333 | 338 |
334 #endif | 339 #endif |
LEFT | RIGHT |