Bug 1145686 - Make MDSM::Shutdown happen on the state machine thread. r=jww

This commit is contained in:
Bobby Holley 2015-03-24 15:12:08 -07:00
parent 7a8d608d4a
commit f63bfb2b8b
3 changed files with 11 additions and 2 deletions

View File

@ -637,7 +637,7 @@ void MediaDecoder::Shutdown()
// necessary to unblock the state machine thread if it's blocked, so
// the asynchronous shutdown in nsDestroyStateMachine won't deadlock.
if (mDecoderStateMachine) {
mDecoderStateMachine->Shutdown();
mDecoderStateMachine->DispatchShutdown();
}
// Force any outstanding seek and byterange requests to complete

View File

@ -1508,7 +1508,7 @@ void MediaDecoderStateMachine::SetDormant(bool aDormant)
void MediaDecoderStateMachine::Shutdown()
{
NS_ASSERTION(NS_IsMainThread(), "Should be on main thread.");
MOZ_ASSERT(OnTaskQueue());
// Once we've entered the shutdown state here there's no going back.
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());

View File

@ -164,7 +164,16 @@ public:
bool IsDormantNeeded();
// Set/Unset dormant state.
void SetDormant(bool aDormant);
private:
void Shutdown();
public:
void DispatchShutdown()
{
TaskQueue()->Dispatch(NS_NewRunnableMethod(this, &MediaDecoderStateMachine::Shutdown));
}
void ShutdownReader();
void FinishShutdown();