Bug 1345751. P1 - remove the else branch for MediaShutdownManager ensures all media activities are finished before "xpcom-shutdown-threads" starts. r=cpearce
authorJW Wang <jwwang@mozilla.com>
Thu, 09 Mar 2017 14:45:09 +0800
changeset 347039 b8681577ccf9025d37f59038c2d75cc540c31dd8
parent 346963 e18d3dd20e8d60bb21524e1b6ef4a87288369afe
child 347040 f4b04c195f3fa001e88f4b6b18aceae7e6fc7575
push id87952
push userkwierso@gmail.com
push dateSat, 11 Mar 2017 01:23:00 +0000
treeherdermozilla-inbound@3683cfb843eb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1345751
milestone55.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 1345751. P1 - remove the else branch for MediaShutdownManager ensures all media activities are finished before "xpcom-shutdown-threads" starts. r=cpearce MozReview-Commit-ID: BdNnlHEb1Nk
dom/media/FileBlockCache.cpp
--- a/dom/media/FileBlockCache.cpp
+++ b/dom/media/FileBlockCache.cpp
@@ -70,25 +70,19 @@ void FileBlockCache::Close()
   if (mThread) {
     // We must shut down the thread in another runnable. This is called
     // while we're shutting down the media cache, and nsIThread::Shutdown()
     // can cause events to run before it completes, which could end up
     // opening more streams, while the media cache is shutting down and
     // releasing memory etc! Also note we close mFD in the destructor so
     // as to not disturb any IO that's currently running.
     nsCOMPtr<nsIThread> mainThread = do_GetMainThread();
-    if (mainThread) {
-      nsCOMPtr<nsIRunnable> event = new ShutdownThreadEvent(mThread);
-      mainThread->Dispatch(event.forget(), NS_DISPATCH_NORMAL);
-    } else {
-      // we're on Mainthread already, *and* the event queues are already
-      // shut down, so no events should occur - certainly not creations of
-      // new streams.
-      mThread->Shutdown();
-    }
+    MOZ_ASSERT(mainThread);
+    nsCOMPtr<nsIRunnable> event = new ShutdownThreadEvent(mThread);
+    mainThread->Dispatch(event.forget(), NS_DISPATCH_NORMAL);
   }
 }
 
 template<typename Container, typename Value>
 bool
 ContainerContains(const Container& aContainer, const Value& value)
 {
   return std::find(aContainer.begin(), aContainer.end(), value)