mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 922123 - Shutdown hang with 100% CPU on Nightly with new cache, r=michal
This commit is contained in:
parent
333e3452e8
commit
331e760119
@ -76,11 +76,10 @@ CacheEntry::CacheEntry(const nsACString& aStorageID,
|
||||
, mIsDoomed(false)
|
||||
, mSecurityInfoLoaded(false)
|
||||
, mPreventCallbacks(false)
|
||||
, mIsRegistered(false)
|
||||
, mIsRegistrationAllowed(true)
|
||||
, mHasMainThreadOnlyCallback(false)
|
||||
, mHasData(false)
|
||||
, mState(NOTLOADED)
|
||||
, mRegistration(NEVERREGISTERED)
|
||||
, mWriter(nullptr)
|
||||
, mPredictedDataSize(0)
|
||||
, mDataSize(0)
|
||||
@ -1169,24 +1168,27 @@ uint32_t CacheEntry::GetExpirationTime() const
|
||||
bool CacheEntry::IsRegistered() const
|
||||
{
|
||||
MOZ_ASSERT(CacheStorageService::IsOnManagementThread());
|
||||
return mIsRegistered;
|
||||
return mRegistration == REGISTERED;
|
||||
}
|
||||
|
||||
bool CacheEntry::CanRegister() const
|
||||
{
|
||||
MOZ_ASSERT(CacheStorageService::IsOnManagementThread());
|
||||
return !mIsRegistered && mIsRegistrationAllowed;
|
||||
return mRegistration == NEVERREGISTERED;
|
||||
}
|
||||
|
||||
void CacheEntry::SetRegistered(bool aRegistered)
|
||||
{
|
||||
MOZ_ASSERT(CacheStorageService::IsOnManagementThread());
|
||||
MOZ_ASSERT(mIsRegistrationAllowed);
|
||||
|
||||
mIsRegistered = aRegistered;
|
||||
|
||||
if (!aRegistered) // Never allow registration again
|
||||
mIsRegistrationAllowed = false;
|
||||
if (aRegistered) {
|
||||
MOZ_ASSERT(mRegistration == NEVERREGISTERED);
|
||||
mRegistration = REGISTERED;
|
||||
}
|
||||
else {
|
||||
MOZ_ASSERT(mRegistration == REGISTERED);
|
||||
mRegistration = DEREGISTERED;
|
||||
}
|
||||
}
|
||||
|
||||
bool CacheEntry::Purge(uint32_t aWhat)
|
||||
|
@ -232,11 +232,6 @@ private:
|
||||
bool mSecurityInfoLoaded : 1;
|
||||
// Prevents any callback invocation
|
||||
bool mPreventCallbacks : 1;
|
||||
// Accessed only on the management thread.
|
||||
// Whether this entry is registered in the storage service helper arrays
|
||||
bool mIsRegistered : 1;
|
||||
// After deregistration entry is no allowed to register again
|
||||
bool mIsRegistrationAllowed : 1;
|
||||
// Way around when having a callback that cannot be invoked on non-main thread
|
||||
bool mHasMainThreadOnlyCallback : 1;
|
||||
// true: after load and an existing file, or after output stream has been opened.
|
||||
@ -263,6 +258,16 @@ private:
|
||||
// State of this entry.
|
||||
EState mState;
|
||||
|
||||
enum ERegistration {
|
||||
NEVERREGISTERED = 0, // The entry has never been registered
|
||||
REGISTERED = 1, // The entry is stored in the memory pool index
|
||||
DEREGISTERED = 2 // The entry has been removed from the pool
|
||||
};
|
||||
|
||||
// Accessed only on the management thread. Records the state of registration
|
||||
// this entry in the memory pool intermediate cache.
|
||||
ERegistration mRegistration;
|
||||
|
||||
// If a new (empty) entry is requested to open an input stream before
|
||||
// output stream has been opened, we must open output stream internally
|
||||
// on CacheFile and hold until writer releases the entry or opens the output
|
||||
|
Loading…
Reference in New Issue
Block a user