mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 03:15:11 +00:00
Bug 523083. Don't bother caching the last nsContentList, it just creates leaks and probably doesn't help anything. r=peterv
This commit is contained in:
parent
9444260032
commit
9848774397
@ -67,9 +67,6 @@ NS_NewPreContentIterator(nsIContentIterator** aInstancePtrResult);
|
||||
#define ASSERT_IN_SYNC PR_BEGIN_MACRO PR_END_MACRO
|
||||
#endif
|
||||
|
||||
|
||||
static nsContentList *gCachedContentList;
|
||||
|
||||
nsBaseContentList::~nsBaseContentList()
|
||||
{
|
||||
}
|
||||
@ -159,11 +156,6 @@ void nsBaseContentList::InsertElementAt(nsIContent* aContent, PRInt32 aIndex)
|
||||
mElements.InsertObjectAt(aContent, aIndex);
|
||||
}
|
||||
|
||||
//static
|
||||
void nsBaseContentList::Shutdown() {
|
||||
NS_IF_RELEASE(gCachedContentList);
|
||||
}
|
||||
|
||||
// nsFormContentList
|
||||
|
||||
nsFormContentList::nsFormContentList(nsIDOMHTMLFormElement *aForm,
|
||||
@ -281,18 +273,6 @@ NS_GetContentList(nsINode* aRootNode, nsIAtom* aMatchAtom,
|
||||
|
||||
NS_ADDREF(list);
|
||||
|
||||
// Hold on to the last requested content list to avoid having it be
|
||||
// removed from the cache immediately when it's released. Avoid
|
||||
// bumping the refcount on the list if the requested list is the one
|
||||
// that's already cached.
|
||||
|
||||
if (gCachedContentList != list) {
|
||||
NS_IF_RELEASE(gCachedContentList);
|
||||
|
||||
gCachedContentList = list;
|
||||
NS_ADDREF(gCachedContentList);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@ -561,21 +541,6 @@ nsContentList::NodeWillBeDestroyed(const nsINode* aNode)
|
||||
SetDirty();
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
nsContentList::OnDocumentDestroy(nsIDocument *aDocument)
|
||||
{
|
||||
// If our content list cache holds a list used for a document that's
|
||||
// now being destroyed, free the cache to prevent the list from
|
||||
// staying around until the next use of content lists ends up
|
||||
// replacing what's in the cache.
|
||||
|
||||
if (gCachedContentList && gCachedContentList->mRootNode &&
|
||||
gCachedContentList->mRootNode->GetOwnerDoc() == aDocument) {
|
||||
NS_RELEASE(gCachedContentList);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsContentList::GetLength(PRUint32* aLength)
|
||||
{
|
||||
|
@ -120,8 +120,6 @@ public:
|
||||
|
||||
virtual PRInt32 IndexOf(nsIContent *aContent, PRBool aDoFlush);
|
||||
|
||||
static void Shutdown();
|
||||
|
||||
protected:
|
||||
nsCOMArray<nsIContent> mElements;
|
||||
};
|
||||
@ -292,8 +290,6 @@ public:
|
||||
NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
|
||||
NS_DECL_NSIMUTATIONOBSERVER_NODEWILLBEDESTROYED
|
||||
|
||||
static void OnDocumentDestroy(nsIDocument *aDocument);
|
||||
|
||||
static nsContentList* FromSupports(nsISupports* aSupports)
|
||||
{
|
||||
nsINodeList* list = static_cast<nsINodeList*>(aSupports);
|
||||
|
@ -7101,8 +7101,6 @@ nsDocument::Destroy()
|
||||
|
||||
mLayoutHistoryState = nsnull;
|
||||
|
||||
nsContentList::OnDocumentDestroy(this);
|
||||
|
||||
// Shut down our external resource map. We might not need this for
|
||||
// leak-fixing if we fix DocumentViewerImpl to do cycle-collection, but
|
||||
// tearing down all those frame trees right now is the right thing to do.
|
||||
|
@ -308,7 +308,6 @@ nsLayoutStatics::Shutdown()
|
||||
nsDOMAttribute::Shutdown();
|
||||
nsDOMEventRTTearoff::Shutdown();
|
||||
nsEventListenerManager::Shutdown();
|
||||
nsContentList::Shutdown();
|
||||
nsComputedDOMStyle::Shutdown();
|
||||
CSSLoaderImpl::Shutdown();
|
||||
nsCSSRuleProcessor::FreeSystemMetrics();
|
||||
|
Loading…
Reference in New Issue
Block a user