Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Unified Diff: src/libplatform/default-platform.cc

Issue 1221083004: Fix memory-leak in default platform implementation of delayed tasks. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/unittests/libplatform/default-platform-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/libplatform/default-platform.cc
diff --git a/src/libplatform/default-platform.cc b/src/libplatform/default-platform.cc
index 2885d55de7066c19546cee6a82587ffa3b050ad9..2e13cc09042a896a62aec3525890f8d72a22eb3d 100644
--- a/src/libplatform/default-platform.cc
+++ b/src/libplatform/default-platform.cc
@@ -41,19 +41,24 @@ DefaultPlatform::~DefaultPlatform() {
base::LockGuard<base::Mutex> guard(&lock_);
queue_.Terminate();
if (initialized_) {
- for (std::vector<WorkerThread*>::iterator i = thread_pool_.begin();
- i != thread_pool_.end(); ++i) {
+ for (auto i = thread_pool_.begin(); i != thread_pool_.end(); ++i) {
delete *i;
}
}
- for (std::map<v8::Isolate*, std::queue<Task*> >::iterator i =
- main_thread_queue_.begin();
- i != main_thread_queue_.end(); ++i) {
+ for (auto i = main_thread_queue_.begin(); i != main_thread_queue_.end();
+ ++i) {
while (!i->second.empty()) {
delete i->second.front();
i->second.pop();
}
}
+ for (auto i = main_thread_delayed_queue_.begin();
+ i != main_thread_delayed_queue_.end(); ++i) {
+ while (!i->second.empty()) {
+ delete i->second.top().second;
+ i->second.pop();
+ }
+ }
}
« no previous file with comments | « no previous file | test/unittests/libplatform/default-platform-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698