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