Bug 1174939 - Handle non-empty tail dispatchers in BeginShutdown. r=jww
authorBobby Holley <bobbyholley@gmail.com>
Mon, 15 Jun 2015 16:19:32 -0700
changeset 279803 5d48c36674e526e00fe603d1ef5e3054efb5db4b
parent 279802 c95ecd760bf3c8509a6f31719e6cd8b001f6a0cc
child 279804 0379d120132a1d23ff5c58b02f73ada9c70b823c
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-beta@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjww
bugs1174939
milestone41.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 1174939 - Handle non-empty tail dispatchers in BeginShutdown. r=jww
dom/media/MediaTaskQueue.cpp
--- a/dom/media/MediaTaskQueue.cpp
+++ b/dom/media/MediaTaskQueue.cpp
@@ -154,20 +154,21 @@ MediaTaskQueue::AwaitShutdownAndIdle()
     mQueueMonitor.Wait();
   }
   AwaitIdleLocked();
 }
 
 nsRefPtr<ShutdownPromise>
 MediaTaskQueue::BeginShutdown()
 {
-  // Make sure there are no tasks for this queue waiting in the caller's tail
-  // dispatcher.
-  MOZ_ASSERT_IF(AbstractThread::GetCurrent(),
-                !AbstractThread::GetCurrent()->TailDispatcher().HasTasksFor(this));
+  // Dispatch any tasks for this queue waiting in the caller's tail dispatcher,
+  // since this is the last opportunity to do so.
+  if (AbstractThread* currentThread = AbstractThread::GetCurrent()) {
+    currentThread->TailDispatcher().DispatchTasksFor(this);
+  }
 
   MonitorAutoLock mon(mQueueMonitor);
   mIsShutdown = true;
   nsRefPtr<ShutdownPromise> p = mShutdownPromise.Ensure(__func__);
   MaybeResolveShutdown();
   mon.NotifyAll();
   return p;
 }