From a55bf8ee906b891a2999a818b7bf00f1bd377f1b Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Sun, 23 May 2010 22:15:18 -0400 Subject: [PATCH] Bug 567680 - nsMemoryCacheDevide::BindEntry increments the entry count for doomed entries; r=bzbarsky --- netwerk/cache/src/nsMemoryCacheDevice.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/netwerk/cache/src/nsMemoryCacheDevice.cpp b/netwerk/cache/src/nsMemoryCacheDevice.cpp index 1a11f616de93..492fea964aee 100644 --- a/netwerk/cache/src/nsMemoryCacheDevice.cpp +++ b/netwerk/cache/src/nsMemoryCacheDevice.cpp @@ -190,10 +190,10 @@ nsMemoryCacheDevice::DeactivateEntry(nsCacheEntry * entry) nsresult nsMemoryCacheDevice::BindEntry(nsCacheEntry * entry) { - if (!entry->IsDoomed()) { - NS_ASSERTION(PR_CLIST_IS_EMPTY(entry),"entry is already on a list!"); - - // append entry to the eviction list + if (!entry->IsDoomed()) { + NS_ASSERTION(PR_CLIST_IS_EMPTY(entry),"entry is already on a list!"); + + // append entry to the eviction list PR_APPEND_LINK(entry, &mEvictionList[EvictionList(entry, 0)]); // add entry to hashtable of mem cache entries @@ -202,15 +202,15 @@ nsMemoryCacheDevice::BindEntry(nsCacheEntry * entry) PR_REMOVE_AND_INIT_LINK(entry); return rv; } - } - // add size of entry to memory totals - ++mEntryCount; - if (mMaxEntryCount < mEntryCount) mMaxEntryCount = mEntryCount; + // add size of entry to memory totals + ++mEntryCount; + if (mMaxEntryCount < mEntryCount) mMaxEntryCount = mEntryCount; + + mTotalSize += entry->Size(); + EvictEntriesIfNecessary(); + } - mTotalSize += entry->Size(); - EvictEntriesIfNecessary(); - return NS_OK; }