mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1027789 - CacheEntry::RememberCallback should unlock before call to InvokeAvailableCallback, r=michal
This commit is contained in:
parent
c4a894b69d
commit
ab4c8d5ea9
@ -274,17 +274,35 @@ void CacheEntry::AsyncOpen(nsICacheEntryOpenCallback* aCallback, uint32_t aFlags
|
||||
|
||||
Callback callback(this, aCallback, readonly, multithread);
|
||||
|
||||
if (!Open(callback, truncate, priority, bypassIfBusy)) {
|
||||
// We get here when the callback wants to bypass cache when it's busy.
|
||||
LOG((" writing or revalidating, callback wants to bypass cache"));
|
||||
callback.mNotWanted = true;
|
||||
InvokeAvailableCallback(callback);
|
||||
}
|
||||
}
|
||||
|
||||
bool CacheEntry::Open(Callback & aCallback, bool aTruncate,
|
||||
bool aPriority, bool aBypassIfBusy)
|
||||
{
|
||||
mozilla::MutexAutoLock lock(mLock);
|
||||
|
||||
RememberCallback(callback, bypassIfBusy);
|
||||
// Check state under the lock
|
||||
if (aBypassIfBusy && (mState == WRITING || mState == REVALIDATING)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
RememberCallback(aCallback);
|
||||
|
||||
// Load() opens the lock
|
||||
if (Load(truncate, priority)) {
|
||||
if (Load(aTruncate, aPriority)) {
|
||||
// Loading is in progress...
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
InvokeCallbacks();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CacheEntry::Load(bool aTruncate, bool aPriority)
|
||||
@ -508,20 +526,13 @@ void CacheEntry::TransferCallbacks(CacheEntry & aFromEntry)
|
||||
}
|
||||
}
|
||||
|
||||
void CacheEntry::RememberCallback(Callback & aCallback, bool aBypassIfBusy)
|
||||
void CacheEntry::RememberCallback(Callback & aCallback)
|
||||
{
|
||||
mLock.AssertCurrentThreadOwns();
|
||||
|
||||
LOG(("CacheEntry::RememberCallback [this=%p, cb=%p, state=%s]",
|
||||
this, aCallback.mCallback.get(), StateString(mState)));
|
||||
|
||||
if (aBypassIfBusy && (mState == WRITING || mState == REVALIDATING)) {
|
||||
LOG((" writing or revalidating, callback wants to bypass cache"));
|
||||
aCallback.mNotWanted = true;
|
||||
InvokeAvailableCallback(aCallback);
|
||||
return;
|
||||
}
|
||||
|
||||
mCallbacks.AppendElement(aCallback);
|
||||
}
|
||||
|
||||
|
@ -204,11 +204,14 @@ private:
|
||||
nsresult mRv;
|
||||
};
|
||||
|
||||
// Starts the load or just invokes the callback, bypasses (when required)
|
||||
// if busy. Returns true on job done, false on bypass.
|
||||
bool Open(Callback & aCallback, bool aTruncate, bool aPriority, bool aBypassIfBusy);
|
||||
// Loads from disk asynchronously
|
||||
bool Load(bool aTruncate, bool aPriority);
|
||||
void OnLoaded();
|
||||
|
||||
void RememberCallback(Callback & aCallback, bool aBypassIfBusy);
|
||||
void RememberCallback(Callback & aCallback);
|
||||
void InvokeCallbacksLock();
|
||||
void InvokeCallbacks();
|
||||
bool InvokeCallbacks(bool aReadOnly);
|
||||
|
Loading…
Reference in New Issue
Block a user