Bug 1561404 - Ensure thread safety r=jya

Adds a lock in MediaCacheStream::SizeOfExcludingThis to prevent a race
condition with MediaCache::NoteSeek

Differential Revision: https://phabricator.services.mozilla.com/D36880

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Tarek Ziadé 2019-07-11 12:15:24 +00:00
Родитель 7c0acde6a7
Коммит 358d1707a7
1 изменённых файлов: 2 добавлений и 0 удалений

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

@ -554,6 +554,8 @@ MediaCacheStream::MediaCacheStream(ChannelMediaResource* aClient,
mIsPrivateBrowsing(aIsPrivateBrowsing) {}
size_t MediaCacheStream::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const {
AutoLock lock(mMediaCache->Monitor());
// Looks like these are not owned:
// - mClient
size_t size = mBlocks.ShallowSizeOfExcludingThis(aMallocSizeOf);