Bug 760067 - Release all OfflineCache custom profile files ASAP after custom profile cache update has finished, r=michal
This commit is contained in:
25
netwerk/cache/nsDiskCacheDeviceSQL.cpp
vendored
25
netwerk/cache/nsDiskCacheDeviceSQL.cpp
vendored
@@ -685,6 +685,10 @@ nsApplicationCache::Activate()
|
||||
NS_ENSURE_TRUE(mDevice, NS_ERROR_NOT_AVAILABLE);
|
||||
|
||||
mDevice->ActivateCache(mGroup, mClientID);
|
||||
|
||||
if (mDevice->AutoShutdown(this))
|
||||
mDevice = nsnull;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@@ -830,6 +834,7 @@ nsOfflineCacheDevice::nsOfflineCacheDevice()
|
||||
: mDB(nsnull)
|
||||
, mCacheCapacity(0)
|
||||
, mDeltaCounter(0)
|
||||
, mAutoShutdown(false)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -2418,3 +2423,23 @@ nsOfflineCacheDevice::SetCapacity(PRUint32 capacity)
|
||||
{
|
||||
mCacheCapacity = capacity * 1024;
|
||||
}
|
||||
|
||||
bool
|
||||
nsOfflineCacheDevice::AutoShutdown(nsIApplicationCache * aAppCache)
|
||||
{
|
||||
if (!mAutoShutdown)
|
||||
return false;
|
||||
|
||||
mAutoShutdown = false;
|
||||
|
||||
Shutdown();
|
||||
|
||||
nsRefPtr<nsCacheService> cacheService = nsCacheService::GlobalInstance();
|
||||
cacheService->RemoveCustomOfflineDevice(this);
|
||||
|
||||
nsCAutoString clientID;
|
||||
aAppCache->GetClientID(clientID);
|
||||
mCaches.Remove(clientID);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user