mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 997963, part 4 - Turn bundleCacheEntry_t::mBundle into an nsCOMPtr. r=ehsan
Also remove the now useless recycleEntry.
This commit is contained in:
parent
234e5741cc
commit
d50d87269d
@ -489,8 +489,7 @@ nsresult nsExtensibleStringBundle::GetSimpleEnumeration(nsISimpleEnumerator ** a
|
||||
|
||||
struct bundleCacheEntry_t : public LinkedListElement<bundleCacheEntry_t> {
|
||||
nsAutoPtr<nsCStringKey> mHashKey;
|
||||
// do not use a nsCOMPtr - this is a struct not a class!
|
||||
nsIStringBundle* mBundle;
|
||||
nsCOMPtr<nsIStringBundle> mBundle;
|
||||
};
|
||||
|
||||
|
||||
@ -561,9 +560,7 @@ nsStringBundleService::flushBundleCache()
|
||||
mBundleMap.Reset();
|
||||
|
||||
while (!mBundleCache.isEmpty()) {
|
||||
bundleCacheEntry_t *cacheEntry = mBundleCache.popFirst();
|
||||
recycleEntry(cacheEntry);
|
||||
delete cacheEntry;
|
||||
delete mBundleCache.popFirst();
|
||||
}
|
||||
}
|
||||
|
||||
@ -637,17 +634,12 @@ nsStringBundleService::insertIntoCache(nsIStringBundle* aBundle,
|
||||
#endif
|
||||
mBundleMap.Remove(cacheEntry->mHashKey);
|
||||
cacheEntry->remove();
|
||||
|
||||
// free up excess memory
|
||||
recycleEntry(cacheEntry);
|
||||
}
|
||||
|
||||
// at this point we have a new cacheEntry that doesn't exist
|
||||
// in the hashtable, so set up the cacheEntry
|
||||
cacheEntry->mBundle = aBundle;
|
||||
NS_ADDREF(cacheEntry->mBundle);
|
||||
|
||||
cacheEntry->mHashKey = (nsCStringKey*)aHashKey->Clone();
|
||||
cacheEntry->mBundle = aBundle;
|
||||
|
||||
// insert the entry into the cache and map, make it the MRU
|
||||
mBundleMap.Put(cacheEntry->mHashKey, cacheEntry);
|
||||
@ -655,12 +647,6 @@ nsStringBundleService::insertIntoCache(nsIStringBundle* aBundle,
|
||||
return cacheEntry;
|
||||
}
|
||||
|
||||
void
|
||||
nsStringBundleService::recycleEntry(bundleCacheEntry_t *aEntry)
|
||||
{
|
||||
NS_RELEASE(aEntry->mBundle);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsStringBundleService::CreateBundle(const char* aURLSpec,
|
||||
nsIStringBundle** aResult)
|
||||
|
@ -44,8 +44,6 @@ private:
|
||||
bundleCacheEntry_t *insertIntoCache(nsIStringBundle *aBundle,
|
||||
nsCStringKey *aHashKey);
|
||||
|
||||
static void recycleEntry(bundleCacheEntry_t*);
|
||||
|
||||
nsHashtable mBundleMap;
|
||||
mozilla::LinkedList<bundleCacheEntry_t> mBundleCache;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user