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

Side by Side Diff: src/JsEngine.cpp

Issue 29447555: Issue 5275 - Minimize memory usage as soon as possible (Closed) Base URL: https://github.com/adblockplus/libadblockplus.git
Patch Set: Created May 24, 2017, 12:09 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/FilterEngine.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 logSystem = val; 342 logSystem = val;
337 } 343 }
338 344
339 345
340 void AdblockPlus::JsEngine::SetGlobalProperty(const std::string& name, 346 void AdblockPlus::JsEngine::SetGlobalProperty(const std::string& name,
341 const AdblockPlus::JsValue& value) 347 const AdblockPlus::JsValue& value)
342 { 348 {
343 auto global = GetGlobalObject(); 349 auto global = GetGlobalObject();
344 global.SetProperty(name, value); 350 global.SetProperty(name, value);
345 } 351 }
OLDNEW
« no previous file with comments | « src/FilterEngine.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld