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

Unified Diff: base/message_loop.cc

Issue 160035: Reapply r21429 - Cleanup pending tasks under Valgrind as well. (Closed)
Patch Set: fix mac break Created 11 years, 5 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_loop.cc
diff --git a/base/message_loop.cc b/base/message_loop.cc
index fbdc94f13d879a0b938ff4bdcb4a1282499e9d95..4c91b1ff23d423ffaf08d17a4ac6aec6a34d0233 100644
--- a/base/message_loop.cc
+++ b/base/message_loop.cc
@@ -372,10 +372,8 @@ bool MessageLoop::DeletePendingTasks() {
// TODO(darin): Delete all tasks once it is safe to do so.
// Until it is totally safe, just do it when running Purify or
// Valgrind.
-#if defined(OS_WIN)
-#ifdef PURIFY
+#if defined(PURIFY)
delete pending_task.task;
-#endif // PURIFY
#elif defined(OS_POSIX)
if (RUNNING_ON_VALGRIND)
delete pending_task.task;
@@ -385,14 +383,17 @@ bool MessageLoop::DeletePendingTasks() {
did_work |= !deferred_non_nestable_work_queue_.empty();
while (!deferred_non_nestable_work_queue_.empty()) {
// TODO(darin): Delete all tasks once it is safe to do so.
- // Until it is totaly safe, just delete them to keep purify happy.
-#ifdef PURIFY
- Task* task = deferred_non_nestable_work_queue_.front().task;
+ // Until it is totaly safe, only delete them under Purify and Valgrind.
+ Task* task = NULL;
+#if defined(PURIFY)
+ task = deferred_non_nestable_work_queue_.front().task;
+#elif defined(OS_POSIX)
+ if (RUNNING_ON_VALGRIND)
+ task = deferred_non_nestable_work_queue_.front().task;
#endif
deferred_non_nestable_work_queue_.pop();
-#ifdef PURIFY
- delete task;
-#endif
+ if (task)
+ delete task;
}
did_work |= !delayed_work_queue_.empty();
while (!delayed_work_queue_.empty()) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698