Backing out bug 493109 on suspicion of causing crashes in linux tests

This commit is contained in:
Robert O'Callahan 2009-05-20 00:24:37 +12:00
Родитель e18dd7545c 7534c33770
Коммит 038ef03387
1 изменённых файлов: 10 добавлений и 18 удалений

Просмотреть файл

@ -1141,6 +1141,15 @@ void nsOggDecodeStateMachine::Shutdown()
mBufferExhausted = PR_FALSE;
oggplay_prepare_for_close(mPlayer);
}
if (mStepDecodeThread) {
// nsOggDecodeStateMachine::Shutdown is called at a safe
// time to spin the event loop. This makes the following call
// also safe.
mon.Exit();
mStepDecodeThread->Shutdown();
mon.Enter();
mStepDecodeThread = nsnull;
}
}
void nsOggDecodeStateMachine::Decode()
@ -1178,19 +1187,6 @@ nsresult nsOggDecodeStateMachine::Run()
if (mPlaying) {
StopPlayback();
}
// Ensure mStepDecodeThread exits
if (mStepDecodeThread) {
mDecodingCompleted = PR_TRUE;
mBufferExhausted = PR_FALSE;
mon.NotifyAll();
mon.Exit();
mStepDecodeThread->Shutdown();
mon.Enter();
NS_ASSERTION(mState == DECODER_STATE_SHUTDOWN,
"How did we escape from the shutdown state???");
mStepDecodeThread = nsnull;
}
return NS_OK;
case DECODER_STATE_DECODING_METADATA:
@ -1284,9 +1280,6 @@ nsresult nsOggDecodeStateMachine::Run()
mDecodingCompleted = PR_FALSE;
mBufferExhausted = PR_FALSE;
mon.NotifyAll();
// We can call Shutdown here without releasing our monitor
// because mStepDecodeThread has already exited
// nsOggStepDecodeEvent.
mStepDecodeThread->Shutdown();
mStepDecodeThread = nsnull;
continue;
@ -1818,13 +1811,11 @@ public:
NS_IMETHOD Run() {
NS_ASSERTION(NS_IsMainThread(), "Should be called on main thread");
// The decode thread must die before the state machine can die.
// The state machine must die before the reader.
// The state machine must die before the decoder.
if (mDecodeThread)
mDecodeThread->Shutdown();
mDecodeThread = nsnull;
mDecodeStateMachine = nsnull;
mReader = nsnull;
@ -1883,6 +1874,7 @@ void nsOggDecoder::Stop()
mDecodeThread);
NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
// Null data fields. They can be reinitialized in future Load()s safely now.
mDecodeThread = nsnull;
mDecodeStateMachine = nsnull;
UnregisterShutdownObserver();