Bug 976363 - Assert that the work queue is empty when a MessageLoop goes away, and delete the tasks in the deferred queue; r=bsmedberg
authorEhsan Akhgari <ehsan@mozilla.com>
Sun, 09 Mar 2014 14:33:25 -0400
changeset 190890 bf5956ac5ba7b59b4c539ecbfc6c69969159b429
parent 190889 7d406c9622a1dea15c252fb67a657372ef0ea213
child 190891 f16600ef3313325bc7cc419d750b1d25d9664d2f
push id474
push userasasaki@mozilla.com
push dateMon, 02 Jun 2014 21:01:02 +0000
treeherdermozilla-release@967f4cf1b31c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs976363
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 976363 - Assert that the work queue is empty when a MessageLoop goes away, and delete the tasks in the deferred queue; r=bsmedberg
ipc/chromium/src/base/message_loop.cc
--- a/ipc/chromium/src/base/message_loop.cc
+++ b/ipc/chromium/src/base/message_loop.cc
@@ -385,44 +385,24 @@ void MessageLoop::ReloadWorkQueue() {
     if (incoming_queue_.empty())
       return;
     std::swap(incoming_queue_, work_queue_);
     DCHECK(incoming_queue_.empty());
   }
 }
 
 bool MessageLoop::DeletePendingTasks() {
-  bool did_work = !work_queue_.empty();
-  while (!work_queue_.empty()) {
-    PendingTask pending_task = work_queue_.front();
-    work_queue_.pop();
-    if (!pending_task.delayed_run_time.is_null()) {
-      // We want to delete delayed tasks in the same order in which they would
-      // normally be deleted in case of any funny dependencies between delayed
-      // tasks.
-      AddToDelayedWorkQueue(pending_task);
-    } else {
-      // TODO(darin): Delete all tasks once it is safe to do so.
-      // Until it is totally safe, just do it when running purify.
-#ifdef PURIFY
-      delete pending_task.task;
-#endif  // PURIFY
-    }
-  }
-  did_work |= !deferred_non_nestable_work_queue_.empty();
+  MOZ_ASSERT(work_queue_.empty());
+  bool 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;
-#endif
     deferred_non_nestable_work_queue_.pop();
-#ifdef PURIFY
     delete task;
-#endif
   }
   did_work |= !delayed_work_queue_.empty();
   while (!delayed_work_queue_.empty()) {
     Task* task = delayed_work_queue_.top().task;
     delayed_work_queue_.pop();
     delete task;
   }
   return did_work;