Bug 1161742 - Use lambdas for WaitForData. r=jww

This commit is contained in:
Bobby Holley 2015-05-05 17:17:35 -07:00
parent 55bc102e4c
commit 2d85ff9631
2 changed files with 12 additions and 16 deletions

View File

@ -934,11 +934,20 @@ MediaDecoderStateMachine::OnNotDecoded(MediaData::Type aType,
if (aReason == MediaDecoderReader::WAITING_FOR_DATA) {
MOZ_ASSERT(mReader->IsWaitForDataSupported(),
"Readers that send WAITING_FOR_DATA need to implement WaitForData");
nsRefPtr<MediaDecoderStateMachine> self = this;
WaitRequestRef(aType).Begin(ProxyMediaCall(DecodeTaskQueue(), mReader.get(), __func__,
&MediaDecoderReader::WaitForData, aType)
->RefableThen(TaskQueue(), __func__, this,
&MediaDecoderStateMachine::OnWaitForDataResolved,
&MediaDecoderStateMachine::OnWaitForDataRejected));
->RefableThen(TaskQueue(), __func__,
[self] (MediaData::Type aType) -> void {
ReentrantMonitorAutoEnter mon(self->mDecoder->GetReentrantMonitor());
self->WaitRequestRef(aType).Complete();
self->DispatchDecodeTasksIfNeeded();
},
[self] (WaitForDataRejectValue aRejection) -> void {
ReentrantMonitorAutoEnter mon(self->mDecoder->GetReentrantMonitor());
self->WaitRequestRef(aRejection.mType).Complete();
}));
return;
}

View File

@ -430,19 +430,6 @@ public:
void OnSeekCompleted(int64_t aTime);
void OnSeekFailed(nsresult aResult);
void OnWaitForDataResolved(MediaData::Type aType)
{
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
WaitRequestRef(aType).Complete();
DispatchDecodeTasksIfNeeded();
}
void OnWaitForDataRejected(WaitForDataRejectValue aRejection)
{
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
WaitRequestRef(aRejection.mType).Complete();
}
// Resets all state related to decoding and playback, emptying all buffers
// and aborting all pending operations on the decode task queue.
void Reset();