Bug 1416084. P2 - wake up readers when download is suspended. r=bechen,gerald

It is possible that download is suspended after all bytes are received but
before OnStopRequest is notified. In that case, we will fail to wake up the
readers waiting to read the partial block and cause bug 1412737 comment 30.

MozReview-Commit-ID: GUk4lXO6Upk

--HG--
extra : rebase_source : 2fc277fa54842e434c3f69a474c44fb4c58c976e
This commit is contained in:
JW Wang 2018-01-15 10:25:11 +08:00
Родитель 0ac7a8be1f
Коммит 1192c9ff4d
1 изменённых файлов: 5 добавлений и 0 удалений

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

@ -2306,6 +2306,11 @@ MediaCacheStream::NotifyClientSuspended(bool aSuspended)
// mClientSuspended changes the decision of reading streams. // mClientSuspended changes the decision of reading streams.
mMediaCache->QueueUpdate(lock); mMediaCache->QueueUpdate(lock);
UpdateDownloadStatistics(lock); UpdateDownloadStatistics(lock);
if (mClientSuspended) {
// Download is suspended. Wake up the readers that might be able to
// get data from the partial block.
lock.NotifyAll();
}
} }
}); });
OwnerThread()->Dispatch(r.forget()); OwnerThread()->Dispatch(r.forget());