mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
Adding code to remove entries from free list when recycled.
This commit is contained in:
parent
15475908d1
commit
de3b5568fb
@ -1138,8 +1138,22 @@ nsZipReaderCache::GetZip(nsIFile* zipFile, nsIZipReader* *result)
|
||||
nsZipCacheEntry* entry = (nsZipCacheEntry*)mZips.Get(&key);
|
||||
if (entry) {
|
||||
*result = entry->mZip;
|
||||
entry->mUseCount++;
|
||||
NS_ADDREF(*result);
|
||||
if (entry->mUseCount++ == 0) {
|
||||
// remove from free list
|
||||
nsZipCacheEntry** entryPtr = &mFreeList;
|
||||
NS_ASSERTION(*entryPtr, "null free list");
|
||||
while ((*entryPtr)->mNextOlder != nsnull) {
|
||||
if ((*entryPtr)->mNextOlder == entry) {
|
||||
(*entryPtr)->mNextOlder = entry->mNextOlder;
|
||||
entry->mNextOlder = nsnull;
|
||||
--mFreeCount;
|
||||
return NS_OK;
|
||||
}
|
||||
entryPtr = &(*entryPtr)->mNextOlder;
|
||||
}
|
||||
NS_NOTREACHED("couldn't find entry in free list");
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user