From 27794791e1317ca7bb28989ec54f2372e010645b Mon Sep 17 00:00:00 2001 From: "peterv%propagandism.org" Date: Sun, 20 Jan 2008 16:56:39 +0000 Subject: [PATCH] Part of fix for bug 412491 (function objects cloned by XPConnect still keep hidden window alive late into shutdown). r/sr=sicking. --- content/base/src/nsDocument.cpp | 3 --- content/base/src/nsNodeInfoManager.cpp | 20 +++----------------- content/base/src/nsNodeInfoManager.h | 2 -- 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index 00bdb1914be..f94e35b90f3 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -152,7 +152,6 @@ static NS_DEFINE_CID(kDOMEventGroupCID, NS_DOMEVENTGROUP_CID); #include "nsIDOMXPathEvaluator.h" #include "nsDOMCID.h" -#include "nsLayoutStatics.h" #include "nsIJSContextStack.h" #include "nsIXPConnect.h" #include "nsCycleCollector.h" @@ -772,7 +771,6 @@ nsDocument::nsDocument(const char* aContentType) mChildren(nsnull), mVisible(PR_TRUE) { - nsLayoutStatics::AddRef(); mContentType = aContentType; #ifdef PR_LOGGING @@ -881,7 +879,6 @@ nsDocument::~nsDocument() delete mHeaderData; delete mBoxObjectTable; delete mContentWrapperHash; - nsLayoutStatics::Release(); } NS_IMPL_CYCLE_COLLECTION_CLASS(nsDocument) diff --git a/content/base/src/nsNodeInfoManager.cpp b/content/base/src/nsNodeInfoManager.cpp index 77a62b86f94..a6a239e22a1 100644 --- a/content/base/src/nsNodeInfoManager.cpp +++ b/content/base/src/nsNodeInfoManager.cpp @@ -54,6 +54,7 @@ #include "prbit.h" #include "plarena.h" #include "nsMemory.h" +#include "nsLayoutStatics.h" #define NS_SMALL_NODE_ARENA_SIZE \ (512 * (sizeof(void*)/4)) @@ -219,8 +220,6 @@ nsDOMNodeAllocator::Free(size_t aSize, void* aPtr) #endif } -PRUint32 nsNodeInfoManager::gNodeManagerCount; - PLHashNumber nsNodeInfoManager::GetNodeInfoInnerHashValue(const void *key) { @@ -257,36 +256,23 @@ nsNodeInfoManager::nsNodeInfoManager() mCommentNodeInfo(nsnull), mDocumentNodeInfo(nsnull) { - ++gNodeManagerCount; + nsLayoutStatics::AddRef(); mNodeInfoHash = PL_NewHashTable(32, GetNodeInfoInnerHashValue, NodeInfoInnerKeyCompare, PL_CompareValues, nsnull, nsnull); - -#ifdef DEBUG_jst - printf ("Creating NodeInfoManager, gcount = %d\n", gNodeManagerCount); -#endif } nsNodeInfoManager::~nsNodeInfoManager() { - --gNodeManagerCount; - if (mNodeInfoHash) PL_HashTableDestroy(mNodeInfoHash); - - if (gNodeManagerCount == 0) { - nsNodeInfo::ClearCache(); - } - // Note: mPrincipal may be null here if we never got inited correctly NS_IF_RELEASE(mPrincipal); -#ifdef DEBUG_jst - printf ("Removing NodeInfoManager, gcount = %d\n", gNodeManagerCount); -#endif + nsLayoutStatics::Release(); } diff --git a/content/base/src/nsNodeInfoManager.h b/content/base/src/nsNodeInfoManager.h index dfc6bc15d73..4b7cf31f6f4 100644 --- a/content/base/src/nsNodeInfoManager.h +++ b/content/base/src/nsNodeInfoManager.h @@ -198,8 +198,6 @@ private: nsINodeInfo *mDocumentNodeInfo; // WEAK to avoid circular ownership nsRefPtr mNodeAllocator; - - static PRUint32 gNodeManagerCount; }; #endif /* nsNodeInfoManager_h___ */