mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1052266 - Potential deadlock detected: CacheEntry, CacheIndex.mLock, CacheStorageService at CacheEntry, r=honzab
This commit is contained in:
parent
38bfee50fb
commit
1284219ac6
@ -241,7 +241,7 @@ NS_INTERFACE_MAP_END_THREADSAFE
|
||||
|
||||
|
||||
CacheIndex::CacheIndex()
|
||||
: mLock("CacheFile.mLock")
|
||||
: mLock("CacheIndex.mLock")
|
||||
, mState(INITIAL)
|
||||
, mShuttingDown(false)
|
||||
, mIndexNeedsUpdate(false)
|
||||
|
@ -109,7 +109,8 @@ NS_IMPL_ISUPPORTS(CacheStorageService,
|
||||
CacheStorageService* CacheStorageService::sSelf = nullptr;
|
||||
|
||||
CacheStorageService::CacheStorageService()
|
||||
: mLock("CacheStorageService")
|
||||
: mLock("CacheStorageService.mLock")
|
||||
, mForcedValidEntriesLock("CacheStorageService.mForcedValidEntriesLock")
|
||||
, mShutdown(false)
|
||||
, mDiskPool(MemoryPool::DISK)
|
||||
, mMemoryPool(MemoryPool::MEMORY)
|
||||
@ -969,7 +970,7 @@ CacheStorageService::RemoveEntry(CacheEntry* aEntry, bool aOnlyUnreferenced)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!aEntry->IsUsingDisk() && IsForcedValidEntryInternal(entryKey)) {
|
||||
if (!aEntry->IsUsingDisk() && IsForcedValidEntry(entryKey)) {
|
||||
LOG((" forced valid, not removing"));
|
||||
return false;
|
||||
}
|
||||
@ -1040,19 +1041,12 @@ CacheStorageService::RecordMemoryOnlyEntry(CacheEntry* aEntry,
|
||||
}
|
||||
}
|
||||
|
||||
// Acquires the mutex lock for CacheStorageService and calls through to
|
||||
// IsForcedValidInternal (bug 1044233)
|
||||
bool CacheStorageService::IsForcedValidEntry(nsACString &aCacheEntryKey)
|
||||
{
|
||||
mozilla::MutexAutoLock lock(mLock);
|
||||
|
||||
return IsForcedValidEntryInternal(aCacheEntryKey);
|
||||
}
|
||||
|
||||
// Checks if a cache entry is forced valid (will be loaded directly from cache
|
||||
// without further validation) - see nsICacheEntry.idl for further details
|
||||
bool CacheStorageService::IsForcedValidEntryInternal(nsACString &aCacheEntryKey)
|
||||
bool CacheStorageService::IsForcedValidEntry(nsACString &aCacheEntryKey)
|
||||
{
|
||||
mozilla::MutexAutoLock lock(mForcedValidEntriesLock);
|
||||
|
||||
TimeStamp validUntil;
|
||||
|
||||
if (!mForcedValidEntries.Get(aCacheEntryKey, &validUntil)) {
|
||||
@ -1078,7 +1072,7 @@ bool CacheStorageService::IsForcedValidEntryInternal(nsACString &aCacheEntryKey)
|
||||
void CacheStorageService::ForceEntryValidFor(nsACString &aCacheEntryKey,
|
||||
uint32_t aSecondsToTheFuture)
|
||||
{
|
||||
mozilla::MutexAutoLock lock(mLock);
|
||||
mozilla::MutexAutoLock lock(mForcedValidEntriesLock);
|
||||
|
||||
TimeStamp now = TimeStamp::NowLoRes();
|
||||
ForcedValidEntriesPrune(now);
|
||||
|
@ -161,12 +161,6 @@ private:
|
||||
private:
|
||||
friend class CacheIndex;
|
||||
|
||||
/**
|
||||
* Gets the mutex lock for CacheStorageService then calls through to
|
||||
* IsForcedValidEntryInternal. See below for details.
|
||||
*/
|
||||
bool IsForcedValidEntry(nsACString &aCacheEntryKey);
|
||||
|
||||
/**
|
||||
* Retrieves the status of the cache entry to see if it has been forced valid
|
||||
* (so it will loaded directly from cache without further validation)
|
||||
@ -174,7 +168,7 @@ private:
|
||||
* thrown away when forced valid
|
||||
* See nsICacheEntry.idl for more details
|
||||
*/
|
||||
bool IsForcedValidEntryInternal(nsACString &aCacheEntryKey);
|
||||
bool IsForcedValidEntry(nsACString &aCacheEntryKey);
|
||||
|
||||
private:
|
||||
// These are helpers for telemetry monitorying of the memory pools.
|
||||
@ -293,6 +287,7 @@ private:
|
||||
static CacheStorageService* sSelf;
|
||||
|
||||
mozilla::Mutex mLock;
|
||||
mozilla::Mutex mForcedValidEntriesLock;
|
||||
|
||||
bool mShutdown;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user