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
--- 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)