Bug 1349883 - part 4: strengthen precondition of ReturnDecodedData(). r=jya

MozReview-Commit-ID: 2jLNlrHEE0b

--HG--
extra : rebase_source : af780e3b10f915302aa1deaba18a324266fa1dc0
This commit is contained in:
John Lin 2017-04-07 17:17:17 +08:00
Родитель ab9060d531
Коммит 6e70175957
1 изменённых файлов: 5 добавлений и 8 удалений

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

@ -460,6 +460,9 @@ RemoteDataDecoder::Drain()
{ {
RefPtr<RemoteDataDecoder> self = this; RefPtr<RemoteDataDecoder> self = this;
return InvokeAsync(mTaskQueue, __func__, [self, this]() { return InvokeAsync(mTaskQueue, __func__, [self, this]() {
if (mShutdown) {
return DecodePromise::CreateAndReject(NS_ERROR_DOM_MEDIA_CANCELED, __func__);
}
RefPtr<DecodePromise> p = mDrainPromise.Ensure(__func__); RefPtr<DecodePromise> p = mDrainPromise.Ensure(__func__);
if (mDrainStatus == DrainStatus::DRAINED) { if (mDrainStatus == DrainStatus::DRAINED) {
// There's no operation to perform other than returning any already // There's no operation to perform other than returning any already
@ -592,15 +595,9 @@ RemoteDataDecoder::UpdateOutputStatus(MediaData* aSample)
void void
RemoteDataDecoder::ReturnDecodedData() RemoteDataDecoder::ReturnDecodedData()
{ {
if (!mTaskQueue->IsCurrentThreadIn()) {
mTaskQueue->Dispatch(
NewRunnableMethod(this, &RemoteDataDecoder::ReturnDecodedData));
return;
}
AssertOnTaskQueue(); AssertOnTaskQueue();
if (mShutdown) { MOZ_ASSERT(!mShutdown);
return;
}
// We only want to clear mDecodedData when we have resolved the promises. // We only want to clear mDecodedData when we have resolved the promises.
if (!mDecodePromise.IsEmpty()) { if (!mDecodePromise.IsEmpty()) {
mDecodePromise.Resolve(mDecodedData, __func__); mDecodePromise.Resolve(mDecodedData, __func__);