Bug 1595596 - Always wait on Prefetch thread before touching mCacheData r=froydnj

This is not, AFAICT, causing crashes - it is just an oversight noticed while
investigating the crash in the bug.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Doug Thayer 2020-03-27 21:00:24 +00:00
Родитель 759822ddcd
Коммит 28daeac06d
1 изменённых файлов: 2 добавлений и 0 удалений

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

@ -276,6 +276,7 @@ Result<Ok, nsresult> StartupCache::LoadArchive() {
return Err(NS_ERROR_UNEXPECTED);
}
auto cleanup = MakeScopeExit([&]() {
WaitOnPrefetchThread();
mTable.clear();
mCacheData.reset();
});
@ -564,6 +565,7 @@ Result<Ok, nsresult> StartupCache::WriteToDisk() {
void StartupCache::InvalidateCache(bool memoryOnly) {
WaitOnWriteThread();
WaitOnPrefetchThread();
mWrittenOnce = false;
if (memoryOnly) {
auto writeResult = WriteToDisk();