Bug 1429009. P1 - notify 'DownloadProgressed' immediately to preserve the event order. r=bechen,gerald

We also need to call GetOwner()->UpdateReadyState() since mCanPlayThrough might
have changed.

MozReview-Commit-ID: C5djzu1sXqV

--HG--
extra : rebase_source : 1037cb7e1bf3a32fa60451e9a2a64ce63d06b8c2
extra : intermediate-source : 373c47f094dfb85ca2576d18a302d9ceb4e82ed5
extra : source : b710ff5026c18ac851be56ac9a369fe69b1d5b5d
This commit is contained in:
JW Wang 2018-01-08 14:51:57 +08:00
Родитель 4a910281dc
Коммит 4d6d7238d7
1 изменённых файлов: 4 добавлений и 1 удалений

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

@ -413,6 +413,8 @@ ChannelMediaDecoder::DownloadProgressed()
MOZ_ASSERT(NS_IsMainThread());
MOZ_DIAGNOSTIC_ASSERT(!IsShutdown());
GetOwner()->DownloadProgressed();
using StatsPromise = MozPromise<MediaStatistics, bool, true>;
InvokeAsync(GetStateMachine()->OwnerThread(),
__func__,
@ -438,7 +440,8 @@ ChannelMediaDecoder::DownloadProgressed()
GetStateMachine()->DispatchCanPlayThrough(mCanPlayThrough);
mResource->ThrottleReadahead(ShouldThrottleDownload(aStats));
AbstractThread::AutoEnter context(AbstractMainThread());
GetOwner()->DownloadProgressed();
// Update readyState since mCanPlayThrough might have changed.
GetOwner()->UpdateReadyState();
},
[]() { MOZ_ASSERT_UNREACHABLE("Promise not resolved"); });
}