Bug 723362 - Make an asynchronous variant of nsCacheEntryDescriptor::Doom, r=hurley
This commit is contained in:
23
netwerk/cache/nsCacheEntryDescriptor.h
vendored
23
netwerk/cache/nsCacheEntryDescriptor.h
vendored
@@ -15,6 +15,7 @@
|
||||
#include "nsCacheService.h"
|
||||
#include "nsIDiskCacheStreamInternal.h"
|
||||
#include "zlib.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
|
||||
/******************************************************************************
|
||||
* nsCacheEntryDescriptor
|
||||
@@ -27,7 +28,9 @@ public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSICACHEENTRYDESCRIPTOR
|
||||
NS_DECL_NSICACHEENTRYINFO
|
||||
|
||||
|
||||
friend class nsAsyncDoomEvent;
|
||||
|
||||
nsCacheEntryDescriptor(nsCacheEntry * entry, nsCacheAccessMode mode);
|
||||
virtual ~nsCacheEntryDescriptor();
|
||||
|
||||
@@ -40,7 +43,20 @@ public:
|
||||
* methods callbacks for nsCacheService
|
||||
*/
|
||||
nsCacheEntry * CacheEntry(void) { return mCacheEntry; }
|
||||
void ClearCacheEntry(void) { mCacheEntry = nullptr; }
|
||||
void ClearCacheEntry(void)
|
||||
{
|
||||
bool asyncDoomPending;
|
||||
{
|
||||
mozilla::MutexAutoLock lock(mLock);
|
||||
asyncDoomPending = mAsyncDoomPending;
|
||||
}
|
||||
|
||||
if (asyncDoomPending && mCacheEntry) {
|
||||
nsCacheService::gService->DoomEntry_Internal(mCacheEntry, true);
|
||||
mDoomedOnClose = true;
|
||||
}
|
||||
mCacheEntry = nullptr;
|
||||
}
|
||||
|
||||
nsresult CloseOutput(void)
|
||||
{
|
||||
@@ -208,6 +224,9 @@ private:
|
||||
nsCacheEntry * mCacheEntry; // we are a child of the entry
|
||||
nsCacheAccessMode mAccessGranted;
|
||||
nsIOutputStream * mOutput;
|
||||
mozilla::Mutex mLock;
|
||||
bool mAsyncDoomPending;
|
||||
bool mDoomedOnClose;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user