зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1309142. Part 2 - add StateObject::HandleShutdown(). r=JamesCheng
MozReview-Commit-ID: 64VPA1fxLzF --HG-- extra : rebase_source : 271d75f4766dda88b2da68db6061cafda1e76295 extra : source : 3f62381eb06918fb2e591c245e96c519967cc59b
This commit is contained in:
Родитель
93a211fec5
Коммит
6c6fc5896a
|
@ -214,6 +214,8 @@ public:
|
|||
|
||||
virtual bool HandleAudioCaptured() { return false; }
|
||||
|
||||
virtual RefPtr<ShutdownPromise> HandleShutdown();
|
||||
|
||||
virtual void DumpDebugInfo() {}
|
||||
|
||||
protected:
|
||||
|
@ -885,6 +887,12 @@ public:
|
|||
MOZ_DIAGNOSTIC_ASSERT(false, "Can't seek in shutdown state.");
|
||||
return MediaDecoder::SeekPromise::CreateAndReject(true, __func__);
|
||||
}
|
||||
|
||||
RefPtr<ShutdownPromise> HandleShutdown() override
|
||||
{
|
||||
MOZ_DIAGNOSTIC_ASSERT(false, "Already shutting down.");
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
bool
|
||||
|
@ -906,6 +914,20 @@ StateObject::HandleDormant(bool aDormant)
|
|||
return true;
|
||||
}
|
||||
|
||||
RefPtr<ShutdownPromise>
|
||||
MediaDecoderStateMachine::
|
||||
StateObject::HandleShutdown()
|
||||
{
|
||||
auto master = mMaster;
|
||||
SetState<ShutdownState>();
|
||||
|
||||
return master->mReader->Shutdown()
|
||||
->Then(master->OwnerThread(), __func__, master,
|
||||
&MediaDecoderStateMachine::FinishShutdown,
|
||||
&MediaDecoderStateMachine::FinishShutdown)
|
||||
->CompletionPromise();
|
||||
}
|
||||
|
||||
void
|
||||
MediaDecoderStateMachine::
|
||||
DecodeMetadataState::OnMetadataRead(MetadataHolder* aMetadata)
|
||||
|
@ -2144,16 +2166,7 @@ RefPtr<ShutdownPromise>
|
|||
MediaDecoderStateMachine::Shutdown()
|
||||
{
|
||||
MOZ_ASSERT(OnTaskQueue());
|
||||
|
||||
mStateObj->SetState<ShutdownState>();
|
||||
|
||||
// Put a task in the decode queue to shutdown the reader.
|
||||
// the queue to spin down.
|
||||
return mReader->Shutdown()
|
||||
->Then(OwnerThread(), __func__, this,
|
||||
&MediaDecoderStateMachine::FinishShutdown,
|
||||
&MediaDecoderStateMachine::FinishShutdown)
|
||||
->CompletionPromise();
|
||||
return mStateObj->HandleShutdown();
|
||||
}
|
||||
|
||||
void MediaDecoderStateMachine::PlayStateChanged()
|
||||
|
|
Загрузка…
Ссылка в новой задаче