diff --git a/mozilla/caps/src/nsCodebasePrincipal.cpp b/mozilla/caps/src/nsCodebasePrincipal.cpp index 195aa7814ca..2f47068a66b 100644 --- a/mozilla/caps/src/nsCodebasePrincipal.cpp +++ b/mozilla/caps/src/nsCodebasePrincipal.cpp @@ -36,7 +36,7 @@ nsCodebasePrincipal::AddRef(void) { NS_PRECONDITION(PRInt32(mJSPrincipals.refcount) >= 0, "illegal refcnt"); ++mJSPrincipals.refcount; - NS_LOG_ADDREF(this, mJSPrincipals.refcount, "nsCodebasePrincipal"); + NS_LOG_ADDREF(this, mJSPrincipals.refcount, "nsCodebasePrincipal", sizeof(*this)); return mJSPrincipals.refcount; } diff --git a/mozilla/content/base/src/nsCommentNode.cpp b/mozilla/content/base/src/nsCommentNode.cpp index fcc69bcc317..37233b091e2 100644 --- a/mozilla/content/base/src/nsCommentNode.cpp +++ b/mozilla/content/base/src/nsCommentNode.cpp @@ -205,7 +205,6 @@ protected: PRUint32 mContentID; }; -nsresult NS_NewCommentNode(nsIContent** aInstancePtrResult); nsresult NS_NewCommentNode(nsIContent** aInstancePtrResult) { diff --git a/mozilla/content/base/src/nsDocument.cpp b/mozilla/content/base/src/nsDocument.cpp index 60fa895e1f6..0e4e1b7a46b 100644 --- a/mozilla/content/base/src/nsDocument.cpp +++ b/mozilla/content/base/src/nsDocument.cpp @@ -503,78 +503,12 @@ nsDOMImplementation::SetScriptObject(void *aScriptObject) // = // ================================================================== -#if 0 -NS_LAYOUT nsresult -NS_NewPostData(PRBool aIsFile, char* aData, - nsIPostData** aInstancePtrResult) -{ - nsresult rv = NS_OK; +MOZ_DECL_CTOR_COUNTER(nsDocumentChildNodes); - if (nsnull == aInstancePtrResult) { - return NS_ERROR_NULL_POINTER; - } - - *aInstancePtrResult = new nsPostData(aIsFile, aData); - if (nsnull != *aInstancePtrResult) { - NS_ADDREF(*aInstancePtrResult); - } else { - rv = NS_ERROR_OUT_OF_MEMORY; - } - - return rv; -} -#endif - -#if 0 // nuking postdata -nsPostData::nsPostData(PRBool aIsFile, char* aData) -{ - NS_INIT_REFCNT(); - - mData = nsnull; - mDataLen = 0; - mIsFile = aIsFile; - - if (aData) { - mDataLen = PL_strlen(aData); - mData = aData; - } -} - -nsPostData::~nsPostData() -{ - if (nsnull != mData) { - delete [] mData; - mData = nsnull; - } -} - - -/* - * Implementation of ISupports methods... - */ -NS_IMPL_ISUPPORTS(nsPostData,kIPostDataIID); - -PRBool nsPostData::IsFile() -{ - return mIsFile; -} - -const char* nsPostData::GetData() -{ - return mData; -} - -PRInt32 nsPostData::GetDataLength() -{ - return mDataLen; -} -#endif // nuking postdata. - -// ================================================================== -// = -// ================================================================== nsDocumentChildNodes::nsDocumentChildNodes(nsIDocument* aDocument) { + MOZ_COUNT_CTOR(nsDocumentChildNodes); + // We don't reference count our document reference (to avoid circular // references). We'll be told when the document goes away. mDocument = aDocument; @@ -582,6 +516,7 @@ nsDocumentChildNodes::nsDocumentChildNodes(nsIDocument* aDocument) nsDocumentChildNodes::~nsDocumentChildNodes() { + MOZ_COUNT_DTOR(nsDocumentChildNodes); } NS_IMETHODIMP diff --git a/mozilla/content/base/src/nsDocumentEncoder.cpp b/mozilla/content/base/src/nsDocumentEncoder.cpp index f4f4aa710fa..b840f1716bf 100644 --- a/mozilla/content/base/src/nsDocumentEncoder.cpp +++ b/mozilla/content/base/src/nsDocumentEncoder.cpp @@ -299,13 +299,17 @@ public: void **aResult); }; +MOZ_DECL_CTOR_COUNTER(nsDocumentEncoderFactory); + nsDocumentEncoderFactory::nsDocumentEncoderFactory() { + MOZ_COUNT_CTOR(nsDocumentEncoderFactory); mRefCnt = 0; } nsDocumentEncoderFactory::~nsDocumentEncoderFactory() { + MOZ_COUNT_DTOR(nsDocumentEncoderFactory); NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction"); } diff --git a/mozilla/content/base/src/nsGenericDOMNodeList.cpp b/mozilla/content/base/src/nsGenericDOMNodeList.cpp index a5a487493d3..09f0a246503 100644 --- a/mozilla/content/base/src/nsGenericDOMNodeList.cpp +++ b/mozilla/content/base/src/nsGenericDOMNodeList.cpp @@ -23,7 +23,7 @@ nsGenericDOMNodeList::nsGenericDOMNodeList() { - mRefCnt = 0; + NS_INIT_REFCNT(); mScriptObject = nsnull; } diff --git a/mozilla/content/base/src/nsNameSpaceManager.cpp b/mozilla/content/base/src/nsNameSpaceManager.cpp index 96e726aa650..9c75756b9ca 100644 --- a/mozilla/content/base/src/nsNameSpaceManager.cpp +++ b/mozilla/content/base/src/nsNameSpaceManager.cpp @@ -38,14 +38,20 @@ static PRInt32 gNameSpaceTableRefs; static nsHashtable* gURIToIDTable; static nsVoidArray* gURIArray; +MOZ_DECL_CTOR_COUNTER(NameSpaceURIKey); + class NameSpaceURIKey : public nsHashKey { public: NameSpaceURIKey(const nsString* aString) : mString(aString) - { } + { + MOZ_COUNT_CTOR(NameSpaceURIKey); + } virtual ~NameSpaceURIKey(void) - { } + { + MOZ_COUNT_DTOR(NameSpaceURIKey); + } virtual PRUint32 HashValue(void) const { @@ -191,7 +197,6 @@ public: PRInt32 mID; }; - NameSpaceImpl::NameSpaceImpl(nsINameSpaceManager* aManager, NameSpaceImpl* aParent, nsIAtom* aPrefix, @@ -384,7 +389,6 @@ protected: }; - NameSpaceManagerImpl::NameSpaceManagerImpl() { NS_INIT_REFCNT(); diff --git a/mozilla/content/base/src/nsRange.cpp b/mozilla/content/base/src/nsRange.cpp index d1e605563e5..3cecdf1e2a8 100644 --- a/mozilla/content/base/src/nsRange.cpp +++ b/mozilla/content/base/src/nsRange.cpp @@ -267,7 +267,7 @@ PRBool GetNodeBracketPoints(nsIContent* aNode, /****************************************************** * constructor/destructor ******************************************************/ - + nsRange::nsRange() : mIsPositioned(PR_FALSE), mStartOffset(0), @@ -287,7 +287,7 @@ nsRange::~nsRange() } /****************************************************** - * XPCOM cruft + * nsISupports ******************************************************/ NS_IMPL_ADDREF(nsRange) diff --git a/mozilla/content/base/src/nsRange.h b/mozilla/content/base/src/nsRange.h index 7b6e1771a90..c588bb6a719 100644 --- a/mozilla/content/base/src/nsRange.h +++ b/mozilla/content/base/src/nsRange.h @@ -15,6 +15,8 @@ * Copyright (C) 1998 Netscape Communications Corporation. All Rights * Reserved. */ +#ifndef nsRange_h___ +#define nsRange_h___ /* * nsRange.h: interface of the nsRange object. @@ -207,3 +209,5 @@ PRBool GetNodeBracketPoints(nsIContent* aNode, nsCOMPtr* outParent, PRInt32* outStartOffset, PRInt32* outEndOffset); + +#endif /* nsRange_h___ */ diff --git a/mozilla/content/base/src/nsStyleContext.cpp b/mozilla/content/base/src/nsStyleContext.cpp index 449ff08acda..15790461e19 100644 --- a/mozilla/content/base/src/nsStyleContext.cpp +++ b/mozilla/content/base/src/nsStyleContext.cpp @@ -26,8 +26,6 @@ #include "nsIFrame.h" -//#define DEBUG_REFS - static NS_DEFINE_IID(kIStyleContextIID, NS_ISTYLECONTEXT_IID); #define DELETE_ARRAY_IF(array) if (array) { delete[] array; array = nsnull; } @@ -1372,26 +1370,16 @@ protected: StyleContentImpl mContent; StyleUserInterfaceImpl mUserInterface; -#ifdef DEBUG_REFS - PRInt32 mInstance; -#endif }; static PRInt32 gLastDataCode; -#ifdef DEBUG_REFS -static PRInt32 gInstanceCount; -static PRInt32 gInstrument = 6; -#endif - static PRBool HashStyleRule(nsISupports* aRule, void* aData) { *((PRUint32*)aData) ^= PRUint32(aRule); return PR_TRUE; } -MOZ_DECL_CTOR_COUNTER(StyleContextImpl); - StyleContextImpl::StyleContextImpl(nsIStyleContext* aParent, nsIAtom* aPseudoTag, nsISupportsArray* aRules, @@ -1413,8 +1401,6 @@ StyleContextImpl::StyleContextImpl(nsIStyleContext* aParent, mContent(), mUserInterface() { - MOZ_COUNT_CTOR(StyleContextImpl); - NS_INIT_REFCNT(); NS_IF_ADDREF(mPseudoTag); NS_IF_ADDREF(mRules); @@ -1430,17 +1416,10 @@ StyleContextImpl::StyleContextImpl(nsIStyleContext* aParent, if (nsnull != mRules) { mRules->EnumerateForwards(HashStyleRule, &mRuleHash); } - -#ifdef DEBUG_REFS - mInstance = ++gInstanceCount; - fprintf(stdout, "%d of %d + StyleContext\n", mInstance, gInstanceCount); -#endif } StyleContextImpl::~StyleContextImpl() { - MOZ_COUNT_DTOR(StyleContextImpl); - NS_ASSERTION((nsnull == mChild) && (nsnull == mEmptyChild), "destructing context with children"); if (mParent) { @@ -1451,76 +1430,9 @@ StyleContextImpl::~StyleContextImpl() NS_IF_RELEASE(mPseudoTag); NS_IF_RELEASE(mRules); - -#ifdef DEBUG_REFS - fprintf(stdout, "%d of %d - StyleContext\n", mInstance, gInstanceCount); - --gInstanceCount; -#endif } -#ifdef LOG_ADDREF_RELEASE -extern "C" { - void __log_addref(void* p, int oldrc, int newrc); - void __log_release(void* p, int oldrc, int newrc); -} - -NS_IMPL_QUERY_INTERFACE(StyleContextImpl, kIStyleContextIID) - -nsrefcnt StyleContextImpl::AddRef(void) -{ - NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); - __log_addref((void*) this, mRefCnt, mRefCnt + 1); - ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "StyleContextImpl"); - return mRefCnt; -} - -nsrefcnt StyleContextImpl::Release(void) -{ - NS_PRECONDITION(0 != mRefCnt, "dup release"); - __log_release((void*) this, mRefCnt, mRefCnt - 1); - --mRefCnt; - NS_LOG_RELEASE(this, mRefCnt, "StyleContextImpl"); - if (mRefCnt == 0) { - NS_DELETEXPCOM(this); - return 0; - } - return mRefCnt; -} -#else - -#ifdef DEBUG_REFS -NS_IMPL_QUERY_INTERFACE(StyleContextImpl, kIStyleContextIID) - -nsrefcnt StyleContextImpl::AddRef(void) -{ - if ((gInstrument == -1) || (mInstance == gInstrument)) { - fprintf(stdout, "%d AddRef StyleContext %d\n", mRefCnt + 1, mInstance); - } - ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "StyleContextImpl"); - return mRefCnt; -} - -nsrefcnt StyleContextImpl::Release(void) -{ - if ((gInstrument == -1) || (mInstance == gInstrument)) { - fprintf(stdout, "%d Release StyleContext %d\n", mRefCnt - 1, mInstance); - } - --mRefCnt; - NS_LOG_RELEASE(this, mRefCnt, "StyleContextImpl"); - if (mRefCnt == 0) { - delete this; - return 0; - } - return mRefCnt; -} -#else NS_IMPL_ISUPPORTS(StyleContextImpl, kIStyleContextIID) -#endif -#endif - - nsIStyleContext* StyleContextImpl::GetParent(void) const { diff --git a/mozilla/content/base/src/nsStyleSet.cpp b/mozilla/content/base/src/nsStyleSet.cpp index 69a94c90558..ab6db6c3ea1 100644 --- a/mozilla/content/base/src/nsStyleSet.cpp +++ b/mozilla/content/base/src/nsStyleSet.cpp @@ -200,8 +200,6 @@ protected: #endif }; -MOZ_DECL_CTOR_COUNTER(StyleSetImpl); - StyleSetImpl::StyleSetImpl() : mOverrideSheets(nsnull), mDocSheets(nsnull), @@ -210,13 +208,11 @@ StyleSetImpl::StyleSetImpl() mRecycler(nsnull), mFrameConstructor(nsnull) { - MOZ_COUNT_CTOR(StyleSetImpl); NS_INIT_REFCNT(); } StyleSetImpl::~StyleSetImpl() { - MOZ_COUNT_DTOR(StyleSetImpl); NS_IF_RELEASE(mOverrideSheets); NS_IF_RELEASE(mDocSheets); NS_IF_RELEASE(mBackstopSheets); diff --git a/mozilla/content/base/src/nsTextNode.cpp b/mozilla/content/base/src/nsTextNode.cpp index ff9b33eab90..38707d1a4c2 100644 --- a/mozilla/content/base/src/nsTextNode.cpp +++ b/mozilla/content/base/src/nsTextNode.cpp @@ -74,7 +74,6 @@ protected: PRUint32 mContentID; }; -nsresult NS_NewTextNode(nsIContent** aInstancePtrResult); nsresult NS_NewTextNode(nsIContent** aInstancePtrResult) { diff --git a/mozilla/content/events/src/nsPrivateTextRange.cpp b/mozilla/content/events/src/nsPrivateTextRange.cpp index 6820b20eace..b61543f6aef 100644 --- a/mozilla/content/events/src/nsPrivateTextRange.cpp +++ b/mozilla/content/events/src/nsPrivateTextRange.cpp @@ -31,7 +31,6 @@ nsPrivateTextRange::nsPrivateTextRange(PRUint16 aRangeStart, PRUint16 aRangeEnd, nsPrivateTextRange::~nsPrivateTextRange(void) { - } NS_IMPL_ADDREF(nsPrivateTextRange) diff --git a/mozilla/content/html/content/src/nsGenericDOMHTMLCollection.cpp b/mozilla/content/html/content/src/nsGenericDOMHTMLCollection.cpp index 3af07046a79..c2e040b833e 100644 --- a/mozilla/content/html/content/src/nsGenericDOMHTMLCollection.cpp +++ b/mozilla/content/html/content/src/nsGenericDOMHTMLCollection.cpp @@ -16,21 +16,18 @@ * Corporation. Portions created by Netscape are Copyright (C) 1998 * Netscape Communications Corporation. All Rights Reserved. */ - +#include "nslayout.h" #include "nsGenericDOMHTMLCollection.h" -MOZ_DECL_CTOR_COUNTER(nsGenericDOMHTMLCollection); nsGenericDOMHTMLCollection::nsGenericDOMHTMLCollection() { - MOZ_COUNT_CTOR(nsGenericDOMHTMLCollection); mRefCnt = 0; mScriptObject = nsnull; } nsGenericDOMHTMLCollection::~nsGenericDOMHTMLCollection() { - MOZ_COUNT_DTOR(nsGenericDOMHTMLCollection); } nsresult diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp index c41be6b6250..5c929f4bb93 100644 --- a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp +++ b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp @@ -1067,7 +1067,9 @@ nsGenericHTMLElement::GetInlineStyleRules(nsISupportsArray* aRules) if (NS_CONTENT_ATTR_HAS_VALUE == mAttributes->GetAttribute(nsHTMLAtoms::style, value)) { if (eHTMLUnit_ISupports == value.GetUnit()) { nsISupports* supports = value.GetISupportsValue(); - result = supports->QueryInterface(kIStyleRuleIID, (void**)&rule); + if (supports) { + result = supports->QueryInterface(kIStyleRuleIID, (void**)&rule); + } NS_RELEASE(supports); } } @@ -1334,16 +1336,19 @@ nsGenericHTMLElement::AttributeToString(nsIAtom* aAttribute, if (nsHTMLAtoms::style == aAttribute) { if (eHTMLUnit_ISupports == aValue.GetUnit()) { nsIStyleRule* rule = (nsIStyleRule*) aValue.GetISupportsValue(); - nsICSSStyleRule* cssRule; - if (NS_OK == rule->QueryInterface(kICSSStyleRuleIID, (void**)&cssRule)) { - nsICSSDeclaration* decl = cssRule->GetDeclaration(); - if (nsnull != decl) { - decl->ToString(aResult); + if (rule) { + nsICSSStyleRule* cssRule; + if (NS_OK == rule->QueryInterface(kICSSStyleRuleIID, (void**)&cssRule)) { + nsICSSDeclaration* decl = cssRule->GetDeclaration(); + if (nsnull != decl) { + decl->ToString(aResult); + } + NS_RELEASE(cssRule); } - NS_RELEASE(cssRule); - } - else { - aResult = "Unknown rule type"; + else { + aResult = "Unknown rule type"; + } + NS_RELEASE(rule); } return NS_CONTENT_ATTR_HAS_VALUE; } diff --git a/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp b/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp index 4f9bfd96ca5..7fa482ed2fc 100644 --- a/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLAnchorElement.cpp @@ -126,18 +126,15 @@ NS_NewHTMLAnchorElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLAnchorElement); nsHTMLAnchorElement::nsHTMLAnchorElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLAnchorElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLAnchorElement::~nsHTMLAnchorElement() { - MOZ_COUNT_DTOR(nsHTMLAnchorElement); } NS_IMPL_ADDREF(nsHTMLAnchorElement) diff --git a/mozilla/content/html/content/src/nsHTMLAppletElement.cpp b/mozilla/content/html/content/src/nsHTMLAppletElement.cpp index 0569de8b43b..5b62bb6d4d5 100644 --- a/mozilla/content/html/content/src/nsHTMLAppletElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLAppletElement.cpp @@ -125,11 +125,9 @@ NS_NewHTMLAppletElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLAppletElement); nsHTMLAppletElement::nsHTMLAppletElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLAppletElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mReflectedApplet = PR_FALSE; @@ -137,7 +135,6 @@ nsHTMLAppletElement::nsHTMLAppletElement(nsIAtom* aTag) nsHTMLAppletElement::~nsHTMLAppletElement() { - MOZ_COUNT_DTOR(nsHTMLAppletElement); } NS_IMPL_ADDREF(nsHTMLAppletElement) diff --git a/mozilla/content/html/content/src/nsHTMLAreaElement.cpp b/mozilla/content/html/content/src/nsHTMLAreaElement.cpp index 153aa4b7567..32fff98fc5d 100644 --- a/mozilla/content/html/content/src/nsHTMLAreaElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLAreaElement.cpp @@ -106,18 +106,15 @@ NS_NewHTMLAreaElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLAreaElement); nsHTMLAreaElement::nsHTMLAreaElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLAreaElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLAreaElement::~nsHTMLAreaElement() { - MOZ_COUNT_DTOR(nsHTMLAreaElement); } NS_IMPL_ADDREF(nsHTMLAreaElement) diff --git a/mozilla/content/html/content/src/nsHTMLBRElement.cpp b/mozilla/content/html/content/src/nsHTMLBRElement.cpp index 1c64346cc09..fabcb1c606c 100644 --- a/mozilla/content/html/content/src/nsHTMLBRElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLBRElement.cpp @@ -85,18 +85,15 @@ NS_NewHTMLBRElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLBRElement); nsHTMLBRElement::nsHTMLBRElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLBRElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLBRElement::~nsHTMLBRElement() { - MOZ_COUNT_DTOR(nsHTMLBRElement); } NS_IMPL_ADDREF(nsHTMLBRElement) diff --git a/mozilla/content/html/content/src/nsHTMLBaseElement.cpp b/mozilla/content/html/content/src/nsHTMLBaseElement.cpp index 2f8420c358e..c16a596818b 100644 --- a/mozilla/content/html/content/src/nsHTMLBaseElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLBaseElement.cpp @@ -86,18 +86,15 @@ NS_NewHTMLBaseElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLBaseElement); nsHTMLBaseElement::nsHTMLBaseElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLBaseElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLBaseElement::~nsHTMLBaseElement() { - MOZ_COUNT_DTOR(nsHTMLBaseElement); } NS_IMPL_ADDREF(nsHTMLBaseElement) diff --git a/mozilla/content/html/content/src/nsHTMLBaseFontElement.cpp b/mozilla/content/html/content/src/nsHTMLBaseFontElement.cpp index d0a471cdc89..166fb96b310 100644 --- a/mozilla/content/html/content/src/nsHTMLBaseFontElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLBaseFontElement.cpp @@ -88,18 +88,15 @@ NS_NewHTMLBaseFontElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLBaseFontElement); nsHTMLBaseFontElement::nsHTMLBaseFontElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLBaseFontElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLBaseFontElement::~nsHTMLBaseFontElement() { - MOZ_COUNT_DTOR(nsHTMLBaseFontElement); } NS_IMPL_ADDREF(nsHTMLBaseFontElement) diff --git a/mozilla/content/html/content/src/nsHTMLBodyElement.cpp b/mozilla/content/html/content/src/nsHTMLBodyElement.cpp index aa2a06238b7..81503510554 100644 --- a/mozilla/content/html/content/src/nsHTMLBodyElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLBodyElement.cpp @@ -116,19 +116,16 @@ public: BodyFixupRule* mInlineStyleRule; }; -MOZ_DECL_CTOR_COUNTER(nsBodyInner); nsBodyInner::nsBodyInner() : nsGenericHTMLContainerElement(), mContentStyleRule(nsnull), mInlineStyleRule(nsnull) { - MOZ_COUNT_CTOR(nsBodyInner); } nsBodyInner::~nsBodyInner() { - MOZ_COUNT_DTOR(nsBodyInner); if (nsnull != mContentStyleRule) { mContentStyleRule->mPart = nsnull; mContentStyleRule->mSheet = nsnull; @@ -215,11 +212,9 @@ friend class BodyFixupRule; //---------------------------------------------------------------------- -MOZ_DECL_CTOR_COUNTER(BodyRule); BodyRule::BodyRule(nsHTMLBodyElement* aPart, nsIHTMLStyleSheet* aSheet) { - MOZ_COUNT_CTOR(BodyRule); NS_INIT_REFCNT(); mPart = aPart; mSheet = aSheet; @@ -227,7 +222,6 @@ BodyRule::BodyRule(nsHTMLBodyElement* aPart, nsIHTMLStyleSheet* aSheet) BodyRule::~BodyRule() { - MOZ_COUNT_DTOR(BodyRule); } NS_IMPL_ISUPPORTS(BodyRule, kIStyleRuleIID); @@ -395,19 +389,16 @@ BodyRule::List(FILE* out, PRInt32 aIndent) const //---------------------------------------------------------------------- -MOZ_DECL_CTOR_COUNTER(BodyFixupRule); BodyFixupRule::BodyFixupRule(nsHTMLBodyElement* aPart, nsIHTMLCSSStyleSheet* aSheet) : mPart(aPart), mSheet(aSheet) { - MOZ_COUNT_CTOR(BodyFixupRule); NS_INIT_REFCNT(); } BodyFixupRule::~BodyFixupRule() { - MOZ_COUNT_DTOR(BodyFixupRule); } NS_IMPL_ADDREF(BodyFixupRule); @@ -570,18 +561,15 @@ NS_NewHTMLBodyElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLBodyElement); nsHTMLBodyElement::nsHTMLBodyElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLBodyElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLBodyElement::~nsHTMLBodyElement() { - MOZ_COUNT_DTOR(nsHTMLBodyElement); } NS_IMPL_ADDREF(nsHTMLBodyElement) diff --git a/mozilla/content/html/content/src/nsHTMLButtonElement.cpp b/mozilla/content/html/content/src/nsHTMLButtonElement.cpp index 0330ab37261..206aeb17957 100644 --- a/mozilla/content/html/content/src/nsHTMLButtonElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLButtonElement.cpp @@ -129,11 +129,9 @@ NS_NewHTMLButtonElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLButtonElement); nsHTMLButtonElement::nsHTMLButtonElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLButtonElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mForm = nsnull; @@ -142,7 +140,6 @@ nsHTMLButtonElement::nsHTMLButtonElement(nsIAtom* aTag) nsHTMLButtonElement::~nsHTMLButtonElement() { - MOZ_COUNT_DTOR(nsHTMLButtonElement); if (nsnull != mForm) { // prevent mForm from decrementing its ref count on us mForm->RemoveElement(this, PR_FALSE); @@ -152,13 +149,7 @@ nsHTMLButtonElement::~nsHTMLButtonElement() // nsISupports -NS_IMETHODIMP_(nsrefcnt) -nsHTMLButtonElement::AddRef(void) -{ - ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "nsHTMLButtonElement"); - return mRefCnt; -} +NS_IMPL_ADDREF(nsHTMLButtonElement); nsresult nsHTMLButtonElement::QueryInterface(REFNSIID aIID, void** aInstancePtr) diff --git a/mozilla/content/html/content/src/nsHTMLDListElement.cpp b/mozilla/content/html/content/src/nsHTMLDListElement.cpp index 9293f3bb61c..488496419f4 100644 --- a/mozilla/content/html/content/src/nsHTMLDListElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLDListElement.cpp @@ -85,18 +85,15 @@ NS_NewHTMLDListElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLDListElement); nsHTMLDListElement::nsHTMLDListElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLDListElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLDListElement::~nsHTMLDListElement() { - MOZ_COUNT_DTOR(nsHTMLDListElement); } NS_IMPL_ADDREF(nsHTMLDListElement) diff --git a/mozilla/content/html/content/src/nsHTMLDelElement.cpp b/mozilla/content/html/content/src/nsHTMLDelElement.cpp index 31f9a943632..5bdc380c701 100644 --- a/mozilla/content/html/content/src/nsHTMLDelElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLDelElement.cpp @@ -86,18 +86,15 @@ NS_NewHTMLDelElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLDelElement); nsHTMLDelElement::nsHTMLDelElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLDelElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLDelElement::~nsHTMLDelElement() { - MOZ_COUNT_DTOR(nsHTMLDelElement); } NS_IMPL_ADDREF(nsHTMLDelElement) diff --git a/mozilla/content/html/content/src/nsHTMLDirectoryElement.cpp b/mozilla/content/html/content/src/nsHTMLDirectoryElement.cpp index 60dc7bf818d..5b8453f282d 100644 --- a/mozilla/content/html/content/src/nsHTMLDirectoryElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLDirectoryElement.cpp @@ -89,18 +89,15 @@ NS_NewHTMLDirectoryElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLDirectoryElement); nsHTMLDirectoryElement::nsHTMLDirectoryElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLDirectoryElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLDirectoryElement::~nsHTMLDirectoryElement() { - MOZ_COUNT_DTOR(nsHTMLDirectoryElement); } NS_IMPL_ADDREF(nsHTMLDirectoryElement) diff --git a/mozilla/content/html/content/src/nsHTMLDivElement.cpp b/mozilla/content/html/content/src/nsHTMLDivElement.cpp index eb79ac37f80..a182b427af4 100644 --- a/mozilla/content/html/content/src/nsHTMLDivElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLDivElement.cpp @@ -87,22 +87,18 @@ NS_NewHTMLDivElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLDivElement); nsHTMLDivElement::nsHTMLDivElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLDivElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLDivElement::~nsHTMLDivElement() { - MOZ_COUNT_DTOR(nsHTMLDivElement); } NS_IMPL_ADDREF(nsHTMLDivElement) - NS_IMPL_RELEASE(nsHTMLDivElement) nsresult diff --git a/mozilla/content/html/content/src/nsHTMLEmbedElement.cpp b/mozilla/content/html/content/src/nsHTMLEmbedElement.cpp index 3f740b1ec66..c0ebd73d863 100644 --- a/mozilla/content/html/content/src/nsHTMLEmbedElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLEmbedElement.cpp @@ -84,18 +84,15 @@ NS_NewHTMLEmbedElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLEmbedElement); nsHTMLEmbedElement::nsHTMLEmbedElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLEmbedElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLEmbedElement::~nsHTMLEmbedElement() { - MOZ_COUNT_DTOR(nsHTMLEmbedElement); } NS_IMPL_ADDREF(nsHTMLEmbedElement) diff --git a/mozilla/content/html/content/src/nsHTMLFieldSetElement.cpp b/mozilla/content/html/content/src/nsHTMLFieldSetElement.cpp index b536967def0..54d6af12adc 100644 --- a/mozilla/content/html/content/src/nsHTMLFieldSetElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLFieldSetElement.cpp @@ -99,11 +99,9 @@ NS_NewHTMLFieldSetElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLFieldSetElement); nsHTMLFieldSetElement::nsHTMLFieldSetElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLFieldSetElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mForm = nsnull; @@ -111,7 +109,6 @@ nsHTMLFieldSetElement::nsHTMLFieldSetElement(nsIAtom* aTag) nsHTMLFieldSetElement::~nsHTMLFieldSetElement() { - MOZ_COUNT_DTOR(nsHTMLFieldSetElement); if (nsnull != mForm) { // prevent mForm from decrementing its ref count on us mForm->RemoveElement(this, PR_FALSE); diff --git a/mozilla/content/html/content/src/nsHTMLFontElement.cpp b/mozilla/content/html/content/src/nsHTMLFontElement.cpp index 1dde753a789..79d12a300c7 100644 --- a/mozilla/content/html/content/src/nsHTMLFontElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLFontElement.cpp @@ -92,18 +92,15 @@ NS_NewHTMLFontElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLFontElement); nsHTMLFontElement::nsHTMLFontElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLFontElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLFontElement::~nsHTMLFontElement() { - MOZ_COUNT_DTOR(nsHTMLFontElement); } NS_IMPL_ADDREF(nsHTMLFontElement) diff --git a/mozilla/content/html/content/src/nsHTMLFormElement.cpp b/mozilla/content/html/content/src/nsHTMLFormElement.cpp index f6600ca3018..1fa2d447a86 100644 --- a/mozilla/content/html/content/src/nsHTMLFormElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLFormElement.cpp @@ -174,11 +174,9 @@ NS_NewHTMLFormElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLFormElement); nsHTMLFormElement::nsHTMLFormElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLFormElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mControls = new nsFormControlList(); @@ -188,7 +186,6 @@ nsHTMLFormElement::nsHTMLFormElement(nsIAtom* aTag) nsHTMLFormElement::~nsHTMLFormElement() { - MOZ_COUNT_DTOR(nsHTMLFormElement); // set the controls to have no form PRUint32 numControls; @@ -239,19 +236,11 @@ nsHTMLFormElement::QueryInterface(REFNSIID aIID, void** aInstancePtr) return NS_NOINTERFACE; } -NS_IMETHODIMP_(nsrefcnt) -nsHTMLFormElement::AddRef(void) -{ - //nsTraceRefcnt::AddRef((nsIForm*)this, mRefCnt+1, __FILE__, __LINE__); - ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "nsHTMLFormElement"); - return mRefCnt; -} +NS_IMPL_ADDREF(nsHTMLFormElement); NS_IMETHODIMP_(nsrefcnt) nsHTMLFormElement::Release() { - //nsTraceRefcnt::Release((nsIForm*)this, mRefCnt-1, __FILE__, __LINE__); --mRefCnt; NS_LOG_RELEASE(this, mRefCnt, "nsHTMLFormElement"); PRUint32 numChildren; @@ -639,18 +628,15 @@ nsHTMLFormElement::Item(PRUint32 aIndex, nsIDOMElement** aReturn) // nsFormControlList implementation, this could go away if there were a lightweight collection implementation somewhere -MOZ_DECL_CTOR_COUNTER(nsFormControlList); nsFormControlList::nsFormControlList() { - MOZ_COUNT_CTOR(nsFormControlList); NS_INIT_REFCNT(); mScriptObject = nsnull; } nsFormControlList::~nsFormControlList() { - MOZ_COUNT_DTOR(nsFormControlList); Clear(); } diff --git a/mozilla/content/html/content/src/nsHTMLFrameElement.cpp b/mozilla/content/html/content/src/nsHTMLFrameElement.cpp index 0c011910ea0..53c3ec05af4 100644 --- a/mozilla/content/html/content/src/nsHTMLFrameElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLFrameElement.cpp @@ -98,18 +98,15 @@ NS_NewHTMLFrameElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLFrameElement); nsHTMLFrameElement::nsHTMLFrameElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLFrameElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLFrameElement::~nsHTMLFrameElement() { - MOZ_COUNT_DTOR(nsHTMLFrameElement); } NS_IMPL_ADDREF(nsHTMLFrameElement) diff --git a/mozilla/content/html/content/src/nsHTMLFrameSetElement.cpp b/mozilla/content/html/content/src/nsHTMLFrameSetElement.cpp index d8e5a0666c8..d25eed9eec8 100644 --- a/mozilla/content/html/content/src/nsHTMLFrameSetElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLFrameSetElement.cpp @@ -86,18 +86,15 @@ NS_NewHTMLFrameSetElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLFrameSetElement); nsHTMLFrameSetElement::nsHTMLFrameSetElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLFrameSetElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLFrameSetElement::~nsHTMLFrameSetElement() { - MOZ_COUNT_DTOR(nsHTMLFrameSetElement); } NS_IMPL_ADDREF(nsHTMLFrameSetElement) diff --git a/mozilla/content/html/content/src/nsHTMLHRElement.cpp b/mozilla/content/html/content/src/nsHTMLHRElement.cpp index 9636040ee4e..b5d2dab6b9f 100644 --- a/mozilla/content/html/content/src/nsHTMLHRElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLHRElement.cpp @@ -91,18 +91,15 @@ NS_NewHTMLHRElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLHRElement); nsHTMLHRElement::nsHTMLHRElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLHRElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLHRElement::~nsHTMLHRElement() { - MOZ_COUNT_DTOR(nsHTMLHRElement); } NS_IMPL_ADDREF(nsHTMLHRElement) diff --git a/mozilla/content/html/content/src/nsHTMLHeadElement.cpp b/mozilla/content/html/content/src/nsHTMLHeadElement.cpp index 393d40b2168..32fe831ddcb 100644 --- a/mozilla/content/html/content/src/nsHTMLHeadElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLHeadElement.cpp @@ -84,18 +84,15 @@ NS_NewHTMLHeadElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLHeadElement); nsHTMLHeadElement::nsHTMLHeadElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLHeadElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLHeadElement::~nsHTMLHeadElement() { - MOZ_COUNT_DTOR(nsHTMLHeadElement); } NS_IMPL_ADDREF(nsHTMLHeadElement) diff --git a/mozilla/content/html/content/src/nsHTMLHeadingElement.cpp b/mozilla/content/html/content/src/nsHTMLHeadingElement.cpp index c474ad4267d..2172e6e4c01 100644 --- a/mozilla/content/html/content/src/nsHTMLHeadingElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLHeadingElement.cpp @@ -85,18 +85,15 @@ NS_NewHTMLHeadingElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLHeadingElement); nsHTMLHeadingElement::nsHTMLHeadingElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLHeadingElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLHeadingElement::~nsHTMLHeadingElement() { - MOZ_COUNT_DTOR(nsHTMLHeadingElement); } NS_IMPL_ADDREF(nsHTMLHeadingElement) diff --git a/mozilla/content/html/content/src/nsHTMLHtmlElement.cpp b/mozilla/content/html/content/src/nsHTMLHtmlElement.cpp index e8803370e2d..c5f26a23186 100644 --- a/mozilla/content/html/content/src/nsHTMLHtmlElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLHtmlElement.cpp @@ -89,17 +89,14 @@ NS_NewHTMLHtmlElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLHtmlElement); nsHTMLHtmlElement::nsHTMLHtmlElement() { - MOZ_COUNT_CTOR(nsHTMLHtmlElement); NS_INIT_REFCNT(); } nsHTMLHtmlElement::~nsHTMLHtmlElement() { - MOZ_COUNT_DTOR(nsHTMLHtmlElement); } NS_IMPL_ADDREF(nsHTMLHtmlElement) diff --git a/mozilla/content/html/content/src/nsHTMLIFrameElement.cpp b/mozilla/content/html/content/src/nsHTMLIFrameElement.cpp index 7e589dd2fa0..1544d9256ac 100644 --- a/mozilla/content/html/content/src/nsHTMLIFrameElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLIFrameElement.cpp @@ -110,18 +110,15 @@ NS_NewHTMLIFrameElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLIFrameElement); nsHTMLIFrameElement::nsHTMLIFrameElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLIFrameElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLIFrameElement::~nsHTMLIFrameElement() { - MOZ_COUNT_DTOR(nsHTMLIFrameElement); } NS_IMPL_ADDREF(nsHTMLIFrameElement) diff --git a/mozilla/content/html/content/src/nsHTMLImageElement.cpp b/mozilla/content/html/content/src/nsHTMLImageElement.cpp index a112b664c58..fd0e874a6ef 100644 --- a/mozilla/content/html/content/src/nsHTMLImageElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLImageElement.cpp @@ -147,11 +147,9 @@ NS_NewHTMLImageElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLImageElement); nsHTMLImageElement::nsHTMLImageElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLImageElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mOwnerDocument = nsnull; @@ -159,7 +157,6 @@ nsHTMLImageElement::nsHTMLImageElement(nsIAtom* aTag) nsHTMLImageElement::~nsHTMLImageElement() { - MOZ_COUNT_DTOR(nsHTMLImageElement); NS_IF_RELEASE(mOwnerDocument); } diff --git a/mozilla/content/html/content/src/nsHTMLInputElement.cpp b/mozilla/content/html/content/src/nsHTMLInputElement.cpp index 9175370e140..b83ea57d364 100644 --- a/mozilla/content/html/content/src/nsHTMLInputElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLInputElement.cpp @@ -162,11 +162,9 @@ NS_NewHTMLInputElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLInputElement); nsHTMLInputElement::nsHTMLInputElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLInputElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mType = NS_FORM_INPUT_TEXT; // default value @@ -177,7 +175,6 @@ nsHTMLInputElement::nsHTMLInputElement(nsIAtom* aTag) nsHTMLInputElement::~nsHTMLInputElement() { - MOZ_COUNT_DTOR(nsHTMLInputElement); if (nsnull != mForm) { // prevent mForm from decrementing its ref count on us mForm->RemoveElement(this, PR_FALSE); @@ -187,15 +184,6 @@ nsHTMLInputElement::~nsHTMLInputElement() // nsISupports -NS_IMETHODIMP_(nsrefcnt) -nsHTMLInputElement::AddRef(void) -{ - ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "nsHTMLInputElement"); - return mRefCnt; -} - - NS_IMETHODIMP nsHTMLInputElement::QueryInterface(REFNSIID aIID, void** aInstancePtr) { @@ -218,6 +206,8 @@ nsHTMLInputElement::QueryInterface(REFNSIID aIID, void** aInstancePtr) return NS_NOINTERFACE; } +NS_IMPL_ADDREF(nsHTMLInputElement); + NS_IMETHODIMP_(nsrefcnt) nsHTMLInputElement::Release() { diff --git a/mozilla/content/html/content/src/nsHTMLInsElement.cpp b/mozilla/content/html/content/src/nsHTMLInsElement.cpp index 0d4338fa410..797b9dccad3 100644 --- a/mozilla/content/html/content/src/nsHTMLInsElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLInsElement.cpp @@ -86,18 +86,15 @@ NS_NewHTMLInsElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLInsElement); nsHTMLInsElement::nsHTMLInsElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLInsElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLInsElement::~nsHTMLInsElement() { - MOZ_COUNT_DTOR(nsHTMLInsElement); } NS_IMPL_ADDREF(nsHTMLInsElement) diff --git a/mozilla/content/html/content/src/nsHTMLIsIndexElement.cpp b/mozilla/content/html/content/src/nsHTMLIsIndexElement.cpp index b8f56bd7a50..8b3ec77b2c4 100644 --- a/mozilla/content/html/content/src/nsHTMLIsIndexElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLIsIndexElement.cpp @@ -85,18 +85,15 @@ NS_NewHTMLIsIndexElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLIsIndexElement); nsHTMLIsIndexElement::nsHTMLIsIndexElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLIsIndexElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLIsIndexElement::~nsHTMLIsIndexElement() { - MOZ_COUNT_DTOR(nsHTMLIsIndexElement); } NS_IMPL_ADDREF(nsHTMLIsIndexElement) diff --git a/mozilla/content/html/content/src/nsHTMLLIElement.cpp b/mozilla/content/html/content/src/nsHTMLLIElement.cpp index ee22d628a38..0fd5fe699f9 100644 --- a/mozilla/content/html/content/src/nsHTMLLIElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLLIElement.cpp @@ -87,18 +87,15 @@ NS_NewHTMLLIElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLLIElement); nsHTMLLIElement::nsHTMLLIElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLLIElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLLIElement::~nsHTMLLIElement() { - MOZ_COUNT_DTOR(nsHTMLLIElement); } NS_IMPL_ADDREF(nsHTMLLIElement) diff --git a/mozilla/content/html/content/src/nsHTMLLabelElement.cpp b/mozilla/content/html/content/src/nsHTMLLabelElement.cpp index 98246fe2ea4..4c27c1ab429 100644 --- a/mozilla/content/html/content/src/nsHTMLLabelElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLLabelElement.cpp @@ -103,11 +103,9 @@ NS_NewHTMLLabelElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLLabelElement); nsHTMLLabelElement::nsHTMLLabelElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLLabelElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mForm = nsnull; @@ -115,7 +113,6 @@ nsHTMLLabelElement::nsHTMLLabelElement(nsIAtom* aTag) nsHTMLLabelElement::~nsHTMLLabelElement() { - MOZ_COUNT_DTOR(nsHTMLLabelElement); if (nsnull != mForm) { // prevent mForm from decrementing its ref count on us mForm->RemoveElement(this, PR_FALSE); diff --git a/mozilla/content/html/content/src/nsHTMLLegendElement.cpp b/mozilla/content/html/content/src/nsHTMLLegendElement.cpp index a186e76029e..ba8f9c99325 100644 --- a/mozilla/content/html/content/src/nsHTMLLegendElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLLegendElement.cpp @@ -93,11 +93,9 @@ NS_NewHTMLLegendElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLLegendElement); nsHTMLLegendElement::nsHTMLLegendElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLLegendElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mForm = nsnull; @@ -105,7 +103,6 @@ nsHTMLLegendElement::nsHTMLLegendElement(nsIAtom* aTag) nsHTMLLegendElement::~nsHTMLLegendElement() { - MOZ_COUNT_DTOR(nsHTMLLegendElement); if (mForm) { NS_RELEASE(mForm); } diff --git a/mozilla/content/html/content/src/nsHTMLLinkElement.cpp b/mozilla/content/html/content/src/nsHTMLLinkElement.cpp index 98af84a8c1c..69d08596346 100644 --- a/mozilla/content/html/content/src/nsHTMLLinkElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLLinkElement.cpp @@ -111,11 +111,9 @@ NS_NewHTMLLinkElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLLinkElement); nsHTMLLinkElement::nsHTMLLinkElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLLinkElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mStyleSheet = nsnull; @@ -123,7 +121,6 @@ nsHTMLLinkElement::nsHTMLLinkElement(nsIAtom* aTag) nsHTMLLinkElement::~nsHTMLLinkElement() { - MOZ_COUNT_DTOR(nsHTMLLinkElement); NS_IF_RELEASE(mStyleSheet); } diff --git a/mozilla/content/html/content/src/nsHTMLMapElement.cpp b/mozilla/content/html/content/src/nsHTMLMapElement.cpp index f29f1b3b0a0..7ca31ada331 100644 --- a/mozilla/content/html/content/src/nsHTMLMapElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLMapElement.cpp @@ -199,11 +199,9 @@ NS_NewHTMLMapElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLMapElement); nsHTMLMapElement::nsHTMLMapElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLMapElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mAreas = nsnull; @@ -211,7 +209,6 @@ nsHTMLMapElement::nsHTMLMapElement(nsIAtom* aTag) nsHTMLMapElement::~nsHTMLMapElement() { - MOZ_COUNT_DTOR(nsHTMLMapElement); if (nsnull != mAreas) { mAreas->ParentDestroyed(); NS_RELEASE(mAreas); diff --git a/mozilla/content/html/content/src/nsHTMLMenuElement.cpp b/mozilla/content/html/content/src/nsHTMLMenuElement.cpp index a4192c2e1e7..9de4785f783 100644 --- a/mozilla/content/html/content/src/nsHTMLMenuElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLMenuElement.cpp @@ -89,18 +89,15 @@ NS_NewHTMLMenuElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLMenuElement); nsHTMLMenuElement::nsHTMLMenuElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLMenuElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLMenuElement::~nsHTMLMenuElement() { - MOZ_COUNT_DTOR(nsHTMLMenuElement); } NS_IMPL_ADDREF(nsHTMLMenuElement) diff --git a/mozilla/content/html/content/src/nsHTMLMetaElement.cpp b/mozilla/content/html/content/src/nsHTMLMetaElement.cpp index d0b7de36b28..89710af5011 100644 --- a/mozilla/content/html/content/src/nsHTMLMetaElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLMetaElement.cpp @@ -90,11 +90,9 @@ NS_NewHTMLMetaElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLMetaElement); nsHTMLMetaElement::nsHTMLMetaElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLMetaElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } @@ -102,7 +100,6 @@ nsHTMLMetaElement::nsHTMLMetaElement(nsIAtom* aTag) nsHTMLMetaElement::~nsHTMLMetaElement() { - MOZ_COUNT_DTOR(nsHTMLMetaElement); } NS_IMPL_ADDREF(nsHTMLMetaElement) diff --git a/mozilla/content/html/content/src/nsHTMLModElement.cpp b/mozilla/content/html/content/src/nsHTMLModElement.cpp index ca9ca40bee4..8297a8635d5 100644 --- a/mozilla/content/html/content/src/nsHTMLModElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLModElement.cpp @@ -86,18 +86,15 @@ NS_NewHTMLModElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLModElement); nsHTMLModElement::nsHTMLModElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLModElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLModElement::~nsHTMLModElement() { - MOZ_COUNT_DTOR(nsHTMLModElement); } NS_IMPL_ADDREF(nsHTMLModElement) diff --git a/mozilla/content/html/content/src/nsHTMLOListElement.cpp b/mozilla/content/html/content/src/nsHTMLOListElement.cpp index aea1a8eef23..f385b4b3a8e 100644 --- a/mozilla/content/html/content/src/nsHTMLOListElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLOListElement.cpp @@ -89,18 +89,15 @@ NS_NewHTMLOListElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLOListElement); nsHTMLOListElement::nsHTMLOListElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLOListElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLOListElement::~nsHTMLOListElement() { - MOZ_COUNT_DTOR(nsHTMLOListElement); } NS_IMPL_ADDREF(nsHTMLOListElement) diff --git a/mozilla/content/html/content/src/nsHTMLObjectElement.cpp b/mozilla/content/html/content/src/nsHTMLObjectElement.cpp index 8c91fc430b9..9858b662ade 100644 --- a/mozilla/content/html/content/src/nsHTMLObjectElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLObjectElement.cpp @@ -117,18 +117,15 @@ NS_NewHTMLObjectElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLObjectElement); nsHTMLObjectElement::nsHTMLObjectElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLObjectElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLObjectElement::~nsHTMLObjectElement() { - MOZ_COUNT_DTOR(nsHTMLObjectElement); } NS_IMPL_ADDREF(nsHTMLObjectElement) diff --git a/mozilla/content/html/content/src/nsHTMLOptGroupElement.cpp b/mozilla/content/html/content/src/nsHTMLOptGroupElement.cpp index cf6d132da15..15a6b384e48 100644 --- a/mozilla/content/html/content/src/nsHTMLOptGroupElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLOptGroupElement.cpp @@ -86,18 +86,15 @@ NS_NewHTMLOptGroupElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLOptGroupElement); nsHTMLOptGroupElement::nsHTMLOptGroupElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLOptGroupElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLOptGroupElement::~nsHTMLOptGroupElement() { - MOZ_COUNT_DTOR(nsHTMLOptGroupElement); } NS_IMPL_ADDREF(nsHTMLOptGroupElement) diff --git a/mozilla/content/html/content/src/nsHTMLOptionElement.cpp b/mozilla/content/html/content/src/nsHTMLOptionElement.cpp index 9dbd921f48c..2e19110fb5b 100644 --- a/mozilla/content/html/content/src/nsHTMLOptionElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLOptionElement.cpp @@ -136,18 +136,15 @@ NS_NewHTMLOptionElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLOptionElement); nsHTMLOptionElement::nsHTMLOptionElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLOptionElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLOptionElement::~nsHTMLOptionElement() { - MOZ_COUNT_DTOR(nsHTMLOptionElement); } // ISupports diff --git a/mozilla/content/html/content/src/nsHTMLParagraphElement.cpp b/mozilla/content/html/content/src/nsHTMLParagraphElement.cpp index 419acd7eeda..5f89345bfa8 100644 --- a/mozilla/content/html/content/src/nsHTMLParagraphElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLParagraphElement.cpp @@ -91,17 +91,14 @@ NS_NewHTMLParagraphElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLParagraphElement); nsHTMLParagraphElement::nsHTMLParagraphElement() { - MOZ_COUNT_CTOR(nsHTMLParagraphElement); NS_INIT_REFCNT(); } nsHTMLParagraphElement::~nsHTMLParagraphElement() { - MOZ_COUNT_DTOR(nsHTMLParagraphElement); } NS_IMPL_ADDREF(nsHTMLParagraphElement) diff --git a/mozilla/content/html/content/src/nsHTMLParamElement.cpp b/mozilla/content/html/content/src/nsHTMLParamElement.cpp index 79332d8b75d..8e3e5a16b27 100644 --- a/mozilla/content/html/content/src/nsHTMLParamElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLParamElement.cpp @@ -90,18 +90,15 @@ NS_NewHTMLParamElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLParamElement); nsHTMLParamElement::nsHTMLParamElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLParamElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLParamElement::~nsHTMLParamElement() { - MOZ_COUNT_DTOR(nsHTMLParamElement); } NS_IMPL_ADDREF(nsHTMLParamElement) diff --git a/mozilla/content/html/content/src/nsHTMLPreElement.cpp b/mozilla/content/html/content/src/nsHTMLPreElement.cpp index 44288f7b827..a4b38b4b6ba 100644 --- a/mozilla/content/html/content/src/nsHTMLPreElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLPreElement.cpp @@ -87,18 +87,15 @@ NS_NewHTMLPreElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLPreElement); nsHTMLPreElement::nsHTMLPreElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLPreElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLPreElement::~nsHTMLPreElement() { - MOZ_COUNT_DTOR(nsHTMLPreElement); } NS_IMPL_ADDREF(nsHTMLPreElement) diff --git a/mozilla/content/html/content/src/nsHTMLQuoteElement.cpp b/mozilla/content/html/content/src/nsHTMLQuoteElement.cpp index ccc44224fd5..c61373814ce 100644 --- a/mozilla/content/html/content/src/nsHTMLQuoteElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLQuoteElement.cpp @@ -84,18 +84,15 @@ NS_NewHTMLQuoteElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLQuoteElement); nsHTMLQuoteElement::nsHTMLQuoteElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLQuoteElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLQuoteElement::~nsHTMLQuoteElement() { - MOZ_COUNT_DTOR(nsHTMLQuoteElement); } NS_IMPL_ADDREF(nsHTMLQuoteElement) diff --git a/mozilla/content/html/content/src/nsHTMLScriptElement.cpp b/mozilla/content/html/content/src/nsHTMLScriptElement.cpp index 8422e697705..c0b436bda6b 100644 --- a/mozilla/content/html/content/src/nsHTMLScriptElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLScriptElement.cpp @@ -97,18 +97,15 @@ NS_NewHTMLScriptElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLScriptElement); nsHTMLScriptElement::nsHTMLScriptElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLScriptElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLScriptElement::~nsHTMLScriptElement() { - MOZ_COUNT_DTOR(nsHTMLScriptElement); } NS_IMPL_ADDREF(nsHTMLScriptElement) diff --git a/mozilla/content/html/content/src/nsHTMLSelectElement.cpp b/mozilla/content/html/content/src/nsHTMLSelectElement.cpp index 073d4b6c733..f411bfb7083 100644 --- a/mozilla/content/html/content/src/nsHTMLSelectElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLSelectElement.cpp @@ -203,11 +203,9 @@ NS_NewHTMLSelectElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLSelectElement); nsHTMLSelectElement::nsHTMLSelectElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLSelectElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mOptions = nsnull; @@ -216,7 +214,6 @@ nsHTMLSelectElement::nsHTMLSelectElement(nsIAtom* aTag) nsHTMLSelectElement::~nsHTMLSelectElement() { - MOZ_COUNT_DTOR(nsHTMLSelectElement); if (nsnull != mForm) { // prevent mForm from decrementing its ref count on us mForm->RemoveElement(this, PR_FALSE); @@ -876,11 +873,9 @@ nsOptionList::GetOptions() mDirty = PR_FALSE; } -MOZ_DECL_CTOR_COUNTER(nsOptionList); nsOptionList::nsOptionList(nsHTMLSelectElement* aSelect) { - MOZ_COUNT_CTOR(nsOptionList); mDirty = PR_TRUE; // Do not maintain a reference counted reference. When // the select goes away, it will let us know. @@ -889,7 +884,6 @@ nsOptionList::nsOptionList(nsHTMLSelectElement* aSelect) nsOptionList::~nsOptionList() { - MOZ_COUNT_DTOR(nsOptionList); DropReference(); } diff --git a/mozilla/content/html/content/src/nsHTMLSharedObjectElement.cpp b/mozilla/content/html/content/src/nsHTMLSharedObjectElement.cpp index 8c91fc430b9..9858b662ade 100644 --- a/mozilla/content/html/content/src/nsHTMLSharedObjectElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLSharedObjectElement.cpp @@ -117,18 +117,15 @@ NS_NewHTMLObjectElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLObjectElement); nsHTMLObjectElement::nsHTMLObjectElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLObjectElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLObjectElement::~nsHTMLObjectElement() { - MOZ_COUNT_DTOR(nsHTMLObjectElement); } NS_IMPL_ADDREF(nsHTMLObjectElement) diff --git a/mozilla/content/html/content/src/nsHTMLSpacerElement.cpp b/mozilla/content/html/content/src/nsHTMLSpacerElement.cpp index 4e74c30710d..bc8b28efa55 100644 --- a/mozilla/content/html/content/src/nsHTMLSpacerElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLSpacerElement.cpp @@ -83,18 +83,15 @@ NS_NewHTMLSpacerElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLSpacerElement); nsHTMLSpacerElement::nsHTMLSpacerElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLSpacerElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLSpacerElement::~nsHTMLSpacerElement() { - MOZ_COUNT_DTOR(nsHTMLSpacerElement); } NS_IMPL_ADDREF(nsHTMLSpacerElement) diff --git a/mozilla/content/html/content/src/nsHTMLSpanElement.cpp b/mozilla/content/html/content/src/nsHTMLSpanElement.cpp index 383b412ac0e..967b520ea06 100644 --- a/mozilla/content/html/content/src/nsHTMLSpanElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLSpanElement.cpp @@ -78,18 +78,15 @@ NS_NewHTMLSpanElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLSpanElement); nsHTMLSpanElement::nsHTMLSpanElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLSpanElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLSpanElement::~nsHTMLSpanElement() { - MOZ_COUNT_DTOR(nsHTMLSpanElement); } NS_IMPL_ADDREF(nsHTMLSpanElement) diff --git a/mozilla/content/html/content/src/nsHTMLStyleElement.cpp b/mozilla/content/html/content/src/nsHTMLStyleElement.cpp index 13891d1e068..ef1e8bfabdd 100644 --- a/mozilla/content/html/content/src/nsHTMLStyleElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLStyleElement.cpp @@ -101,11 +101,9 @@ NS_NewHTMLStyleElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLStyleElement); nsHTMLStyleElement::nsHTMLStyleElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLStyleElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mStyleSheet = nsnull; @@ -113,7 +111,6 @@ nsHTMLStyleElement::nsHTMLStyleElement(nsIAtom* aTag) nsHTMLStyleElement::~nsHTMLStyleElement() { - MOZ_COUNT_DTOR(nsHTMLStyleElement); NS_IF_RELEASE(mStyleSheet); } diff --git a/mozilla/content/html/content/src/nsHTMLTableCaptionElement.cpp b/mozilla/content/html/content/src/nsHTMLTableCaptionElement.cpp index 5c22ce0e7c1..6055b09a4cd 100644 --- a/mozilla/content/html/content/src/nsHTMLTableCaptionElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTableCaptionElement.cpp @@ -85,18 +85,15 @@ NS_NewHTMLTableCaptionElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLTableCaptionElement); nsHTMLTableCaptionElement::nsHTMLTableCaptionElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLTableCaptionElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLTableCaptionElement::~nsHTMLTableCaptionElement() { - MOZ_COUNT_DTOR(nsHTMLTableCaptionElement); } NS_IMPL_ADDREF(nsHTMLTableCaptionElement) diff --git a/mozilla/content/html/content/src/nsHTMLTableCellElement.cpp b/mozilla/content/html/content/src/nsHTMLTableCellElement.cpp index dacf8f27002..d1efd2d75c8 100644 --- a/mozilla/content/html/content/src/nsHTMLTableCellElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTableCellElement.cpp @@ -131,11 +131,9 @@ NS_NewHTMLTableCellElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLTableCellElement); nsHTMLTableCellElement::nsHTMLTableCellElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLTableCellElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mColIndex=0; @@ -143,7 +141,6 @@ nsHTMLTableCellElement::nsHTMLTableCellElement(nsIAtom* aTag) nsHTMLTableCellElement::~nsHTMLTableCellElement() { - MOZ_COUNT_DTOR(nsHTMLTableCellElement); } NS_IMPL_ADDREF(nsHTMLTableCellElement) diff --git a/mozilla/content/html/content/src/nsHTMLTableColElement.cpp b/mozilla/content/html/content/src/nsHTMLTableColElement.cpp index df124d5d0ab..e12f2ca24e8 100644 --- a/mozilla/content/html/content/src/nsHTMLTableColElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTableColElement.cpp @@ -101,18 +101,15 @@ NS_NewHTMLTableColElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLTableColElement); nsHTMLTableColElement::nsHTMLTableColElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLTableColElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLTableColElement::~nsHTMLTableColElement() { - MOZ_COUNT_DTOR(nsHTMLTableColElement); } NS_IMPL_ADDREF(nsHTMLTableColElement) diff --git a/mozilla/content/html/content/src/nsHTMLTableColGroupElement.cpp b/mozilla/content/html/content/src/nsHTMLTableColGroupElement.cpp index fe95dbfc91a..0e2274ca4bd 100644 --- a/mozilla/content/html/content/src/nsHTMLTableColGroupElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTableColGroupElement.cpp @@ -95,18 +95,15 @@ NS_NewHTMLTableColGroupElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTa return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLTableColGroupElement); nsHTMLTableColGroupElement::nsHTMLTableColGroupElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLTableColGroupElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLTableColGroupElement::~nsHTMLTableColGroupElement() { - MOZ_COUNT_DTOR(nsHTMLTableColGroupElement); } NS_IMPL_ADDREF(nsHTMLTableColGroupElement) diff --git a/mozilla/content/html/content/src/nsHTMLTableElement.cpp b/mozilla/content/html/content/src/nsHTMLTableElement.cpp index 382f3c8592e..cd0924e15f9 100644 --- a/mozilla/content/html/content/src/nsHTMLTableElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTableElement.cpp @@ -149,18 +149,15 @@ protected: nsHTMLTableElement * mParent; }; -MOZ_DECL_CTOR_COUNTER(TableRowsCollection); TableRowsCollection::TableRowsCollection(nsHTMLTableElement *aParent) : nsGenericDOMHTMLCollection() { - MOZ_COUNT_CTOR(TableRowsCollection); mParent = aParent; } TableRowsCollection::~TableRowsCollection() { - MOZ_COUNT_DTOR(TableRowsCollection); // we do NOT have a ref-counted reference to mParent, so do NOT release it! // this is to avoid circular references. The instantiator who provided mParent // is responsible for managing our reference for us. @@ -335,11 +332,9 @@ NS_NewHTMLTableElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLTableElement); nsHTMLTableElement::nsHTMLTableElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLTableElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mTBodies=nsnull; @@ -348,7 +343,6 @@ nsHTMLTableElement::nsHTMLTableElement(nsIAtom* aTag) nsHTMLTableElement::~nsHTMLTableElement() { - MOZ_COUNT_DTOR(nsHTMLTableElement); if (nsnull!=mTBodies) { mTBodies->ParentDestroyed(); diff --git a/mozilla/content/html/content/src/nsHTMLTableRowElement.cpp b/mozilla/content/html/content/src/nsHTMLTableRowElement.cpp index 22c6890b073..1d7487e42fc 100644 --- a/mozilla/content/html/content/src/nsHTMLTableRowElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTableRowElement.cpp @@ -60,18 +60,15 @@ public: NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn); }; -MOZ_DECL_CTOR_COUNTER(nsTableCellCollection); nsTableCellCollection::nsTableCellCollection(nsIContent* aParent, nsIAtom* aTag) : GenericElementCollection(aParent, aTag) { - MOZ_COUNT_CTOR(nsTableCellCollection); } nsTableCellCollection::~nsTableCellCollection() { - MOZ_COUNT_DTOR(nsTableCellCollection); } NS_IMETHODIMP @@ -239,11 +236,9 @@ NS_NewHTMLTableRowElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLTableRowElement); nsHTMLTableRowElement::nsHTMLTableRowElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLTableRowElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mCells = nsnull; @@ -251,7 +246,6 @@ nsHTMLTableRowElement::nsHTMLTableRowElement(nsIAtom* aTag) nsHTMLTableRowElement::~nsHTMLTableRowElement() { - MOZ_COUNT_DTOR(nsHTMLTableRowElement); if (nsnull != mCells) { mCells->ParentDestroyed(); NS_RELEASE(mCells); diff --git a/mozilla/content/html/content/src/nsHTMLTableSectionElement.cpp b/mozilla/content/html/content/src/nsHTMLTableSectionElement.cpp index 6ed3be40531..724db0f4d7d 100644 --- a/mozilla/content/html/content/src/nsHTMLTableSectionElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTableSectionElement.cpp @@ -100,11 +100,9 @@ NS_NewHTMLTableSectionElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLTableSectionElement); nsHTMLTableSectionElement::nsHTMLTableSectionElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLTableSectionElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mRows = nsnull; @@ -112,7 +110,6 @@ nsHTMLTableSectionElement::nsHTMLTableSectionElement(nsIAtom* aTag) nsHTMLTableSectionElement::~nsHTMLTableSectionElement() { - MOZ_COUNT_DTOR(nsHTMLTableSectionElement); if (nsnull!=mRows) { mRows->ParentDestroyed(); NS_RELEASE(mRows); diff --git a/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp b/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp index b9f08cb861d..6c061686f1e 100644 --- a/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTextAreaElement.cpp @@ -129,11 +129,9 @@ NS_NewHTMLTextAreaElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLTextAreaElement); nsHTMLTextAreaElement::nsHTMLTextAreaElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLTextAreaElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mForm = nsnull; @@ -141,7 +139,6 @@ nsHTMLTextAreaElement::nsHTMLTextAreaElement(nsIAtom* aTag) nsHTMLTextAreaElement::~nsHTMLTextAreaElement() { - MOZ_COUNT_DTOR(nsHTMLTextAreaElement); if (nsnull != mForm) { // prevent mForm from decrementing its ref count on us mForm->RemoveElement(this, PR_FALSE); diff --git a/mozilla/content/html/content/src/nsHTMLTitleElement.cpp b/mozilla/content/html/content/src/nsHTMLTitleElement.cpp index 1f1cbd7be43..de97a35962a 100644 --- a/mozilla/content/html/content/src/nsHTMLTitleElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLTitleElement.cpp @@ -90,18 +90,15 @@ NS_NewHTMLTitleElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLTitleElement); nsHTMLTitleElement::nsHTMLTitleElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLTitleElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLTitleElement::~nsHTMLTitleElement() { - MOZ_COUNT_DTOR(nsHTMLTitleElement); } NS_IMPL_ADDREF(nsHTMLTitleElement) diff --git a/mozilla/content/html/content/src/nsHTMLUListElement.cpp b/mozilla/content/html/content/src/nsHTMLUListElement.cpp index b628f1e96e2..ee03600e6b2 100644 --- a/mozilla/content/html/content/src/nsHTMLUListElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLUListElement.cpp @@ -90,18 +90,15 @@ NS_NewHTMLUListElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLUListElement); nsHTMLUListElement::nsHTMLUListElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLUListElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLUListElement::~nsHTMLUListElement() { - MOZ_COUNT_DTOR(nsHTMLUListElement); } NS_IMPL_ADDREF(nsHTMLUListElement) diff --git a/mozilla/content/html/content/src/nsHTMLWBRElement.cpp b/mozilla/content/html/content/src/nsHTMLWBRElement.cpp index 05dc92ba3a6..fefdb6e39ba 100644 --- a/mozilla/content/html/content/src/nsHTMLWBRElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLWBRElement.cpp @@ -82,18 +82,15 @@ NS_NewHTMLWBRElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLWBRElement); nsHTMLWBRElement::nsHTMLWBRElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLWBRElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLWBRElement::~nsHTMLWBRElement() { - MOZ_COUNT_DTOR(nsHTMLWBRElement); } NS_IMPL_ADDREF(nsHTMLWBRElement) diff --git a/mozilla/content/html/document/src/nsHTMLContentSink.cpp b/mozilla/content/html/document/src/nsHTMLContentSink.cpp index 80930e00ba9..1ad481b24f0 100644 --- a/mozilla/content/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/content/html/document/src/nsHTMLContentSink.cpp @@ -955,8 +955,11 @@ nsHTMLElementFactory::CreateInstanceByTag(const nsString& aTag, //---------------------------------------------------------------------- +MOZ_DECL_CTOR_COUNTER(SinkContext); + SinkContext::SinkContext(HTMLContentSink* aSink) { + MOZ_COUNT_CTOR(SinkContext); mSink = aSink; mPreAppend = PR_FALSE; mStack = nsnull; @@ -969,6 +972,7 @@ SinkContext::SinkContext(HTMLContentSink* aSink) SinkContext::~SinkContext() { + MOZ_COUNT_DTOR(SinkContext); if (nsnull != mStack) { for (PRInt32 i = 0; i < mStackPos; i++) { NS_RELEASE(mStack[i].mContent); @@ -1631,6 +1635,7 @@ NS_NewHTMLContentSink(nsIHTMLContentSink** aResult, return it->QueryInterface(kIHTMLContentSinkIID, (void **)aResult); } +// Note: operator new zeros our memory HTMLContentSink::HTMLContentSink() { #ifdef NS_DEBUG @@ -1639,12 +1644,6 @@ HTMLContentSink::HTMLContentSink() } #endif mNotAtRef = PR_TRUE; - mParser = nsnull; - mDocumentBaseURL = nsnull; - mBody = nsnull; - mFrameset = nsnull; - mStyleSheetCount = 0; - mCSSLoader = nsnull; mContentIDCounter = NS_CONTENT_ID_COUNTER_BASE; } diff --git a/mozilla/content/html/document/src/nsHTMLDocument.cpp b/mozilla/content/html/document/src/nsHTMLDocument.cpp index 41704a65a4f..6629c25dcbb 100644 --- a/mozilla/content/html/document/src/nsHTMLDocument.cpp +++ b/mozilla/content/html/document/src/nsHTMLDocument.cpp @@ -685,11 +685,9 @@ NS_IMETHODIMP nsHTMLDocument::SetTitle(const nsString& aTitle) nsISupports* container; if (NS_OK == cx->GetContainer(&container)) { if (nsnull != container) { - nsIWebShell* ws = nsnull; - container->QueryInterface(kIWebShellIID, (void**) &ws); - if (nsnull != ws) { - ws->SetTitle(aTitle.GetUnicode()); - NS_RELEASE(ws); + nsCOMPtr webShell = do_QueryInterface(container); + if (webShell) { + webShell->SetTitle(aTitle.GetUnicode()); } NS_RELEASE(container); } @@ -1102,12 +1100,11 @@ NS_IMETHODIMP nsHTMLDocument::CreateElement(const nsString& aTagName, nsIDOMElement** aReturn) { - nsIHTMLContent* content; - nsresult rv = NS_CreateHTMLElement(&content, aTagName); - if (NS_OK != rv) { - return rv; + nsCOMPtr content; + nsresult rv = NS_CreateHTMLElement(getter_AddRefs(content), aTagName); + if (NS_SUCCEEDED(rv)) { + rv = content->QueryInterface(kIDOMElementIID, (void**)aReturn); } - rv = content->QueryInterface(kIDOMElementIID, (void**)aReturn); return rv; } diff --git a/mozilla/content/html/style/src/nsCSSLoader.cpp b/mozilla/content/html/style/src/nsCSSLoader.cpp index 69228f938d8..68bfd0725ce 100644 --- a/mozilla/content/html/style/src/nsCSSLoader.cpp +++ b/mozilla/content/html/style/src/nsCSSLoader.cpp @@ -50,12 +50,15 @@ static NS_DEFINE_IID(kIStyleSheetLinkingElementIID, NS_ISTYLESHEETLINKINGELEMENT class CSSLoaderImpl; +MOZ_DECL_CTOR_COUNTER(URLKey); + class URLKey: public nsHashKey { public: URLKey(nsIURI* aURL) : nsHashKey(), mURL(aURL) { + MOZ_COUNT_CTOR(URLKey); NS_ADDREF(mURL); mHashValue = 0; @@ -72,11 +75,13 @@ public: mURL(aKey.mURL), mHashValue(aKey.mHashValue) { + MOZ_COUNT_CTOR(URLKey); NS_ADDREF(mURL); } virtual ~URLKey(void) { + MOZ_COUNT_DTOR(URLKey); NS_RELEASE(mURL); } @@ -102,22 +107,27 @@ public: PRUint32 mHashValue; }; +MOZ_DECL_CTOR_COUNTER(SupportsKey); + class SupportsKey: public nsHashKey { public: SupportsKey(nsISupports* aSupports) : nsHashKey(), mSupports(aSupports) { // note: does not hold reference on supports pointer + MOZ_COUNT_CTOR(SupportsKey); } SupportsKey(const SupportsKey& aKey) : nsHashKey(), mSupports(aKey.mSupports) { + MOZ_COUNT_CTOR(SupportsKey); } virtual ~SupportsKey(void) { + MOZ_COUNT_DTOR(SupportsKey); } virtual PRUint32 HashValue(void) const @@ -178,6 +188,8 @@ struct SheetLoadData { void* mCallbackData; }; +MOZ_DECL_CTOR_COUNTER(PendingSheetData); + struct PendingSheetData { PendingSheetData(nsICSSStyleSheet* aSheet, PRInt32 aDocIndex, nsIContent* aElement) @@ -186,12 +198,14 @@ struct PendingSheetData { mOwningElement(aElement), mNotify(PR_FALSE) { + MOZ_COUNT_CTOR(PendingSheetData); NS_ADDREF(mSheet); NS_IF_ADDREF(mOwningElement); } ~PendingSheetData(void) { + MOZ_COUNT_DTOR(PendingSheetData); NS_RELEASE(mSheet); NS_IF_RELEASE(mOwningElement); } @@ -303,6 +317,8 @@ public: #endif }; +MOZ_DECL_CTOR_COUNTER(SheetLoadData); + SheetLoadData::SheetLoadData(CSSLoaderImpl* aLoader, nsIURI* aURL, const nsString& aTitle, const nsString& aMedia, PRInt32 aDefaultNameSpaceID, @@ -327,6 +343,7 @@ SheetLoadData::SheetLoadData(CSSLoaderImpl* aLoader, nsIURI* aURL, mCallback(nsnull), mCallbackData(nsnull) { + MOZ_COUNT_CTOR(SheetLoadData); NS_ADDREF(mLoader); NS_ADDREF(mURL); NS_IF_ADDREF(mOwningElement); @@ -356,6 +373,7 @@ SheetLoadData::SheetLoadData(CSSLoaderImpl* aLoader, nsIURI* aURL, mCallback(nsnull), mCallbackData(nsnull) { + MOZ_COUNT_CTOR(SheetLoadData); NS_ADDREF(mLoader); NS_ADDREF(mURL); NS_ADDREF(mParentSheet); @@ -382,6 +400,7 @@ SheetLoadData::SheetLoadData(CSSLoaderImpl* aLoader, nsIURI* aURL, mCallback(aCallback), mCallbackData(nsnull) { + MOZ_COUNT_CTOR(SheetLoadData); NS_ADDREF(mLoader); NS_ADDREF(mURL); } @@ -389,6 +408,7 @@ SheetLoadData::SheetLoadData(CSSLoaderImpl* aLoader, nsIURI* aURL, SheetLoadData::~SheetLoadData(void) { + MOZ_COUNT_DTOR(SheetLoadData); NS_RELEASE(mLoader); NS_RELEASE(mURL); NS_IF_RELEASE(mOwningElement); diff --git a/mozilla/content/html/style/src/nsCSSParser.cpp b/mozilla/content/html/style/src/nsCSSParser.cpp index 6eed9961baa..edd7a2ec46b 100644 --- a/mozilla/content/html/style/src/nsCSSParser.cpp +++ b/mozilla/content/html/style/src/nsCSSParser.cpp @@ -55,6 +55,8 @@ static NS_DEFINE_IID(kICSSParserIID, NS_ICSS_PARSER_IID); static NS_DEFINE_IID(kICSSStyleSheetIID, NS_ICSS_STYLE_SHEET_IID); static NS_DEFINE_IID(kIStyleSheetIID, NS_ISTYLE_SHEET_IID); +MOZ_DECL_CTOR_COUNTER(SelectorList); + // e.g. "P B, H1 B { ... }" has a selector list with two elements, // each of which has two selectors. struct SelectorList { @@ -77,10 +79,12 @@ SelectorList::SelectorList(void) : mSelectors(nsnull), mNext(nsnull) { + MOZ_COUNT_CTOR(SelectorList); } SelectorList::~SelectorList() { + MOZ_COUNT_DTOR(SelectorList); nsCSSSelector* sel = mSelectors; while (nsnull != sel) { nsCSSSelector* dead = sel; diff --git a/mozilla/content/html/style/src/nsCSSRule.cpp b/mozilla/content/html/style/src/nsCSSRule.cpp index 9918dea40c0..b656b0d9ee6 100644 --- a/mozilla/content/html/style/src/nsCSSRule.cpp +++ b/mozilla/content/html/style/src/nsCSSRule.cpp @@ -16,14 +16,10 @@ * Reserved. */ #include "nsCSSRule.h" - #include "nsCRT.h" #include "nsIArena.h" #include "nsICSSStyleSheet.h" - -//#define DEBUG_REFS - void* nsCSSRule::operator new(size_t size) { nsCSSRule* rv = (nsCSSRule*) ::operator new(size); @@ -58,74 +54,25 @@ void nsCSSRule::operator delete(void* ptr) } } - -#ifdef DEBUG_REFS -static PRInt32 gInstanceCount; -static const PRInt32 kInstrument = 1075; -#endif - - nsCSSRule::nsCSSRule(void) : mSheet(nsnull) { NS_INIT_REFCNT(); - -#ifdef DEBUG_REFS - mInstance = gInstanceCount++; - fprintf(stdout, "%d of %d + CSSRule\n", mInstance, gInstanceCount); -#endif } nsCSSRule::nsCSSRule(const nsCSSRule& aCopy) : mSheet(aCopy.mSheet) { NS_INIT_REFCNT(); - -#ifdef DEBUG_REFS - mInstance = gInstanceCount++; - fprintf(stdout, "%d of %d + CSSRule\n", mInstance, gInstanceCount); -#endif } nsCSSRule::~nsCSSRule(void) { -#ifdef DEBUG_REFS - --gInstanceCount; - fprintf(stdout, "%d of %d - CSSStyleRule\n", mInstance, gInstanceCount); -#endif } -#ifdef DEBUG_REFS -nsrefcnt -nsCSSRule::AddRef(void) -{ - if (mInstance == kInstrument) { - fprintf(stdout, "%d AddRef CSSRule\n", mRefCnt + 1); - } - ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "nsCSSRule"); - return mRefCnt; -} - -nsrefcnt -nsCSSRule::Release(void) -{ - if (mInstance == kInstrument) { - fprintf(stdout, "%d Release CSSRule\n", mRefCnt - 1); - } - --mRefCnt; - NS_LOG_RELEASE(this, mRefCnt, "nsCSSRule"); - if (mRefCnt == 0) { - NS_DELETEXPCOM(this); - return 0; - } - return mRefCnt; -} -#else NS_IMPL_ADDREF(nsCSSRule) NS_IMPL_RELEASE(nsCSSRule) -#endif NS_IMETHODIMP nsCSSRule::GetStyleSheet(nsIStyleSheet*& aSheet) const diff --git a/mozilla/content/html/style/src/nsCSSScanner.cpp b/mozilla/content/html/style/src/nsCSSScanner.cpp index 94cdfa1a30a..2c752b76521 100644 --- a/mozilla/content/html/style/src/nsCSSScanner.cpp +++ b/mozilla/content/html/style/src/nsCSSScanner.cpp @@ -40,14 +40,14 @@ static const PRUint8 START_IDENT = 0x10; static const PRUint8 IS_IDENT = 0x20; static const PRUint8 IS_WHITESPACE = 0x40; -static PRUint8* gLexTable; +static PRBool gLexTableSetup = PR_FALSE; +static PRUint8 gLexTable[256]; static void BuildLexTable() { - PRUint8* lt = new PRUint8[256]; - nsCRT::zero(lt, 256); - gLexTable = lt; + gLexTableSetup = PR_TRUE; + PRUint8* lt = gLexTable; int i; lt[CSS_ESCAPE] = START_IDENT; lt['-'] |= IS_IDENT; @@ -137,10 +137,12 @@ nsCSSToken::AppendToString(nsString& aBuffer) } } +MOZ_DECL_CTOR_COUNTER(nsCSSScanner); nsCSSScanner::nsCSSScanner() { - if (nsnull == gLexTable) { + MOZ_COUNT_CTOR(nsCSSScanner); + if (!gLexTableSetup) { // XXX need a monitor BuildLexTable(); } @@ -155,6 +157,7 @@ nsCSSScanner::nsCSSScanner() nsCSSScanner::~nsCSSScanner() { + MOZ_COUNT_DTOR(nsCSSScanner); Close(); if (nsnull != mBuffer) { delete [] mBuffer; diff --git a/mozilla/content/html/style/src/nsCSSStyleRule.cpp b/mozilla/content/html/style/src/nsCSSStyleRule.cpp index 0326b33e93e..3f7d329117e 100644 --- a/mozilla/content/html/style/src/nsCSSStyleRule.cpp +++ b/mozilla/content/html/style/src/nsCSSStyleRule.cpp @@ -79,10 +79,13 @@ static NS_DEFINE_IID(kCSSUserInterfaceSID, NS_CSS_USER_INTERFACE_SID); #define NS_IF_DELETE(ptr) \ if (nsnull != ptr) { delete ptr; ptr = nsnull; } +MOZ_DECL_CTOR_COUNTER(nsAtomList); + nsAtomList::nsAtomList(nsIAtom* aAtom) : mAtom(aAtom), mNext(nsnull) { + MOZ_COUNT_CTOR(nsAtomList); NS_IF_ADDREF(mAtom); } @@ -90,6 +93,7 @@ nsAtomList::nsAtomList(const nsString& aAtomValue) : mAtom(nsnull), mNext(nsnull) { + MOZ_COUNT_CTOR(nsAtomList); mAtom = NS_NewAtom(aAtomValue); } @@ -97,12 +101,14 @@ nsAtomList::nsAtomList(const nsAtomList& aCopy) : mAtom(aCopy.mAtom), mNext(nsnull) { + MOZ_COUNT_CTOR(nsAtomList); NS_IF_ADDREF(mAtom); NS_IF_COPY(mNext, aCopy.mNext, nsAtomList); } nsAtomList::~nsAtomList(void) { + MOZ_COUNT_DTOR(nsAtomList); NS_IF_RELEASE(mAtom); NS_IF_DELETE(mNext); } @@ -123,6 +129,8 @@ PRBool nsAtomList::Equals(const nsAtomList* aOther) const return PR_FALSE; } +MOZ_DECL_CTOR_COUNTER(nsAttrSelector); + nsAttrSelector::nsAttrSelector(PRInt32 aNameSpace, const nsString& aAttr) : mNameSpace(aNameSpace), mAttr(nsnull), @@ -131,6 +139,7 @@ nsAttrSelector::nsAttrSelector(PRInt32 aNameSpace, const nsString& aAttr) mValue(), mNext(nsnull) { + MOZ_COUNT_CTOR(nsAttrSelector); mAttr = NS_NewAtom(aAttr); } @@ -143,6 +152,7 @@ nsAttrSelector::nsAttrSelector(PRInt32 aNameSpace, const nsString& aAttr, PRUint mValue(aValue), mNext(nsnull) { + MOZ_COUNT_CTOR(nsAttrSelector); mAttr = NS_NewAtom(aAttr); } @@ -154,12 +164,14 @@ nsAttrSelector::nsAttrSelector(const nsAttrSelector& aCopy) mValue(aCopy.mValue), mNext(nsnull) { + MOZ_COUNT_CTOR(nsAttrSelector); NS_IF_ADDREF(mAttr); NS_IF_COPY(mNext, aCopy.mNext, nsAttrSelector); } nsAttrSelector::~nsAttrSelector(void) { + MOZ_COUNT_DTOR(nsAttrSelector); NS_IF_RELEASE(mAttr); NS_IF_DELETE(mNext); } @@ -184,6 +196,8 @@ PRBool nsAttrSelector::Equals(const nsAttrSelector* aOther) const return PR_FALSE; } +MOZ_DECL_CTOR_COUNTER(nsCSSSelector); + nsCSSSelector::nsCSSSelector(void) : mNameSpace(kNameSpaceID_Unknown), mTag(nsnull), mID(nsnull), @@ -193,6 +207,7 @@ nsCSSSelector::nsCSSSelector(void) mOperator(0), mNext(nsnull) { + MOZ_COUNT_CTOR(nsCSSSelector); } nsCSSSelector::nsCSSSelector(const nsCSSSelector& aCopy) @@ -204,6 +219,7 @@ nsCSSSelector::nsCSSSelector(const nsCSSSelector& aCopy) mOperator(aCopy.mOperator), mNext(nsnull) { + MOZ_COUNT_CTOR(nsCSSSelector); NS_IF_ADDREF(mTag); NS_IF_ADDREF(mID); NS_IF_COPY(mClassList, aCopy.mClassList, nsAtomList); @@ -213,6 +229,7 @@ nsCSSSelector::nsCSSSelector(const nsCSSSelector& aCopy) nsCSSSelector::~nsCSSSelector(void) { + MOZ_COUNT_DTOR(nsCSSSelector); Reset(); } @@ -548,8 +565,12 @@ protected: nsICSSStyleRule *mRule; }; +MOZ_DECL_CTOR_COUNTER(DOMCSSDeclarationImpl); + DOMCSSDeclarationImpl::DOMCSSDeclarationImpl(nsICSSStyleRule *aRule) { + MOZ_COUNT_CTOR(DOMCSSDeclarationImpl); + // This reference is not reference-counted. The rule // object tells us when its about to go away. mRule = aRule; @@ -557,6 +578,7 @@ DOMCSSDeclarationImpl::DOMCSSDeclarationImpl(nsICSSStyleRule *aRule) DOMCSSDeclarationImpl::~DOMCSSDeclarationImpl(void) { + MOZ_COUNT_DTOR(DOMCSSDeclarationImpl); } void @@ -732,7 +754,6 @@ protected: void* mScriptObject; }; - CSSStyleRuleImpl::CSSStyleRuleImpl(const nsCSSSelector& aSelector) : nsCSSRule(), mSelector(aSelector), mSelectorText(), mDeclaration(nsnull), diff --git a/mozilla/content/html/style/src/nsCSSStyleSheet.cpp b/mozilla/content/html/style/src/nsCSSStyleSheet.cpp index 49bb428c98c..9e900477c7d 100644 --- a/mozilla/content/html/style/src/nsCSSStyleSheet.cpp +++ b/mozilla/content/html/style/src/nsCSSStyleSheet.cpp @@ -60,7 +60,6 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); #include "nsITextContent.h" #include "prlog.h" -//#define DEBUG_REFS //#define DEBUG_RULES #define DEBUG_CASCADE @@ -1063,11 +1062,6 @@ void CSSStyleSheetImpl::operator delete(void* ptr) } } -#ifdef DEBUG_REFS -static PRInt32 gInstanceCount; -#endif -MOZ_DECL_CTOR_COUNTER(CSSStyleSheetImpl); - CSSStyleSheetImpl::CSSStyleSheetImpl() : nsICSSStyleSheet(), mTitle(), @@ -1083,15 +1077,9 @@ CSSStyleSheetImpl::CSSStyleSheetImpl() mDirty(PR_FALSE), mScriptObject(nsnull) { - MOZ_COUNT_CTOR(CSSStyleSheetImpl); NS_INIT_REFCNT(); mInner = new CSSStyleSheetInner(this); - -#ifdef DEBUG_REFS - ++gInstanceCount; - fprintf(stdout, "%d + CSSStyleSheet size: %d\n", gInstanceCount, sizeof(*this)); -#endif } CSSStyleSheetImpl::CSSStyleSheetImpl(const CSSStyleSheetImpl& aCopy) @@ -1110,7 +1098,6 @@ CSSStyleSheetImpl::CSSStyleSheetImpl(const CSSStyleSheetImpl& aCopy) mScriptObject(nsnull), mInner(aCopy.mInner) { - MOZ_COUNT_CTOR(CSSStyleSheetImpl); NS_INIT_REFCNT(); mInner->AddSheet(this); @@ -1141,20 +1128,10 @@ CSSStyleSheetImpl::CSSStyleSheetImpl(const CSSStyleSheetImpl& aCopy) } while (otherChild && ourSlot); } - -#ifdef DEBUG_REFS - ++gInstanceCount; - fprintf(stdout, "%d + CSSStyleSheet size: %d\n", gInstanceCount, sizeof(*this)); -#endif } CSSStyleSheetImpl::~CSSStyleSheetImpl() { - MOZ_COUNT_DTOR(CSSStyleSheetImpl); -#ifdef DEBUG_REFS - --gInstanceCount; - fprintf(stdout, "%d - CSSStyleSheet\n", gInstanceCount); -#endif NS_IF_RELEASE(mMedia); if (mFirstChild) { CSSStyleSheetImpl* child = mFirstChild; diff --git a/mozilla/content/html/style/src/nsHTMLAttributes.cpp b/mozilla/content/html/style/src/nsHTMLAttributes.cpp index 7fad315cd91..793f5a54d65 100644 --- a/mozilla/content/html/style/src/nsHTMLAttributes.cpp +++ b/mozilla/content/html/style/src/nsHTMLAttributes.cpp @@ -29,16 +29,17 @@ #include "nsVoidArray.h" #include "nsISizeOfHandler.h" -//#define DEBUG_REFS - static NS_DEFINE_IID(kIHTMLAttributesIID, NS_IHTML_ATTRIBUTES_IID); +MOZ_DECL_CTOR_COUNTER(HTMLAttribute); + struct HTMLAttribute { HTMLAttribute(void) : mAttribute(nsnull), mValue(), mNext(nsnull) { + MOZ_COUNT_CTOR(HTMLAttribute); } HTMLAttribute(nsIAtom* aAttribute, const nsString& aValue) @@ -46,6 +47,7 @@ struct HTMLAttribute { mValue(aValue), mNext(nsnull) { + MOZ_COUNT_CTOR(HTMLAttribute); NS_IF_ADDREF(mAttribute); } @@ -54,6 +56,7 @@ struct HTMLAttribute { mValue(aValue), mNext(nsnull) { + MOZ_COUNT_CTOR(HTMLAttribute); NS_IF_ADDREF(mAttribute); } @@ -62,11 +65,13 @@ struct HTMLAttribute { mValue(aCopy.mValue), mNext(nsnull) { + MOZ_COUNT_CTOR(HTMLAttribute); NS_IF_ADDREF(mAttribute); } ~HTMLAttribute(void) { + MOZ_COUNT_DTOR(HTMLAttribute); NS_IF_RELEASE(mAttribute); } @@ -222,25 +227,33 @@ struct HTMLAttribute { // ---------------- +MOZ_DECL_CTOR_COUNTER(nsClassList); + struct nsClassList { nsClassList(nsIAtom* aAtom) : mAtom(aAtom), // take ref mNext(nsnull) { + MOZ_COUNT_CTOR(nsClassList); } + nsClassList(const nsClassList& aCopy) : mAtom(aCopy.mAtom), mNext(nsnull) { + MOZ_COUNT_CTOR(nsClassList); NS_IF_ADDREF(mAtom); if (aCopy.mNext) { mNext = new nsClassList(*(aCopy.mNext)); } } + ~nsClassList(void) { + MOZ_COUNT_DTOR(nsClassList); Reset(); } + void Reset(void) { NS_IF_RELEASE(mAtom); @@ -828,19 +841,8 @@ protected: nsClassList mFirstClass; nsIAtom* mNameBuffer[kNameBufferSize]; - -#ifdef DEBUG_REFS - PRInt32 mInstance; -#endif }; - -#ifdef DEBUG_REFS -static PRInt32 gInstanceCount = 0; -static PRInt32 gInstrument = 4; -#endif - - void* HTMLAttributesImpl::operator new(size_t size) { HTMLAttributesImpl* rv = (HTMLAttributesImpl*) ::operator new(size); @@ -875,7 +877,6 @@ void HTMLAttributesImpl::operator delete(void* ptr) } } - HTMLAttributesImpl::HTMLAttributesImpl(void) : mAttrNames(mNameBuffer), mAttrCount(0), @@ -886,11 +887,6 @@ HTMLAttributesImpl::HTMLAttributesImpl(void) mFirstClass(nsnull) { NS_INIT_REFCNT(); - -#ifdef DEBUG_REFS - mInstance = ++gInstanceCount; - fprintf(stdout, "%d of %d + HTMLAttributes\n", mInstance, gInstanceCount); -#endif } HTMLAttributesImpl::HTMLAttributesImpl(const HTMLAttributesImpl& aCopy) @@ -929,51 +925,15 @@ HTMLAttributesImpl::HTMLAttributesImpl(const HTMLAttributesImpl& aCopy) } NS_IF_ADDREF(mID); - -#ifdef DEBUG_REFS - mInstance = ++gInstanceCount; - fprintf(stdout, "%d of %d + HTMLAttributes\n", mInstance, gInstanceCount); -#endif } HTMLAttributesImpl::~HTMLAttributesImpl(void) { Reset(); - -#ifdef DEBUG_REFS - fprintf(stdout, "%d of %d - HTMLAttributes\n", mInstance, gInstanceCount); - --gInstanceCount; -#endif } -#ifdef DEBUG_REFS -nsrefcnt HTMLAttributesImpl::AddRef(void) -{ - if ((gInstrument == -1) || (mInstance == gInstrument)) { - fprintf(stdout, "%d AddRef HTMLAttributes %d\n", mRefCnt + 1, mInstance); - } - ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "HTMLAttributesImpl"); - return mRefCnt; -} - -nsrefcnt HTMLAttributesImpl::Release(void) -{ - if ((gInstrument == -1) || (mInstance == gInstrument)) { - fprintf(stdout, "%d Release HTMLAttributes %d\n", mRefCnt - 1, mInstance); - } - --mRefCnt; - NS_LOG_RELEASE(this, mRefCnt, "HTMLAttributesImpl"); - if (mRefCnt == 0) { - delete this; - return 0; - } - return mRefCnt; -} -#else NS_IMPL_ADDREF(HTMLAttributesImpl) NS_IMPL_RELEASE(HTMLAttributesImpl) -#endif NS_IMPL_QUERY_INTERFACE(HTMLAttributesImpl, kIHTMLAttributesIID); diff --git a/mozilla/content/html/style/src/nsHTMLCSSStyleSheet.cpp b/mozilla/content/html/style/src/nsHTMLCSSStyleSheet.cpp index ae846ea82b2..add1b1f0a30 100644 --- a/mozilla/content/html/style/src/nsHTMLCSSStyleSheet.cpp +++ b/mozilla/content/html/style/src/nsHTMLCSSStyleSheet.cpp @@ -369,8 +369,6 @@ void HTMLCSSStyleSheetImpl::operator delete(void* ptr) } } -MOZ_DECL_CTOR_COUNTER(HTMLCSSStyleSheetImpl); - HTMLCSSStyleSheetImpl::HTMLCSSStyleSheetImpl() : nsIHTMLCSSStyleSheet(), mURL(nsnull), @@ -378,15 +376,11 @@ HTMLCSSStyleSheetImpl::HTMLCSSStyleSheetImpl() mFirstLineRule(nsnull), mFirstLetterRule(nsnull) { - MOZ_COUNT_CTOR(HTMLCSSStyleSheetImpl); - NS_INIT_REFCNT(); } HTMLCSSStyleSheetImpl::~HTMLCSSStyleSheetImpl() { - MOZ_COUNT_DTOR(HTMLCSSStyleSheetImpl); - NS_RELEASE(mURL); if (nsnull != mFirstLineRule) { mFirstLineRule->mSheet = nsnull; diff --git a/mozilla/content/html/style/src/nsHTMLStyleSheet.cpp b/mozilla/content/html/style/src/nsHTMLStyleSheet.cpp index acd6004591e..bbb6cf76e56 100644 --- a/mozilla/content/html/style/src/nsHTMLStyleSheet.cpp +++ b/mozilla/content/html/style/src/nsHTMLStyleSheet.cpp @@ -318,15 +318,19 @@ public: } mHash; }; +MOZ_DECL_CTOR_COUNTER(AttributeKey); + AttributeKey::AttributeKey(nsIHTMLMappedAttributes* aAttributes) : mAttributes(aAttributes) { + MOZ_COUNT_CTOR(AttributeKey); NS_ADDREF(mAttributes); mHash.mInitializer = 0; } AttributeKey::~AttributeKey(void) { + MOZ_COUNT_DTOR(AttributeKey); NS_RELEASE(mAttributes); } @@ -504,8 +508,6 @@ void HTMLStyleSheetImpl::operator delete(void* ptr) } } - - HTMLStyleSheetImpl::HTMLStyleSheetImpl(void) : nsIHTMLStyleSheet(), mURL(nsnull), diff --git a/mozilla/content/xml/content/src/nsXMLCDATASection.cpp b/mozilla/content/xml/content/src/nsXMLCDATASection.cpp index e8b6c922ba2..0758e7fca24 100644 --- a/mozilla/content/xml/content/src/nsXMLCDATASection.cpp +++ b/mozilla/content/xml/content/src/nsXMLCDATASection.cpp @@ -90,11 +90,8 @@ NS_NewXMLCDATASection(nsIContent** aInstancePtrResult) return it->QueryInterface(kIContentIID, (void **) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsXMLCDATASection); - nsXMLCDATASection::nsXMLCDATASection() { - MOZ_COUNT_CTOR(nsXMLCDATASection); NS_INIT_REFCNT(); mInner.Init(this); mContentID = 0; @@ -102,7 +99,6 @@ nsXMLCDATASection::nsXMLCDATASection() nsXMLCDATASection::~nsXMLCDATASection() { - MOZ_COUNT_DTOR(nsXMLCDATASection); } NS_IMPL_ADDREF(nsXMLCDATASection) diff --git a/mozilla/content/xml/content/src/nsXMLElement.cpp b/mozilla/content/xml/content/src/nsXMLElement.cpp index 9f6ac942dcd..9b759f86b4e 100644 --- a/mozilla/content/xml/content/src/nsXMLElement.cpp +++ b/mozilla/content/xml/content/src/nsXMLElement.cpp @@ -76,7 +76,7 @@ nsXMLElement::~nsXMLElement() NS_IMETHODIMP nsXMLElement::QueryInterface(REFNSIID aIID, - void** aInstancePtr) + void** aInstancePtr) { NS_IMPL_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this, nsIXMLContent) if (aIID.Equals(kIXMLContentIID)) { diff --git a/mozilla/docshell/base/nsWebShell.cpp b/mozilla/docshell/base/nsWebShell.cpp index 66d0c11cab5..6c94e62a5c2 100644 --- a/mozilla/docshell/base/nsWebShell.cpp +++ b/mozilla/docshell/base/nsWebShell.cpp @@ -607,12 +607,9 @@ nsresult nsWebShell::DestroyPluginHost(void) //---------------------------------------------------------------------- -MOZ_DECL_CTOR_COUNTER(nsWebShell); - // Note: operator new zeros our memory nsWebShell::nsWebShell() { - MOZ_COUNT_CTOR(nsWebShell); #ifdef DETECT_WEBSHELL_LEAKS // We're counting the number of |nsWebShells| to help find leaks ++gNumberOfWebShells; @@ -647,7 +644,6 @@ nsWebShell::nsWebShell() nsWebShell::~nsWebShell() { - MOZ_COUNT_DTOR(nsWebShell); if (nsnull != mHistoryService) { nsServiceManager::ReleaseService(kGlobalHistoryCID, mHistoryService); mHistoryService = nsnull; diff --git a/mozilla/editor/base/EditTxn.cpp b/mozilla/editor/base/EditTxn.cpp index dc874d252b3..ecd47a5361b 100644 --- a/mozilla/editor/base/EditTxn.cpp +++ b/mozilla/editor/base/EditTxn.cpp @@ -27,19 +27,15 @@ static NS_DEFINE_IID(kITransactionIID, NS_ITRANSACTION_IID); NS_IMPL_ADDREF(EditTxn) NS_IMPL_RELEASE(EditTxn) -MOZ_DECL_CTOR_COUNTER(EditTxn); - // note that aEditor is not refcounted EditTxn::EditTxn() : mTransactionID(-1) { - MOZ_COUNT_CTOR(EditTxn); NS_INIT_REFCNT(); } EditTxn::~EditTxn() { - MOZ_COUNT_DTOR(EditTxn); } NS_IMETHODIMP EditTxn::Do(void) diff --git a/mozilla/editor/libeditor/base/EditTxn.cpp b/mozilla/editor/libeditor/base/EditTxn.cpp index dc874d252b3..ecd47a5361b 100644 --- a/mozilla/editor/libeditor/base/EditTxn.cpp +++ b/mozilla/editor/libeditor/base/EditTxn.cpp @@ -27,19 +27,15 @@ static NS_DEFINE_IID(kITransactionIID, NS_ITRANSACTION_IID); NS_IMPL_ADDREF(EditTxn) NS_IMPL_RELEASE(EditTxn) -MOZ_DECL_CTOR_COUNTER(EditTxn); - // note that aEditor is not refcounted EditTxn::EditTxn() : mTransactionID(-1) { - MOZ_COUNT_CTOR(EditTxn); NS_INIT_REFCNT(); } EditTxn::~EditTxn() { - MOZ_COUNT_DTOR(EditTxn); } NS_IMETHODIMP EditTxn::Do(void) diff --git a/mozilla/gfx/src/gtk/nsFontMetricsGTK.cpp b/mozilla/gfx/src/gtk/nsFontMetricsGTK.cpp index 0a56fde5016..fa243752ff2 100644 --- a/mozilla/gfx/src/gtk/nsFontMetricsGTK.cpp +++ b/mozilla/gfx/src/gtk/nsFontMetricsGTK.cpp @@ -39,11 +39,8 @@ #define REALLY_NOISY_FONTS #endif -MOZ_DECL_CTOR_COUNTER(nsFontMetricsGTK); - nsFontMetricsGTK::nsFontMetricsGTK() { - MOZ_COUNT_CTOR(nsFontMetricsGTK); NS_INIT_REFCNT(); mDeviceContext = nsnull; mFont = nsnull; @@ -68,8 +65,6 @@ nsFontMetricsGTK::nsFontMetricsGTK() nsFontMetricsGTK::~nsFontMetricsGTK() { - MOZ_COUNT_DTOR(nsFontMetricsGTK); - if (nsnull != mFont) { delete mFont; mFont = nsnull; @@ -99,35 +94,7 @@ nsFontMetricsGTK::~nsFontMetricsGTK() } -#undef LOG_REFCNTS -#ifdef LOG_REFCNTS -extern "C" { - void __log_addref(void* p, int oldrc, int newrc); - void __log_release(void* p, int oldrc, int newrc); -} - -nsrefcnt nsFontMetricsGTK::AddRef(void) -{ - NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); - __log_addref((void*) this, mRefCnt, mRefCnt + 1); - return ++mRefCnt; -} - -nsrefcnt nsFontMetricsGTK::Release(void) -{ - __log_release((void*) this, mRefCnt, mRefCnt - 1); - NS_PRECONDITION(0 != mRefCnt, "dup release"); - if (--mRefCnt == 0) { - NS_DELETEXPCOM(this); - return 0; - } - return mRefCnt; -} - -NS_IMPL_QUERY_INTERFACE1(nsFontMetricsGTK, nsIFontMetrics) -#else NS_IMPL_ISUPPORTS1(nsFontMetricsGTK, nsIFontMetrics) -#endif #ifdef FONT_SWITCHING diff --git a/mozilla/gfx/src/gtk/nsRenderingContextGTK.cpp b/mozilla/gfx/src/gtk/nsRenderingContextGTK.cpp index 381bbf05c4d..85ce9cef0ad 100644 --- a/mozilla/gfx/src/gtk/nsRenderingContextGTK.cpp +++ b/mozilla/gfx/src/gtk/nsRenderingContextGTK.cpp @@ -40,11 +40,8 @@ static NS_DEFINE_CID(kRegionCID, NS_REGION_CID); gdk.height = ns.height; \ PR_END_MACRO -MOZ_DECL_CTOR_COUNTER(nsRenderingContextGTK); - nsRenderingContextGTK::nsRenderingContextGTK() { - MOZ_COUNT_CTOR(nsRenderingContextGTK); NS_INIT_REFCNT(); mFontMetrics = nsnull; @@ -65,8 +62,6 @@ nsRenderingContextGTK::nsRenderingContextGTK() nsRenderingContextGTK::~nsRenderingContextGTK() { - MOZ_COUNT_DTOR(nsRenderingContextGTK); - // Destroy the State Machine if (mStateCache) { diff --git a/mozilla/gfx/src/nsDeviceContext.cpp b/mozilla/gfx/src/nsDeviceContext.cpp index 81c27c2c7e2..1c1fab5be99 100644 --- a/mozilla/gfx/src/nsDeviceContext.cpp +++ b/mozilla/gfx/src/nsDeviceContext.cpp @@ -48,12 +48,8 @@ protected: NS_IMPL_ISUPPORTS1(DeviceContextImpl, nsIDeviceContext) -MOZ_DECL_CTOR_COUNTER(DeviceContextImpl); - DeviceContextImpl :: DeviceContextImpl() { - MOZ_COUNT_CTOR(DeviceContextImpl); - NS_INIT_REFCNT(); mFontCache = nsnull; mDevUnitsToAppUnits = 1.0f; @@ -79,8 +75,6 @@ static PRBool DeleteValue(nsHashKey* aKey, void* aValue, void* closure) DeviceContextImpl :: ~DeviceContextImpl() { - MOZ_COUNT_DTOR(DeviceContextImpl); - if (nsnull != mFontCache) { delete mFontCache; diff --git a/mozilla/js/src/xpconnect/src/nsXPConnect.cpp b/mozilla/js/src/xpconnect/src/nsXPConnect.cpp index 076a473b123..7bc53939f88 100644 --- a/mozilla/js/src/xpconnect/src/nsXPConnect.cpp +++ b/mozilla/js/src/xpconnect/src/nsXPConnect.cpp @@ -42,36 +42,7 @@ #define JS_CLASS_MAP_SIZE 256 #define NATIVE_CLASS_MAP_SIZE 256 -#if 0 -extern "C" { - void __log_addref(void* p, int oldrc, int newrc); - void __log_release(void* p, int oldrc, int newrc); -}; - -NS_IMETHODIMP_(nsrefcnt) nsXPConnect::AddRef(void) -{ - NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); - __log_addref(this, mRefCnt, mRefCnt + 1); - ++mRefCnt; - return mRefCnt; -} - -NS_IMETHODIMP_(nsrefcnt) nsXPConnect::Release(void) -{ - NS_PRECONDITION(0 != mRefCnt, "dup release"); - __log_release(this, mRefCnt, mRefCnt - 1); - --mRefCnt; - if (mRefCnt == 0) { - NS_DELETEXPCOM(this); - return 0; - } - return mRefCnt; -} - -NS_IMPL_QUERY_INTERFACE1(nsXPConnect, nsIXPConnect) -#else NS_IMPL_ISUPPORTS1(nsXPConnect, nsIXPConnect) -#endif const char XPC_COMPONENTS_STR[] = "Components"; diff --git a/mozilla/js/src/xpconnect/src/xpcstack.cpp b/mozilla/js/src/xpconnect/src/xpcstack.cpp index 828b1adb862..fbe3340fb66 100644 --- a/mozilla/js/src/xpconnect/src/xpcstack.cpp +++ b/mozilla/js/src/xpconnect/src/xpcstack.cpp @@ -182,7 +182,7 @@ XPCJSStackFrame::AddRef(void) if(mStack) mStack->AddRef(); ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "XPCJSStackFrame"); + NS_LOG_ADDREF(this, mRefCnt, "XPCJSStackFrame", sizeof(*this)); return mRefCnt; } diff --git a/mozilla/js/src/xpconnect/src/xpcwrappedjs.cpp b/mozilla/js/src/xpconnect/src/xpcwrappedjs.cpp index b8942a59905..dfc6a0ad793 100644 --- a/mozilla/js/src/xpconnect/src/xpcwrappedjs.cpp +++ b/mozilla/js/src/xpconnect/src/xpcwrappedjs.cpp @@ -72,7 +72,7 @@ nsXPCWrappedJS::AddRef(void) { NS_PRECONDITION(mRoot, "bad root"); ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "nsXPCWrappedJS"); + NS_LOG_ADDREF(this, mRefCnt, "nsXPCWrappedJS", sizeof(*this)); if(1 == mRefCnt && mRoot && mRoot != this) NS_ADDREF(mRoot); @@ -311,7 +311,7 @@ nsXPCWrappedJSMethods::AddRef(void) { NS_PRECONDITION(mWrapper, "bad state"); ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "nsXPCWrappedJSMethods"); + NS_LOG_ADDREF(this, mRefCnt, "nsXPCWrappedJSMethods", sizeof(*this)); if(2 == mRefCnt) NS_ADDREF(mWrapper); return mRefCnt; diff --git a/mozilla/js/src/xpconnect/src/xpcwrappednative.cpp b/mozilla/js/src/xpconnect/src/xpcwrappednative.cpp index 5b106a8212f..dc292562da0 100644 --- a/mozilla/js/src/xpconnect/src/xpcwrappednative.cpp +++ b/mozilla/js/src/xpconnect/src/xpcwrappednative.cpp @@ -46,7 +46,7 @@ nsXPCWrappedNative::AddRef(void) NS_PRECONDITION(mRoot, "bad root"); XPCContext* xpcc; ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "nsXPCWrappedNative"); + NS_LOG_ADDREF(this, mRefCnt, "nsXPCWrappedNative", sizeof(*this)); if(1 == mRefCnt && mRoot != this) NS_ADDREF(mRoot); else if(2 == mRefCnt && nsnull != (xpcc = mClass->GetXPCContext())) diff --git a/mozilla/js/src/xpconnect/tests/components/xpctest_noisy.cpp b/mozilla/js/src/xpconnect/tests/components/xpctest_noisy.cpp index d6ecb383afc..d9499a9383e 100644 --- a/mozilla/js/src/xpconnect/tests/components/xpctest_noisy.cpp +++ b/mozilla/js/src/xpconnect/tests/components/xpctest_noisy.cpp @@ -58,7 +58,7 @@ NS_IMETHODIMP_(nsrefcnt) xpctestNoisy::AddRef(void) { NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "xpctestNoisy"); + NS_LOG_ADDREF(this, mRefCnt, "xpctestNoisy", sizeof(*this)); printf("Noisy %d - incremented refcount to %d\n", mID, mRefCnt); return mRefCnt; } diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index 9b131224af3..4cb1996c4df 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -485,7 +485,6 @@ nsCSSFrameConstructor::~nsCSSFrameConstructor(void) NS_IMPL_ISUPPORTS(nsCSSFrameConstructor, kIStyleFrameConstructionIID); - NS_IMETHODIMP nsCSSFrameConstructor::Init(nsIDocument* aDocument) { diff --git a/mozilla/layout/base/nsCaret.cpp b/mozilla/layout/base/nsCaret.cpp index 62734840488..48a56b85b7d 100644 --- a/mozilla/layout/base/nsCaret.cpp +++ b/mozilla/layout/base/nsCaret.cpp @@ -46,6 +46,7 @@ static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID); //----------------------------------------------------------------------------- + nsCaret::nsCaret() : mPresShell(nsnull) , mBlinkTimer(nsnull) diff --git a/mozilla/layout/base/nsFrameManager.cpp b/mozilla/layout/base/nsFrameManager.cpp index 738c269b0f3..316293dfa0f 100644 --- a/mozilla/layout/base/nsFrameManager.cpp +++ b/mozilla/layout/base/nsFrameManager.cpp @@ -74,9 +74,12 @@ protected: PLHashTable* mTable; }; +MOZ_DECL_CTOR_COUNTER(UndisplayedNode); + struct UndisplayedNode { UndisplayedNode(nsIContent* aContent, nsIStyleContext* aStyle) { + MOZ_COUNT_CTOR(UndisplayedNode); mContent = aContent; mStyle = aStyle; NS_ADDREF(mStyle); @@ -84,6 +87,7 @@ struct UndisplayedNode { } UndisplayedNode(nsIStyleContext* aPseudoStyle) { + MOZ_COUNT_CTOR(UndisplayedNode); mContent = nsnull; mStyle = aPseudoStyle; NS_ADDREF(mStyle); @@ -91,6 +95,7 @@ struct UndisplayedNode { } ~UndisplayedNode(void) { + MOZ_COUNT_DTOR(UndisplayedNode); NS_RELEASE(mStyle); if (mNext) { delete mNext; @@ -261,6 +266,7 @@ NS_NewFrameManager(nsIFrameManager** aInstancePtrResult) FrameManager::FrameManager() { + NS_INIT_REFCNT(); } NS_IMPL_ADDREF(FrameManager) @@ -1313,8 +1319,11 @@ CompareKeys(void* key1, void* key2) return key1 == key2; } +MOZ_DECL_CTOR_COUNTER(FrameHashTable); + FrameHashTable::FrameHashTable(PRUint32 aNumBuckets) { + MOZ_COUNT_CTOR(FrameHashTable); mTable = PL_NewHashTable(aNumBuckets, (PLHashFunction)HashKey, (PLHashComparator)CompareKeys, (PLHashComparator)nsnull, @@ -1323,6 +1332,7 @@ FrameHashTable::FrameHashTable(PRUint32 aNumBuckets) FrameHashTable::~FrameHashTable() { + MOZ_COUNT_DTOR(FrameHashTable); PL_HashTableDestroy(mTable); } @@ -1395,8 +1405,13 @@ FrameHashTable::Dump(FILE* fp) } #endif +//---------------------------------------------------------------------- + +MOZ_DECL_CTOR_COUNTER(UndisplayedMap); + UndisplayedMap::UndisplayedMap(PRUint32 aNumBuckets) { + MOZ_COUNT_CTOR(UndisplayedMap); mTable = PL_NewHashTable(aNumBuckets, (PLHashFunction)HashKey, (PLHashComparator)CompareKeys, (PLHashComparator)nsnull, @@ -1406,6 +1421,7 @@ UndisplayedMap::UndisplayedMap(PRUint32 aNumBuckets) UndisplayedMap::~UndisplayedMap(void) { + MOZ_COUNT_DTOR(UndisplayedMap); Clear(); PL_HashTableDestroy(mTable); } diff --git a/mozilla/layout/base/nsFrameTraversal.cpp b/mozilla/layout/base/nsFrameTraversal.cpp index 30188ad5612..13ac188fc4e 100644 --- a/mozilla/layout/base/nsFrameTraversal.cpp +++ b/mozilla/layout/base/nsFrameTraversal.cpp @@ -41,6 +41,7 @@ public: NS_IMETHOD IsDone();//what does this mean??off edge? yes nsFrameIterator(); + protected: void setCurrent(nsIFrame *aFrame){mCurrent = aFrame;} nsIFrame *getCurrent(){return mCurrent;} @@ -131,8 +132,6 @@ NS_IMPL_ADDREF(nsFrameIterator) NS_IMPL_RELEASE(nsFrameIterator) - - nsFrameIterator::nsFrameIterator() { mOffEdge = 0; @@ -143,7 +142,6 @@ nsFrameIterator::nsFrameIterator() } - NS_IMETHODIMP nsFrameIterator::QueryInterface(REFNSIID aIID, void** aInstancePtr) { diff --git a/mozilla/layout/base/nsLayoutHistoryState.cpp b/mozilla/layout/base/nsLayoutHistoryState.cpp index c9130bf330e..029297ae85a 100644 --- a/mozilla/layout/base/nsLayoutHistoryState.cpp +++ b/mozilla/layout/base/nsLayoutHistoryState.cpp @@ -20,18 +20,25 @@ #include "nsHashtable.h" #include "nsIStatefulFrame.h" // Get StateType enum +MOZ_DECL_CTOR_COUNTER(HistoryKey); + class HistoryKey: public nsHashKey { private: PRUint32 itsHash; public: HistoryKey(PRUint32 aContentID, nsIStatefulFrame::StateType aStateType) { + MOZ_COUNT_CTOR(HistoryKey); itsHash = aContentID * nsIStatefulFrame::eNumStateTypes + aStateType; } HistoryKey(PRUint32 aKey) { + MOZ_COUNT_CTOR(HistoryKey); itsHash = aKey; } + ~HistoryKey() { + MOZ_COUNT_DTOR(HistoryKey); + } PRUint32 HashValue(void) const { return itsHash; @@ -90,7 +97,6 @@ nsLayoutHistoryState::nsLayoutHistoryState() nsLayoutHistoryState::~nsLayoutHistoryState() { - } NS_IMPL_ISUPPORTS(nsLayoutHistoryState, diff --git a/mozilla/layout/base/nsPresContext.cpp b/mozilla/layout/base/nsPresContext.cpp index 85027184573..e4b991eaa3e 100644 --- a/mozilla/layout/base/nsPresContext.cpp +++ b/mozilla/layout/base/nsPresContext.cpp @@ -59,8 +59,6 @@ static NS_DEFINE_IID(kIPresContextIID, NS_IPRESCONTEXT_IID); static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID); static NS_DEFINE_IID(kILookAndFeelIID, NS_ILOOKANDFEEL_IID); -MOZ_DECL_CTOR_COUNTER(nsPresContext); - nsPresContext::nsPresContext() : mDefaultFont("Times", NS_FONT_STYLE_NORMAL, NS_FONT_VARIANT_NORMAL, @@ -73,7 +71,6 @@ nsPresContext::nsPresContext() 0, NSIntPointsToTwips(10)) { - MOZ_COUNT_CTOR(nsPresContext); NS_INIT_REFCNT(); mCompatibilityMode = eCompatibility_Standard; mCompatibilityLocked = PR_FALSE; @@ -96,7 +93,6 @@ nsPresContext::nsPresContext() nsPresContext::~nsPresContext() { - MOZ_COUNT_DTOR(nsPresContext); mShell = nsnull; Stop(); diff --git a/mozilla/layout/base/nsPresShell.cpp b/mozilla/layout/base/nsPresShell.cpp index 81f15620561..76cfd717560 100644 --- a/mozilla/layout/base/nsPresShell.cpp +++ b/mozilla/layout/base/nsPresShell.cpp @@ -81,7 +81,6 @@ static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID); static NS_DEFINE_CID(kCTransferableCID, NS_TRANSFERABLE_CID); static NS_DEFINE_IID(kCXIFConverterCID, NS_XIFFORMATCONVERTER_CID); -static PRBool gsNoisyRefs = PR_FALSE; #undef NOISY // comment out to hide caret @@ -406,11 +405,8 @@ NS_NewPresShell(nsIPresShell** aInstancePtrResult) return it->QueryInterface(kIPresShellIID, (void **) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(PresShell); - PresShell::PresShell() { - MOZ_COUNT_CTOR(PresShell); mIsDestroying = PR_FALSE; mCaretEnabled = PR_FALSE; mDisplayNonTextSelection = PR_FALSE; @@ -419,39 +415,8 @@ PresShell::PresShell() EnableScrolling(); } -#ifdef NS_DEBUG -// for debugging only -nsrefcnt PresShell::AddRef(void) -{ - if (gsNoisyRefs) { - printf("PresShell: AddRef: %p, cnt = %d \n",this, mRefCnt+1); - } - ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "PresShell"); - return mRefCnt; -} - -// for debugging only -nsrefcnt PresShell::Release(void) -{ - if (gsNoisyRefs) { - printf("PresShell Release: %p, cnt = %d \n",this, mRefCnt-1); - } - --mRefCnt; - NS_LOG_RELEASE(this, mRefCnt, "PresShell"); - if (mRefCnt == 0) { - if (gsNoisyRefs) { - printf("PresShell Delete: %p, \n",this); - } - delete this; - return 0; - } - return mRefCnt; -} -#else NS_IMPL_ADDREF(PresShell) NS_IMPL_RELEASE(PresShell) -#endif nsresult PresShell::QueryInterface(const nsIID& aIID, void** aInstancePtr) @@ -504,8 +469,6 @@ PresShell::QueryInterface(const nsIID& aIID, void** aInstancePtr) PresShell::~PresShell() { - MOZ_COUNT_DTOR(PresShell); - mRefCnt = 99;/* XXX hack! get around re-entrancy bugs */ mIsDestroying = PR_TRUE; diff --git a/mozilla/layout/base/nsStyleChangeList.cpp b/mozilla/layout/base/nsStyleChangeList.cpp index 06e8eb64db6..6193c8d4257 100644 --- a/mozilla/layout/base/nsStyleChangeList.cpp +++ b/mozilla/layout/base/nsStyleChangeList.cpp @@ -24,15 +24,19 @@ static const PRUint32 kGrowArrayBy = 10; +MOZ_DECL_CTOR_COUNTER(nsStyleChangeList); + nsStyleChangeList::nsStyleChangeList(void) : mArray(mBuffer), mArraySize(kStyleChangeBufferSize), mCount(0) { + MOZ_COUNT_CTOR(nsStyleChangeList); } nsStyleChangeList::~nsStyleChangeList(void) { + MOZ_COUNT_DTOR(nsStyleChangeList); Clear(); } diff --git a/mozilla/layout/base/public/nslayout.h b/mozilla/layout/base/public/nslayout.h index 023d0bc9202..cb618f60149 100644 --- a/mozilla/layout/base/public/nslayout.h +++ b/mozilla/layout/base/public/nslayout.h @@ -19,6 +19,8 @@ #define nslayout_h___ #include "nscore.h" +#include "nsISupports.h" +#include "nsTraceRefcnt.h" // Note: For now, NS_LAYOUT and NS_HTML are joined at the hip #if defined(_IMPL_NS_LAYOUT) || defined(_IMPL_NS_HTML) diff --git a/mozilla/layout/base/src/nsCaret.cpp b/mozilla/layout/base/src/nsCaret.cpp index 62734840488..48a56b85b7d 100644 --- a/mozilla/layout/base/src/nsCaret.cpp +++ b/mozilla/layout/base/src/nsCaret.cpp @@ -46,6 +46,7 @@ static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID); //----------------------------------------------------------------------------- + nsCaret::nsCaret() : mPresShell(nsnull) , mBlinkTimer(nsnull) diff --git a/mozilla/layout/base/src/nsCommentNode.cpp b/mozilla/layout/base/src/nsCommentNode.cpp index fcc69bcc317..37233b091e2 100644 --- a/mozilla/layout/base/src/nsCommentNode.cpp +++ b/mozilla/layout/base/src/nsCommentNode.cpp @@ -205,7 +205,6 @@ protected: PRUint32 mContentID; }; -nsresult NS_NewCommentNode(nsIContent** aInstancePtrResult); nsresult NS_NewCommentNode(nsIContent** aInstancePtrResult) { diff --git a/mozilla/layout/base/src/nsDocument.cpp b/mozilla/layout/base/src/nsDocument.cpp index 60fa895e1f6..0e4e1b7a46b 100644 --- a/mozilla/layout/base/src/nsDocument.cpp +++ b/mozilla/layout/base/src/nsDocument.cpp @@ -503,78 +503,12 @@ nsDOMImplementation::SetScriptObject(void *aScriptObject) // = // ================================================================== -#if 0 -NS_LAYOUT nsresult -NS_NewPostData(PRBool aIsFile, char* aData, - nsIPostData** aInstancePtrResult) -{ - nsresult rv = NS_OK; +MOZ_DECL_CTOR_COUNTER(nsDocumentChildNodes); - if (nsnull == aInstancePtrResult) { - return NS_ERROR_NULL_POINTER; - } - - *aInstancePtrResult = new nsPostData(aIsFile, aData); - if (nsnull != *aInstancePtrResult) { - NS_ADDREF(*aInstancePtrResult); - } else { - rv = NS_ERROR_OUT_OF_MEMORY; - } - - return rv; -} -#endif - -#if 0 // nuking postdata -nsPostData::nsPostData(PRBool aIsFile, char* aData) -{ - NS_INIT_REFCNT(); - - mData = nsnull; - mDataLen = 0; - mIsFile = aIsFile; - - if (aData) { - mDataLen = PL_strlen(aData); - mData = aData; - } -} - -nsPostData::~nsPostData() -{ - if (nsnull != mData) { - delete [] mData; - mData = nsnull; - } -} - - -/* - * Implementation of ISupports methods... - */ -NS_IMPL_ISUPPORTS(nsPostData,kIPostDataIID); - -PRBool nsPostData::IsFile() -{ - return mIsFile; -} - -const char* nsPostData::GetData() -{ - return mData; -} - -PRInt32 nsPostData::GetDataLength() -{ - return mDataLen; -} -#endif // nuking postdata. - -// ================================================================== -// = -// ================================================================== nsDocumentChildNodes::nsDocumentChildNodes(nsIDocument* aDocument) { + MOZ_COUNT_CTOR(nsDocumentChildNodes); + // We don't reference count our document reference (to avoid circular // references). We'll be told when the document goes away. mDocument = aDocument; @@ -582,6 +516,7 @@ nsDocumentChildNodes::nsDocumentChildNodes(nsIDocument* aDocument) nsDocumentChildNodes::~nsDocumentChildNodes() { + MOZ_COUNT_DTOR(nsDocumentChildNodes); } NS_IMETHODIMP diff --git a/mozilla/layout/base/src/nsDocumentEncoder.cpp b/mozilla/layout/base/src/nsDocumentEncoder.cpp index f4f4aa710fa..b840f1716bf 100644 --- a/mozilla/layout/base/src/nsDocumentEncoder.cpp +++ b/mozilla/layout/base/src/nsDocumentEncoder.cpp @@ -299,13 +299,17 @@ public: void **aResult); }; +MOZ_DECL_CTOR_COUNTER(nsDocumentEncoderFactory); + nsDocumentEncoderFactory::nsDocumentEncoderFactory() { + MOZ_COUNT_CTOR(nsDocumentEncoderFactory); mRefCnt = 0; } nsDocumentEncoderFactory::~nsDocumentEncoderFactory() { + MOZ_COUNT_DTOR(nsDocumentEncoderFactory); NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction"); } diff --git a/mozilla/layout/base/src/nsFrameImageLoader.cpp b/mozilla/layout/base/src/nsFrameImageLoader.cpp index afe07ccc971..5c1e41039d0 100644 --- a/mozilla/layout/base/src/nsFrameImageLoader.cpp +++ b/mozilla/layout/base/src/nsFrameImageLoader.cpp @@ -78,36 +78,8 @@ nsFrameImageLoader::~nsFrameImageLoader() NS_IF_RELEASE(mImage); } -#ifndef LOG_ADDREF_RELEASE NS_IMPL_ADDREF(nsFrameImageLoader) NS_IMPL_RELEASE(nsFrameImageLoader) -#else -extern "C" { - void __log_addref(void* p, int oldrc, int newrc); - void __log_release(void* p, int oldrc, int newrc); -} - -nsrefcnt nsFrameImageLoader::AddRef(void) -{ - NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); - __log_addref((void*) this, mRefCnt, mRefCnt + 1); - NS_LOG_ADDREF(this, mRefCnt, "nsFrameImageLoader"); - return ++mRefCnt; -} - -nsrefcnt nsFrameImageLoader::Release(void) -{ - __log_release((void*) this, mRefCnt, mRefCnt - 1); - NS_PRECONDITION(0 != mRefCnt, "dup release"); - --mRefCnt; - NS_LOG_RELEASE(this, mRefCnt, "nsFrameImageLoader"); - if (mRefCnt == 0) { - NS_DELETEXPCOM(this); - return 0; - } - return mRefCnt; -} -#endif NS_IMETHODIMP nsFrameImageLoader::QueryInterface(REFNSIID aIID, void** aInstancePtr) diff --git a/mozilla/layout/base/src/nsFrameTraversal.cpp b/mozilla/layout/base/src/nsFrameTraversal.cpp index 30188ad5612..13ac188fc4e 100644 --- a/mozilla/layout/base/src/nsFrameTraversal.cpp +++ b/mozilla/layout/base/src/nsFrameTraversal.cpp @@ -41,6 +41,7 @@ public: NS_IMETHOD IsDone();//what does this mean??off edge? yes nsFrameIterator(); + protected: void setCurrent(nsIFrame *aFrame){mCurrent = aFrame;} nsIFrame *getCurrent(){return mCurrent;} @@ -131,8 +132,6 @@ NS_IMPL_ADDREF(nsFrameIterator) NS_IMPL_RELEASE(nsFrameIterator) - - nsFrameIterator::nsFrameIterator() { mOffEdge = 0; @@ -143,7 +142,6 @@ nsFrameIterator::nsFrameIterator() } - NS_IMETHODIMP nsFrameIterator::QueryInterface(REFNSIID aIID, void** aInstancePtr) { diff --git a/mozilla/layout/base/src/nsGenericDOMNodeList.cpp b/mozilla/layout/base/src/nsGenericDOMNodeList.cpp index a5a487493d3..09f0a246503 100644 --- a/mozilla/layout/base/src/nsGenericDOMNodeList.cpp +++ b/mozilla/layout/base/src/nsGenericDOMNodeList.cpp @@ -23,7 +23,7 @@ nsGenericDOMNodeList::nsGenericDOMNodeList() { - mRefCnt = 0; + NS_INIT_REFCNT(); mScriptObject = nsnull; } diff --git a/mozilla/layout/base/src/nsLayoutHistoryState.cpp b/mozilla/layout/base/src/nsLayoutHistoryState.cpp index c9130bf330e..029297ae85a 100644 --- a/mozilla/layout/base/src/nsLayoutHistoryState.cpp +++ b/mozilla/layout/base/src/nsLayoutHistoryState.cpp @@ -20,18 +20,25 @@ #include "nsHashtable.h" #include "nsIStatefulFrame.h" // Get StateType enum +MOZ_DECL_CTOR_COUNTER(HistoryKey); + class HistoryKey: public nsHashKey { private: PRUint32 itsHash; public: HistoryKey(PRUint32 aContentID, nsIStatefulFrame::StateType aStateType) { + MOZ_COUNT_CTOR(HistoryKey); itsHash = aContentID * nsIStatefulFrame::eNumStateTypes + aStateType; } HistoryKey(PRUint32 aKey) { + MOZ_COUNT_CTOR(HistoryKey); itsHash = aKey; } + ~HistoryKey() { + MOZ_COUNT_DTOR(HistoryKey); + } PRUint32 HashValue(void) const { return itsHash; @@ -90,7 +97,6 @@ nsLayoutHistoryState::nsLayoutHistoryState() nsLayoutHistoryState::~nsLayoutHistoryState() { - } NS_IMPL_ISUPPORTS(nsLayoutHistoryState, diff --git a/mozilla/layout/base/src/nsNameSpaceManager.cpp b/mozilla/layout/base/src/nsNameSpaceManager.cpp index 96e726aa650..9c75756b9ca 100644 --- a/mozilla/layout/base/src/nsNameSpaceManager.cpp +++ b/mozilla/layout/base/src/nsNameSpaceManager.cpp @@ -38,14 +38,20 @@ static PRInt32 gNameSpaceTableRefs; static nsHashtable* gURIToIDTable; static nsVoidArray* gURIArray; +MOZ_DECL_CTOR_COUNTER(NameSpaceURIKey); + class NameSpaceURIKey : public nsHashKey { public: NameSpaceURIKey(const nsString* aString) : mString(aString) - { } + { + MOZ_COUNT_CTOR(NameSpaceURIKey); + } virtual ~NameSpaceURIKey(void) - { } + { + MOZ_COUNT_DTOR(NameSpaceURIKey); + } virtual PRUint32 HashValue(void) const { @@ -191,7 +197,6 @@ public: PRInt32 mID; }; - NameSpaceImpl::NameSpaceImpl(nsINameSpaceManager* aManager, NameSpaceImpl* aParent, nsIAtom* aPrefix, @@ -384,7 +389,6 @@ protected: }; - NameSpaceManagerImpl::NameSpaceManagerImpl() { NS_INIT_REFCNT(); diff --git a/mozilla/layout/base/src/nsPresContext.cpp b/mozilla/layout/base/src/nsPresContext.cpp index 85027184573..e4b991eaa3e 100644 --- a/mozilla/layout/base/src/nsPresContext.cpp +++ b/mozilla/layout/base/src/nsPresContext.cpp @@ -59,8 +59,6 @@ static NS_DEFINE_IID(kIPresContextIID, NS_IPRESCONTEXT_IID); static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID); static NS_DEFINE_IID(kILookAndFeelIID, NS_ILOOKANDFEEL_IID); -MOZ_DECL_CTOR_COUNTER(nsPresContext); - nsPresContext::nsPresContext() : mDefaultFont("Times", NS_FONT_STYLE_NORMAL, NS_FONT_VARIANT_NORMAL, @@ -73,7 +71,6 @@ nsPresContext::nsPresContext() 0, NSIntPointsToTwips(10)) { - MOZ_COUNT_CTOR(nsPresContext); NS_INIT_REFCNT(); mCompatibilityMode = eCompatibility_Standard; mCompatibilityLocked = PR_FALSE; @@ -96,7 +93,6 @@ nsPresContext::nsPresContext() nsPresContext::~nsPresContext() { - MOZ_COUNT_DTOR(nsPresContext); mShell = nsnull; Stop(); diff --git a/mozilla/layout/base/src/nsRange.cpp b/mozilla/layout/base/src/nsRange.cpp index d1e605563e5..3cecdf1e2a8 100644 --- a/mozilla/layout/base/src/nsRange.cpp +++ b/mozilla/layout/base/src/nsRange.cpp @@ -267,7 +267,7 @@ PRBool GetNodeBracketPoints(nsIContent* aNode, /****************************************************** * constructor/destructor ******************************************************/ - + nsRange::nsRange() : mIsPositioned(PR_FALSE), mStartOffset(0), @@ -287,7 +287,7 @@ nsRange::~nsRange() } /****************************************************** - * XPCOM cruft + * nsISupports ******************************************************/ NS_IMPL_ADDREF(nsRange) diff --git a/mozilla/layout/base/src/nsRange.h b/mozilla/layout/base/src/nsRange.h index 7b6e1771a90..c588bb6a719 100644 --- a/mozilla/layout/base/src/nsRange.h +++ b/mozilla/layout/base/src/nsRange.h @@ -15,6 +15,8 @@ * Copyright (C) 1998 Netscape Communications Corporation. All Rights * Reserved. */ +#ifndef nsRange_h___ +#define nsRange_h___ /* * nsRange.h: interface of the nsRange object. @@ -207,3 +209,5 @@ PRBool GetNodeBracketPoints(nsIContent* aNode, nsCOMPtr* outParent, PRInt32* outStartOffset, PRInt32* outEndOffset); + +#endif /* nsRange_h___ */ diff --git a/mozilla/layout/base/src/nsRangeList.cpp b/mozilla/layout/base/src/nsRangeList.cpp index b4ecf6788dd..b9828d3eec0 100644 --- a/mozilla/layout/base/src/nsRangeList.cpp +++ b/mozilla/layout/base/src/nsRangeList.cpp @@ -611,7 +611,6 @@ nsRangeList::nsRangeList() nsRangeList::~nsRangeList() { - if (mSelectionListeners) { PRUint32 cnt; @@ -1407,7 +1406,6 @@ nsRangeList::DeleteFromDocument() // note: this can return a nil anchor node - nsDOMSelection::nsDOMSelection(nsRangeList *aList) { mRangeList = aList; @@ -1689,11 +1687,11 @@ nsDOMSelection::AddItem(nsIDOMRange *aItem) return NS_ERROR_FAILURE; if (!aItem) return NS_ERROR_NULL_POINTER; - nsCOMPtr isupp; - nsresult result = aItem->QueryInterface(nsCOMTypeInfo::GetIID(), getter_AddRefs(isupp)); - if (NS_FAILED(result)) - return result; - result = mRangeArray->AppendElement(isupp); + nsresult result; + nsCOMPtr isupp = do_QueryInterface(aItem, &result); + if (NS_SUCCEEDED(result)) { + result = mRangeArray->AppendElement(isupp); + } return result; } @@ -1739,9 +1737,8 @@ nsDOMSelection::Clear() if (NS_FAILED(rv)) return rv; if (cnt == 0) break; - nsCOMPtr range; nsCOMPtr isupportsindex = dont_AddRef(mRangeArray->ElementAt(0)); - range = do_QueryInterface(isupportsindex); + nsCOMPtr range = do_QueryInterface(isupportsindex); mRangeArray->RemoveElementAt(0); selectFrames(range, 0); // Does RemoveElementAt also delete the elements? diff --git a/mozilla/layout/base/src/nsSpaceManager.cpp b/mozilla/layout/base/src/nsSpaceManager.cpp index 2eaae7b1fd8..d84e6e4b249 100644 --- a/mozilla/layout/base/src/nsSpaceManager.cpp +++ b/mozilla/layout/base/src/nsSpaceManager.cpp @@ -1010,20 +1010,33 @@ nsSpaceManager::DestroyFrameInfo(FrameInfo* aFrameInfo) ///////////////////////////////////////////////////////////////////////////// // FrameInfo +MOZ_DECL_CTOR_COUNTER(FrameInfo); + nsSpaceManager::FrameInfo::FrameInfo(nsIFrame* aFrame, const nsRect& aRect) : mFrame(aFrame), mRect(aRect), mNext(0) { + MOZ_COUNT_CTOR(FrameInfo); } +#ifdef DEBUG +nsSpaceManager::FrameInfo::~FrameInfo() +{ + MOZ_COUNT_DTOR(FrameInfo); +} +#endif + ///////////////////////////////////////////////////////////////////////////// // BandRect +MOZ_DECL_CTOR_COUNTER(BandRect); + nsSpaceManager::BandRect::BandRect(nscoord aLeft, nscoord aTop, nscoord aRight, nscoord aBottom, nsIFrame* aFrame) { + MOZ_COUNT_CTOR(BandRect); mLeft = aLeft; mTop = aTop; mRight = aRight; @@ -1038,6 +1051,7 @@ nsSpaceManager::BandRect::BandRect(nscoord aLeft, nscoord aBottom, nsVoidArray* aFrames) { + MOZ_COUNT_CTOR(BandRect); mLeft = aLeft; mTop = aTop; mRight = aRight; @@ -1049,6 +1063,7 @@ nsSpaceManager::BandRect::BandRect(nscoord aLeft, nsSpaceManager::BandRect::~BandRect() { + MOZ_COUNT_DTOR(BandRect); if (mNumFrames > 1) { delete mFrames; } diff --git a/mozilla/layout/base/src/nsSpaceManager.h b/mozilla/layout/base/src/nsSpaceManager.h index dd16b65254d..c682f74af40 100644 --- a/mozilla/layout/base/src/nsSpaceManager.h +++ b/mozilla/layout/base/src/nsSpaceManager.h @@ -68,6 +68,9 @@ protected: FrameInfo* mNext; FrameInfo(nsIFrame* aFrame, const nsRect& aRect); +#ifdef DEBUG + ~FrameInfo(); +#endif }; public: diff --git a/mozilla/layout/base/src/nsStyleChangeList.cpp b/mozilla/layout/base/src/nsStyleChangeList.cpp index 06e8eb64db6..6193c8d4257 100644 --- a/mozilla/layout/base/src/nsStyleChangeList.cpp +++ b/mozilla/layout/base/src/nsStyleChangeList.cpp @@ -24,15 +24,19 @@ static const PRUint32 kGrowArrayBy = 10; +MOZ_DECL_CTOR_COUNTER(nsStyleChangeList); + nsStyleChangeList::nsStyleChangeList(void) : mArray(mBuffer), mArraySize(kStyleChangeBufferSize), mCount(0) { + MOZ_COUNT_CTOR(nsStyleChangeList); } nsStyleChangeList::~nsStyleChangeList(void) { + MOZ_COUNT_DTOR(nsStyleChangeList); Clear(); } diff --git a/mozilla/layout/base/src/nsStyleContext.cpp b/mozilla/layout/base/src/nsStyleContext.cpp index 449ff08acda..15790461e19 100644 --- a/mozilla/layout/base/src/nsStyleContext.cpp +++ b/mozilla/layout/base/src/nsStyleContext.cpp @@ -26,8 +26,6 @@ #include "nsIFrame.h" -//#define DEBUG_REFS - static NS_DEFINE_IID(kIStyleContextIID, NS_ISTYLECONTEXT_IID); #define DELETE_ARRAY_IF(array) if (array) { delete[] array; array = nsnull; } @@ -1372,26 +1370,16 @@ protected: StyleContentImpl mContent; StyleUserInterfaceImpl mUserInterface; -#ifdef DEBUG_REFS - PRInt32 mInstance; -#endif }; static PRInt32 gLastDataCode; -#ifdef DEBUG_REFS -static PRInt32 gInstanceCount; -static PRInt32 gInstrument = 6; -#endif - static PRBool HashStyleRule(nsISupports* aRule, void* aData) { *((PRUint32*)aData) ^= PRUint32(aRule); return PR_TRUE; } -MOZ_DECL_CTOR_COUNTER(StyleContextImpl); - StyleContextImpl::StyleContextImpl(nsIStyleContext* aParent, nsIAtom* aPseudoTag, nsISupportsArray* aRules, @@ -1413,8 +1401,6 @@ StyleContextImpl::StyleContextImpl(nsIStyleContext* aParent, mContent(), mUserInterface() { - MOZ_COUNT_CTOR(StyleContextImpl); - NS_INIT_REFCNT(); NS_IF_ADDREF(mPseudoTag); NS_IF_ADDREF(mRules); @@ -1430,17 +1416,10 @@ StyleContextImpl::StyleContextImpl(nsIStyleContext* aParent, if (nsnull != mRules) { mRules->EnumerateForwards(HashStyleRule, &mRuleHash); } - -#ifdef DEBUG_REFS - mInstance = ++gInstanceCount; - fprintf(stdout, "%d of %d + StyleContext\n", mInstance, gInstanceCount); -#endif } StyleContextImpl::~StyleContextImpl() { - MOZ_COUNT_DTOR(StyleContextImpl); - NS_ASSERTION((nsnull == mChild) && (nsnull == mEmptyChild), "destructing context with children"); if (mParent) { @@ -1451,76 +1430,9 @@ StyleContextImpl::~StyleContextImpl() NS_IF_RELEASE(mPseudoTag); NS_IF_RELEASE(mRules); - -#ifdef DEBUG_REFS - fprintf(stdout, "%d of %d - StyleContext\n", mInstance, gInstanceCount); - --gInstanceCount; -#endif } -#ifdef LOG_ADDREF_RELEASE -extern "C" { - void __log_addref(void* p, int oldrc, int newrc); - void __log_release(void* p, int oldrc, int newrc); -} - -NS_IMPL_QUERY_INTERFACE(StyleContextImpl, kIStyleContextIID) - -nsrefcnt StyleContextImpl::AddRef(void) -{ - NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); - __log_addref((void*) this, mRefCnt, mRefCnt + 1); - ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "StyleContextImpl"); - return mRefCnt; -} - -nsrefcnt StyleContextImpl::Release(void) -{ - NS_PRECONDITION(0 != mRefCnt, "dup release"); - __log_release((void*) this, mRefCnt, mRefCnt - 1); - --mRefCnt; - NS_LOG_RELEASE(this, mRefCnt, "StyleContextImpl"); - if (mRefCnt == 0) { - NS_DELETEXPCOM(this); - return 0; - } - return mRefCnt; -} -#else - -#ifdef DEBUG_REFS -NS_IMPL_QUERY_INTERFACE(StyleContextImpl, kIStyleContextIID) - -nsrefcnt StyleContextImpl::AddRef(void) -{ - if ((gInstrument == -1) || (mInstance == gInstrument)) { - fprintf(stdout, "%d AddRef StyleContext %d\n", mRefCnt + 1, mInstance); - } - ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "StyleContextImpl"); - return mRefCnt; -} - -nsrefcnt StyleContextImpl::Release(void) -{ - if ((gInstrument == -1) || (mInstance == gInstrument)) { - fprintf(stdout, "%d Release StyleContext %d\n", mRefCnt - 1, mInstance); - } - --mRefCnt; - NS_LOG_RELEASE(this, mRefCnt, "StyleContextImpl"); - if (mRefCnt == 0) { - delete this; - return 0; - } - return mRefCnt; -} -#else NS_IMPL_ISUPPORTS(StyleContextImpl, kIStyleContextIID) -#endif -#endif - - nsIStyleContext* StyleContextImpl::GetParent(void) const { diff --git a/mozilla/layout/base/src/nsStyleSet.cpp b/mozilla/layout/base/src/nsStyleSet.cpp index 69a94c90558..ab6db6c3ea1 100644 --- a/mozilla/layout/base/src/nsStyleSet.cpp +++ b/mozilla/layout/base/src/nsStyleSet.cpp @@ -200,8 +200,6 @@ protected: #endif }; -MOZ_DECL_CTOR_COUNTER(StyleSetImpl); - StyleSetImpl::StyleSetImpl() : mOverrideSheets(nsnull), mDocSheets(nsnull), @@ -210,13 +208,11 @@ StyleSetImpl::StyleSetImpl() mRecycler(nsnull), mFrameConstructor(nsnull) { - MOZ_COUNT_CTOR(StyleSetImpl); NS_INIT_REFCNT(); } StyleSetImpl::~StyleSetImpl() { - MOZ_COUNT_DTOR(StyleSetImpl); NS_IF_RELEASE(mOverrideSheets); NS_IF_RELEASE(mDocSheets); NS_IF_RELEASE(mBackstopSheets); diff --git a/mozilla/layout/base/src/nsTextNode.cpp b/mozilla/layout/base/src/nsTextNode.cpp index ff9b33eab90..38707d1a4c2 100644 --- a/mozilla/layout/base/src/nsTextNode.cpp +++ b/mozilla/layout/base/src/nsTextNode.cpp @@ -74,7 +74,6 @@ protected: PRUint32 mContentID; }; -nsresult NS_NewTextNode(nsIContent** aInstancePtrResult); nsresult NS_NewTextNode(nsIContent** aInstancePtrResult) { diff --git a/mozilla/layout/base/src/nsXIFConverter.cpp b/mozilla/layout/base/src/nsXIFConverter.cpp index 5faf34b7865..5456b913752 100644 --- a/mozilla/layout/base/src/nsXIFConverter.cpp +++ b/mozilla/layout/base/src/nsXIFConverter.cpp @@ -19,11 +19,14 @@ #include "nsXIFConverter.h" #include +MOZ_DECL_CTOR_COUNTER(nsXIFConverter); nsXIFConverter::nsXIFConverter(nsString& aBuffer) : mIndent(0), mBuffer(aBuffer) { + MOZ_COUNT_CTOR(nsXIFConverter); + char* prolog = "\n"; char* doctype = "\n"; @@ -63,6 +66,7 @@ nsXIFConverter::nsXIFConverter(nsString& aBuffer) nsXIFConverter::~nsXIFConverter() { + MOZ_COUNT_DTOR(nsXIFConverter); #ifdef DEBUG WriteDebugFile(); #endif diff --git a/mozilla/layout/events/src/nsPrivateTextRange.cpp b/mozilla/layout/events/src/nsPrivateTextRange.cpp index 6820b20eace..b61543f6aef 100644 --- a/mozilla/layout/events/src/nsPrivateTextRange.cpp +++ b/mozilla/layout/events/src/nsPrivateTextRange.cpp @@ -31,7 +31,6 @@ nsPrivateTextRange::nsPrivateTextRange(PRUint16 aRangeStart, PRUint16 aRangeEnd, nsPrivateTextRange::~nsPrivateTextRange(void) { - } NS_IMPL_ADDREF(nsPrivateTextRange) diff --git a/mozilla/layout/forms/nsButtonFrameRenderer.cpp b/mozilla/layout/forms/nsButtonFrameRenderer.cpp index 64974d84960..85f6af666d1 100644 --- a/mozilla/layout/forms/nsButtonFrameRenderer.cpp +++ b/mozilla/layout/forms/nsButtonFrameRenderer.cpp @@ -1,3 +1,21 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are Copyright (C) 1998 + * Netscape Communications Corporation. All Rights Reserved. + */ #include "nsButtonFrameRenderer.h" #include "nsIRenderingContext.h" #include "nsCSSRendering.h" @@ -11,51 +29,55 @@ #define HOVER "hover" #define FOCUS "focus" +MOZ_DECL_CTOR_COUNTER(nsButtonFrameRenderer); + nsButtonFrameRenderer::nsButtonFrameRenderer() { - mNameSpace = kNameSpaceID_HTML; + MOZ_COUNT_CTOR(nsButtonFrameRenderer); + mNameSpace = kNameSpaceID_HTML; } nsButtonFrameRenderer::~nsButtonFrameRenderer() { + MOZ_COUNT_DTOR(nsButtonFrameRenderer); } void nsButtonFrameRenderer::SetNameSpace(PRInt32 aNameSpace) { - mNameSpace = aNameSpace; + mNameSpace = aNameSpace; } void nsButtonFrameRenderer::SetFrame(nsFrame* aFrame, nsIPresContext& aPresContext) { - mFrame = aFrame; - ReResolveStyles(aPresContext); + mFrame = aFrame; + ReResolveStyles(aPresContext); } nsIFrame* nsButtonFrameRenderer::GetFrame() { - return mFrame; + return mFrame; } PRInt32 nsButtonFrameRenderer::GetNameSpace() { - return mNameSpace; + return mNameSpace; } void nsButtonFrameRenderer::SetDisabled(PRBool aDisabled, PRBool notify) { - // get the content + // get the content nsCOMPtr content; mFrame->GetContent(getter_AddRefs(content)); if (aDisabled) - content->SetAttribute(mNameSpace, nsHTMLAtoms::disabled, "", notify); + content->SetAttribute(mNameSpace, nsHTMLAtoms::disabled, "", notify); else - content->UnsetAttribute(mNameSpace, nsHTMLAtoms::disabled, notify); + content->UnsetAttribute(mNameSpace, nsHTMLAtoms::disabled, notify); } @@ -84,119 +106,119 @@ nsButtonFrameRenderer::Redraw() void nsButtonFrameRenderer::PaintButton (nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect, - nsFramePaintLayer aWhichLayer, - const nsRect& aRect) + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer, + const nsRect& aRect) { //printf("painted width='%d' height='%d'\n",aRect.width, aRect.height); - // draw the border and background inside the focus and outline borders - PaintBorderAndBackground(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer, aRect); + // draw the border and background inside the focus and outline borders + PaintBorderAndBackground(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer, aRect); - // draw the focus and outline borders + // draw the focus and outline borders PaintOutlineAndFocusBorders(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer, aRect); } void nsButtonFrameRenderer::PaintOutlineAndFocusBorders(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect, - nsFramePaintLayer aWhichLayer, - const nsRect& aRect) + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer, + const nsRect& aRect) { - // once we have all that let draw the focus if we have it. We will need to draw 2 focuses. - // the inner and the outer. This is so we can do any kind of look and feel some buttons have - // focus on the outside like mac and motif. While others like windows have it inside (dotted line). - // Usually only one will be specifed. But I guess you could have both if you wanted to. + // once we have all that let draw the focus if we have it. We will need to draw 2 focuses. + // the inner and the outer. This is so we can do any kind of look and feel some buttons have + // focus on the outside like mac and motif. While others like windows have it inside (dotted line). + // Usually only one will be specifed. But I guess you could have both if you wanted to. - nsRect rect; + nsRect rect; if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) - { - if (mOuterFocusStyle) { - // ---------- paint the outer focus border ------------- + { + if (mOuterFocusStyle) { + // ---------- paint the outer focus border ------------- - GetButtonOuterFocusRect(aRect, rect); + GetButtonOuterFocusRect(aRect, rect); - const nsStyleSpacing* spacing = (const nsStyleSpacing*)mOuterFocusStyle ->GetStyleData(eStyleStruct_Spacing); + const nsStyleSpacing* spacing = (const nsStyleSpacing*)mOuterFocusStyle ->GetStyleData(eStyleStruct_Spacing); - nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame, - aDirtyRect, rect, *spacing, mOuterFocusStyle, 0); - } + nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame, + aDirtyRect, rect, *spacing, mOuterFocusStyle, 0); + } - // ---------- paint the inner focus border ------------- - if (mInnerFocusStyle) { + // ---------- paint the inner focus border ------------- + if (mInnerFocusStyle) { - GetButtonInnerFocusRect(aRect, rect); + GetButtonInnerFocusRect(aRect, rect); - const nsStyleSpacing* spacing = (const nsStyleSpacing*)mInnerFocusStyle ->GetStyleData(eStyleStruct_Spacing); + const nsStyleSpacing* spacing = (const nsStyleSpacing*)mInnerFocusStyle ->GetStyleData(eStyleStruct_Spacing); - nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame, - aDirtyRect, rect, *spacing, mInnerFocusStyle, 0); - } - } + nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame, + aDirtyRect, rect, *spacing, mInnerFocusStyle, 0); + } + } if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) - { + { /* - if (mOutlineStyle) { + if (mOutlineStyle) { - GetButtonOutlineRect(aRect, rect); + GetButtonOutlineRect(aRect, rect); - mOutlineRect = rect; + mOutlineRect = rect; - const nsStyleSpacing* spacing = (const nsStyleSpacing*)mOutlineStyle ->GetStyleData(eStyleStruct_Spacing); + const nsStyleSpacing* spacing = (const nsStyleSpacing*)mOutlineStyle ->GetStyleData(eStyleStruct_Spacing); - // set the clipping area so we can draw outside our bounds. - aRenderingContext.PushState(); - PRBool clipEmpty; + // set the clipping area so we can draw outside our bounds. + aRenderingContext.PushState(); + PRBool clipEmpty; - aRenderingContext.SetClipRect(rect, nsClipCombine_kReplace, clipEmpty); - nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame, - aDirtyRect, rect, *spacing, mOutlineStyle, 0); + aRenderingContext.SetClipRect(rect, nsClipCombine_kReplace, clipEmpty); + nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame, + aDirtyRect, rect, *spacing, mOutlineStyle, 0); - aRenderingContext.PopState(clipEmpty); - } + aRenderingContext.PopState(clipEmpty); + } */ - } + } } void nsButtonFrameRenderer::PaintBorderAndBackground(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect, - nsFramePaintLayer aWhichLayer, - const nsRect& aRect) + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer, + const nsRect& aRect) { - if (NS_FRAME_PAINT_LAYER_BACKGROUND != aWhichLayer) - return; + if (NS_FRAME_PAINT_LAYER_BACKGROUND != aWhichLayer) + return; - // get the button rect this is inside the focus and outline rects - nsRect buttonRect; - GetButtonRect(aRect, buttonRect); + // get the button rect this is inside the focus and outline rects + nsRect buttonRect; + GetButtonRect(aRect, buttonRect); - nsCOMPtr context; - mFrame->GetStyleContext(getter_AddRefs(context)); + nsCOMPtr context; + mFrame->GetStyleContext(getter_AddRefs(context)); - // get the styles - const nsStyleSpacing* spacing = + // get the styles + const nsStyleSpacing* spacing = (const nsStyleSpacing*)context->GetStyleData(eStyleStruct_Spacing); - const nsStyleColor* color = + const nsStyleColor* color = (const nsStyleColor*)context->GetStyleData(eStyleStruct_Color); - // paint the border and background + // paint the border and background - nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, mFrame, - aDirtyRect, buttonRect, *color, *spacing, 0, 0); + nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, mFrame, + aDirtyRect, buttonRect, *color, *spacing, 0, 0); - nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame, - aDirtyRect, buttonRect, *spacing, context, 0); + nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame, + aDirtyRect, buttonRect, *spacing, context, 0); } @@ -204,69 +226,69 @@ nsButtonFrameRenderer::PaintBorderAndBackground(nsIPresContext& aPresContext, void nsButtonFrameRenderer::GetButtonOutlineRect(const nsRect& aRect, nsRect& outlineRect) { - outlineRect = aRect; - outlineRect.Inflate(GetButtonOutlineBorderAndPadding()); + outlineRect = aRect; + outlineRect.Inflate(GetButtonOutlineBorderAndPadding()); } void nsButtonFrameRenderer::GetButtonOuterFocusRect(const nsRect& aRect, nsRect& focusRect) { - focusRect = aRect; + focusRect = aRect; } void nsButtonFrameRenderer::GetButtonRect(const nsRect& aRect, nsRect& r) { - r = aRect; - r.Deflate(GetButtonOuterFocusBorderAndPadding()); + r = aRect; + r.Deflate(GetButtonOuterFocusBorderAndPadding()); } void nsButtonFrameRenderer::GetButtonInnerFocusRect(const nsRect& aRect, nsRect& focusRect) { - GetButtonRect(aRect, focusRect); - focusRect.Deflate(GetButtonBorderAndPadding()); - focusRect.Deflate(GetButtonInnerFocusMargin()); + GetButtonRect(aRect, focusRect); + focusRect.Deflate(GetButtonBorderAndPadding()); + focusRect.Deflate(GetButtonInnerFocusMargin()); } void nsButtonFrameRenderer::GetButtonContentRect(const nsRect& aRect, nsRect& r) { - GetButtonInnerFocusRect(aRect, r); - r.Deflate(GetButtonInnerFocusBorderAndPadding()); + GetButtonInnerFocusRect(aRect, r); + r.Deflate(GetButtonInnerFocusBorderAndPadding()); } nsMargin nsButtonFrameRenderer::GetButtonOuterFocusBorderAndPadding() { - nsMargin focusBorderAndPadding(0,0,0,0); + nsMargin focusBorderAndPadding(0,0,0,0); - if (mOuterFocusStyle) { - // get the outer focus border and padding - const nsStyleSpacing* spacing = (const nsStyleSpacing*)mOuterFocusStyle ->GetStyleData(eStyleStruct_Spacing); - if (!spacing->GetBorderPadding(focusBorderAndPadding)) { + if (mOuterFocusStyle) { + // get the outer focus border and padding + const nsStyleSpacing* spacing = (const nsStyleSpacing*)mOuterFocusStyle ->GetStyleData(eStyleStruct_Spacing); + if (!spacing->GetBorderPadding(focusBorderAndPadding)) { NS_NOTYETIMPLEMENTED("percentage border"); } - } + } - return focusBorderAndPadding; + return focusBorderAndPadding; } nsMargin nsButtonFrameRenderer::GetButtonBorderAndPadding() { - nsCOMPtr context; - mFrame->GetStyleContext(getter_AddRefs(context)); + nsCOMPtr context; + mFrame->GetStyleContext(getter_AddRefs(context)); - nsMargin borderAndPadding(0,0,0,0); - const nsStyleSpacing* spacing = (const nsStyleSpacing*)context ->GetStyleData(eStyleStruct_Spacing); - if (!spacing->GetBorderPadding(borderAndPadding)) { - NS_NOTYETIMPLEMENTED("percentage border"); - } - return borderAndPadding; + nsMargin borderAndPadding(0,0,0,0); + const nsStyleSpacing* spacing = (const nsStyleSpacing*)context ->GetStyleData(eStyleStruct_Spacing); + if (!spacing->GetBorderPadding(borderAndPadding)) { + NS_NOTYETIMPLEMENTED("percentage border"); + } + return borderAndPadding; } /** @@ -275,47 +297,47 @@ nsButtonFrameRenderer::GetButtonBorderAndPadding() nsMargin nsButtonFrameRenderer::GetButtonInnerFocusMargin() { - nsMargin innerFocusMargin(0,0,0,0); + nsMargin innerFocusMargin(0,0,0,0); - if (mInnerFocusStyle) { - // get the outer focus border and padding - const nsStyleSpacing* spacing = (const nsStyleSpacing*)mInnerFocusStyle ->GetStyleData(eStyleStruct_Spacing); - spacing->GetMargin(innerFocusMargin); - } + if (mInnerFocusStyle) { + // get the outer focus border and padding + const nsStyleSpacing* spacing = (const nsStyleSpacing*)mInnerFocusStyle ->GetStyleData(eStyleStruct_Spacing); + spacing->GetMargin(innerFocusMargin); + } - return innerFocusMargin; + return innerFocusMargin; } nsMargin nsButtonFrameRenderer::GetButtonInnerFocusBorderAndPadding() { - nsMargin innerFocusBorderAndPadding(0,0,0,0); + nsMargin innerFocusBorderAndPadding(0,0,0,0); - if (mInnerFocusStyle) { - // get the outer focus border and padding - const nsStyleSpacing* spacing = (const nsStyleSpacing*)mInnerFocusStyle ->GetStyleData(eStyleStruct_Spacing); - if (!spacing->GetBorderPadding(innerFocusBorderAndPadding)) { + if (mInnerFocusStyle) { + // get the outer focus border and padding + const nsStyleSpacing* spacing = (const nsStyleSpacing*)mInnerFocusStyle ->GetStyleData(eStyleStruct_Spacing); + if (!spacing->GetBorderPadding(innerFocusBorderAndPadding)) { NS_NOTYETIMPLEMENTED("percentage border"); } - } + } - return innerFocusBorderAndPadding; + return innerFocusBorderAndPadding; } nsMargin nsButtonFrameRenderer::GetButtonOutlineBorderAndPadding() { - nsMargin borderAndPadding(0,0,0,0); + nsMargin borderAndPadding(0,0,0,0); - if (mOutlineStyle) { - // get the outline border and padding - const nsStyleSpacing* spacing = (const nsStyleSpacing*)mOutlineStyle ->GetStyleData(eStyleStruct_Spacing); - if (!spacing->GetBorderPadding(borderAndPadding)) { + if (mOutlineStyle) { + // get the outline border and padding + const nsStyleSpacing* spacing = (const nsStyleSpacing*)mOutlineStyle ->GetStyleData(eStyleStruct_Spacing); + if (!spacing->GetBorderPadding(borderAndPadding)) { NS_NOTYETIMPLEMENTED("percentage border"); } - } + } - return borderAndPadding; + return borderAndPadding; } // gets the full size of our border with all the focus borders @@ -339,29 +361,29 @@ void nsButtonFrameRenderer::ReResolveStyles(nsIPresContext& aPresContext) { - // get all the styles - nsCOMPtr content; - mFrame->GetContent(getter_AddRefs(content)); - nsCOMPtr context; - mFrame->GetStyleContext(getter_AddRefs(context)); + // get all the styles + nsCOMPtr content; + mFrame->GetContent(getter_AddRefs(content)); + nsCOMPtr context; + mFrame->GetStyleContext(getter_AddRefs(context)); // style that draw an outline around the button - nsCOMPtr atom ( getter_AddRefs(NS_NewAtom(":-moz-outline")) ); - aPresContext.ProbePseudoStyleContextFor(content, atom, context, - PR_FALSE, - getter_AddRefs(mOutlineStyle)); + nsCOMPtr atom ( getter_AddRefs(NS_NewAtom(":-moz-outline")) ); + aPresContext.ProbePseudoStyleContextFor(content, atom, context, + PR_FALSE, + getter_AddRefs(mOutlineStyle)); - // style for the inner such as a dotted line (Windows) - atom = getter_AddRefs(NS_NewAtom(":-moz-focus-inner")); - aPresContext.ProbePseudoStyleContextFor(content, atom, context, - PR_FALSE, - getter_AddRefs(mInnerFocusStyle)); + // style for the inner such as a dotted line (Windows) + atom = getter_AddRefs(NS_NewAtom(":-moz-focus-inner")); + aPresContext.ProbePseudoStyleContextFor(content, atom, context, + PR_FALSE, + getter_AddRefs(mInnerFocusStyle)); - // style for outer focus like a ridged border (MAC). - atom = getter_AddRefs(NS_NewAtom(":-moz-focus-outer")); - aPresContext.ProbePseudoStyleContextFor(content, atom, context, - PR_FALSE, - getter_AddRefs(mOuterFocusStyle)); + // style for outer focus like a ridged border (MAC). + atom = getter_AddRefs(NS_NewAtom(":-moz-focus-outer")); + aPresContext.ProbePseudoStyleContextFor(content, atom, context, + PR_FALSE, + getter_AddRefs(mOuterFocusStyle)); } diff --git a/mozilla/layout/forms/nsFormControlHelper.cpp b/mozilla/layout/forms/nsFormControlHelper.cpp index 2026a44b3a8..a0fcdee1efe 100644 --- a/mozilla/layout/forms/nsFormControlHelper.cpp +++ b/mozilla/layout/forms/nsFormControlHelper.cpp @@ -60,13 +60,16 @@ static NS_DEFINE_IID(kIViewIID, NS_IVIEW_IID); static NS_DEFINE_IID(kIFrameIID, NS_IFRAME_IID); static NS_DEFINE_IID(kIDOMHTMLInputElementIID, NS_IDOMHTMLINPUTELEMENT_IID); +MOZ_DECL_CTOR_COUNTER(nsFormControlHelper); nsFormControlHelper::nsFormControlHelper() { + MOZ_COUNT_CTOR(nsFormControlHelper); } nsFormControlHelper::~nsFormControlHelper() { + MOZ_COUNT_DTOR(nsFormControlHelper); } void nsFormControlHelper::ForceDrawFrame(nsIFrame * aFrame) diff --git a/mozilla/layout/generic/nsImageMap.cpp b/mozilla/layout/generic/nsImageMap.cpp index c2b02f6b244..8ca6247b9ba 100644 --- a/mozilla/layout/generic/nsImageMap.cpp +++ b/mozilla/layout/generic/nsImageMap.cpp @@ -92,18 +92,22 @@ public: PRBool mHasURL; }; +MOZ_DECL_CTOR_COUNTER(Area); + Area::Area(const nsString& aBaseURL, const nsString& aHREF, const nsString& aTarget, const nsString& aAltText, PRBool aSuppress, PRBool aHasURL) : mBase(aBaseURL), mHREF(aHREF), mTarget(aTarget), mAltText(aAltText), mSuppressFeedback(aSuppress), mHasURL(aHasURL) { + MOZ_COUNT_CTOR(Area); mCoords = nsnull; mNumCoords = 0; } Area::~Area() { + MOZ_COUNT_DTOR(Area); delete [] mCoords; } diff --git a/mozilla/layout/generic/nsLineBox.cpp b/mozilla/layout/generic/nsLineBox.cpp index 4fa8a8b2b69..b6521a3045c 100644 --- a/mozilla/layout/generic/nsLineBox.cpp +++ b/mozilla/layout/generic/nsLineBox.cpp @@ -27,8 +27,11 @@ #include "nsLayoutAtoms.h" #endif +MOZ_DECL_CTOR_COUNTER(nsLineBox); + nsLineBox::nsLineBox(nsIFrame* aFrame, PRInt32 aCount, PRUint16 flags) { + MOZ_COUNT_CTOR(nsLineBox); mFirstChild = aFrame; mChildCount = aCount; mState = LINE_IS_DIRTY | flags; @@ -43,6 +46,7 @@ nsLineBox::nsLineBox(nsIFrame* aFrame, PRInt32 aCount, PRUint16 flags) nsLineBox::~nsLineBox() { + MOZ_COUNT_DTOR(nsLineBox); } static void @@ -619,6 +623,8 @@ nsFloaterCacheFreeList::Append(nsFloaterCache* aFloater) //---------------------------------------------------------------------- +MOZ_DECL_CTOR_COUNTER(nsFloaterCache); + nsFloaterCache::nsFloaterCache() : mPlaceholder(nsnull), mIsCurrentLineFloater(PR_TRUE), @@ -627,4 +633,12 @@ nsFloaterCache::nsFloaterCache() mCombinedArea(0, 0, 0, 0), mNext(nsnull) { + MOZ_COUNT_CTOR(nsFloaterCache); } + +#ifdef DEBUG +nsFloaterCache::~nsFloaterCache() +{ + MOZ_COUNT_DTOR(nsFloaterCache); +} +#endif diff --git a/mozilla/layout/generic/nsLineBox.h b/mozilla/layout/generic/nsLineBox.h index 2e753c4c9b7..027704cdee4 100644 --- a/mozilla/layout/generic/nsLineBox.h +++ b/mozilla/layout/generic/nsLineBox.h @@ -47,7 +47,11 @@ class nsFloaterCacheFreeList; class nsFloaterCache { public: nsFloaterCache(); +#ifdef DEBUG + ~nsFloaterCache(); +#else ~nsFloaterCache() { } +#endif nsFloaterCache* Next() const { return mNext; } diff --git a/mozilla/layout/generic/nsLineLayout.cpp b/mozilla/layout/generic/nsLineLayout.cpp index 35a21f7ed64..7cdf2d0747e 100644 --- a/mozilla/layout/generic/nsLineLayout.cpp +++ b/mozilla/layout/generic/nsLineLayout.cpp @@ -49,13 +49,17 @@ #undef REALLY_NOISY_TRIM #endif +MOZ_DECL_CTOR_COUNTER(nsTextRun); + nsTextRun::nsTextRun() { + MOZ_COUNT_CTOR(nsTextRun); mNext = nsnull; } nsTextRun::~nsTextRun() { + MOZ_COUNT_DTOR(nsTextRun); } void @@ -80,6 +84,8 @@ nsTextRun::List(FILE* out, PRInt32 aIndent) #define PLACED_LEFT 0x1 #define PLACED_RIGHT 0x2 +MOZ_DECL_CTOR_COUNTER(nsLineLayout); + nsLineLayout::nsLineLayout(nsIPresContext& aPresContext, nsISpaceManager* aSpaceManager, const nsHTMLReflowState* aOuterReflowState, @@ -91,6 +97,8 @@ nsLineLayout::nsLineLayout(nsIPresContext& aPresContext, mMinLineHeight(0), mComputeMaxElementSize(aComputeMaxElementSize) { + MOZ_COUNT_CTOR(nsLineLayout); + // Stash away some style data that we need aOuterReflowState->frame->GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&) mStyleText); @@ -129,6 +137,8 @@ nsLineLayout::nsLineLayout(nsIPresContext& aPresContext, nsLineLayout::nsLineLayout(nsIPresContext& aPresContext) : mPresContext(aPresContext) { + MOZ_COUNT_CTOR(nsLineLayout); + mTextRuns = nsnull; mTextRunP = &mTextRuns; mNewTextRun = nsnull; @@ -139,6 +149,8 @@ nsLineLayout::nsLineLayout(nsIPresContext& aPresContext) nsLineLayout::~nsLineLayout() { + MOZ_COUNT_DTOR(nsLineLayout); + NS_ASSERTION(nsnull == mRootSpan, "bad line-layout user"); nsTextRun::DeleteTextRuns(mTextRuns); diff --git a/mozilla/layout/generic/nsSpaceManager.cpp b/mozilla/layout/generic/nsSpaceManager.cpp index 2eaae7b1fd8..d84e6e4b249 100644 --- a/mozilla/layout/generic/nsSpaceManager.cpp +++ b/mozilla/layout/generic/nsSpaceManager.cpp @@ -1010,20 +1010,33 @@ nsSpaceManager::DestroyFrameInfo(FrameInfo* aFrameInfo) ///////////////////////////////////////////////////////////////////////////// // FrameInfo +MOZ_DECL_CTOR_COUNTER(FrameInfo); + nsSpaceManager::FrameInfo::FrameInfo(nsIFrame* aFrame, const nsRect& aRect) : mFrame(aFrame), mRect(aRect), mNext(0) { + MOZ_COUNT_CTOR(FrameInfo); } +#ifdef DEBUG +nsSpaceManager::FrameInfo::~FrameInfo() +{ + MOZ_COUNT_DTOR(FrameInfo); +} +#endif + ///////////////////////////////////////////////////////////////////////////// // BandRect +MOZ_DECL_CTOR_COUNTER(BandRect); + nsSpaceManager::BandRect::BandRect(nscoord aLeft, nscoord aTop, nscoord aRight, nscoord aBottom, nsIFrame* aFrame) { + MOZ_COUNT_CTOR(BandRect); mLeft = aLeft; mTop = aTop; mRight = aRight; @@ -1038,6 +1051,7 @@ nsSpaceManager::BandRect::BandRect(nscoord aLeft, nscoord aBottom, nsVoidArray* aFrames) { + MOZ_COUNT_CTOR(BandRect); mLeft = aLeft; mTop = aTop; mRight = aRight; @@ -1049,6 +1063,7 @@ nsSpaceManager::BandRect::BandRect(nscoord aLeft, nsSpaceManager::BandRect::~BandRect() { + MOZ_COUNT_DTOR(BandRect); if (mNumFrames > 1) { delete mFrames; } diff --git a/mozilla/layout/generic/nsSpaceManager.h b/mozilla/layout/generic/nsSpaceManager.h index dd16b65254d..c682f74af40 100644 --- a/mozilla/layout/generic/nsSpaceManager.h +++ b/mozilla/layout/generic/nsSpaceManager.h @@ -68,6 +68,9 @@ protected: FrameInfo* mNext; FrameInfo(nsIFrame* aFrame, const nsRect& aRect); +#ifdef DEBUG + ~FrameInfo(); +#endif }; public: diff --git a/mozilla/layout/generic/nsTextTransformer.cpp b/mozilla/layout/generic/nsTextTransformer.cpp index 60933747f55..751c217e9fa 100644 --- a/mozilla/layout/generic/nsTextTransformer.cpp +++ b/mozilla/layout/generic/nsTextTransformer.cpp @@ -40,6 +40,8 @@ static nsrefcnt gCaseConvRefCnt = 0; #define MAX_UNIBYTE 127 +MOZ_DECL_CTOR_COUNTER(nsTextTransformer); + nsTextTransformer::nsTextTransformer(nsILineBreaker* aLineBreaker, nsIWordBreaker* aWordBreaker) : mBuffer(mAutoWordBuffer), @@ -48,6 +50,7 @@ nsTextTransformer::nsTextTransformer(nsILineBreaker* aLineBreaker, mLineBreaker(aLineBreaker), mWordBreaker(aWordBreaker) { + MOZ_COUNT_CTOR(nsTextTransformer); if (gCaseConvRefCnt++ == 0) { nsresult res; res = nsServiceManager::GetService(kUnicharUtilCID, kICaseConversionIID, @@ -59,6 +62,7 @@ nsTextTransformer::nsTextTransformer(nsILineBreaker* aLineBreaker, nsTextTransformer::~nsTextTransformer() { + MOZ_COUNT_DTOR(nsTextTransformer); if (mBuffer != mAutoWordBuffer) { delete [] mBuffer; } diff --git a/mozilla/layout/html/base/src/nsDST.cpp b/mozilla/layout/html/base/src/nsDST.cpp index 87052854705..f400c7b2027 100644 --- a/mozilla/layout/html/base/src/nsDST.cpp +++ b/mozilla/layout/html/base/src/nsDST.cpp @@ -18,6 +18,7 @@ #define PL_ARENA_CONST_ALIGN_MASK 7 #include "nslayout.h" #include "nsDST.h" +#include "nsISupports.h" #ifdef NS_DEBUG #include #endif @@ -50,16 +51,21 @@ inline void* nsDST::Node::operator new(size_t aSize, NodeArena& aArena) #define NS_DST_ARENA_BLOCK_SIZE 1024 +MOZ_DECL_CTOR_COUNTER(NodeArena); + // Constructor nsDST::NodeArena::NodeArena() : mFreeList(0) { + MOZ_COUNT_CTOR(NodeArena); PL_INIT_ARENA_POOL(&mPool, "DSTNodeArena", NS_DST_ARENA_BLOCK_SIZE); } // Destructor nsDST::NodeArena::~NodeArena() { + MOZ_COUNT_DTOR(NodeArena); + // Free the arena in the pool and finish using it PL_FinishArenaPool(&mPool); } @@ -110,15 +116,19 @@ nsDST::NodeArena::FreeArenaPool() ///////////////////////////////////////////////////////////////////////////// // Digital search tree for doing a radix-search of pointer-based keys +MOZ_DECL_CTOR_COUNTER(nsDST); + // Constructor nsDST::nsDST(PtrBits aLevelZeroBit) : mRoot(0), mLevelZeroBit(aLevelZeroBit) { + MOZ_COUNT_CTOR(nsDST); } // Destructor nsDST::~nsDST() { + MOZ_COUNT_DTOR(nsDST); } // Removes all nodes from the tree diff --git a/mozilla/layout/html/base/src/nsFrameManager.cpp b/mozilla/layout/html/base/src/nsFrameManager.cpp index 738c269b0f3..316293dfa0f 100644 --- a/mozilla/layout/html/base/src/nsFrameManager.cpp +++ b/mozilla/layout/html/base/src/nsFrameManager.cpp @@ -74,9 +74,12 @@ protected: PLHashTable* mTable; }; +MOZ_DECL_CTOR_COUNTER(UndisplayedNode); + struct UndisplayedNode { UndisplayedNode(nsIContent* aContent, nsIStyleContext* aStyle) { + MOZ_COUNT_CTOR(UndisplayedNode); mContent = aContent; mStyle = aStyle; NS_ADDREF(mStyle); @@ -84,6 +87,7 @@ struct UndisplayedNode { } UndisplayedNode(nsIStyleContext* aPseudoStyle) { + MOZ_COUNT_CTOR(UndisplayedNode); mContent = nsnull; mStyle = aPseudoStyle; NS_ADDREF(mStyle); @@ -91,6 +95,7 @@ struct UndisplayedNode { } ~UndisplayedNode(void) { + MOZ_COUNT_DTOR(UndisplayedNode); NS_RELEASE(mStyle); if (mNext) { delete mNext; @@ -261,6 +266,7 @@ NS_NewFrameManager(nsIFrameManager** aInstancePtrResult) FrameManager::FrameManager() { + NS_INIT_REFCNT(); } NS_IMPL_ADDREF(FrameManager) @@ -1313,8 +1319,11 @@ CompareKeys(void* key1, void* key2) return key1 == key2; } +MOZ_DECL_CTOR_COUNTER(FrameHashTable); + FrameHashTable::FrameHashTable(PRUint32 aNumBuckets) { + MOZ_COUNT_CTOR(FrameHashTable); mTable = PL_NewHashTable(aNumBuckets, (PLHashFunction)HashKey, (PLHashComparator)CompareKeys, (PLHashComparator)nsnull, @@ -1323,6 +1332,7 @@ FrameHashTable::FrameHashTable(PRUint32 aNumBuckets) FrameHashTable::~FrameHashTable() { + MOZ_COUNT_DTOR(FrameHashTable); PL_HashTableDestroy(mTable); } @@ -1395,8 +1405,13 @@ FrameHashTable::Dump(FILE* fp) } #endif +//---------------------------------------------------------------------- + +MOZ_DECL_CTOR_COUNTER(UndisplayedMap); + UndisplayedMap::UndisplayedMap(PRUint32 aNumBuckets) { + MOZ_COUNT_CTOR(UndisplayedMap); mTable = PL_NewHashTable(aNumBuckets, (PLHashFunction)HashKey, (PLHashComparator)CompareKeys, (PLHashComparator)nsnull, @@ -1406,6 +1421,7 @@ UndisplayedMap::UndisplayedMap(PRUint32 aNumBuckets) UndisplayedMap::~UndisplayedMap(void) { + MOZ_COUNT_DTOR(UndisplayedMap); Clear(); PL_HashTableDestroy(mTable); } diff --git a/mozilla/layout/html/base/src/nsHTMLImageLoader.cpp b/mozilla/layout/html/base/src/nsHTMLImageLoader.cpp index 4fbdee3cdb6..3a36fb45879 100644 --- a/mozilla/layout/html/base/src/nsHTMLImageLoader.cpp +++ b/mozilla/layout/html/base/src/nsHTMLImageLoader.cpp @@ -29,6 +29,8 @@ #undef NOISY_IMAGE_LOADING #endif +MOZ_DECL_CTOR_COUNTER(nsHTMLImageLoader); + nsHTMLImageLoader::nsHTMLImageLoader() : mBaseURL(nsnull), mFrame(nsnull), @@ -39,10 +41,12 @@ nsHTMLImageLoader::nsHTMLImageLoader() mIntrinsicImageSize(0, 0), mComputedImageSize(0, 0) { + MOZ_COUNT_CTOR(nsHTMLImageLoader); } nsHTMLImageLoader::~nsHTMLImageLoader() { + MOZ_COUNT_DTOR(nsHTMLImageLoader); NS_IF_RELEASE(mBaseURL); NS_IF_RELEASE(mImageLoader); } diff --git a/mozilla/layout/html/base/src/nsImageMap.cpp b/mozilla/layout/html/base/src/nsImageMap.cpp index c2b02f6b244..8ca6247b9ba 100644 --- a/mozilla/layout/html/base/src/nsImageMap.cpp +++ b/mozilla/layout/html/base/src/nsImageMap.cpp @@ -92,18 +92,22 @@ public: PRBool mHasURL; }; +MOZ_DECL_CTOR_COUNTER(Area); + Area::Area(const nsString& aBaseURL, const nsString& aHREF, const nsString& aTarget, const nsString& aAltText, PRBool aSuppress, PRBool aHasURL) : mBase(aBaseURL), mHREF(aHREF), mTarget(aTarget), mAltText(aAltText), mSuppressFeedback(aSuppress), mHasURL(aHasURL) { + MOZ_COUNT_CTOR(Area); mCoords = nsnull; mNumCoords = 0; } Area::~Area() { + MOZ_COUNT_DTOR(Area); delete [] mCoords; } diff --git a/mozilla/layout/html/base/src/nsLineBox.cpp b/mozilla/layout/html/base/src/nsLineBox.cpp index 4fa8a8b2b69..b6521a3045c 100644 --- a/mozilla/layout/html/base/src/nsLineBox.cpp +++ b/mozilla/layout/html/base/src/nsLineBox.cpp @@ -27,8 +27,11 @@ #include "nsLayoutAtoms.h" #endif +MOZ_DECL_CTOR_COUNTER(nsLineBox); + nsLineBox::nsLineBox(nsIFrame* aFrame, PRInt32 aCount, PRUint16 flags) { + MOZ_COUNT_CTOR(nsLineBox); mFirstChild = aFrame; mChildCount = aCount; mState = LINE_IS_DIRTY | flags; @@ -43,6 +46,7 @@ nsLineBox::nsLineBox(nsIFrame* aFrame, PRInt32 aCount, PRUint16 flags) nsLineBox::~nsLineBox() { + MOZ_COUNT_DTOR(nsLineBox); } static void @@ -619,6 +623,8 @@ nsFloaterCacheFreeList::Append(nsFloaterCache* aFloater) //---------------------------------------------------------------------- +MOZ_DECL_CTOR_COUNTER(nsFloaterCache); + nsFloaterCache::nsFloaterCache() : mPlaceholder(nsnull), mIsCurrentLineFloater(PR_TRUE), @@ -627,4 +633,12 @@ nsFloaterCache::nsFloaterCache() mCombinedArea(0, 0, 0, 0), mNext(nsnull) { + MOZ_COUNT_CTOR(nsFloaterCache); } + +#ifdef DEBUG +nsFloaterCache::~nsFloaterCache() +{ + MOZ_COUNT_DTOR(nsFloaterCache); +} +#endif diff --git a/mozilla/layout/html/base/src/nsLineBox.h b/mozilla/layout/html/base/src/nsLineBox.h index 2e753c4c9b7..027704cdee4 100644 --- a/mozilla/layout/html/base/src/nsLineBox.h +++ b/mozilla/layout/html/base/src/nsLineBox.h @@ -47,7 +47,11 @@ class nsFloaterCacheFreeList; class nsFloaterCache { public: nsFloaterCache(); +#ifdef DEBUG + ~nsFloaterCache(); +#else ~nsFloaterCache() { } +#endif nsFloaterCache* Next() const { return mNext; } diff --git a/mozilla/layout/html/base/src/nsLineLayout.cpp b/mozilla/layout/html/base/src/nsLineLayout.cpp index 35a21f7ed64..7cdf2d0747e 100644 --- a/mozilla/layout/html/base/src/nsLineLayout.cpp +++ b/mozilla/layout/html/base/src/nsLineLayout.cpp @@ -49,13 +49,17 @@ #undef REALLY_NOISY_TRIM #endif +MOZ_DECL_CTOR_COUNTER(nsTextRun); + nsTextRun::nsTextRun() { + MOZ_COUNT_CTOR(nsTextRun); mNext = nsnull; } nsTextRun::~nsTextRun() { + MOZ_COUNT_DTOR(nsTextRun); } void @@ -80,6 +84,8 @@ nsTextRun::List(FILE* out, PRInt32 aIndent) #define PLACED_LEFT 0x1 #define PLACED_RIGHT 0x2 +MOZ_DECL_CTOR_COUNTER(nsLineLayout); + nsLineLayout::nsLineLayout(nsIPresContext& aPresContext, nsISpaceManager* aSpaceManager, const nsHTMLReflowState* aOuterReflowState, @@ -91,6 +97,8 @@ nsLineLayout::nsLineLayout(nsIPresContext& aPresContext, mMinLineHeight(0), mComputeMaxElementSize(aComputeMaxElementSize) { + MOZ_COUNT_CTOR(nsLineLayout); + // Stash away some style data that we need aOuterReflowState->frame->GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&) mStyleText); @@ -129,6 +137,8 @@ nsLineLayout::nsLineLayout(nsIPresContext& aPresContext, nsLineLayout::nsLineLayout(nsIPresContext& aPresContext) : mPresContext(aPresContext) { + MOZ_COUNT_CTOR(nsLineLayout); + mTextRuns = nsnull; mTextRunP = &mTextRuns; mNewTextRun = nsnull; @@ -139,6 +149,8 @@ nsLineLayout::nsLineLayout(nsIPresContext& aPresContext) nsLineLayout::~nsLineLayout() { + MOZ_COUNT_DTOR(nsLineLayout); + NS_ASSERTION(nsnull == mRootSpan, "bad line-layout user"); nsTextRun::DeleteTextRuns(mTextRuns); diff --git a/mozilla/layout/html/base/src/nsPresShell.cpp b/mozilla/layout/html/base/src/nsPresShell.cpp index 81f15620561..76cfd717560 100644 --- a/mozilla/layout/html/base/src/nsPresShell.cpp +++ b/mozilla/layout/html/base/src/nsPresShell.cpp @@ -81,7 +81,6 @@ static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID); static NS_DEFINE_CID(kCTransferableCID, NS_TRANSFERABLE_CID); static NS_DEFINE_IID(kCXIFConverterCID, NS_XIFFORMATCONVERTER_CID); -static PRBool gsNoisyRefs = PR_FALSE; #undef NOISY // comment out to hide caret @@ -406,11 +405,8 @@ NS_NewPresShell(nsIPresShell** aInstancePtrResult) return it->QueryInterface(kIPresShellIID, (void **) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(PresShell); - PresShell::PresShell() { - MOZ_COUNT_CTOR(PresShell); mIsDestroying = PR_FALSE; mCaretEnabled = PR_FALSE; mDisplayNonTextSelection = PR_FALSE; @@ -419,39 +415,8 @@ PresShell::PresShell() EnableScrolling(); } -#ifdef NS_DEBUG -// for debugging only -nsrefcnt PresShell::AddRef(void) -{ - if (gsNoisyRefs) { - printf("PresShell: AddRef: %p, cnt = %d \n",this, mRefCnt+1); - } - ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "PresShell"); - return mRefCnt; -} - -// for debugging only -nsrefcnt PresShell::Release(void) -{ - if (gsNoisyRefs) { - printf("PresShell Release: %p, cnt = %d \n",this, mRefCnt-1); - } - --mRefCnt; - NS_LOG_RELEASE(this, mRefCnt, "PresShell"); - if (mRefCnt == 0) { - if (gsNoisyRefs) { - printf("PresShell Delete: %p, \n",this); - } - delete this; - return 0; - } - return mRefCnt; -} -#else NS_IMPL_ADDREF(PresShell) NS_IMPL_RELEASE(PresShell) -#endif nsresult PresShell::QueryInterface(const nsIID& aIID, void** aInstancePtr) @@ -504,8 +469,6 @@ PresShell::QueryInterface(const nsIID& aIID, void** aInstancePtr) PresShell::~PresShell() { - MOZ_COUNT_DTOR(PresShell); - mRefCnt = 99;/* XXX hack! get around re-entrancy bugs */ mIsDestroying = PR_TRUE; diff --git a/mozilla/layout/html/base/src/nsTextTransformer.cpp b/mozilla/layout/html/base/src/nsTextTransformer.cpp index 60933747f55..751c217e9fa 100644 --- a/mozilla/layout/html/base/src/nsTextTransformer.cpp +++ b/mozilla/layout/html/base/src/nsTextTransformer.cpp @@ -40,6 +40,8 @@ static nsrefcnt gCaseConvRefCnt = 0; #define MAX_UNIBYTE 127 +MOZ_DECL_CTOR_COUNTER(nsTextTransformer); + nsTextTransformer::nsTextTransformer(nsILineBreaker* aLineBreaker, nsIWordBreaker* aWordBreaker) : mBuffer(mAutoWordBuffer), @@ -48,6 +50,7 @@ nsTextTransformer::nsTextTransformer(nsILineBreaker* aLineBreaker, mLineBreaker(aLineBreaker), mWordBreaker(aWordBreaker) { + MOZ_COUNT_CTOR(nsTextTransformer); if (gCaseConvRefCnt++ == 0) { nsresult res; res = nsServiceManager::GetService(kUnicharUtilCID, kICaseConversionIID, @@ -59,6 +62,7 @@ nsTextTransformer::nsTextTransformer(nsILineBreaker* aLineBreaker, nsTextTransformer::~nsTextTransformer() { + MOZ_COUNT_DTOR(nsTextTransformer); if (mBuffer != mAutoWordBuffer) { delete [] mBuffer; } diff --git a/mozilla/layout/html/content/src/nsGenericDOMHTMLCollection.cpp b/mozilla/layout/html/content/src/nsGenericDOMHTMLCollection.cpp index 3af07046a79..c2e040b833e 100644 --- a/mozilla/layout/html/content/src/nsGenericDOMHTMLCollection.cpp +++ b/mozilla/layout/html/content/src/nsGenericDOMHTMLCollection.cpp @@ -16,21 +16,18 @@ * Corporation. Portions created by Netscape are Copyright (C) 1998 * Netscape Communications Corporation. All Rights Reserved. */ - +#include "nslayout.h" #include "nsGenericDOMHTMLCollection.h" -MOZ_DECL_CTOR_COUNTER(nsGenericDOMHTMLCollection); nsGenericDOMHTMLCollection::nsGenericDOMHTMLCollection() { - MOZ_COUNT_CTOR(nsGenericDOMHTMLCollection); mRefCnt = 0; mScriptObject = nsnull; } nsGenericDOMHTMLCollection::~nsGenericDOMHTMLCollection() { - MOZ_COUNT_DTOR(nsGenericDOMHTMLCollection); } nsresult diff --git a/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp b/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp index c41be6b6250..5c929f4bb93 100644 --- a/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp +++ b/mozilla/layout/html/content/src/nsGenericHTMLElement.cpp @@ -1067,7 +1067,9 @@ nsGenericHTMLElement::GetInlineStyleRules(nsISupportsArray* aRules) if (NS_CONTENT_ATTR_HAS_VALUE == mAttributes->GetAttribute(nsHTMLAtoms::style, value)) { if (eHTMLUnit_ISupports == value.GetUnit()) { nsISupports* supports = value.GetISupportsValue(); - result = supports->QueryInterface(kIStyleRuleIID, (void**)&rule); + if (supports) { + result = supports->QueryInterface(kIStyleRuleIID, (void**)&rule); + } NS_RELEASE(supports); } } @@ -1334,16 +1336,19 @@ nsGenericHTMLElement::AttributeToString(nsIAtom* aAttribute, if (nsHTMLAtoms::style == aAttribute) { if (eHTMLUnit_ISupports == aValue.GetUnit()) { nsIStyleRule* rule = (nsIStyleRule*) aValue.GetISupportsValue(); - nsICSSStyleRule* cssRule; - if (NS_OK == rule->QueryInterface(kICSSStyleRuleIID, (void**)&cssRule)) { - nsICSSDeclaration* decl = cssRule->GetDeclaration(); - if (nsnull != decl) { - decl->ToString(aResult); + if (rule) { + nsICSSStyleRule* cssRule; + if (NS_OK == rule->QueryInterface(kICSSStyleRuleIID, (void**)&cssRule)) { + nsICSSDeclaration* decl = cssRule->GetDeclaration(); + if (nsnull != decl) { + decl->ToString(aResult); + } + NS_RELEASE(cssRule); } - NS_RELEASE(cssRule); - } - else { - aResult = "Unknown rule type"; + else { + aResult = "Unknown rule type"; + } + NS_RELEASE(rule); } return NS_CONTENT_ATTR_HAS_VALUE; } diff --git a/mozilla/layout/html/content/src/nsHTMLAnchorElement.cpp b/mozilla/layout/html/content/src/nsHTMLAnchorElement.cpp index 4f9bfd96ca5..7fa482ed2fc 100644 --- a/mozilla/layout/html/content/src/nsHTMLAnchorElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLAnchorElement.cpp @@ -126,18 +126,15 @@ NS_NewHTMLAnchorElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLAnchorElement); nsHTMLAnchorElement::nsHTMLAnchorElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLAnchorElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLAnchorElement::~nsHTMLAnchorElement() { - MOZ_COUNT_DTOR(nsHTMLAnchorElement); } NS_IMPL_ADDREF(nsHTMLAnchorElement) diff --git a/mozilla/layout/html/content/src/nsHTMLAppletElement.cpp b/mozilla/layout/html/content/src/nsHTMLAppletElement.cpp index 0569de8b43b..5b62bb6d4d5 100644 --- a/mozilla/layout/html/content/src/nsHTMLAppletElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLAppletElement.cpp @@ -125,11 +125,9 @@ NS_NewHTMLAppletElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLAppletElement); nsHTMLAppletElement::nsHTMLAppletElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLAppletElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mReflectedApplet = PR_FALSE; @@ -137,7 +135,6 @@ nsHTMLAppletElement::nsHTMLAppletElement(nsIAtom* aTag) nsHTMLAppletElement::~nsHTMLAppletElement() { - MOZ_COUNT_DTOR(nsHTMLAppletElement); } NS_IMPL_ADDREF(nsHTMLAppletElement) diff --git a/mozilla/layout/html/content/src/nsHTMLAreaElement.cpp b/mozilla/layout/html/content/src/nsHTMLAreaElement.cpp index 153aa4b7567..32fff98fc5d 100644 --- a/mozilla/layout/html/content/src/nsHTMLAreaElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLAreaElement.cpp @@ -106,18 +106,15 @@ NS_NewHTMLAreaElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLAreaElement); nsHTMLAreaElement::nsHTMLAreaElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLAreaElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLAreaElement::~nsHTMLAreaElement() { - MOZ_COUNT_DTOR(nsHTMLAreaElement); } NS_IMPL_ADDREF(nsHTMLAreaElement) diff --git a/mozilla/layout/html/content/src/nsHTMLBRElement.cpp b/mozilla/layout/html/content/src/nsHTMLBRElement.cpp index 1c64346cc09..fabcb1c606c 100644 --- a/mozilla/layout/html/content/src/nsHTMLBRElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLBRElement.cpp @@ -85,18 +85,15 @@ NS_NewHTMLBRElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLBRElement); nsHTMLBRElement::nsHTMLBRElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLBRElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLBRElement::~nsHTMLBRElement() { - MOZ_COUNT_DTOR(nsHTMLBRElement); } NS_IMPL_ADDREF(nsHTMLBRElement) diff --git a/mozilla/layout/html/content/src/nsHTMLBaseElement.cpp b/mozilla/layout/html/content/src/nsHTMLBaseElement.cpp index 2f8420c358e..c16a596818b 100644 --- a/mozilla/layout/html/content/src/nsHTMLBaseElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLBaseElement.cpp @@ -86,18 +86,15 @@ NS_NewHTMLBaseElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLBaseElement); nsHTMLBaseElement::nsHTMLBaseElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLBaseElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLBaseElement::~nsHTMLBaseElement() { - MOZ_COUNT_DTOR(nsHTMLBaseElement); } NS_IMPL_ADDREF(nsHTMLBaseElement) diff --git a/mozilla/layout/html/content/src/nsHTMLBaseFontElement.cpp b/mozilla/layout/html/content/src/nsHTMLBaseFontElement.cpp index d0a471cdc89..166fb96b310 100644 --- a/mozilla/layout/html/content/src/nsHTMLBaseFontElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLBaseFontElement.cpp @@ -88,18 +88,15 @@ NS_NewHTMLBaseFontElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLBaseFontElement); nsHTMLBaseFontElement::nsHTMLBaseFontElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLBaseFontElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLBaseFontElement::~nsHTMLBaseFontElement() { - MOZ_COUNT_DTOR(nsHTMLBaseFontElement); } NS_IMPL_ADDREF(nsHTMLBaseFontElement) diff --git a/mozilla/layout/html/content/src/nsHTMLBodyElement.cpp b/mozilla/layout/html/content/src/nsHTMLBodyElement.cpp index aa2a06238b7..81503510554 100644 --- a/mozilla/layout/html/content/src/nsHTMLBodyElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLBodyElement.cpp @@ -116,19 +116,16 @@ public: BodyFixupRule* mInlineStyleRule; }; -MOZ_DECL_CTOR_COUNTER(nsBodyInner); nsBodyInner::nsBodyInner() : nsGenericHTMLContainerElement(), mContentStyleRule(nsnull), mInlineStyleRule(nsnull) { - MOZ_COUNT_CTOR(nsBodyInner); } nsBodyInner::~nsBodyInner() { - MOZ_COUNT_DTOR(nsBodyInner); if (nsnull != mContentStyleRule) { mContentStyleRule->mPart = nsnull; mContentStyleRule->mSheet = nsnull; @@ -215,11 +212,9 @@ friend class BodyFixupRule; //---------------------------------------------------------------------- -MOZ_DECL_CTOR_COUNTER(BodyRule); BodyRule::BodyRule(nsHTMLBodyElement* aPart, nsIHTMLStyleSheet* aSheet) { - MOZ_COUNT_CTOR(BodyRule); NS_INIT_REFCNT(); mPart = aPart; mSheet = aSheet; @@ -227,7 +222,6 @@ BodyRule::BodyRule(nsHTMLBodyElement* aPart, nsIHTMLStyleSheet* aSheet) BodyRule::~BodyRule() { - MOZ_COUNT_DTOR(BodyRule); } NS_IMPL_ISUPPORTS(BodyRule, kIStyleRuleIID); @@ -395,19 +389,16 @@ BodyRule::List(FILE* out, PRInt32 aIndent) const //---------------------------------------------------------------------- -MOZ_DECL_CTOR_COUNTER(BodyFixupRule); BodyFixupRule::BodyFixupRule(nsHTMLBodyElement* aPart, nsIHTMLCSSStyleSheet* aSheet) : mPart(aPart), mSheet(aSheet) { - MOZ_COUNT_CTOR(BodyFixupRule); NS_INIT_REFCNT(); } BodyFixupRule::~BodyFixupRule() { - MOZ_COUNT_DTOR(BodyFixupRule); } NS_IMPL_ADDREF(BodyFixupRule); @@ -570,18 +561,15 @@ NS_NewHTMLBodyElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLBodyElement); nsHTMLBodyElement::nsHTMLBodyElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLBodyElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLBodyElement::~nsHTMLBodyElement() { - MOZ_COUNT_DTOR(nsHTMLBodyElement); } NS_IMPL_ADDREF(nsHTMLBodyElement) diff --git a/mozilla/layout/html/content/src/nsHTMLButtonElement.cpp b/mozilla/layout/html/content/src/nsHTMLButtonElement.cpp index 0330ab37261..206aeb17957 100644 --- a/mozilla/layout/html/content/src/nsHTMLButtonElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLButtonElement.cpp @@ -129,11 +129,9 @@ NS_NewHTMLButtonElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLButtonElement); nsHTMLButtonElement::nsHTMLButtonElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLButtonElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mForm = nsnull; @@ -142,7 +140,6 @@ nsHTMLButtonElement::nsHTMLButtonElement(nsIAtom* aTag) nsHTMLButtonElement::~nsHTMLButtonElement() { - MOZ_COUNT_DTOR(nsHTMLButtonElement); if (nsnull != mForm) { // prevent mForm from decrementing its ref count on us mForm->RemoveElement(this, PR_FALSE); @@ -152,13 +149,7 @@ nsHTMLButtonElement::~nsHTMLButtonElement() // nsISupports -NS_IMETHODIMP_(nsrefcnt) -nsHTMLButtonElement::AddRef(void) -{ - ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "nsHTMLButtonElement"); - return mRefCnt; -} +NS_IMPL_ADDREF(nsHTMLButtonElement); nsresult nsHTMLButtonElement::QueryInterface(REFNSIID aIID, void** aInstancePtr) diff --git a/mozilla/layout/html/content/src/nsHTMLDListElement.cpp b/mozilla/layout/html/content/src/nsHTMLDListElement.cpp index 9293f3bb61c..488496419f4 100644 --- a/mozilla/layout/html/content/src/nsHTMLDListElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLDListElement.cpp @@ -85,18 +85,15 @@ NS_NewHTMLDListElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLDListElement); nsHTMLDListElement::nsHTMLDListElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLDListElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLDListElement::~nsHTMLDListElement() { - MOZ_COUNT_DTOR(nsHTMLDListElement); } NS_IMPL_ADDREF(nsHTMLDListElement) diff --git a/mozilla/layout/html/content/src/nsHTMLDelElement.cpp b/mozilla/layout/html/content/src/nsHTMLDelElement.cpp index 31f9a943632..5bdc380c701 100644 --- a/mozilla/layout/html/content/src/nsHTMLDelElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLDelElement.cpp @@ -86,18 +86,15 @@ NS_NewHTMLDelElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLDelElement); nsHTMLDelElement::nsHTMLDelElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLDelElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLDelElement::~nsHTMLDelElement() { - MOZ_COUNT_DTOR(nsHTMLDelElement); } NS_IMPL_ADDREF(nsHTMLDelElement) diff --git a/mozilla/layout/html/content/src/nsHTMLDirectoryElement.cpp b/mozilla/layout/html/content/src/nsHTMLDirectoryElement.cpp index 60dc7bf818d..5b8453f282d 100644 --- a/mozilla/layout/html/content/src/nsHTMLDirectoryElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLDirectoryElement.cpp @@ -89,18 +89,15 @@ NS_NewHTMLDirectoryElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLDirectoryElement); nsHTMLDirectoryElement::nsHTMLDirectoryElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLDirectoryElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLDirectoryElement::~nsHTMLDirectoryElement() { - MOZ_COUNT_DTOR(nsHTMLDirectoryElement); } NS_IMPL_ADDREF(nsHTMLDirectoryElement) diff --git a/mozilla/layout/html/content/src/nsHTMLDivElement.cpp b/mozilla/layout/html/content/src/nsHTMLDivElement.cpp index eb79ac37f80..a182b427af4 100644 --- a/mozilla/layout/html/content/src/nsHTMLDivElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLDivElement.cpp @@ -87,22 +87,18 @@ NS_NewHTMLDivElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLDivElement); nsHTMLDivElement::nsHTMLDivElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLDivElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLDivElement::~nsHTMLDivElement() { - MOZ_COUNT_DTOR(nsHTMLDivElement); } NS_IMPL_ADDREF(nsHTMLDivElement) - NS_IMPL_RELEASE(nsHTMLDivElement) nsresult diff --git a/mozilla/layout/html/content/src/nsHTMLEmbedElement.cpp b/mozilla/layout/html/content/src/nsHTMLEmbedElement.cpp index 3f740b1ec66..c0ebd73d863 100644 --- a/mozilla/layout/html/content/src/nsHTMLEmbedElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLEmbedElement.cpp @@ -84,18 +84,15 @@ NS_NewHTMLEmbedElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLEmbedElement); nsHTMLEmbedElement::nsHTMLEmbedElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLEmbedElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLEmbedElement::~nsHTMLEmbedElement() { - MOZ_COUNT_DTOR(nsHTMLEmbedElement); } NS_IMPL_ADDREF(nsHTMLEmbedElement) diff --git a/mozilla/layout/html/content/src/nsHTMLFieldSetElement.cpp b/mozilla/layout/html/content/src/nsHTMLFieldSetElement.cpp index b536967def0..54d6af12adc 100644 --- a/mozilla/layout/html/content/src/nsHTMLFieldSetElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLFieldSetElement.cpp @@ -99,11 +99,9 @@ NS_NewHTMLFieldSetElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLFieldSetElement); nsHTMLFieldSetElement::nsHTMLFieldSetElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLFieldSetElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mForm = nsnull; @@ -111,7 +109,6 @@ nsHTMLFieldSetElement::nsHTMLFieldSetElement(nsIAtom* aTag) nsHTMLFieldSetElement::~nsHTMLFieldSetElement() { - MOZ_COUNT_DTOR(nsHTMLFieldSetElement); if (nsnull != mForm) { // prevent mForm from decrementing its ref count on us mForm->RemoveElement(this, PR_FALSE); diff --git a/mozilla/layout/html/content/src/nsHTMLFontElement.cpp b/mozilla/layout/html/content/src/nsHTMLFontElement.cpp index 1dde753a789..79d12a300c7 100644 --- a/mozilla/layout/html/content/src/nsHTMLFontElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLFontElement.cpp @@ -92,18 +92,15 @@ NS_NewHTMLFontElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLFontElement); nsHTMLFontElement::nsHTMLFontElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLFontElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLFontElement::~nsHTMLFontElement() { - MOZ_COUNT_DTOR(nsHTMLFontElement); } NS_IMPL_ADDREF(nsHTMLFontElement) diff --git a/mozilla/layout/html/content/src/nsHTMLFormElement.cpp b/mozilla/layout/html/content/src/nsHTMLFormElement.cpp index f6600ca3018..1fa2d447a86 100644 --- a/mozilla/layout/html/content/src/nsHTMLFormElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLFormElement.cpp @@ -174,11 +174,9 @@ NS_NewHTMLFormElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLFormElement); nsHTMLFormElement::nsHTMLFormElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLFormElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mControls = new nsFormControlList(); @@ -188,7 +186,6 @@ nsHTMLFormElement::nsHTMLFormElement(nsIAtom* aTag) nsHTMLFormElement::~nsHTMLFormElement() { - MOZ_COUNT_DTOR(nsHTMLFormElement); // set the controls to have no form PRUint32 numControls; @@ -239,19 +236,11 @@ nsHTMLFormElement::QueryInterface(REFNSIID aIID, void** aInstancePtr) return NS_NOINTERFACE; } -NS_IMETHODIMP_(nsrefcnt) -nsHTMLFormElement::AddRef(void) -{ - //nsTraceRefcnt::AddRef((nsIForm*)this, mRefCnt+1, __FILE__, __LINE__); - ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "nsHTMLFormElement"); - return mRefCnt; -} +NS_IMPL_ADDREF(nsHTMLFormElement); NS_IMETHODIMP_(nsrefcnt) nsHTMLFormElement::Release() { - //nsTraceRefcnt::Release((nsIForm*)this, mRefCnt-1, __FILE__, __LINE__); --mRefCnt; NS_LOG_RELEASE(this, mRefCnt, "nsHTMLFormElement"); PRUint32 numChildren; @@ -639,18 +628,15 @@ nsHTMLFormElement::Item(PRUint32 aIndex, nsIDOMElement** aReturn) // nsFormControlList implementation, this could go away if there were a lightweight collection implementation somewhere -MOZ_DECL_CTOR_COUNTER(nsFormControlList); nsFormControlList::nsFormControlList() { - MOZ_COUNT_CTOR(nsFormControlList); NS_INIT_REFCNT(); mScriptObject = nsnull; } nsFormControlList::~nsFormControlList() { - MOZ_COUNT_DTOR(nsFormControlList); Clear(); } diff --git a/mozilla/layout/html/content/src/nsHTMLFrameElement.cpp b/mozilla/layout/html/content/src/nsHTMLFrameElement.cpp index 0c011910ea0..53c3ec05af4 100644 --- a/mozilla/layout/html/content/src/nsHTMLFrameElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLFrameElement.cpp @@ -98,18 +98,15 @@ NS_NewHTMLFrameElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLFrameElement); nsHTMLFrameElement::nsHTMLFrameElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLFrameElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLFrameElement::~nsHTMLFrameElement() { - MOZ_COUNT_DTOR(nsHTMLFrameElement); } NS_IMPL_ADDREF(nsHTMLFrameElement) diff --git a/mozilla/layout/html/content/src/nsHTMLFrameSetElement.cpp b/mozilla/layout/html/content/src/nsHTMLFrameSetElement.cpp index d8e5a0666c8..d25eed9eec8 100644 --- a/mozilla/layout/html/content/src/nsHTMLFrameSetElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLFrameSetElement.cpp @@ -86,18 +86,15 @@ NS_NewHTMLFrameSetElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLFrameSetElement); nsHTMLFrameSetElement::nsHTMLFrameSetElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLFrameSetElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLFrameSetElement::~nsHTMLFrameSetElement() { - MOZ_COUNT_DTOR(nsHTMLFrameSetElement); } NS_IMPL_ADDREF(nsHTMLFrameSetElement) diff --git a/mozilla/layout/html/content/src/nsHTMLHRElement.cpp b/mozilla/layout/html/content/src/nsHTMLHRElement.cpp index 9636040ee4e..b5d2dab6b9f 100644 --- a/mozilla/layout/html/content/src/nsHTMLHRElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLHRElement.cpp @@ -91,18 +91,15 @@ NS_NewHTMLHRElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLHRElement); nsHTMLHRElement::nsHTMLHRElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLHRElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLHRElement::~nsHTMLHRElement() { - MOZ_COUNT_DTOR(nsHTMLHRElement); } NS_IMPL_ADDREF(nsHTMLHRElement) diff --git a/mozilla/layout/html/content/src/nsHTMLHeadElement.cpp b/mozilla/layout/html/content/src/nsHTMLHeadElement.cpp index 393d40b2168..32fe831ddcb 100644 --- a/mozilla/layout/html/content/src/nsHTMLHeadElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLHeadElement.cpp @@ -84,18 +84,15 @@ NS_NewHTMLHeadElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLHeadElement); nsHTMLHeadElement::nsHTMLHeadElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLHeadElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLHeadElement::~nsHTMLHeadElement() { - MOZ_COUNT_DTOR(nsHTMLHeadElement); } NS_IMPL_ADDREF(nsHTMLHeadElement) diff --git a/mozilla/layout/html/content/src/nsHTMLHeadingElement.cpp b/mozilla/layout/html/content/src/nsHTMLHeadingElement.cpp index c474ad4267d..2172e6e4c01 100644 --- a/mozilla/layout/html/content/src/nsHTMLHeadingElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLHeadingElement.cpp @@ -85,18 +85,15 @@ NS_NewHTMLHeadingElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLHeadingElement); nsHTMLHeadingElement::nsHTMLHeadingElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLHeadingElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLHeadingElement::~nsHTMLHeadingElement() { - MOZ_COUNT_DTOR(nsHTMLHeadingElement); } NS_IMPL_ADDREF(nsHTMLHeadingElement) diff --git a/mozilla/layout/html/content/src/nsHTMLHtmlElement.cpp b/mozilla/layout/html/content/src/nsHTMLHtmlElement.cpp index e8803370e2d..c5f26a23186 100644 --- a/mozilla/layout/html/content/src/nsHTMLHtmlElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLHtmlElement.cpp @@ -89,17 +89,14 @@ NS_NewHTMLHtmlElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLHtmlElement); nsHTMLHtmlElement::nsHTMLHtmlElement() { - MOZ_COUNT_CTOR(nsHTMLHtmlElement); NS_INIT_REFCNT(); } nsHTMLHtmlElement::~nsHTMLHtmlElement() { - MOZ_COUNT_DTOR(nsHTMLHtmlElement); } NS_IMPL_ADDREF(nsHTMLHtmlElement) diff --git a/mozilla/layout/html/content/src/nsHTMLIFrameElement.cpp b/mozilla/layout/html/content/src/nsHTMLIFrameElement.cpp index 7e589dd2fa0..1544d9256ac 100644 --- a/mozilla/layout/html/content/src/nsHTMLIFrameElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLIFrameElement.cpp @@ -110,18 +110,15 @@ NS_NewHTMLIFrameElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLIFrameElement); nsHTMLIFrameElement::nsHTMLIFrameElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLIFrameElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLIFrameElement::~nsHTMLIFrameElement() { - MOZ_COUNT_DTOR(nsHTMLIFrameElement); } NS_IMPL_ADDREF(nsHTMLIFrameElement) diff --git a/mozilla/layout/html/content/src/nsHTMLImageElement.cpp b/mozilla/layout/html/content/src/nsHTMLImageElement.cpp index a112b664c58..fd0e874a6ef 100644 --- a/mozilla/layout/html/content/src/nsHTMLImageElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLImageElement.cpp @@ -147,11 +147,9 @@ NS_NewHTMLImageElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLImageElement); nsHTMLImageElement::nsHTMLImageElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLImageElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mOwnerDocument = nsnull; @@ -159,7 +157,6 @@ nsHTMLImageElement::nsHTMLImageElement(nsIAtom* aTag) nsHTMLImageElement::~nsHTMLImageElement() { - MOZ_COUNT_DTOR(nsHTMLImageElement); NS_IF_RELEASE(mOwnerDocument); } diff --git a/mozilla/layout/html/content/src/nsHTMLInputElement.cpp b/mozilla/layout/html/content/src/nsHTMLInputElement.cpp index 9175370e140..b83ea57d364 100644 --- a/mozilla/layout/html/content/src/nsHTMLInputElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLInputElement.cpp @@ -162,11 +162,9 @@ NS_NewHTMLInputElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLInputElement); nsHTMLInputElement::nsHTMLInputElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLInputElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mType = NS_FORM_INPUT_TEXT; // default value @@ -177,7 +175,6 @@ nsHTMLInputElement::nsHTMLInputElement(nsIAtom* aTag) nsHTMLInputElement::~nsHTMLInputElement() { - MOZ_COUNT_DTOR(nsHTMLInputElement); if (nsnull != mForm) { // prevent mForm from decrementing its ref count on us mForm->RemoveElement(this, PR_FALSE); @@ -187,15 +184,6 @@ nsHTMLInputElement::~nsHTMLInputElement() // nsISupports -NS_IMETHODIMP_(nsrefcnt) -nsHTMLInputElement::AddRef(void) -{ - ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "nsHTMLInputElement"); - return mRefCnt; -} - - NS_IMETHODIMP nsHTMLInputElement::QueryInterface(REFNSIID aIID, void** aInstancePtr) { @@ -218,6 +206,8 @@ nsHTMLInputElement::QueryInterface(REFNSIID aIID, void** aInstancePtr) return NS_NOINTERFACE; } +NS_IMPL_ADDREF(nsHTMLInputElement); + NS_IMETHODIMP_(nsrefcnt) nsHTMLInputElement::Release() { diff --git a/mozilla/layout/html/content/src/nsHTMLInsElement.cpp b/mozilla/layout/html/content/src/nsHTMLInsElement.cpp index 0d4338fa410..797b9dccad3 100644 --- a/mozilla/layout/html/content/src/nsHTMLInsElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLInsElement.cpp @@ -86,18 +86,15 @@ NS_NewHTMLInsElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLInsElement); nsHTMLInsElement::nsHTMLInsElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLInsElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLInsElement::~nsHTMLInsElement() { - MOZ_COUNT_DTOR(nsHTMLInsElement); } NS_IMPL_ADDREF(nsHTMLInsElement) diff --git a/mozilla/layout/html/content/src/nsHTMLIsIndexElement.cpp b/mozilla/layout/html/content/src/nsHTMLIsIndexElement.cpp index b8f56bd7a50..8b3ec77b2c4 100644 --- a/mozilla/layout/html/content/src/nsHTMLIsIndexElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLIsIndexElement.cpp @@ -85,18 +85,15 @@ NS_NewHTMLIsIndexElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLIsIndexElement); nsHTMLIsIndexElement::nsHTMLIsIndexElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLIsIndexElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLIsIndexElement::~nsHTMLIsIndexElement() { - MOZ_COUNT_DTOR(nsHTMLIsIndexElement); } NS_IMPL_ADDREF(nsHTMLIsIndexElement) diff --git a/mozilla/layout/html/content/src/nsHTMLLIElement.cpp b/mozilla/layout/html/content/src/nsHTMLLIElement.cpp index ee22d628a38..0fd5fe699f9 100644 --- a/mozilla/layout/html/content/src/nsHTMLLIElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLLIElement.cpp @@ -87,18 +87,15 @@ NS_NewHTMLLIElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLLIElement); nsHTMLLIElement::nsHTMLLIElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLLIElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLLIElement::~nsHTMLLIElement() { - MOZ_COUNT_DTOR(nsHTMLLIElement); } NS_IMPL_ADDREF(nsHTMLLIElement) diff --git a/mozilla/layout/html/content/src/nsHTMLLabelElement.cpp b/mozilla/layout/html/content/src/nsHTMLLabelElement.cpp index 98246fe2ea4..4c27c1ab429 100644 --- a/mozilla/layout/html/content/src/nsHTMLLabelElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLLabelElement.cpp @@ -103,11 +103,9 @@ NS_NewHTMLLabelElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLLabelElement); nsHTMLLabelElement::nsHTMLLabelElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLLabelElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mForm = nsnull; @@ -115,7 +113,6 @@ nsHTMLLabelElement::nsHTMLLabelElement(nsIAtom* aTag) nsHTMLLabelElement::~nsHTMLLabelElement() { - MOZ_COUNT_DTOR(nsHTMLLabelElement); if (nsnull != mForm) { // prevent mForm from decrementing its ref count on us mForm->RemoveElement(this, PR_FALSE); diff --git a/mozilla/layout/html/content/src/nsHTMLLegendElement.cpp b/mozilla/layout/html/content/src/nsHTMLLegendElement.cpp index a186e76029e..ba8f9c99325 100644 --- a/mozilla/layout/html/content/src/nsHTMLLegendElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLLegendElement.cpp @@ -93,11 +93,9 @@ NS_NewHTMLLegendElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLLegendElement); nsHTMLLegendElement::nsHTMLLegendElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLLegendElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mForm = nsnull; @@ -105,7 +103,6 @@ nsHTMLLegendElement::nsHTMLLegendElement(nsIAtom* aTag) nsHTMLLegendElement::~nsHTMLLegendElement() { - MOZ_COUNT_DTOR(nsHTMLLegendElement); if (mForm) { NS_RELEASE(mForm); } diff --git a/mozilla/layout/html/content/src/nsHTMLLinkElement.cpp b/mozilla/layout/html/content/src/nsHTMLLinkElement.cpp index 98af84a8c1c..69d08596346 100644 --- a/mozilla/layout/html/content/src/nsHTMLLinkElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLLinkElement.cpp @@ -111,11 +111,9 @@ NS_NewHTMLLinkElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLLinkElement); nsHTMLLinkElement::nsHTMLLinkElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLLinkElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mStyleSheet = nsnull; @@ -123,7 +121,6 @@ nsHTMLLinkElement::nsHTMLLinkElement(nsIAtom* aTag) nsHTMLLinkElement::~nsHTMLLinkElement() { - MOZ_COUNT_DTOR(nsHTMLLinkElement); NS_IF_RELEASE(mStyleSheet); } diff --git a/mozilla/layout/html/content/src/nsHTMLMapElement.cpp b/mozilla/layout/html/content/src/nsHTMLMapElement.cpp index f29f1b3b0a0..7ca31ada331 100644 --- a/mozilla/layout/html/content/src/nsHTMLMapElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLMapElement.cpp @@ -199,11 +199,9 @@ NS_NewHTMLMapElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLMapElement); nsHTMLMapElement::nsHTMLMapElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLMapElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mAreas = nsnull; @@ -211,7 +209,6 @@ nsHTMLMapElement::nsHTMLMapElement(nsIAtom* aTag) nsHTMLMapElement::~nsHTMLMapElement() { - MOZ_COUNT_DTOR(nsHTMLMapElement); if (nsnull != mAreas) { mAreas->ParentDestroyed(); NS_RELEASE(mAreas); diff --git a/mozilla/layout/html/content/src/nsHTMLMenuElement.cpp b/mozilla/layout/html/content/src/nsHTMLMenuElement.cpp index a4192c2e1e7..9de4785f783 100644 --- a/mozilla/layout/html/content/src/nsHTMLMenuElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLMenuElement.cpp @@ -89,18 +89,15 @@ NS_NewHTMLMenuElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLMenuElement); nsHTMLMenuElement::nsHTMLMenuElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLMenuElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLMenuElement::~nsHTMLMenuElement() { - MOZ_COUNT_DTOR(nsHTMLMenuElement); } NS_IMPL_ADDREF(nsHTMLMenuElement) diff --git a/mozilla/layout/html/content/src/nsHTMLMetaElement.cpp b/mozilla/layout/html/content/src/nsHTMLMetaElement.cpp index d0b7de36b28..89710af5011 100644 --- a/mozilla/layout/html/content/src/nsHTMLMetaElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLMetaElement.cpp @@ -90,11 +90,9 @@ NS_NewHTMLMetaElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLMetaElement); nsHTMLMetaElement::nsHTMLMetaElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLMetaElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } @@ -102,7 +100,6 @@ nsHTMLMetaElement::nsHTMLMetaElement(nsIAtom* aTag) nsHTMLMetaElement::~nsHTMLMetaElement() { - MOZ_COUNT_DTOR(nsHTMLMetaElement); } NS_IMPL_ADDREF(nsHTMLMetaElement) diff --git a/mozilla/layout/html/content/src/nsHTMLModElement.cpp b/mozilla/layout/html/content/src/nsHTMLModElement.cpp index ca9ca40bee4..8297a8635d5 100644 --- a/mozilla/layout/html/content/src/nsHTMLModElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLModElement.cpp @@ -86,18 +86,15 @@ NS_NewHTMLModElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLModElement); nsHTMLModElement::nsHTMLModElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLModElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLModElement::~nsHTMLModElement() { - MOZ_COUNT_DTOR(nsHTMLModElement); } NS_IMPL_ADDREF(nsHTMLModElement) diff --git a/mozilla/layout/html/content/src/nsHTMLOListElement.cpp b/mozilla/layout/html/content/src/nsHTMLOListElement.cpp index aea1a8eef23..f385b4b3a8e 100644 --- a/mozilla/layout/html/content/src/nsHTMLOListElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLOListElement.cpp @@ -89,18 +89,15 @@ NS_NewHTMLOListElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLOListElement); nsHTMLOListElement::nsHTMLOListElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLOListElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLOListElement::~nsHTMLOListElement() { - MOZ_COUNT_DTOR(nsHTMLOListElement); } NS_IMPL_ADDREF(nsHTMLOListElement) diff --git a/mozilla/layout/html/content/src/nsHTMLObjectElement.cpp b/mozilla/layout/html/content/src/nsHTMLObjectElement.cpp index 8c91fc430b9..9858b662ade 100644 --- a/mozilla/layout/html/content/src/nsHTMLObjectElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLObjectElement.cpp @@ -117,18 +117,15 @@ NS_NewHTMLObjectElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLObjectElement); nsHTMLObjectElement::nsHTMLObjectElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLObjectElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLObjectElement::~nsHTMLObjectElement() { - MOZ_COUNT_DTOR(nsHTMLObjectElement); } NS_IMPL_ADDREF(nsHTMLObjectElement) diff --git a/mozilla/layout/html/content/src/nsHTMLOptGroupElement.cpp b/mozilla/layout/html/content/src/nsHTMLOptGroupElement.cpp index cf6d132da15..15a6b384e48 100644 --- a/mozilla/layout/html/content/src/nsHTMLOptGroupElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLOptGroupElement.cpp @@ -86,18 +86,15 @@ NS_NewHTMLOptGroupElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLOptGroupElement); nsHTMLOptGroupElement::nsHTMLOptGroupElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLOptGroupElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLOptGroupElement::~nsHTMLOptGroupElement() { - MOZ_COUNT_DTOR(nsHTMLOptGroupElement); } NS_IMPL_ADDREF(nsHTMLOptGroupElement) diff --git a/mozilla/layout/html/content/src/nsHTMLOptionElement.cpp b/mozilla/layout/html/content/src/nsHTMLOptionElement.cpp index 9dbd921f48c..2e19110fb5b 100644 --- a/mozilla/layout/html/content/src/nsHTMLOptionElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLOptionElement.cpp @@ -136,18 +136,15 @@ NS_NewHTMLOptionElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLOptionElement); nsHTMLOptionElement::nsHTMLOptionElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLOptionElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLOptionElement::~nsHTMLOptionElement() { - MOZ_COUNT_DTOR(nsHTMLOptionElement); } // ISupports diff --git a/mozilla/layout/html/content/src/nsHTMLParagraphElement.cpp b/mozilla/layout/html/content/src/nsHTMLParagraphElement.cpp index 419acd7eeda..5f89345bfa8 100644 --- a/mozilla/layout/html/content/src/nsHTMLParagraphElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLParagraphElement.cpp @@ -91,17 +91,14 @@ NS_NewHTMLParagraphElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLParagraphElement); nsHTMLParagraphElement::nsHTMLParagraphElement() { - MOZ_COUNT_CTOR(nsHTMLParagraphElement); NS_INIT_REFCNT(); } nsHTMLParagraphElement::~nsHTMLParagraphElement() { - MOZ_COUNT_DTOR(nsHTMLParagraphElement); } NS_IMPL_ADDREF(nsHTMLParagraphElement) diff --git a/mozilla/layout/html/content/src/nsHTMLParamElement.cpp b/mozilla/layout/html/content/src/nsHTMLParamElement.cpp index 79332d8b75d..8e3e5a16b27 100644 --- a/mozilla/layout/html/content/src/nsHTMLParamElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLParamElement.cpp @@ -90,18 +90,15 @@ NS_NewHTMLParamElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLParamElement); nsHTMLParamElement::nsHTMLParamElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLParamElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLParamElement::~nsHTMLParamElement() { - MOZ_COUNT_DTOR(nsHTMLParamElement); } NS_IMPL_ADDREF(nsHTMLParamElement) diff --git a/mozilla/layout/html/content/src/nsHTMLPreElement.cpp b/mozilla/layout/html/content/src/nsHTMLPreElement.cpp index 44288f7b827..a4b38b4b6ba 100644 --- a/mozilla/layout/html/content/src/nsHTMLPreElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLPreElement.cpp @@ -87,18 +87,15 @@ NS_NewHTMLPreElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLPreElement); nsHTMLPreElement::nsHTMLPreElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLPreElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLPreElement::~nsHTMLPreElement() { - MOZ_COUNT_DTOR(nsHTMLPreElement); } NS_IMPL_ADDREF(nsHTMLPreElement) diff --git a/mozilla/layout/html/content/src/nsHTMLQuoteElement.cpp b/mozilla/layout/html/content/src/nsHTMLQuoteElement.cpp index ccc44224fd5..c61373814ce 100644 --- a/mozilla/layout/html/content/src/nsHTMLQuoteElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLQuoteElement.cpp @@ -84,18 +84,15 @@ NS_NewHTMLQuoteElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLQuoteElement); nsHTMLQuoteElement::nsHTMLQuoteElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLQuoteElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLQuoteElement::~nsHTMLQuoteElement() { - MOZ_COUNT_DTOR(nsHTMLQuoteElement); } NS_IMPL_ADDREF(nsHTMLQuoteElement) diff --git a/mozilla/layout/html/content/src/nsHTMLScriptElement.cpp b/mozilla/layout/html/content/src/nsHTMLScriptElement.cpp index 8422e697705..c0b436bda6b 100644 --- a/mozilla/layout/html/content/src/nsHTMLScriptElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLScriptElement.cpp @@ -97,18 +97,15 @@ NS_NewHTMLScriptElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLScriptElement); nsHTMLScriptElement::nsHTMLScriptElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLScriptElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLScriptElement::~nsHTMLScriptElement() { - MOZ_COUNT_DTOR(nsHTMLScriptElement); } NS_IMPL_ADDREF(nsHTMLScriptElement) diff --git a/mozilla/layout/html/content/src/nsHTMLSelectElement.cpp b/mozilla/layout/html/content/src/nsHTMLSelectElement.cpp index 073d4b6c733..f411bfb7083 100644 --- a/mozilla/layout/html/content/src/nsHTMLSelectElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLSelectElement.cpp @@ -203,11 +203,9 @@ NS_NewHTMLSelectElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLSelectElement); nsHTMLSelectElement::nsHTMLSelectElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLSelectElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mOptions = nsnull; @@ -216,7 +214,6 @@ nsHTMLSelectElement::nsHTMLSelectElement(nsIAtom* aTag) nsHTMLSelectElement::~nsHTMLSelectElement() { - MOZ_COUNT_DTOR(nsHTMLSelectElement); if (nsnull != mForm) { // prevent mForm from decrementing its ref count on us mForm->RemoveElement(this, PR_FALSE); @@ -876,11 +873,9 @@ nsOptionList::GetOptions() mDirty = PR_FALSE; } -MOZ_DECL_CTOR_COUNTER(nsOptionList); nsOptionList::nsOptionList(nsHTMLSelectElement* aSelect) { - MOZ_COUNT_CTOR(nsOptionList); mDirty = PR_TRUE; // Do not maintain a reference counted reference. When // the select goes away, it will let us know. @@ -889,7 +884,6 @@ nsOptionList::nsOptionList(nsHTMLSelectElement* aSelect) nsOptionList::~nsOptionList() { - MOZ_COUNT_DTOR(nsOptionList); DropReference(); } diff --git a/mozilla/layout/html/content/src/nsHTMLSpacerElement.cpp b/mozilla/layout/html/content/src/nsHTMLSpacerElement.cpp index 4e74c30710d..bc8b28efa55 100644 --- a/mozilla/layout/html/content/src/nsHTMLSpacerElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLSpacerElement.cpp @@ -83,18 +83,15 @@ NS_NewHTMLSpacerElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLSpacerElement); nsHTMLSpacerElement::nsHTMLSpacerElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLSpacerElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLSpacerElement::~nsHTMLSpacerElement() { - MOZ_COUNT_DTOR(nsHTMLSpacerElement); } NS_IMPL_ADDREF(nsHTMLSpacerElement) diff --git a/mozilla/layout/html/content/src/nsHTMLSpanElement.cpp b/mozilla/layout/html/content/src/nsHTMLSpanElement.cpp index 383b412ac0e..967b520ea06 100644 --- a/mozilla/layout/html/content/src/nsHTMLSpanElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLSpanElement.cpp @@ -78,18 +78,15 @@ NS_NewHTMLSpanElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLSpanElement); nsHTMLSpanElement::nsHTMLSpanElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLSpanElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLSpanElement::~nsHTMLSpanElement() { - MOZ_COUNT_DTOR(nsHTMLSpanElement); } NS_IMPL_ADDREF(nsHTMLSpanElement) diff --git a/mozilla/layout/html/content/src/nsHTMLStyleElement.cpp b/mozilla/layout/html/content/src/nsHTMLStyleElement.cpp index 13891d1e068..ef1e8bfabdd 100644 --- a/mozilla/layout/html/content/src/nsHTMLStyleElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLStyleElement.cpp @@ -101,11 +101,9 @@ NS_NewHTMLStyleElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLStyleElement); nsHTMLStyleElement::nsHTMLStyleElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLStyleElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mStyleSheet = nsnull; @@ -113,7 +111,6 @@ nsHTMLStyleElement::nsHTMLStyleElement(nsIAtom* aTag) nsHTMLStyleElement::~nsHTMLStyleElement() { - MOZ_COUNT_DTOR(nsHTMLStyleElement); NS_IF_RELEASE(mStyleSheet); } diff --git a/mozilla/layout/html/content/src/nsHTMLTableCaptionElement.cpp b/mozilla/layout/html/content/src/nsHTMLTableCaptionElement.cpp index 5c22ce0e7c1..6055b09a4cd 100644 --- a/mozilla/layout/html/content/src/nsHTMLTableCaptionElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLTableCaptionElement.cpp @@ -85,18 +85,15 @@ NS_NewHTMLTableCaptionElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLTableCaptionElement); nsHTMLTableCaptionElement::nsHTMLTableCaptionElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLTableCaptionElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLTableCaptionElement::~nsHTMLTableCaptionElement() { - MOZ_COUNT_DTOR(nsHTMLTableCaptionElement); } NS_IMPL_ADDREF(nsHTMLTableCaptionElement) diff --git a/mozilla/layout/html/content/src/nsHTMLTableCellElement.cpp b/mozilla/layout/html/content/src/nsHTMLTableCellElement.cpp index dacf8f27002..d1efd2d75c8 100644 --- a/mozilla/layout/html/content/src/nsHTMLTableCellElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLTableCellElement.cpp @@ -131,11 +131,9 @@ NS_NewHTMLTableCellElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLTableCellElement); nsHTMLTableCellElement::nsHTMLTableCellElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLTableCellElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mColIndex=0; @@ -143,7 +141,6 @@ nsHTMLTableCellElement::nsHTMLTableCellElement(nsIAtom* aTag) nsHTMLTableCellElement::~nsHTMLTableCellElement() { - MOZ_COUNT_DTOR(nsHTMLTableCellElement); } NS_IMPL_ADDREF(nsHTMLTableCellElement) diff --git a/mozilla/layout/html/content/src/nsHTMLTableColElement.cpp b/mozilla/layout/html/content/src/nsHTMLTableColElement.cpp index df124d5d0ab..e12f2ca24e8 100644 --- a/mozilla/layout/html/content/src/nsHTMLTableColElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLTableColElement.cpp @@ -101,18 +101,15 @@ NS_NewHTMLTableColElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLTableColElement); nsHTMLTableColElement::nsHTMLTableColElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLTableColElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLTableColElement::~nsHTMLTableColElement() { - MOZ_COUNT_DTOR(nsHTMLTableColElement); } NS_IMPL_ADDREF(nsHTMLTableColElement) diff --git a/mozilla/layout/html/content/src/nsHTMLTableColGroupElement.cpp b/mozilla/layout/html/content/src/nsHTMLTableColGroupElement.cpp index fe95dbfc91a..0e2274ca4bd 100644 --- a/mozilla/layout/html/content/src/nsHTMLTableColGroupElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLTableColGroupElement.cpp @@ -95,18 +95,15 @@ NS_NewHTMLTableColGroupElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTa return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLTableColGroupElement); nsHTMLTableColGroupElement::nsHTMLTableColGroupElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLTableColGroupElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLTableColGroupElement::~nsHTMLTableColGroupElement() { - MOZ_COUNT_DTOR(nsHTMLTableColGroupElement); } NS_IMPL_ADDREF(nsHTMLTableColGroupElement) diff --git a/mozilla/layout/html/content/src/nsHTMLTableElement.cpp b/mozilla/layout/html/content/src/nsHTMLTableElement.cpp index 382f3c8592e..cd0924e15f9 100644 --- a/mozilla/layout/html/content/src/nsHTMLTableElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLTableElement.cpp @@ -149,18 +149,15 @@ protected: nsHTMLTableElement * mParent; }; -MOZ_DECL_CTOR_COUNTER(TableRowsCollection); TableRowsCollection::TableRowsCollection(nsHTMLTableElement *aParent) : nsGenericDOMHTMLCollection() { - MOZ_COUNT_CTOR(TableRowsCollection); mParent = aParent; } TableRowsCollection::~TableRowsCollection() { - MOZ_COUNT_DTOR(TableRowsCollection); // we do NOT have a ref-counted reference to mParent, so do NOT release it! // this is to avoid circular references. The instantiator who provided mParent // is responsible for managing our reference for us. @@ -335,11 +332,9 @@ NS_NewHTMLTableElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLTableElement); nsHTMLTableElement::nsHTMLTableElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLTableElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mTBodies=nsnull; @@ -348,7 +343,6 @@ nsHTMLTableElement::nsHTMLTableElement(nsIAtom* aTag) nsHTMLTableElement::~nsHTMLTableElement() { - MOZ_COUNT_DTOR(nsHTMLTableElement); if (nsnull!=mTBodies) { mTBodies->ParentDestroyed(); diff --git a/mozilla/layout/html/content/src/nsHTMLTableRowElement.cpp b/mozilla/layout/html/content/src/nsHTMLTableRowElement.cpp index 22c6890b073..1d7487e42fc 100644 --- a/mozilla/layout/html/content/src/nsHTMLTableRowElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLTableRowElement.cpp @@ -60,18 +60,15 @@ public: NS_IMETHOD Item(PRUint32 aIndex, nsIDOMNode** aReturn); }; -MOZ_DECL_CTOR_COUNTER(nsTableCellCollection); nsTableCellCollection::nsTableCellCollection(nsIContent* aParent, nsIAtom* aTag) : GenericElementCollection(aParent, aTag) { - MOZ_COUNT_CTOR(nsTableCellCollection); } nsTableCellCollection::~nsTableCellCollection() { - MOZ_COUNT_DTOR(nsTableCellCollection); } NS_IMETHODIMP @@ -239,11 +236,9 @@ NS_NewHTMLTableRowElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLTableRowElement); nsHTMLTableRowElement::nsHTMLTableRowElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLTableRowElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mCells = nsnull; @@ -251,7 +246,6 @@ nsHTMLTableRowElement::nsHTMLTableRowElement(nsIAtom* aTag) nsHTMLTableRowElement::~nsHTMLTableRowElement() { - MOZ_COUNT_DTOR(nsHTMLTableRowElement); if (nsnull != mCells) { mCells->ParentDestroyed(); NS_RELEASE(mCells); diff --git a/mozilla/layout/html/content/src/nsHTMLTableSectionElement.cpp b/mozilla/layout/html/content/src/nsHTMLTableSectionElement.cpp index 6ed3be40531..724db0f4d7d 100644 --- a/mozilla/layout/html/content/src/nsHTMLTableSectionElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLTableSectionElement.cpp @@ -100,11 +100,9 @@ NS_NewHTMLTableSectionElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLTableSectionElement); nsHTMLTableSectionElement::nsHTMLTableSectionElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLTableSectionElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mRows = nsnull; @@ -112,7 +110,6 @@ nsHTMLTableSectionElement::nsHTMLTableSectionElement(nsIAtom* aTag) nsHTMLTableSectionElement::~nsHTMLTableSectionElement() { - MOZ_COUNT_DTOR(nsHTMLTableSectionElement); if (nsnull!=mRows) { mRows->ParentDestroyed(); NS_RELEASE(mRows); diff --git a/mozilla/layout/html/content/src/nsHTMLTextAreaElement.cpp b/mozilla/layout/html/content/src/nsHTMLTextAreaElement.cpp index b9f08cb861d..6c061686f1e 100644 --- a/mozilla/layout/html/content/src/nsHTMLTextAreaElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLTextAreaElement.cpp @@ -129,11 +129,9 @@ NS_NewHTMLTextAreaElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLTextAreaElement); nsHTMLTextAreaElement::nsHTMLTextAreaElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLTextAreaElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); mForm = nsnull; @@ -141,7 +139,6 @@ nsHTMLTextAreaElement::nsHTMLTextAreaElement(nsIAtom* aTag) nsHTMLTextAreaElement::~nsHTMLTextAreaElement() { - MOZ_COUNT_DTOR(nsHTMLTextAreaElement); if (nsnull != mForm) { // prevent mForm from decrementing its ref count on us mForm->RemoveElement(this, PR_FALSE); diff --git a/mozilla/layout/html/content/src/nsHTMLTitleElement.cpp b/mozilla/layout/html/content/src/nsHTMLTitleElement.cpp index 1f1cbd7be43..de97a35962a 100644 --- a/mozilla/layout/html/content/src/nsHTMLTitleElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLTitleElement.cpp @@ -90,18 +90,15 @@ NS_NewHTMLTitleElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLTitleElement); nsHTMLTitleElement::nsHTMLTitleElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLTitleElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLTitleElement::~nsHTMLTitleElement() { - MOZ_COUNT_DTOR(nsHTMLTitleElement); } NS_IMPL_ADDREF(nsHTMLTitleElement) diff --git a/mozilla/layout/html/content/src/nsHTMLUListElement.cpp b/mozilla/layout/html/content/src/nsHTMLUListElement.cpp index b628f1e96e2..ee03600e6b2 100644 --- a/mozilla/layout/html/content/src/nsHTMLUListElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLUListElement.cpp @@ -90,18 +90,15 @@ NS_NewHTMLUListElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLUListElement); nsHTMLUListElement::nsHTMLUListElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLUListElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLUListElement::~nsHTMLUListElement() { - MOZ_COUNT_DTOR(nsHTMLUListElement); } NS_IMPL_ADDREF(nsHTMLUListElement) diff --git a/mozilla/layout/html/content/src/nsHTMLWBRElement.cpp b/mozilla/layout/html/content/src/nsHTMLWBRElement.cpp index 05dc92ba3a6..fefdb6e39ba 100644 --- a/mozilla/layout/html/content/src/nsHTMLWBRElement.cpp +++ b/mozilla/layout/html/content/src/nsHTMLWBRElement.cpp @@ -82,18 +82,15 @@ NS_NewHTMLWBRElement(nsIHTMLContent** aInstancePtrResult, nsIAtom* aTag) return it->QueryInterface(kIHTMLContentIID, (void**) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsHTMLWBRElement); nsHTMLWBRElement::nsHTMLWBRElement(nsIAtom* aTag) { - MOZ_COUNT_CTOR(nsHTMLWBRElement); NS_INIT_REFCNT(); mInner.Init(this, aTag); } nsHTMLWBRElement::~nsHTMLWBRElement() { - MOZ_COUNT_DTOR(nsHTMLWBRElement); } NS_IMPL_ADDREF(nsHTMLWBRElement) diff --git a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp index 80930e00ba9..1ad481b24f0 100644 --- a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp @@ -955,8 +955,11 @@ nsHTMLElementFactory::CreateInstanceByTag(const nsString& aTag, //---------------------------------------------------------------------- +MOZ_DECL_CTOR_COUNTER(SinkContext); + SinkContext::SinkContext(HTMLContentSink* aSink) { + MOZ_COUNT_CTOR(SinkContext); mSink = aSink; mPreAppend = PR_FALSE; mStack = nsnull; @@ -969,6 +972,7 @@ SinkContext::SinkContext(HTMLContentSink* aSink) SinkContext::~SinkContext() { + MOZ_COUNT_DTOR(SinkContext); if (nsnull != mStack) { for (PRInt32 i = 0; i < mStackPos; i++) { NS_RELEASE(mStack[i].mContent); @@ -1631,6 +1635,7 @@ NS_NewHTMLContentSink(nsIHTMLContentSink** aResult, return it->QueryInterface(kIHTMLContentSinkIID, (void **)aResult); } +// Note: operator new zeros our memory HTMLContentSink::HTMLContentSink() { #ifdef NS_DEBUG @@ -1639,12 +1644,6 @@ HTMLContentSink::HTMLContentSink() } #endif mNotAtRef = PR_TRUE; - mParser = nsnull; - mDocumentBaseURL = nsnull; - mBody = nsnull; - mFrameset = nsnull; - mStyleSheetCount = 0; - mCSSLoader = nsnull; mContentIDCounter = NS_CONTENT_ID_COUNTER_BASE; } diff --git a/mozilla/layout/html/document/src/nsHTMLDocument.cpp b/mozilla/layout/html/document/src/nsHTMLDocument.cpp index 41704a65a4f..6629c25dcbb 100644 --- a/mozilla/layout/html/document/src/nsHTMLDocument.cpp +++ b/mozilla/layout/html/document/src/nsHTMLDocument.cpp @@ -685,11 +685,9 @@ NS_IMETHODIMP nsHTMLDocument::SetTitle(const nsString& aTitle) nsISupports* container; if (NS_OK == cx->GetContainer(&container)) { if (nsnull != container) { - nsIWebShell* ws = nsnull; - container->QueryInterface(kIWebShellIID, (void**) &ws); - if (nsnull != ws) { - ws->SetTitle(aTitle.GetUnicode()); - NS_RELEASE(ws); + nsCOMPtr webShell = do_QueryInterface(container); + if (webShell) { + webShell->SetTitle(aTitle.GetUnicode()); } NS_RELEASE(container); } @@ -1102,12 +1100,11 @@ NS_IMETHODIMP nsHTMLDocument::CreateElement(const nsString& aTagName, nsIDOMElement** aReturn) { - nsIHTMLContent* content; - nsresult rv = NS_CreateHTMLElement(&content, aTagName); - if (NS_OK != rv) { - return rv; + nsCOMPtr content; + nsresult rv = NS_CreateHTMLElement(getter_AddRefs(content), aTagName); + if (NS_SUCCEEDED(rv)) { + rv = content->QueryInterface(kIDOMElementIID, (void**)aReturn); } - rv = content->QueryInterface(kIDOMElementIID, (void**)aReturn); return rv; } diff --git a/mozilla/layout/html/forms/src/nsButtonFrameRenderer.cpp b/mozilla/layout/html/forms/src/nsButtonFrameRenderer.cpp index 64974d84960..85f6af666d1 100644 --- a/mozilla/layout/html/forms/src/nsButtonFrameRenderer.cpp +++ b/mozilla/layout/html/forms/src/nsButtonFrameRenderer.cpp @@ -1,3 +1,21 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" + * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See + * the License for the specific language governing rights and limitations + * under the License. + * + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is Netscape Communications + * Corporation. Portions created by Netscape are Copyright (C) 1998 + * Netscape Communications Corporation. All Rights Reserved. + */ #include "nsButtonFrameRenderer.h" #include "nsIRenderingContext.h" #include "nsCSSRendering.h" @@ -11,51 +29,55 @@ #define HOVER "hover" #define FOCUS "focus" +MOZ_DECL_CTOR_COUNTER(nsButtonFrameRenderer); + nsButtonFrameRenderer::nsButtonFrameRenderer() { - mNameSpace = kNameSpaceID_HTML; + MOZ_COUNT_CTOR(nsButtonFrameRenderer); + mNameSpace = kNameSpaceID_HTML; } nsButtonFrameRenderer::~nsButtonFrameRenderer() { + MOZ_COUNT_DTOR(nsButtonFrameRenderer); } void nsButtonFrameRenderer::SetNameSpace(PRInt32 aNameSpace) { - mNameSpace = aNameSpace; + mNameSpace = aNameSpace; } void nsButtonFrameRenderer::SetFrame(nsFrame* aFrame, nsIPresContext& aPresContext) { - mFrame = aFrame; - ReResolveStyles(aPresContext); + mFrame = aFrame; + ReResolveStyles(aPresContext); } nsIFrame* nsButtonFrameRenderer::GetFrame() { - return mFrame; + return mFrame; } PRInt32 nsButtonFrameRenderer::GetNameSpace() { - return mNameSpace; + return mNameSpace; } void nsButtonFrameRenderer::SetDisabled(PRBool aDisabled, PRBool notify) { - // get the content + // get the content nsCOMPtr content; mFrame->GetContent(getter_AddRefs(content)); if (aDisabled) - content->SetAttribute(mNameSpace, nsHTMLAtoms::disabled, "", notify); + content->SetAttribute(mNameSpace, nsHTMLAtoms::disabled, "", notify); else - content->UnsetAttribute(mNameSpace, nsHTMLAtoms::disabled, notify); + content->UnsetAttribute(mNameSpace, nsHTMLAtoms::disabled, notify); } @@ -84,119 +106,119 @@ nsButtonFrameRenderer::Redraw() void nsButtonFrameRenderer::PaintButton (nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect, - nsFramePaintLayer aWhichLayer, - const nsRect& aRect) + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer, + const nsRect& aRect) { //printf("painted width='%d' height='%d'\n",aRect.width, aRect.height); - // draw the border and background inside the focus and outline borders - PaintBorderAndBackground(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer, aRect); + // draw the border and background inside the focus and outline borders + PaintBorderAndBackground(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer, aRect); - // draw the focus and outline borders + // draw the focus and outline borders PaintOutlineAndFocusBorders(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer, aRect); } void nsButtonFrameRenderer::PaintOutlineAndFocusBorders(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect, - nsFramePaintLayer aWhichLayer, - const nsRect& aRect) + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer, + const nsRect& aRect) { - // once we have all that let draw the focus if we have it. We will need to draw 2 focuses. - // the inner and the outer. This is so we can do any kind of look and feel some buttons have - // focus on the outside like mac and motif. While others like windows have it inside (dotted line). - // Usually only one will be specifed. But I guess you could have both if you wanted to. + // once we have all that let draw the focus if we have it. We will need to draw 2 focuses. + // the inner and the outer. This is so we can do any kind of look and feel some buttons have + // focus on the outside like mac and motif. While others like windows have it inside (dotted line). + // Usually only one will be specifed. But I guess you could have both if you wanted to. - nsRect rect; + nsRect rect; if (NS_FRAME_PAINT_LAYER_BACKGROUND == aWhichLayer) - { - if (mOuterFocusStyle) { - // ---------- paint the outer focus border ------------- + { + if (mOuterFocusStyle) { + // ---------- paint the outer focus border ------------- - GetButtonOuterFocusRect(aRect, rect); + GetButtonOuterFocusRect(aRect, rect); - const nsStyleSpacing* spacing = (const nsStyleSpacing*)mOuterFocusStyle ->GetStyleData(eStyleStruct_Spacing); + const nsStyleSpacing* spacing = (const nsStyleSpacing*)mOuterFocusStyle ->GetStyleData(eStyleStruct_Spacing); - nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame, - aDirtyRect, rect, *spacing, mOuterFocusStyle, 0); - } + nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame, + aDirtyRect, rect, *spacing, mOuterFocusStyle, 0); + } - // ---------- paint the inner focus border ------------- - if (mInnerFocusStyle) { + // ---------- paint the inner focus border ------------- + if (mInnerFocusStyle) { - GetButtonInnerFocusRect(aRect, rect); + GetButtonInnerFocusRect(aRect, rect); - const nsStyleSpacing* spacing = (const nsStyleSpacing*)mInnerFocusStyle ->GetStyleData(eStyleStruct_Spacing); + const nsStyleSpacing* spacing = (const nsStyleSpacing*)mInnerFocusStyle ->GetStyleData(eStyleStruct_Spacing); - nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame, - aDirtyRect, rect, *spacing, mInnerFocusStyle, 0); - } - } + nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame, + aDirtyRect, rect, *spacing, mInnerFocusStyle, 0); + } + } if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) - { + { /* - if (mOutlineStyle) { + if (mOutlineStyle) { - GetButtonOutlineRect(aRect, rect); + GetButtonOutlineRect(aRect, rect); - mOutlineRect = rect; + mOutlineRect = rect; - const nsStyleSpacing* spacing = (const nsStyleSpacing*)mOutlineStyle ->GetStyleData(eStyleStruct_Spacing); + const nsStyleSpacing* spacing = (const nsStyleSpacing*)mOutlineStyle ->GetStyleData(eStyleStruct_Spacing); - // set the clipping area so we can draw outside our bounds. - aRenderingContext.PushState(); - PRBool clipEmpty; + // set the clipping area so we can draw outside our bounds. + aRenderingContext.PushState(); + PRBool clipEmpty; - aRenderingContext.SetClipRect(rect, nsClipCombine_kReplace, clipEmpty); - nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame, - aDirtyRect, rect, *spacing, mOutlineStyle, 0); + aRenderingContext.SetClipRect(rect, nsClipCombine_kReplace, clipEmpty); + nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame, + aDirtyRect, rect, *spacing, mOutlineStyle, 0); - aRenderingContext.PopState(clipEmpty); - } + aRenderingContext.PopState(clipEmpty); + } */ - } + } } void nsButtonFrameRenderer::PaintBorderAndBackground(nsIPresContext& aPresContext, - nsIRenderingContext& aRenderingContext, - const nsRect& aDirtyRect, - nsFramePaintLayer aWhichLayer, - const nsRect& aRect) + nsIRenderingContext& aRenderingContext, + const nsRect& aDirtyRect, + nsFramePaintLayer aWhichLayer, + const nsRect& aRect) { - if (NS_FRAME_PAINT_LAYER_BACKGROUND != aWhichLayer) - return; + if (NS_FRAME_PAINT_LAYER_BACKGROUND != aWhichLayer) + return; - // get the button rect this is inside the focus and outline rects - nsRect buttonRect; - GetButtonRect(aRect, buttonRect); + // get the button rect this is inside the focus and outline rects + nsRect buttonRect; + GetButtonRect(aRect, buttonRect); - nsCOMPtr context; - mFrame->GetStyleContext(getter_AddRefs(context)); + nsCOMPtr context; + mFrame->GetStyleContext(getter_AddRefs(context)); - // get the styles - const nsStyleSpacing* spacing = + // get the styles + const nsStyleSpacing* spacing = (const nsStyleSpacing*)context->GetStyleData(eStyleStruct_Spacing); - const nsStyleColor* color = + const nsStyleColor* color = (const nsStyleColor*)context->GetStyleData(eStyleStruct_Color); - // paint the border and background + // paint the border and background - nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, mFrame, - aDirtyRect, buttonRect, *color, *spacing, 0, 0); + nsCSSRendering::PaintBackground(aPresContext, aRenderingContext, mFrame, + aDirtyRect, buttonRect, *color, *spacing, 0, 0); - nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame, - aDirtyRect, buttonRect, *spacing, context, 0); + nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame, + aDirtyRect, buttonRect, *spacing, context, 0); } @@ -204,69 +226,69 @@ nsButtonFrameRenderer::PaintBorderAndBackground(nsIPresContext& aPresContext, void nsButtonFrameRenderer::GetButtonOutlineRect(const nsRect& aRect, nsRect& outlineRect) { - outlineRect = aRect; - outlineRect.Inflate(GetButtonOutlineBorderAndPadding()); + outlineRect = aRect; + outlineRect.Inflate(GetButtonOutlineBorderAndPadding()); } void nsButtonFrameRenderer::GetButtonOuterFocusRect(const nsRect& aRect, nsRect& focusRect) { - focusRect = aRect; + focusRect = aRect; } void nsButtonFrameRenderer::GetButtonRect(const nsRect& aRect, nsRect& r) { - r = aRect; - r.Deflate(GetButtonOuterFocusBorderAndPadding()); + r = aRect; + r.Deflate(GetButtonOuterFocusBorderAndPadding()); } void nsButtonFrameRenderer::GetButtonInnerFocusRect(const nsRect& aRect, nsRect& focusRect) { - GetButtonRect(aRect, focusRect); - focusRect.Deflate(GetButtonBorderAndPadding()); - focusRect.Deflate(GetButtonInnerFocusMargin()); + GetButtonRect(aRect, focusRect); + focusRect.Deflate(GetButtonBorderAndPadding()); + focusRect.Deflate(GetButtonInnerFocusMargin()); } void nsButtonFrameRenderer::GetButtonContentRect(const nsRect& aRect, nsRect& r) { - GetButtonInnerFocusRect(aRect, r); - r.Deflate(GetButtonInnerFocusBorderAndPadding()); + GetButtonInnerFocusRect(aRect, r); + r.Deflate(GetButtonInnerFocusBorderAndPadding()); } nsMargin nsButtonFrameRenderer::GetButtonOuterFocusBorderAndPadding() { - nsMargin focusBorderAndPadding(0,0,0,0); + nsMargin focusBorderAndPadding(0,0,0,0); - if (mOuterFocusStyle) { - // get the outer focus border and padding - const nsStyleSpacing* spacing = (const nsStyleSpacing*)mOuterFocusStyle ->GetStyleData(eStyleStruct_Spacing); - if (!spacing->GetBorderPadding(focusBorderAndPadding)) { + if (mOuterFocusStyle) { + // get the outer focus border and padding + const nsStyleSpacing* spacing = (const nsStyleSpacing*)mOuterFocusStyle ->GetStyleData(eStyleStruct_Spacing); + if (!spacing->GetBorderPadding(focusBorderAndPadding)) { NS_NOTYETIMPLEMENTED("percentage border"); } - } + } - return focusBorderAndPadding; + return focusBorderAndPadding; } nsMargin nsButtonFrameRenderer::GetButtonBorderAndPadding() { - nsCOMPtr context; - mFrame->GetStyleContext(getter_AddRefs(context)); + nsCOMPtr context; + mFrame->GetStyleContext(getter_AddRefs(context)); - nsMargin borderAndPadding(0,0,0,0); - const nsStyleSpacing* spacing = (const nsStyleSpacing*)context ->GetStyleData(eStyleStruct_Spacing); - if (!spacing->GetBorderPadding(borderAndPadding)) { - NS_NOTYETIMPLEMENTED("percentage border"); - } - return borderAndPadding; + nsMargin borderAndPadding(0,0,0,0); + const nsStyleSpacing* spacing = (const nsStyleSpacing*)context ->GetStyleData(eStyleStruct_Spacing); + if (!spacing->GetBorderPadding(borderAndPadding)) { + NS_NOTYETIMPLEMENTED("percentage border"); + } + return borderAndPadding; } /** @@ -275,47 +297,47 @@ nsButtonFrameRenderer::GetButtonBorderAndPadding() nsMargin nsButtonFrameRenderer::GetButtonInnerFocusMargin() { - nsMargin innerFocusMargin(0,0,0,0); + nsMargin innerFocusMargin(0,0,0,0); - if (mInnerFocusStyle) { - // get the outer focus border and padding - const nsStyleSpacing* spacing = (const nsStyleSpacing*)mInnerFocusStyle ->GetStyleData(eStyleStruct_Spacing); - spacing->GetMargin(innerFocusMargin); - } + if (mInnerFocusStyle) { + // get the outer focus border and padding + const nsStyleSpacing* spacing = (const nsStyleSpacing*)mInnerFocusStyle ->GetStyleData(eStyleStruct_Spacing); + spacing->GetMargin(innerFocusMargin); + } - return innerFocusMargin; + return innerFocusMargin; } nsMargin nsButtonFrameRenderer::GetButtonInnerFocusBorderAndPadding() { - nsMargin innerFocusBorderAndPadding(0,0,0,0); + nsMargin innerFocusBorderAndPadding(0,0,0,0); - if (mInnerFocusStyle) { - // get the outer focus border and padding - const nsStyleSpacing* spacing = (const nsStyleSpacing*)mInnerFocusStyle ->GetStyleData(eStyleStruct_Spacing); - if (!spacing->GetBorderPadding(innerFocusBorderAndPadding)) { + if (mInnerFocusStyle) { + // get the outer focus border and padding + const nsStyleSpacing* spacing = (const nsStyleSpacing*)mInnerFocusStyle ->GetStyleData(eStyleStruct_Spacing); + if (!spacing->GetBorderPadding(innerFocusBorderAndPadding)) { NS_NOTYETIMPLEMENTED("percentage border"); } - } + } - return innerFocusBorderAndPadding; + return innerFocusBorderAndPadding; } nsMargin nsButtonFrameRenderer::GetButtonOutlineBorderAndPadding() { - nsMargin borderAndPadding(0,0,0,0); + nsMargin borderAndPadding(0,0,0,0); - if (mOutlineStyle) { - // get the outline border and padding - const nsStyleSpacing* spacing = (const nsStyleSpacing*)mOutlineStyle ->GetStyleData(eStyleStruct_Spacing); - if (!spacing->GetBorderPadding(borderAndPadding)) { + if (mOutlineStyle) { + // get the outline border and padding + const nsStyleSpacing* spacing = (const nsStyleSpacing*)mOutlineStyle ->GetStyleData(eStyleStruct_Spacing); + if (!spacing->GetBorderPadding(borderAndPadding)) { NS_NOTYETIMPLEMENTED("percentage border"); } - } + } - return borderAndPadding; + return borderAndPadding; } // gets the full size of our border with all the focus borders @@ -339,29 +361,29 @@ void nsButtonFrameRenderer::ReResolveStyles(nsIPresContext& aPresContext) { - // get all the styles - nsCOMPtr content; - mFrame->GetContent(getter_AddRefs(content)); - nsCOMPtr context; - mFrame->GetStyleContext(getter_AddRefs(context)); + // get all the styles + nsCOMPtr content; + mFrame->GetContent(getter_AddRefs(content)); + nsCOMPtr context; + mFrame->GetStyleContext(getter_AddRefs(context)); // style that draw an outline around the button - nsCOMPtr atom ( getter_AddRefs(NS_NewAtom(":-moz-outline")) ); - aPresContext.ProbePseudoStyleContextFor(content, atom, context, - PR_FALSE, - getter_AddRefs(mOutlineStyle)); + nsCOMPtr atom ( getter_AddRefs(NS_NewAtom(":-moz-outline")) ); + aPresContext.ProbePseudoStyleContextFor(content, atom, context, + PR_FALSE, + getter_AddRefs(mOutlineStyle)); - // style for the inner such as a dotted line (Windows) - atom = getter_AddRefs(NS_NewAtom(":-moz-focus-inner")); - aPresContext.ProbePseudoStyleContextFor(content, atom, context, - PR_FALSE, - getter_AddRefs(mInnerFocusStyle)); + // style for the inner such as a dotted line (Windows) + atom = getter_AddRefs(NS_NewAtom(":-moz-focus-inner")); + aPresContext.ProbePseudoStyleContextFor(content, atom, context, + PR_FALSE, + getter_AddRefs(mInnerFocusStyle)); - // style for outer focus like a ridged border (MAC). - atom = getter_AddRefs(NS_NewAtom(":-moz-focus-outer")); - aPresContext.ProbePseudoStyleContextFor(content, atom, context, - PR_FALSE, - getter_AddRefs(mOuterFocusStyle)); + // style for outer focus like a ridged border (MAC). + atom = getter_AddRefs(NS_NewAtom(":-moz-focus-outer")); + aPresContext.ProbePseudoStyleContextFor(content, atom, context, + PR_FALSE, + getter_AddRefs(mOuterFocusStyle)); } diff --git a/mozilla/layout/html/forms/src/nsFormControlHelper.cpp b/mozilla/layout/html/forms/src/nsFormControlHelper.cpp index 2026a44b3a8..a0fcdee1efe 100644 --- a/mozilla/layout/html/forms/src/nsFormControlHelper.cpp +++ b/mozilla/layout/html/forms/src/nsFormControlHelper.cpp @@ -60,13 +60,16 @@ static NS_DEFINE_IID(kIViewIID, NS_IVIEW_IID); static NS_DEFINE_IID(kIFrameIID, NS_IFRAME_IID); static NS_DEFINE_IID(kIDOMHTMLInputElementIID, NS_IDOMHTMLINPUTELEMENT_IID); +MOZ_DECL_CTOR_COUNTER(nsFormControlHelper); nsFormControlHelper::nsFormControlHelper() { + MOZ_COUNT_CTOR(nsFormControlHelper); } nsFormControlHelper::~nsFormControlHelper() { + MOZ_COUNT_DTOR(nsFormControlHelper); } void nsFormControlHelper::ForceDrawFrame(nsIFrame * aFrame) diff --git a/mozilla/layout/html/forms/src/nsGfxTextControlFrame.cpp b/mozilla/layout/html/forms/src/nsGfxTextControlFrame.cpp index 5a18148ec4a..32723443668 100644 --- a/mozilla/layout/html/forms/src/nsGfxTextControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsGfxTextControlFrame.cpp @@ -2307,7 +2307,6 @@ NS_IMPL_ADDREF(nsEnderFocusListener) NS_IMPL_RELEASE(nsEnderFocusListener) - nsEnderFocusListener::nsEnderFocusListener() { NS_INIT_REFCNT(); @@ -2496,7 +2495,6 @@ NS_IMPL_ADDREF(nsEnderSelectionListener) NS_IMPL_RELEASE(nsEnderSelectionListener) - nsEnderSelectionListener::nsEnderSelectionListener() { NS_INIT_REFCNT(); @@ -2582,6 +2580,12 @@ nsEnderSelectionListener::NotifySelectionChanged() NS_IMPL_ADDREF(EnderTempObserver); NS_IMPL_RELEASE(EnderTempObserver); +EnderTempObserver::EnderTempObserver() +{ + NS_INIT_REFCNT(); + mFirstCall = PR_TRUE; +} + EnderTempObserver::~EnderTempObserver() { } diff --git a/mozilla/layout/html/forms/src/nsGfxTextControlFrame.h b/mozilla/layout/html/forms/src/nsGfxTextControlFrame.h index 36c8c8c2856..f49e1d1e0ce 100644 --- a/mozilla/layout/html/forms/src/nsGfxTextControlFrame.h +++ b/mozilla/layout/html/forms/src/nsGfxTextControlFrame.h @@ -53,16 +53,11 @@ class nsGfxTextControlFrame; class EnderTempObserver : public nsIDocumentLoaderObserver { public: - EnderTempObserver() - { - NS_INIT_REFCNT(); - mFirstCall = PR_TRUE; - } + EnderTempObserver(); + virtual ~EnderTempObserver(); NS_IMETHOD SetFrame(nsGfxTextControlFrame *aFrame); - virtual ~EnderTempObserver(); - // nsISupports NS_DECL_ISUPPORTS diff --git a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp index 9b131224af3..4cb1996c4df 100644 --- a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -485,7 +485,6 @@ nsCSSFrameConstructor::~nsCSSFrameConstructor(void) NS_IMPL_ISUPPORTS(nsCSSFrameConstructor, kIStyleFrameConstructionIID); - NS_IMETHODIMP nsCSSFrameConstructor::Init(nsIDocument* aDocument) { diff --git a/mozilla/layout/html/style/src/nsCSSLoader.cpp b/mozilla/layout/html/style/src/nsCSSLoader.cpp index 69228f938d8..68bfd0725ce 100644 --- a/mozilla/layout/html/style/src/nsCSSLoader.cpp +++ b/mozilla/layout/html/style/src/nsCSSLoader.cpp @@ -50,12 +50,15 @@ static NS_DEFINE_IID(kIStyleSheetLinkingElementIID, NS_ISTYLESHEETLINKINGELEMENT class CSSLoaderImpl; +MOZ_DECL_CTOR_COUNTER(URLKey); + class URLKey: public nsHashKey { public: URLKey(nsIURI* aURL) : nsHashKey(), mURL(aURL) { + MOZ_COUNT_CTOR(URLKey); NS_ADDREF(mURL); mHashValue = 0; @@ -72,11 +75,13 @@ public: mURL(aKey.mURL), mHashValue(aKey.mHashValue) { + MOZ_COUNT_CTOR(URLKey); NS_ADDREF(mURL); } virtual ~URLKey(void) { + MOZ_COUNT_DTOR(URLKey); NS_RELEASE(mURL); } @@ -102,22 +107,27 @@ public: PRUint32 mHashValue; }; +MOZ_DECL_CTOR_COUNTER(SupportsKey); + class SupportsKey: public nsHashKey { public: SupportsKey(nsISupports* aSupports) : nsHashKey(), mSupports(aSupports) { // note: does not hold reference on supports pointer + MOZ_COUNT_CTOR(SupportsKey); } SupportsKey(const SupportsKey& aKey) : nsHashKey(), mSupports(aKey.mSupports) { + MOZ_COUNT_CTOR(SupportsKey); } virtual ~SupportsKey(void) { + MOZ_COUNT_DTOR(SupportsKey); } virtual PRUint32 HashValue(void) const @@ -178,6 +188,8 @@ struct SheetLoadData { void* mCallbackData; }; +MOZ_DECL_CTOR_COUNTER(PendingSheetData); + struct PendingSheetData { PendingSheetData(nsICSSStyleSheet* aSheet, PRInt32 aDocIndex, nsIContent* aElement) @@ -186,12 +198,14 @@ struct PendingSheetData { mOwningElement(aElement), mNotify(PR_FALSE) { + MOZ_COUNT_CTOR(PendingSheetData); NS_ADDREF(mSheet); NS_IF_ADDREF(mOwningElement); } ~PendingSheetData(void) { + MOZ_COUNT_DTOR(PendingSheetData); NS_RELEASE(mSheet); NS_IF_RELEASE(mOwningElement); } @@ -303,6 +317,8 @@ public: #endif }; +MOZ_DECL_CTOR_COUNTER(SheetLoadData); + SheetLoadData::SheetLoadData(CSSLoaderImpl* aLoader, nsIURI* aURL, const nsString& aTitle, const nsString& aMedia, PRInt32 aDefaultNameSpaceID, @@ -327,6 +343,7 @@ SheetLoadData::SheetLoadData(CSSLoaderImpl* aLoader, nsIURI* aURL, mCallback(nsnull), mCallbackData(nsnull) { + MOZ_COUNT_CTOR(SheetLoadData); NS_ADDREF(mLoader); NS_ADDREF(mURL); NS_IF_ADDREF(mOwningElement); @@ -356,6 +373,7 @@ SheetLoadData::SheetLoadData(CSSLoaderImpl* aLoader, nsIURI* aURL, mCallback(nsnull), mCallbackData(nsnull) { + MOZ_COUNT_CTOR(SheetLoadData); NS_ADDREF(mLoader); NS_ADDREF(mURL); NS_ADDREF(mParentSheet); @@ -382,6 +400,7 @@ SheetLoadData::SheetLoadData(CSSLoaderImpl* aLoader, nsIURI* aURL, mCallback(aCallback), mCallbackData(nsnull) { + MOZ_COUNT_CTOR(SheetLoadData); NS_ADDREF(mLoader); NS_ADDREF(mURL); } @@ -389,6 +408,7 @@ SheetLoadData::SheetLoadData(CSSLoaderImpl* aLoader, nsIURI* aURL, SheetLoadData::~SheetLoadData(void) { + MOZ_COUNT_DTOR(SheetLoadData); NS_RELEASE(mLoader); NS_RELEASE(mURL); NS_IF_RELEASE(mOwningElement); diff --git a/mozilla/layout/html/style/src/nsCSSParser.cpp b/mozilla/layout/html/style/src/nsCSSParser.cpp index 6eed9961baa..edd7a2ec46b 100644 --- a/mozilla/layout/html/style/src/nsCSSParser.cpp +++ b/mozilla/layout/html/style/src/nsCSSParser.cpp @@ -55,6 +55,8 @@ static NS_DEFINE_IID(kICSSParserIID, NS_ICSS_PARSER_IID); static NS_DEFINE_IID(kICSSStyleSheetIID, NS_ICSS_STYLE_SHEET_IID); static NS_DEFINE_IID(kIStyleSheetIID, NS_ISTYLE_SHEET_IID); +MOZ_DECL_CTOR_COUNTER(SelectorList); + // e.g. "P B, H1 B { ... }" has a selector list with two elements, // each of which has two selectors. struct SelectorList { @@ -77,10 +79,12 @@ SelectorList::SelectorList(void) : mSelectors(nsnull), mNext(nsnull) { + MOZ_COUNT_CTOR(SelectorList); } SelectorList::~SelectorList() { + MOZ_COUNT_DTOR(SelectorList); nsCSSSelector* sel = mSelectors; while (nsnull != sel) { nsCSSSelector* dead = sel; diff --git a/mozilla/layout/html/style/src/nsCSSRule.cpp b/mozilla/layout/html/style/src/nsCSSRule.cpp index 9918dea40c0..b656b0d9ee6 100644 --- a/mozilla/layout/html/style/src/nsCSSRule.cpp +++ b/mozilla/layout/html/style/src/nsCSSRule.cpp @@ -16,14 +16,10 @@ * Reserved. */ #include "nsCSSRule.h" - #include "nsCRT.h" #include "nsIArena.h" #include "nsICSSStyleSheet.h" - -//#define DEBUG_REFS - void* nsCSSRule::operator new(size_t size) { nsCSSRule* rv = (nsCSSRule*) ::operator new(size); @@ -58,74 +54,25 @@ void nsCSSRule::operator delete(void* ptr) } } - -#ifdef DEBUG_REFS -static PRInt32 gInstanceCount; -static const PRInt32 kInstrument = 1075; -#endif - - nsCSSRule::nsCSSRule(void) : mSheet(nsnull) { NS_INIT_REFCNT(); - -#ifdef DEBUG_REFS - mInstance = gInstanceCount++; - fprintf(stdout, "%d of %d + CSSRule\n", mInstance, gInstanceCount); -#endif } nsCSSRule::nsCSSRule(const nsCSSRule& aCopy) : mSheet(aCopy.mSheet) { NS_INIT_REFCNT(); - -#ifdef DEBUG_REFS - mInstance = gInstanceCount++; - fprintf(stdout, "%d of %d + CSSRule\n", mInstance, gInstanceCount); -#endif } nsCSSRule::~nsCSSRule(void) { -#ifdef DEBUG_REFS - --gInstanceCount; - fprintf(stdout, "%d of %d - CSSStyleRule\n", mInstance, gInstanceCount); -#endif } -#ifdef DEBUG_REFS -nsrefcnt -nsCSSRule::AddRef(void) -{ - if (mInstance == kInstrument) { - fprintf(stdout, "%d AddRef CSSRule\n", mRefCnt + 1); - } - ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "nsCSSRule"); - return mRefCnt; -} - -nsrefcnt -nsCSSRule::Release(void) -{ - if (mInstance == kInstrument) { - fprintf(stdout, "%d Release CSSRule\n", mRefCnt - 1); - } - --mRefCnt; - NS_LOG_RELEASE(this, mRefCnt, "nsCSSRule"); - if (mRefCnt == 0) { - NS_DELETEXPCOM(this); - return 0; - } - return mRefCnt; -} -#else NS_IMPL_ADDREF(nsCSSRule) NS_IMPL_RELEASE(nsCSSRule) -#endif NS_IMETHODIMP nsCSSRule::GetStyleSheet(nsIStyleSheet*& aSheet) const diff --git a/mozilla/layout/html/style/src/nsCSSScanner.cpp b/mozilla/layout/html/style/src/nsCSSScanner.cpp index 94cdfa1a30a..2c752b76521 100644 --- a/mozilla/layout/html/style/src/nsCSSScanner.cpp +++ b/mozilla/layout/html/style/src/nsCSSScanner.cpp @@ -40,14 +40,14 @@ static const PRUint8 START_IDENT = 0x10; static const PRUint8 IS_IDENT = 0x20; static const PRUint8 IS_WHITESPACE = 0x40; -static PRUint8* gLexTable; +static PRBool gLexTableSetup = PR_FALSE; +static PRUint8 gLexTable[256]; static void BuildLexTable() { - PRUint8* lt = new PRUint8[256]; - nsCRT::zero(lt, 256); - gLexTable = lt; + gLexTableSetup = PR_TRUE; + PRUint8* lt = gLexTable; int i; lt[CSS_ESCAPE] = START_IDENT; lt['-'] |= IS_IDENT; @@ -137,10 +137,12 @@ nsCSSToken::AppendToString(nsString& aBuffer) } } +MOZ_DECL_CTOR_COUNTER(nsCSSScanner); nsCSSScanner::nsCSSScanner() { - if (nsnull == gLexTable) { + MOZ_COUNT_CTOR(nsCSSScanner); + if (!gLexTableSetup) { // XXX need a monitor BuildLexTable(); } @@ -155,6 +157,7 @@ nsCSSScanner::nsCSSScanner() nsCSSScanner::~nsCSSScanner() { + MOZ_COUNT_DTOR(nsCSSScanner); Close(); if (nsnull != mBuffer) { delete [] mBuffer; diff --git a/mozilla/layout/html/style/src/nsCSSStyleRule.cpp b/mozilla/layout/html/style/src/nsCSSStyleRule.cpp index 0326b33e93e..3f7d329117e 100644 --- a/mozilla/layout/html/style/src/nsCSSStyleRule.cpp +++ b/mozilla/layout/html/style/src/nsCSSStyleRule.cpp @@ -79,10 +79,13 @@ static NS_DEFINE_IID(kCSSUserInterfaceSID, NS_CSS_USER_INTERFACE_SID); #define NS_IF_DELETE(ptr) \ if (nsnull != ptr) { delete ptr; ptr = nsnull; } +MOZ_DECL_CTOR_COUNTER(nsAtomList); + nsAtomList::nsAtomList(nsIAtom* aAtom) : mAtom(aAtom), mNext(nsnull) { + MOZ_COUNT_CTOR(nsAtomList); NS_IF_ADDREF(mAtom); } @@ -90,6 +93,7 @@ nsAtomList::nsAtomList(const nsString& aAtomValue) : mAtom(nsnull), mNext(nsnull) { + MOZ_COUNT_CTOR(nsAtomList); mAtom = NS_NewAtom(aAtomValue); } @@ -97,12 +101,14 @@ nsAtomList::nsAtomList(const nsAtomList& aCopy) : mAtom(aCopy.mAtom), mNext(nsnull) { + MOZ_COUNT_CTOR(nsAtomList); NS_IF_ADDREF(mAtom); NS_IF_COPY(mNext, aCopy.mNext, nsAtomList); } nsAtomList::~nsAtomList(void) { + MOZ_COUNT_DTOR(nsAtomList); NS_IF_RELEASE(mAtom); NS_IF_DELETE(mNext); } @@ -123,6 +129,8 @@ PRBool nsAtomList::Equals(const nsAtomList* aOther) const return PR_FALSE; } +MOZ_DECL_CTOR_COUNTER(nsAttrSelector); + nsAttrSelector::nsAttrSelector(PRInt32 aNameSpace, const nsString& aAttr) : mNameSpace(aNameSpace), mAttr(nsnull), @@ -131,6 +139,7 @@ nsAttrSelector::nsAttrSelector(PRInt32 aNameSpace, const nsString& aAttr) mValue(), mNext(nsnull) { + MOZ_COUNT_CTOR(nsAttrSelector); mAttr = NS_NewAtom(aAttr); } @@ -143,6 +152,7 @@ nsAttrSelector::nsAttrSelector(PRInt32 aNameSpace, const nsString& aAttr, PRUint mValue(aValue), mNext(nsnull) { + MOZ_COUNT_CTOR(nsAttrSelector); mAttr = NS_NewAtom(aAttr); } @@ -154,12 +164,14 @@ nsAttrSelector::nsAttrSelector(const nsAttrSelector& aCopy) mValue(aCopy.mValue), mNext(nsnull) { + MOZ_COUNT_CTOR(nsAttrSelector); NS_IF_ADDREF(mAttr); NS_IF_COPY(mNext, aCopy.mNext, nsAttrSelector); } nsAttrSelector::~nsAttrSelector(void) { + MOZ_COUNT_DTOR(nsAttrSelector); NS_IF_RELEASE(mAttr); NS_IF_DELETE(mNext); } @@ -184,6 +196,8 @@ PRBool nsAttrSelector::Equals(const nsAttrSelector* aOther) const return PR_FALSE; } +MOZ_DECL_CTOR_COUNTER(nsCSSSelector); + nsCSSSelector::nsCSSSelector(void) : mNameSpace(kNameSpaceID_Unknown), mTag(nsnull), mID(nsnull), @@ -193,6 +207,7 @@ nsCSSSelector::nsCSSSelector(void) mOperator(0), mNext(nsnull) { + MOZ_COUNT_CTOR(nsCSSSelector); } nsCSSSelector::nsCSSSelector(const nsCSSSelector& aCopy) @@ -204,6 +219,7 @@ nsCSSSelector::nsCSSSelector(const nsCSSSelector& aCopy) mOperator(aCopy.mOperator), mNext(nsnull) { + MOZ_COUNT_CTOR(nsCSSSelector); NS_IF_ADDREF(mTag); NS_IF_ADDREF(mID); NS_IF_COPY(mClassList, aCopy.mClassList, nsAtomList); @@ -213,6 +229,7 @@ nsCSSSelector::nsCSSSelector(const nsCSSSelector& aCopy) nsCSSSelector::~nsCSSSelector(void) { + MOZ_COUNT_DTOR(nsCSSSelector); Reset(); } @@ -548,8 +565,12 @@ protected: nsICSSStyleRule *mRule; }; +MOZ_DECL_CTOR_COUNTER(DOMCSSDeclarationImpl); + DOMCSSDeclarationImpl::DOMCSSDeclarationImpl(nsICSSStyleRule *aRule) { + MOZ_COUNT_CTOR(DOMCSSDeclarationImpl); + // This reference is not reference-counted. The rule // object tells us when its about to go away. mRule = aRule; @@ -557,6 +578,7 @@ DOMCSSDeclarationImpl::DOMCSSDeclarationImpl(nsICSSStyleRule *aRule) DOMCSSDeclarationImpl::~DOMCSSDeclarationImpl(void) { + MOZ_COUNT_DTOR(DOMCSSDeclarationImpl); } void @@ -732,7 +754,6 @@ protected: void* mScriptObject; }; - CSSStyleRuleImpl::CSSStyleRuleImpl(const nsCSSSelector& aSelector) : nsCSSRule(), mSelector(aSelector), mSelectorText(), mDeclaration(nsnull), diff --git a/mozilla/layout/html/style/src/nsCSSStyleSheet.cpp b/mozilla/layout/html/style/src/nsCSSStyleSheet.cpp index 49bb428c98c..9e900477c7d 100644 --- a/mozilla/layout/html/style/src/nsCSSStyleSheet.cpp +++ b/mozilla/layout/html/style/src/nsCSSStyleSheet.cpp @@ -60,7 +60,6 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); #include "nsITextContent.h" #include "prlog.h" -//#define DEBUG_REFS //#define DEBUG_RULES #define DEBUG_CASCADE @@ -1063,11 +1062,6 @@ void CSSStyleSheetImpl::operator delete(void* ptr) } } -#ifdef DEBUG_REFS -static PRInt32 gInstanceCount; -#endif -MOZ_DECL_CTOR_COUNTER(CSSStyleSheetImpl); - CSSStyleSheetImpl::CSSStyleSheetImpl() : nsICSSStyleSheet(), mTitle(), @@ -1083,15 +1077,9 @@ CSSStyleSheetImpl::CSSStyleSheetImpl() mDirty(PR_FALSE), mScriptObject(nsnull) { - MOZ_COUNT_CTOR(CSSStyleSheetImpl); NS_INIT_REFCNT(); mInner = new CSSStyleSheetInner(this); - -#ifdef DEBUG_REFS - ++gInstanceCount; - fprintf(stdout, "%d + CSSStyleSheet size: %d\n", gInstanceCount, sizeof(*this)); -#endif } CSSStyleSheetImpl::CSSStyleSheetImpl(const CSSStyleSheetImpl& aCopy) @@ -1110,7 +1098,6 @@ CSSStyleSheetImpl::CSSStyleSheetImpl(const CSSStyleSheetImpl& aCopy) mScriptObject(nsnull), mInner(aCopy.mInner) { - MOZ_COUNT_CTOR(CSSStyleSheetImpl); NS_INIT_REFCNT(); mInner->AddSheet(this); @@ -1141,20 +1128,10 @@ CSSStyleSheetImpl::CSSStyleSheetImpl(const CSSStyleSheetImpl& aCopy) } while (otherChild && ourSlot); } - -#ifdef DEBUG_REFS - ++gInstanceCount; - fprintf(stdout, "%d + CSSStyleSheet size: %d\n", gInstanceCount, sizeof(*this)); -#endif } CSSStyleSheetImpl::~CSSStyleSheetImpl() { - MOZ_COUNT_DTOR(CSSStyleSheetImpl); -#ifdef DEBUG_REFS - --gInstanceCount; - fprintf(stdout, "%d - CSSStyleSheet\n", gInstanceCount); -#endif NS_IF_RELEASE(mMedia); if (mFirstChild) { CSSStyleSheetImpl* child = mFirstChild; diff --git a/mozilla/layout/html/style/src/nsHTMLAttributes.cpp b/mozilla/layout/html/style/src/nsHTMLAttributes.cpp index 7fad315cd91..793f5a54d65 100644 --- a/mozilla/layout/html/style/src/nsHTMLAttributes.cpp +++ b/mozilla/layout/html/style/src/nsHTMLAttributes.cpp @@ -29,16 +29,17 @@ #include "nsVoidArray.h" #include "nsISizeOfHandler.h" -//#define DEBUG_REFS - static NS_DEFINE_IID(kIHTMLAttributesIID, NS_IHTML_ATTRIBUTES_IID); +MOZ_DECL_CTOR_COUNTER(HTMLAttribute); + struct HTMLAttribute { HTMLAttribute(void) : mAttribute(nsnull), mValue(), mNext(nsnull) { + MOZ_COUNT_CTOR(HTMLAttribute); } HTMLAttribute(nsIAtom* aAttribute, const nsString& aValue) @@ -46,6 +47,7 @@ struct HTMLAttribute { mValue(aValue), mNext(nsnull) { + MOZ_COUNT_CTOR(HTMLAttribute); NS_IF_ADDREF(mAttribute); } @@ -54,6 +56,7 @@ struct HTMLAttribute { mValue(aValue), mNext(nsnull) { + MOZ_COUNT_CTOR(HTMLAttribute); NS_IF_ADDREF(mAttribute); } @@ -62,11 +65,13 @@ struct HTMLAttribute { mValue(aCopy.mValue), mNext(nsnull) { + MOZ_COUNT_CTOR(HTMLAttribute); NS_IF_ADDREF(mAttribute); } ~HTMLAttribute(void) { + MOZ_COUNT_DTOR(HTMLAttribute); NS_IF_RELEASE(mAttribute); } @@ -222,25 +227,33 @@ struct HTMLAttribute { // ---------------- +MOZ_DECL_CTOR_COUNTER(nsClassList); + struct nsClassList { nsClassList(nsIAtom* aAtom) : mAtom(aAtom), // take ref mNext(nsnull) { + MOZ_COUNT_CTOR(nsClassList); } + nsClassList(const nsClassList& aCopy) : mAtom(aCopy.mAtom), mNext(nsnull) { + MOZ_COUNT_CTOR(nsClassList); NS_IF_ADDREF(mAtom); if (aCopy.mNext) { mNext = new nsClassList(*(aCopy.mNext)); } } + ~nsClassList(void) { + MOZ_COUNT_DTOR(nsClassList); Reset(); } + void Reset(void) { NS_IF_RELEASE(mAtom); @@ -828,19 +841,8 @@ protected: nsClassList mFirstClass; nsIAtom* mNameBuffer[kNameBufferSize]; - -#ifdef DEBUG_REFS - PRInt32 mInstance; -#endif }; - -#ifdef DEBUG_REFS -static PRInt32 gInstanceCount = 0; -static PRInt32 gInstrument = 4; -#endif - - void* HTMLAttributesImpl::operator new(size_t size) { HTMLAttributesImpl* rv = (HTMLAttributesImpl*) ::operator new(size); @@ -875,7 +877,6 @@ void HTMLAttributesImpl::operator delete(void* ptr) } } - HTMLAttributesImpl::HTMLAttributesImpl(void) : mAttrNames(mNameBuffer), mAttrCount(0), @@ -886,11 +887,6 @@ HTMLAttributesImpl::HTMLAttributesImpl(void) mFirstClass(nsnull) { NS_INIT_REFCNT(); - -#ifdef DEBUG_REFS - mInstance = ++gInstanceCount; - fprintf(stdout, "%d of %d + HTMLAttributes\n", mInstance, gInstanceCount); -#endif } HTMLAttributesImpl::HTMLAttributesImpl(const HTMLAttributesImpl& aCopy) @@ -929,51 +925,15 @@ HTMLAttributesImpl::HTMLAttributesImpl(const HTMLAttributesImpl& aCopy) } NS_IF_ADDREF(mID); - -#ifdef DEBUG_REFS - mInstance = ++gInstanceCount; - fprintf(stdout, "%d of %d + HTMLAttributes\n", mInstance, gInstanceCount); -#endif } HTMLAttributesImpl::~HTMLAttributesImpl(void) { Reset(); - -#ifdef DEBUG_REFS - fprintf(stdout, "%d of %d - HTMLAttributes\n", mInstance, gInstanceCount); - --gInstanceCount; -#endif } -#ifdef DEBUG_REFS -nsrefcnt HTMLAttributesImpl::AddRef(void) -{ - if ((gInstrument == -1) || (mInstance == gInstrument)) { - fprintf(stdout, "%d AddRef HTMLAttributes %d\n", mRefCnt + 1, mInstance); - } - ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "HTMLAttributesImpl"); - return mRefCnt; -} - -nsrefcnt HTMLAttributesImpl::Release(void) -{ - if ((gInstrument == -1) || (mInstance == gInstrument)) { - fprintf(stdout, "%d Release HTMLAttributes %d\n", mRefCnt - 1, mInstance); - } - --mRefCnt; - NS_LOG_RELEASE(this, mRefCnt, "HTMLAttributesImpl"); - if (mRefCnt == 0) { - delete this; - return 0; - } - return mRefCnt; -} -#else NS_IMPL_ADDREF(HTMLAttributesImpl) NS_IMPL_RELEASE(HTMLAttributesImpl) -#endif NS_IMPL_QUERY_INTERFACE(HTMLAttributesImpl, kIHTMLAttributesIID); diff --git a/mozilla/layout/html/style/src/nsHTMLCSSStyleSheet.cpp b/mozilla/layout/html/style/src/nsHTMLCSSStyleSheet.cpp index ae846ea82b2..add1b1f0a30 100644 --- a/mozilla/layout/html/style/src/nsHTMLCSSStyleSheet.cpp +++ b/mozilla/layout/html/style/src/nsHTMLCSSStyleSheet.cpp @@ -369,8 +369,6 @@ void HTMLCSSStyleSheetImpl::operator delete(void* ptr) } } -MOZ_DECL_CTOR_COUNTER(HTMLCSSStyleSheetImpl); - HTMLCSSStyleSheetImpl::HTMLCSSStyleSheetImpl() : nsIHTMLCSSStyleSheet(), mURL(nsnull), @@ -378,15 +376,11 @@ HTMLCSSStyleSheetImpl::HTMLCSSStyleSheetImpl() mFirstLineRule(nsnull), mFirstLetterRule(nsnull) { - MOZ_COUNT_CTOR(HTMLCSSStyleSheetImpl); - NS_INIT_REFCNT(); } HTMLCSSStyleSheetImpl::~HTMLCSSStyleSheetImpl() { - MOZ_COUNT_DTOR(HTMLCSSStyleSheetImpl); - NS_RELEASE(mURL); if (nsnull != mFirstLineRule) { mFirstLineRule->mSheet = nsnull; diff --git a/mozilla/layout/html/style/src/nsHTMLStyleSheet.cpp b/mozilla/layout/html/style/src/nsHTMLStyleSheet.cpp index acd6004591e..bbb6cf76e56 100644 --- a/mozilla/layout/html/style/src/nsHTMLStyleSheet.cpp +++ b/mozilla/layout/html/style/src/nsHTMLStyleSheet.cpp @@ -318,15 +318,19 @@ public: } mHash; }; +MOZ_DECL_CTOR_COUNTER(AttributeKey); + AttributeKey::AttributeKey(nsIHTMLMappedAttributes* aAttributes) : mAttributes(aAttributes) { + MOZ_COUNT_CTOR(AttributeKey); NS_ADDREF(mAttributes); mHash.mInitializer = 0; } AttributeKey::~AttributeKey(void) { + MOZ_COUNT_DTOR(AttributeKey); NS_RELEASE(mAttributes); } @@ -504,8 +508,6 @@ void HTMLStyleSheetImpl::operator delete(void* ptr) } } - - HTMLStyleSheetImpl::HTMLStyleSheetImpl(void) : nsIHTMLStyleSheet(), mURL(nsnull), diff --git a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp index 6b7e1559264..5c24d39b0e8 100644 --- a/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp +++ b/mozilla/layout/html/table/src/BasicTableLayoutStrategy.cpp @@ -58,9 +58,12 @@ PRBool BasicTableLayoutStrategy::IsFixedWidth(const nsStylePosition* aStylePosit (eStyleUnit_Coord==aStyleTable->mSpanWidth.GetUnit())); } +MOZ_DECL_CTOR_COUNTER(BasicTableLayoutStrategy); + BasicTableLayoutStrategy::BasicTableLayoutStrategy(nsTableFrame *aFrame, PRBool aIsNavQuirks) { + MOZ_COUNT_CTOR(BasicTableLayoutStrategy); NS_ASSERTION(nsnull != aFrame, "bad frame arg"); mTableFrame = aFrame; @@ -72,6 +75,7 @@ BasicTableLayoutStrategy::BasicTableLayoutStrategy(nsTableFrame *aFrame, PRBool BasicTableLayoutStrategy::~BasicTableLayoutStrategy() { + MOZ_COUNT_DTOR(BasicTableLayoutStrategy); } PRBool BasicTableLayoutStrategy::Initialize(nsSize* aMaxElementSize, diff --git a/mozilla/layout/html/table/src/nsCellMap.cpp b/mozilla/layout/html/table/src/nsCellMap.cpp index 5ad1f91d446..10c5c437492 100644 --- a/mozilla/layout/html/table/src/nsCellMap.cpp +++ b/mozilla/layout/html/table/src/nsCellMap.cpp @@ -24,15 +24,22 @@ #define kIsCollapsedRowsGrowSize 5 // CellData +MOZ_DECL_CTOR_COUNTER(CellData); + CellData::CellData() { + MOZ_COUNT_CTOR(CellData); mOrigCell = nsnull; mRowSpanData = nsnull; mColSpanData = nsnull; } CellData::~CellData() -{} +{ + MOZ_COUNT_DTOR(CellData); +} + +MOZ_DECL_CTOR_COUNTER(nsCellMap); // nsCellMap @@ -43,6 +50,8 @@ nsCellMap::nsCellMap(int aRowCount, int aColCount) mRowCount(0), mNextAvailRowIndex(0) { + MOZ_COUNT_CTOR(nsCellMap); + mIsCollapsedRows = nsnull; mIsCollapsedCols = nsnull; @@ -51,6 +60,8 @@ nsCellMap::nsCellMap(int aRowCount, int aColCount) nsCellMap::~nsCellMap() { + MOZ_COUNT_DTOR(nsCellMap); + PRInt32 mapRowCount = mRows.Count(); PRInt32 colCount = mNumCellsOrigInCol.Count(); PRInt32 colX; diff --git a/mozilla/layout/style/nsCSSLoader.cpp b/mozilla/layout/style/nsCSSLoader.cpp index 69228f938d8..68bfd0725ce 100644 --- a/mozilla/layout/style/nsCSSLoader.cpp +++ b/mozilla/layout/style/nsCSSLoader.cpp @@ -50,12 +50,15 @@ static NS_DEFINE_IID(kIStyleSheetLinkingElementIID, NS_ISTYLESHEETLINKINGELEMENT class CSSLoaderImpl; +MOZ_DECL_CTOR_COUNTER(URLKey); + class URLKey: public nsHashKey { public: URLKey(nsIURI* aURL) : nsHashKey(), mURL(aURL) { + MOZ_COUNT_CTOR(URLKey); NS_ADDREF(mURL); mHashValue = 0; @@ -72,11 +75,13 @@ public: mURL(aKey.mURL), mHashValue(aKey.mHashValue) { + MOZ_COUNT_CTOR(URLKey); NS_ADDREF(mURL); } virtual ~URLKey(void) { + MOZ_COUNT_DTOR(URLKey); NS_RELEASE(mURL); } @@ -102,22 +107,27 @@ public: PRUint32 mHashValue; }; +MOZ_DECL_CTOR_COUNTER(SupportsKey); + class SupportsKey: public nsHashKey { public: SupportsKey(nsISupports* aSupports) : nsHashKey(), mSupports(aSupports) { // note: does not hold reference on supports pointer + MOZ_COUNT_CTOR(SupportsKey); } SupportsKey(const SupportsKey& aKey) : nsHashKey(), mSupports(aKey.mSupports) { + MOZ_COUNT_CTOR(SupportsKey); } virtual ~SupportsKey(void) { + MOZ_COUNT_DTOR(SupportsKey); } virtual PRUint32 HashValue(void) const @@ -178,6 +188,8 @@ struct SheetLoadData { void* mCallbackData; }; +MOZ_DECL_CTOR_COUNTER(PendingSheetData); + struct PendingSheetData { PendingSheetData(nsICSSStyleSheet* aSheet, PRInt32 aDocIndex, nsIContent* aElement) @@ -186,12 +198,14 @@ struct PendingSheetData { mOwningElement(aElement), mNotify(PR_FALSE) { + MOZ_COUNT_CTOR(PendingSheetData); NS_ADDREF(mSheet); NS_IF_ADDREF(mOwningElement); } ~PendingSheetData(void) { + MOZ_COUNT_DTOR(PendingSheetData); NS_RELEASE(mSheet); NS_IF_RELEASE(mOwningElement); } @@ -303,6 +317,8 @@ public: #endif }; +MOZ_DECL_CTOR_COUNTER(SheetLoadData); + SheetLoadData::SheetLoadData(CSSLoaderImpl* aLoader, nsIURI* aURL, const nsString& aTitle, const nsString& aMedia, PRInt32 aDefaultNameSpaceID, @@ -327,6 +343,7 @@ SheetLoadData::SheetLoadData(CSSLoaderImpl* aLoader, nsIURI* aURL, mCallback(nsnull), mCallbackData(nsnull) { + MOZ_COUNT_CTOR(SheetLoadData); NS_ADDREF(mLoader); NS_ADDREF(mURL); NS_IF_ADDREF(mOwningElement); @@ -356,6 +373,7 @@ SheetLoadData::SheetLoadData(CSSLoaderImpl* aLoader, nsIURI* aURL, mCallback(nsnull), mCallbackData(nsnull) { + MOZ_COUNT_CTOR(SheetLoadData); NS_ADDREF(mLoader); NS_ADDREF(mURL); NS_ADDREF(mParentSheet); @@ -382,6 +400,7 @@ SheetLoadData::SheetLoadData(CSSLoaderImpl* aLoader, nsIURI* aURL, mCallback(aCallback), mCallbackData(nsnull) { + MOZ_COUNT_CTOR(SheetLoadData); NS_ADDREF(mLoader); NS_ADDREF(mURL); } @@ -389,6 +408,7 @@ SheetLoadData::SheetLoadData(CSSLoaderImpl* aLoader, nsIURI* aURL, SheetLoadData::~SheetLoadData(void) { + MOZ_COUNT_DTOR(SheetLoadData); NS_RELEASE(mLoader); NS_RELEASE(mURL); NS_IF_RELEASE(mOwningElement); diff --git a/mozilla/layout/style/nsCSSParser.cpp b/mozilla/layout/style/nsCSSParser.cpp index 6eed9961baa..edd7a2ec46b 100644 --- a/mozilla/layout/style/nsCSSParser.cpp +++ b/mozilla/layout/style/nsCSSParser.cpp @@ -55,6 +55,8 @@ static NS_DEFINE_IID(kICSSParserIID, NS_ICSS_PARSER_IID); static NS_DEFINE_IID(kICSSStyleSheetIID, NS_ICSS_STYLE_SHEET_IID); static NS_DEFINE_IID(kIStyleSheetIID, NS_ISTYLE_SHEET_IID); +MOZ_DECL_CTOR_COUNTER(SelectorList); + // e.g. "P B, H1 B { ... }" has a selector list with two elements, // each of which has two selectors. struct SelectorList { @@ -77,10 +79,12 @@ SelectorList::SelectorList(void) : mSelectors(nsnull), mNext(nsnull) { + MOZ_COUNT_CTOR(SelectorList); } SelectorList::~SelectorList() { + MOZ_COUNT_DTOR(SelectorList); nsCSSSelector* sel = mSelectors; while (nsnull != sel) { nsCSSSelector* dead = sel; diff --git a/mozilla/layout/style/nsCSSRule.cpp b/mozilla/layout/style/nsCSSRule.cpp index 9918dea40c0..b656b0d9ee6 100644 --- a/mozilla/layout/style/nsCSSRule.cpp +++ b/mozilla/layout/style/nsCSSRule.cpp @@ -16,14 +16,10 @@ * Reserved. */ #include "nsCSSRule.h" - #include "nsCRT.h" #include "nsIArena.h" #include "nsICSSStyleSheet.h" - -//#define DEBUG_REFS - void* nsCSSRule::operator new(size_t size) { nsCSSRule* rv = (nsCSSRule*) ::operator new(size); @@ -58,74 +54,25 @@ void nsCSSRule::operator delete(void* ptr) } } - -#ifdef DEBUG_REFS -static PRInt32 gInstanceCount; -static const PRInt32 kInstrument = 1075; -#endif - - nsCSSRule::nsCSSRule(void) : mSheet(nsnull) { NS_INIT_REFCNT(); - -#ifdef DEBUG_REFS - mInstance = gInstanceCount++; - fprintf(stdout, "%d of %d + CSSRule\n", mInstance, gInstanceCount); -#endif } nsCSSRule::nsCSSRule(const nsCSSRule& aCopy) : mSheet(aCopy.mSheet) { NS_INIT_REFCNT(); - -#ifdef DEBUG_REFS - mInstance = gInstanceCount++; - fprintf(stdout, "%d of %d + CSSRule\n", mInstance, gInstanceCount); -#endif } nsCSSRule::~nsCSSRule(void) { -#ifdef DEBUG_REFS - --gInstanceCount; - fprintf(stdout, "%d of %d - CSSStyleRule\n", mInstance, gInstanceCount); -#endif } -#ifdef DEBUG_REFS -nsrefcnt -nsCSSRule::AddRef(void) -{ - if (mInstance == kInstrument) { - fprintf(stdout, "%d AddRef CSSRule\n", mRefCnt + 1); - } - ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "nsCSSRule"); - return mRefCnt; -} - -nsrefcnt -nsCSSRule::Release(void) -{ - if (mInstance == kInstrument) { - fprintf(stdout, "%d Release CSSRule\n", mRefCnt - 1); - } - --mRefCnt; - NS_LOG_RELEASE(this, mRefCnt, "nsCSSRule"); - if (mRefCnt == 0) { - NS_DELETEXPCOM(this); - return 0; - } - return mRefCnt; -} -#else NS_IMPL_ADDREF(nsCSSRule) NS_IMPL_RELEASE(nsCSSRule) -#endif NS_IMETHODIMP nsCSSRule::GetStyleSheet(nsIStyleSheet*& aSheet) const diff --git a/mozilla/layout/style/nsCSSScanner.cpp b/mozilla/layout/style/nsCSSScanner.cpp index 94cdfa1a30a..2c752b76521 100644 --- a/mozilla/layout/style/nsCSSScanner.cpp +++ b/mozilla/layout/style/nsCSSScanner.cpp @@ -40,14 +40,14 @@ static const PRUint8 START_IDENT = 0x10; static const PRUint8 IS_IDENT = 0x20; static const PRUint8 IS_WHITESPACE = 0x40; -static PRUint8* gLexTable; +static PRBool gLexTableSetup = PR_FALSE; +static PRUint8 gLexTable[256]; static void BuildLexTable() { - PRUint8* lt = new PRUint8[256]; - nsCRT::zero(lt, 256); - gLexTable = lt; + gLexTableSetup = PR_TRUE; + PRUint8* lt = gLexTable; int i; lt[CSS_ESCAPE] = START_IDENT; lt['-'] |= IS_IDENT; @@ -137,10 +137,12 @@ nsCSSToken::AppendToString(nsString& aBuffer) } } +MOZ_DECL_CTOR_COUNTER(nsCSSScanner); nsCSSScanner::nsCSSScanner() { - if (nsnull == gLexTable) { + MOZ_COUNT_CTOR(nsCSSScanner); + if (!gLexTableSetup) { // XXX need a monitor BuildLexTable(); } @@ -155,6 +157,7 @@ nsCSSScanner::nsCSSScanner() nsCSSScanner::~nsCSSScanner() { + MOZ_COUNT_DTOR(nsCSSScanner); Close(); if (nsnull != mBuffer) { delete [] mBuffer; diff --git a/mozilla/layout/style/nsCSSStyleRule.cpp b/mozilla/layout/style/nsCSSStyleRule.cpp index 0326b33e93e..3f7d329117e 100644 --- a/mozilla/layout/style/nsCSSStyleRule.cpp +++ b/mozilla/layout/style/nsCSSStyleRule.cpp @@ -79,10 +79,13 @@ static NS_DEFINE_IID(kCSSUserInterfaceSID, NS_CSS_USER_INTERFACE_SID); #define NS_IF_DELETE(ptr) \ if (nsnull != ptr) { delete ptr; ptr = nsnull; } +MOZ_DECL_CTOR_COUNTER(nsAtomList); + nsAtomList::nsAtomList(nsIAtom* aAtom) : mAtom(aAtom), mNext(nsnull) { + MOZ_COUNT_CTOR(nsAtomList); NS_IF_ADDREF(mAtom); } @@ -90,6 +93,7 @@ nsAtomList::nsAtomList(const nsString& aAtomValue) : mAtom(nsnull), mNext(nsnull) { + MOZ_COUNT_CTOR(nsAtomList); mAtom = NS_NewAtom(aAtomValue); } @@ -97,12 +101,14 @@ nsAtomList::nsAtomList(const nsAtomList& aCopy) : mAtom(aCopy.mAtom), mNext(nsnull) { + MOZ_COUNT_CTOR(nsAtomList); NS_IF_ADDREF(mAtom); NS_IF_COPY(mNext, aCopy.mNext, nsAtomList); } nsAtomList::~nsAtomList(void) { + MOZ_COUNT_DTOR(nsAtomList); NS_IF_RELEASE(mAtom); NS_IF_DELETE(mNext); } @@ -123,6 +129,8 @@ PRBool nsAtomList::Equals(const nsAtomList* aOther) const return PR_FALSE; } +MOZ_DECL_CTOR_COUNTER(nsAttrSelector); + nsAttrSelector::nsAttrSelector(PRInt32 aNameSpace, const nsString& aAttr) : mNameSpace(aNameSpace), mAttr(nsnull), @@ -131,6 +139,7 @@ nsAttrSelector::nsAttrSelector(PRInt32 aNameSpace, const nsString& aAttr) mValue(), mNext(nsnull) { + MOZ_COUNT_CTOR(nsAttrSelector); mAttr = NS_NewAtom(aAttr); } @@ -143,6 +152,7 @@ nsAttrSelector::nsAttrSelector(PRInt32 aNameSpace, const nsString& aAttr, PRUint mValue(aValue), mNext(nsnull) { + MOZ_COUNT_CTOR(nsAttrSelector); mAttr = NS_NewAtom(aAttr); } @@ -154,12 +164,14 @@ nsAttrSelector::nsAttrSelector(const nsAttrSelector& aCopy) mValue(aCopy.mValue), mNext(nsnull) { + MOZ_COUNT_CTOR(nsAttrSelector); NS_IF_ADDREF(mAttr); NS_IF_COPY(mNext, aCopy.mNext, nsAttrSelector); } nsAttrSelector::~nsAttrSelector(void) { + MOZ_COUNT_DTOR(nsAttrSelector); NS_IF_RELEASE(mAttr); NS_IF_DELETE(mNext); } @@ -184,6 +196,8 @@ PRBool nsAttrSelector::Equals(const nsAttrSelector* aOther) const return PR_FALSE; } +MOZ_DECL_CTOR_COUNTER(nsCSSSelector); + nsCSSSelector::nsCSSSelector(void) : mNameSpace(kNameSpaceID_Unknown), mTag(nsnull), mID(nsnull), @@ -193,6 +207,7 @@ nsCSSSelector::nsCSSSelector(void) mOperator(0), mNext(nsnull) { + MOZ_COUNT_CTOR(nsCSSSelector); } nsCSSSelector::nsCSSSelector(const nsCSSSelector& aCopy) @@ -204,6 +219,7 @@ nsCSSSelector::nsCSSSelector(const nsCSSSelector& aCopy) mOperator(aCopy.mOperator), mNext(nsnull) { + MOZ_COUNT_CTOR(nsCSSSelector); NS_IF_ADDREF(mTag); NS_IF_ADDREF(mID); NS_IF_COPY(mClassList, aCopy.mClassList, nsAtomList); @@ -213,6 +229,7 @@ nsCSSSelector::nsCSSSelector(const nsCSSSelector& aCopy) nsCSSSelector::~nsCSSSelector(void) { + MOZ_COUNT_DTOR(nsCSSSelector); Reset(); } @@ -548,8 +565,12 @@ protected: nsICSSStyleRule *mRule; }; +MOZ_DECL_CTOR_COUNTER(DOMCSSDeclarationImpl); + DOMCSSDeclarationImpl::DOMCSSDeclarationImpl(nsICSSStyleRule *aRule) { + MOZ_COUNT_CTOR(DOMCSSDeclarationImpl); + // This reference is not reference-counted. The rule // object tells us when its about to go away. mRule = aRule; @@ -557,6 +578,7 @@ DOMCSSDeclarationImpl::DOMCSSDeclarationImpl(nsICSSStyleRule *aRule) DOMCSSDeclarationImpl::~DOMCSSDeclarationImpl(void) { + MOZ_COUNT_DTOR(DOMCSSDeclarationImpl); } void @@ -732,7 +754,6 @@ protected: void* mScriptObject; }; - CSSStyleRuleImpl::CSSStyleRuleImpl(const nsCSSSelector& aSelector) : nsCSSRule(), mSelector(aSelector), mSelectorText(), mDeclaration(nsnull), diff --git a/mozilla/layout/style/nsCSSStyleSheet.cpp b/mozilla/layout/style/nsCSSStyleSheet.cpp index 49bb428c98c..9e900477c7d 100644 --- a/mozilla/layout/style/nsCSSStyleSheet.cpp +++ b/mozilla/layout/style/nsCSSStyleSheet.cpp @@ -60,7 +60,6 @@ static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); #include "nsITextContent.h" #include "prlog.h" -//#define DEBUG_REFS //#define DEBUG_RULES #define DEBUG_CASCADE @@ -1063,11 +1062,6 @@ void CSSStyleSheetImpl::operator delete(void* ptr) } } -#ifdef DEBUG_REFS -static PRInt32 gInstanceCount; -#endif -MOZ_DECL_CTOR_COUNTER(CSSStyleSheetImpl); - CSSStyleSheetImpl::CSSStyleSheetImpl() : nsICSSStyleSheet(), mTitle(), @@ -1083,15 +1077,9 @@ CSSStyleSheetImpl::CSSStyleSheetImpl() mDirty(PR_FALSE), mScriptObject(nsnull) { - MOZ_COUNT_CTOR(CSSStyleSheetImpl); NS_INIT_REFCNT(); mInner = new CSSStyleSheetInner(this); - -#ifdef DEBUG_REFS - ++gInstanceCount; - fprintf(stdout, "%d + CSSStyleSheet size: %d\n", gInstanceCount, sizeof(*this)); -#endif } CSSStyleSheetImpl::CSSStyleSheetImpl(const CSSStyleSheetImpl& aCopy) @@ -1110,7 +1098,6 @@ CSSStyleSheetImpl::CSSStyleSheetImpl(const CSSStyleSheetImpl& aCopy) mScriptObject(nsnull), mInner(aCopy.mInner) { - MOZ_COUNT_CTOR(CSSStyleSheetImpl); NS_INIT_REFCNT(); mInner->AddSheet(this); @@ -1141,20 +1128,10 @@ CSSStyleSheetImpl::CSSStyleSheetImpl(const CSSStyleSheetImpl& aCopy) } while (otherChild && ourSlot); } - -#ifdef DEBUG_REFS - ++gInstanceCount; - fprintf(stdout, "%d + CSSStyleSheet size: %d\n", gInstanceCount, sizeof(*this)); -#endif } CSSStyleSheetImpl::~CSSStyleSheetImpl() { - MOZ_COUNT_DTOR(CSSStyleSheetImpl); -#ifdef DEBUG_REFS - --gInstanceCount; - fprintf(stdout, "%d - CSSStyleSheet\n", gInstanceCount); -#endif NS_IF_RELEASE(mMedia); if (mFirstChild) { CSSStyleSheetImpl* child = mFirstChild; diff --git a/mozilla/layout/style/nsHTMLCSSStyleSheet.cpp b/mozilla/layout/style/nsHTMLCSSStyleSheet.cpp index ae846ea82b2..add1b1f0a30 100644 --- a/mozilla/layout/style/nsHTMLCSSStyleSheet.cpp +++ b/mozilla/layout/style/nsHTMLCSSStyleSheet.cpp @@ -369,8 +369,6 @@ void HTMLCSSStyleSheetImpl::operator delete(void* ptr) } } -MOZ_DECL_CTOR_COUNTER(HTMLCSSStyleSheetImpl); - HTMLCSSStyleSheetImpl::HTMLCSSStyleSheetImpl() : nsIHTMLCSSStyleSheet(), mURL(nsnull), @@ -378,15 +376,11 @@ HTMLCSSStyleSheetImpl::HTMLCSSStyleSheetImpl() mFirstLineRule(nsnull), mFirstLetterRule(nsnull) { - MOZ_COUNT_CTOR(HTMLCSSStyleSheetImpl); - NS_INIT_REFCNT(); } HTMLCSSStyleSheetImpl::~HTMLCSSStyleSheetImpl() { - MOZ_COUNT_DTOR(HTMLCSSStyleSheetImpl); - NS_RELEASE(mURL); if (nsnull != mFirstLineRule) { mFirstLineRule->mSheet = nsnull; diff --git a/mozilla/layout/style/nsHTMLStyleSheet.cpp b/mozilla/layout/style/nsHTMLStyleSheet.cpp index acd6004591e..bbb6cf76e56 100644 --- a/mozilla/layout/style/nsHTMLStyleSheet.cpp +++ b/mozilla/layout/style/nsHTMLStyleSheet.cpp @@ -318,15 +318,19 @@ public: } mHash; }; +MOZ_DECL_CTOR_COUNTER(AttributeKey); + AttributeKey::AttributeKey(nsIHTMLMappedAttributes* aAttributes) : mAttributes(aAttributes) { + MOZ_COUNT_CTOR(AttributeKey); NS_ADDREF(mAttributes); mHash.mInitializer = 0; } AttributeKey::~AttributeKey(void) { + MOZ_COUNT_DTOR(AttributeKey); NS_RELEASE(mAttributes); } @@ -504,8 +508,6 @@ void HTMLStyleSheetImpl::operator delete(void* ptr) } } - - HTMLStyleSheetImpl::HTMLStyleSheetImpl(void) : nsIHTMLStyleSheet(), mURL(nsnull), diff --git a/mozilla/layout/style/nsStyleContext.cpp b/mozilla/layout/style/nsStyleContext.cpp index 449ff08acda..15790461e19 100644 --- a/mozilla/layout/style/nsStyleContext.cpp +++ b/mozilla/layout/style/nsStyleContext.cpp @@ -26,8 +26,6 @@ #include "nsIFrame.h" -//#define DEBUG_REFS - static NS_DEFINE_IID(kIStyleContextIID, NS_ISTYLECONTEXT_IID); #define DELETE_ARRAY_IF(array) if (array) { delete[] array; array = nsnull; } @@ -1372,26 +1370,16 @@ protected: StyleContentImpl mContent; StyleUserInterfaceImpl mUserInterface; -#ifdef DEBUG_REFS - PRInt32 mInstance; -#endif }; static PRInt32 gLastDataCode; -#ifdef DEBUG_REFS -static PRInt32 gInstanceCount; -static PRInt32 gInstrument = 6; -#endif - static PRBool HashStyleRule(nsISupports* aRule, void* aData) { *((PRUint32*)aData) ^= PRUint32(aRule); return PR_TRUE; } -MOZ_DECL_CTOR_COUNTER(StyleContextImpl); - StyleContextImpl::StyleContextImpl(nsIStyleContext* aParent, nsIAtom* aPseudoTag, nsISupportsArray* aRules, @@ -1413,8 +1401,6 @@ StyleContextImpl::StyleContextImpl(nsIStyleContext* aParent, mContent(), mUserInterface() { - MOZ_COUNT_CTOR(StyleContextImpl); - NS_INIT_REFCNT(); NS_IF_ADDREF(mPseudoTag); NS_IF_ADDREF(mRules); @@ -1430,17 +1416,10 @@ StyleContextImpl::StyleContextImpl(nsIStyleContext* aParent, if (nsnull != mRules) { mRules->EnumerateForwards(HashStyleRule, &mRuleHash); } - -#ifdef DEBUG_REFS - mInstance = ++gInstanceCount; - fprintf(stdout, "%d of %d + StyleContext\n", mInstance, gInstanceCount); -#endif } StyleContextImpl::~StyleContextImpl() { - MOZ_COUNT_DTOR(StyleContextImpl); - NS_ASSERTION((nsnull == mChild) && (nsnull == mEmptyChild), "destructing context with children"); if (mParent) { @@ -1451,76 +1430,9 @@ StyleContextImpl::~StyleContextImpl() NS_IF_RELEASE(mPseudoTag); NS_IF_RELEASE(mRules); - -#ifdef DEBUG_REFS - fprintf(stdout, "%d of %d - StyleContext\n", mInstance, gInstanceCount); - --gInstanceCount; -#endif } -#ifdef LOG_ADDREF_RELEASE -extern "C" { - void __log_addref(void* p, int oldrc, int newrc); - void __log_release(void* p, int oldrc, int newrc); -} - -NS_IMPL_QUERY_INTERFACE(StyleContextImpl, kIStyleContextIID) - -nsrefcnt StyleContextImpl::AddRef(void) -{ - NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); - __log_addref((void*) this, mRefCnt, mRefCnt + 1); - ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "StyleContextImpl"); - return mRefCnt; -} - -nsrefcnt StyleContextImpl::Release(void) -{ - NS_PRECONDITION(0 != mRefCnt, "dup release"); - __log_release((void*) this, mRefCnt, mRefCnt - 1); - --mRefCnt; - NS_LOG_RELEASE(this, mRefCnt, "StyleContextImpl"); - if (mRefCnt == 0) { - NS_DELETEXPCOM(this); - return 0; - } - return mRefCnt; -} -#else - -#ifdef DEBUG_REFS -NS_IMPL_QUERY_INTERFACE(StyleContextImpl, kIStyleContextIID) - -nsrefcnt StyleContextImpl::AddRef(void) -{ - if ((gInstrument == -1) || (mInstance == gInstrument)) { - fprintf(stdout, "%d AddRef StyleContext %d\n", mRefCnt + 1, mInstance); - } - ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "StyleContextImpl"); - return mRefCnt; -} - -nsrefcnt StyleContextImpl::Release(void) -{ - if ((gInstrument == -1) || (mInstance == gInstrument)) { - fprintf(stdout, "%d Release StyleContext %d\n", mRefCnt - 1, mInstance); - } - --mRefCnt; - NS_LOG_RELEASE(this, mRefCnt, "StyleContextImpl"); - if (mRefCnt == 0) { - delete this; - return 0; - } - return mRefCnt; -} -#else NS_IMPL_ISUPPORTS(StyleContextImpl, kIStyleContextIID) -#endif -#endif - - nsIStyleContext* StyleContextImpl::GetParent(void) const { diff --git a/mozilla/layout/style/nsStyleSet.cpp b/mozilla/layout/style/nsStyleSet.cpp index 69a94c90558..ab6db6c3ea1 100644 --- a/mozilla/layout/style/nsStyleSet.cpp +++ b/mozilla/layout/style/nsStyleSet.cpp @@ -200,8 +200,6 @@ protected: #endif }; -MOZ_DECL_CTOR_COUNTER(StyleSetImpl); - StyleSetImpl::StyleSetImpl() : mOverrideSheets(nsnull), mDocSheets(nsnull), @@ -210,13 +208,11 @@ StyleSetImpl::StyleSetImpl() mRecycler(nsnull), mFrameConstructor(nsnull) { - MOZ_COUNT_CTOR(StyleSetImpl); NS_INIT_REFCNT(); } StyleSetImpl::~StyleSetImpl() { - MOZ_COUNT_DTOR(StyleSetImpl); NS_IF_RELEASE(mOverrideSheets); NS_IF_RELEASE(mDocSheets); NS_IF_RELEASE(mBackstopSheets); diff --git a/mozilla/layout/tables/BasicTableLayoutStrategy.cpp b/mozilla/layout/tables/BasicTableLayoutStrategy.cpp index 6b7e1559264..5c24d39b0e8 100644 --- a/mozilla/layout/tables/BasicTableLayoutStrategy.cpp +++ b/mozilla/layout/tables/BasicTableLayoutStrategy.cpp @@ -58,9 +58,12 @@ PRBool BasicTableLayoutStrategy::IsFixedWidth(const nsStylePosition* aStylePosit (eStyleUnit_Coord==aStyleTable->mSpanWidth.GetUnit())); } +MOZ_DECL_CTOR_COUNTER(BasicTableLayoutStrategy); + BasicTableLayoutStrategy::BasicTableLayoutStrategy(nsTableFrame *aFrame, PRBool aIsNavQuirks) { + MOZ_COUNT_CTOR(BasicTableLayoutStrategy); NS_ASSERTION(nsnull != aFrame, "bad frame arg"); mTableFrame = aFrame; @@ -72,6 +75,7 @@ BasicTableLayoutStrategy::BasicTableLayoutStrategy(nsTableFrame *aFrame, PRBool BasicTableLayoutStrategy::~BasicTableLayoutStrategy() { + MOZ_COUNT_DTOR(BasicTableLayoutStrategy); } PRBool BasicTableLayoutStrategy::Initialize(nsSize* aMaxElementSize, diff --git a/mozilla/layout/tables/nsCellMap.cpp b/mozilla/layout/tables/nsCellMap.cpp index 5ad1f91d446..10c5c437492 100644 --- a/mozilla/layout/tables/nsCellMap.cpp +++ b/mozilla/layout/tables/nsCellMap.cpp @@ -24,15 +24,22 @@ #define kIsCollapsedRowsGrowSize 5 // CellData +MOZ_DECL_CTOR_COUNTER(CellData); + CellData::CellData() { + MOZ_COUNT_CTOR(CellData); mOrigCell = nsnull; mRowSpanData = nsnull; mColSpanData = nsnull; } CellData::~CellData() -{} +{ + MOZ_COUNT_DTOR(CellData); +} + +MOZ_DECL_CTOR_COUNTER(nsCellMap); // nsCellMap @@ -43,6 +50,8 @@ nsCellMap::nsCellMap(int aRowCount, int aColCount) mRowCount(0), mNextAvailRowIndex(0) { + MOZ_COUNT_CTOR(nsCellMap); + mIsCollapsedRows = nsnull; mIsCollapsedCols = nsnull; @@ -51,6 +60,8 @@ nsCellMap::nsCellMap(int aRowCount, int aColCount) nsCellMap::~nsCellMap() { + MOZ_COUNT_DTOR(nsCellMap); + PRInt32 mapRowCount = mRows.Count(); PRInt32 colCount = mNumCellsOrigInCol.Count(); PRInt32 colX; diff --git a/mozilla/layout/xml/content/src/nsXMLCDATASection.cpp b/mozilla/layout/xml/content/src/nsXMLCDATASection.cpp index e8b6c922ba2..0758e7fca24 100644 --- a/mozilla/layout/xml/content/src/nsXMLCDATASection.cpp +++ b/mozilla/layout/xml/content/src/nsXMLCDATASection.cpp @@ -90,11 +90,8 @@ NS_NewXMLCDATASection(nsIContent** aInstancePtrResult) return it->QueryInterface(kIContentIID, (void **) aInstancePtrResult); } -MOZ_DECL_CTOR_COUNTER(nsXMLCDATASection); - nsXMLCDATASection::nsXMLCDATASection() { - MOZ_COUNT_CTOR(nsXMLCDATASection); NS_INIT_REFCNT(); mInner.Init(this); mContentID = 0; @@ -102,7 +99,6 @@ nsXMLCDATASection::nsXMLCDATASection() nsXMLCDATASection::~nsXMLCDATASection() { - MOZ_COUNT_DTOR(nsXMLCDATASection); } NS_IMPL_ADDREF(nsXMLCDATASection) diff --git a/mozilla/layout/xml/content/src/nsXMLElement.cpp b/mozilla/layout/xml/content/src/nsXMLElement.cpp index 9f6ac942dcd..9b759f86b4e 100644 --- a/mozilla/layout/xml/content/src/nsXMLElement.cpp +++ b/mozilla/layout/xml/content/src/nsXMLElement.cpp @@ -76,7 +76,7 @@ nsXMLElement::~nsXMLElement() NS_IMETHODIMP nsXMLElement::QueryInterface(REFNSIID aIID, - void** aInstancePtr) + void** aInstancePtr) { NS_IMPL_CONTENT_QUERY_INTERFACE(aIID, aInstancePtr, this, nsIXMLContent) if (aIID.Equals(kIXMLContentIID)) { diff --git a/mozilla/layout/xul/base/src/nsMenuBarListener.cpp b/mozilla/layout/xul/base/src/nsMenuBarListener.cpp index 499ba00b523..2be90aabd7f 100644 --- a/mozilla/layout/xul/base/src/nsMenuBarListener.cpp +++ b/mozilla/layout/xul/base/src/nsMenuBarListener.cpp @@ -49,6 +49,7 @@ NS_IMPL_RELEASE(nsMenuBarListener) //////////////////////////////////////////////////////////////////////// + nsMenuBarListener::nsMenuBarListener(nsMenuBarFrame* aMenuBar) :mAltKeyDown(PR_FALSE) { diff --git a/mozilla/layout/xul/base/src/nsMenuDismissalListener.cpp b/mozilla/layout/xul/base/src/nsMenuDismissalListener.cpp index ba010697bbe..ea2ec89e2a0 100644 --- a/mozilla/layout/xul/base/src/nsMenuDismissalListener.cpp +++ b/mozilla/layout/xul/base/src/nsMenuDismissalListener.cpp @@ -30,6 +30,7 @@ NS_IMPL_RELEASE(nsMenuDismissalListener) //////////////////////////////////////////////////////////////////////// + nsMenuDismissalListener::nsMenuDismissalListener() : mWidget(0), mEnabled(PR_TRUE) { diff --git a/mozilla/layout/xul/base/src/nsToolbarDragListener.cpp b/mozilla/layout/xul/base/src/nsToolbarDragListener.cpp index 4734ec1aa1d..c2193d8bfc6 100644 --- a/mozilla/layout/xul/base/src/nsToolbarDragListener.cpp +++ b/mozilla/layout/xul/base/src/nsToolbarDragListener.cpp @@ -40,6 +40,7 @@ NS_IMPL_RELEASE(nsToolbarDragListener) // // Not much to do besides init member variables // + nsToolbarDragListener :: nsToolbarDragListener ( nsToolbarFrame* inToolbar, nsIPresContext* inPresContext ) : mToolbar(inToolbar), mPresContext(inPresContext), mCurrentDropLoc(-1) { diff --git a/mozilla/layout/xul/base/src/nsTreeTwistyListener.cpp b/mozilla/layout/xul/base/src/nsTreeTwistyListener.cpp index dea9ef1e725..e3c303fd731 100644 --- a/mozilla/layout/xul/base/src/nsTreeTwistyListener.cpp +++ b/mozilla/layout/xul/base/src/nsTreeTwistyListener.cpp @@ -38,6 +38,8 @@ NS_IMPL_RELEASE(nsTreeTwistyListener) //////////////////////////////////////////////////////////////////////// + + nsTreeTwistyListener::nsTreeTwistyListener() { NS_INIT_REFCNT(); diff --git a/mozilla/view/src/nsViewManager.cpp b/mozilla/view/src/nsViewManager.cpp index 66f3d657185..58f2fbb6043 100644 --- a/mozilla/view/src/nsViewManager.cpp +++ b/mozilla/view/src/nsViewManager.cpp @@ -83,12 +83,14 @@ static void vm_timer_callback(nsITimer *aTimer, void *aClosure) #endif } +#if 0 static void blinkRect(nsIRenderingContext* context, const nsRect& r) { context->InvertRect(r); ::PR_Sleep(::PR_MillisecondsToInterval(100)); context->InvertRect(r); } +#endif PRUint32 nsViewManager::mVMCount = 0; nsDrawingSurface nsViewManager::mDrawingSurface = nsnull; @@ -102,20 +104,15 @@ PRInt32 nsViewManager::gBlendHeight = 0; static NS_DEFINE_IID(knsViewManagerIID, NS_IVIEWMANAGER_IID); -MOZ_DECL_CTOR_COUNTER(nsViewManager); - nsViewManager :: nsViewManager() { - MOZ_COUNT_CTOR(nsViewManager); - + NS_INIT_REFCNT(); mVMCount++; mUpdateBatchCnt = 0; } nsViewManager :: ~nsViewManager() { - MOZ_COUNT_DTOR(nsViewManager); - if (nsnull != mTimer) { mTimer->Cancel(); //XXX this should not be necessary. MMP @@ -201,12 +198,7 @@ nsViewManager :: ~nsViewManager() NS_IMPL_QUERY_INTERFACE(nsViewManager, knsViewManagerIID) -nsrefcnt nsViewManager::AddRef(void) -{ - ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "nsViewManager"); - return mRefCnt; -} +NS_IMPL_ADDREF(nsViewManager); nsrefcnt nsViewManager::Release(void) { @@ -217,6 +209,7 @@ nsrefcnt nsViewManager::Release(void) the destruction has finished to decrement the refcount prevents that. */ + NS_LOG_RELEASE(this, mRefCnt - 1, "nsViewManager"); if (mRefCnt == 1) { if (nsnull != mRootView) { @@ -228,7 +221,6 @@ nsrefcnt nsViewManager::Release(void) return 0; } mRefCnt--; - NS_LOG_RELEASE(this, mRefCnt, "nsViewManager"); return mRefCnt; } @@ -2645,7 +2637,9 @@ void nsViewManager::ShowDisplayList(PRInt32 flatlen) view->GetParent(parent); view->GetZIndex(zindex); rect *= t2p; - printf("%snsIView@%08X [z=%d, x=%d, y=%d, w=%d, h=%d, p=%08X]\n", nest, view, zindex, rect.x, rect.y, rect.width, rect.height, parent); + printf("%snsIView@%p [z=%d, x=%d, y=%d, w=%d, h=%d, p=%p]\n", + nest, view, zindex, + rect.x, rect.y, rect.width, rect.height, parent); newnestcnt = nestcnt; diff --git a/mozilla/webshell/src/nsThrobber.cpp b/mozilla/webshell/src/nsThrobber.cpp index 4b50adc3438..45525230c3b 100644 --- a/mozilla/webshell/src/nsThrobber.cpp +++ b/mozilla/webshell/src/nsThrobber.cpp @@ -111,7 +111,7 @@ public: //----------------------------------------------- nsrefcnt AddRefObject() { ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "nsThrobber"); + NS_LOG_ADDREF(this, mRefCnt, "nsThrobber", sizeof(*this)); return mRefCnt; } diff --git a/mozilla/webshell/src/nsWebShell.cpp b/mozilla/webshell/src/nsWebShell.cpp index 66d0c11cab5..6c94e62a5c2 100644 --- a/mozilla/webshell/src/nsWebShell.cpp +++ b/mozilla/webshell/src/nsWebShell.cpp @@ -607,12 +607,9 @@ nsresult nsWebShell::DestroyPluginHost(void) //---------------------------------------------------------------------- -MOZ_DECL_CTOR_COUNTER(nsWebShell); - // Note: operator new zeros our memory nsWebShell::nsWebShell() { - MOZ_COUNT_CTOR(nsWebShell); #ifdef DETECT_WEBSHELL_LEAKS // We're counting the number of |nsWebShells| to help find leaks ++gNumberOfWebShells; @@ -647,7 +644,6 @@ nsWebShell::nsWebShell() nsWebShell::~nsWebShell() { - MOZ_COUNT_DTOR(nsWebShell); if (nsnull != mHistoryService) { nsServiceManager::ReleaseService(kGlobalHistoryCID, mHistoryService); mHistoryService = nsnull; diff --git a/mozilla/webshell/tests/viewer/nsThrobber.cpp b/mozilla/webshell/tests/viewer/nsThrobber.cpp index 6249a708c53..4a938166497 100644 --- a/mozilla/webshell/tests/viewer/nsThrobber.cpp +++ b/mozilla/webshell/tests/viewer/nsThrobber.cpp @@ -175,14 +175,11 @@ nsThrobber::HandleThrobberEvent(nsGUIEvent *aEvent) //---------------------------------------------------------------------- -MOZ_DECL_CTOR_COUNTER(nsThrobber); - PRInt32 nsThrobber::gNumThrobbers; // Note: operator new zeros our memory nsThrobber::nsThrobber() { - MOZ_COUNT_CTOR(nsThrobber); NS_INIT_REFCNT(); if (0 == gNumThrobbers++) { gThrobbers = new nsVoidArray; @@ -192,7 +189,6 @@ nsThrobber::nsThrobber() nsThrobber::~nsThrobber() { - MOZ_COUNT_DTOR(nsThrobber); Destroy(); } @@ -213,38 +209,7 @@ nsThrobber::Destroy() } } -#ifdef LOG_REFCNTS -extern "C" { - void __log_addref(void* p, int oldrc, int newrc); - void __log_release(void* p, int oldrc, int newrc); -} - -nsrefcnt nsThrobber::AddRef(void) -{ - NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); - __log_addref((void*) this, mRefCnt, mRefCnt + 1); - ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "nsThrobber"); - return mRefCnt; -} - -nsrefcnt nsThrobber::Release(void) -{ - __log_release((void*) this, mRefCnt, mRefCnt - 1); - NS_PRECONDITION(0 != mRefCnt, "dup release"); - --mRefCnt; - NS_LOG_RELEASE(this, mRefCnt, "nsThrobber"); - if (mRefCnt == 0) { - NS_DELETEXPCOM(this); - return 0; - } - return mRefCnt; -} - -NS_IMPL_QUERY_INTERFACE(nsThrobber, kIImageObserverIID) -#else NS_IMPL_ISUPPORTS(nsThrobber, kIImageObserverIID) -#endif nsresult nsThrobber::Init(nsIWidget* aParent, const nsRect& aBounds, const nsString& aFileNameMask, PRInt32 aNumImages) diff --git a/mozilla/widget/src/gtk/nsAppShell.cpp b/mozilla/widget/src/gtk/nsAppShell.cpp index 2801f4de855..d2d1c4f9ccd 100644 --- a/mozilla/widget/src/gtk/nsAppShell.cpp +++ b/mozilla/widget/src/gtk/nsAppShell.cpp @@ -109,8 +109,6 @@ PRBool EventQueueTokenQueue::PopToken(nsIEventQueue *aQueue, gint *aToken) { return found; } -MOZ_DECL_CTOR_COUNTER(nsAppShell); - //------------------------------------------------------------------------- // // nsAppShell constructor @@ -118,7 +116,6 @@ MOZ_DECL_CTOR_COUNTER(nsAppShell); //------------------------------------------------------------------------- nsAppShell::nsAppShell() { - MOZ_COUNT_CTOR(nsAppShell); NS_INIT_REFCNT(); mDispatchListener = 0; mLock = PR_NewLock(); @@ -135,7 +132,6 @@ nsAppShell::nsAppShell() //------------------------------------------------------------------------- nsAppShell::~nsAppShell() { - MOZ_COUNT_DTOR(nsAppShell); PR_DestroyLock(mLock); delete mEventQueueTokens; } @@ -146,38 +142,7 @@ nsAppShell::~nsAppShell() // //------------------------------------------------------------------------- -#ifdef LOG_REFCNTS -extern "C" { - void __log_addref(void* p, int oldrc, int newrc); - void __log_release(void* p, int oldrc, int newrc); -} - -nsrefcnt nsAppShell::AddRef(void) -{ - NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); - __log_addref((void*) this, mRefCnt, mRefCnt + 1); - ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "nsAppShell"); - return mRefCnt; -} - -nsrefcnt nsAppShell::Release(void) -{ - __log_release((void*) this, mRefCnt, mRefCnt - 1); - NS_PRECONDITION(0 != mRefCnt, "dup release"); - --mRefCnt; - NS_LOG_RELEASE(this, mRefCnt, "nsAppShell"); - if (mRefCnt == 0) { - NS_DELETEXPCOM(this); - return 0; - } - return mRefCnt; -} - -NS_IMPL_QUERY_INTERFACE1(nsAppShell, nsIAppShell) -#else NS_IMPL_ISUPPORTS1(nsAppShell, nsIAppShell) -#endif //------------------------------------------------------------------------- NS_IMETHODIMP nsAppShell::SetDispatchListener(nsDispatchListener* aDispatchListener) diff --git a/mozilla/widget/src/gtk/nsToolkit.cpp b/mozilla/widget/src/gtk/nsToolkit.cpp index 820d1017dfc..bbae4fe22f8 100644 --- a/mozilla/widget/src/gtk/nsToolkit.cpp +++ b/mozilla/widget/src/gtk/nsToolkit.cpp @@ -19,8 +19,6 @@ #include "nscore.h" // needed for 'nsnull' #include "nsToolkit.h" -MOZ_DECL_CTOR_COUNTER(nsToolkit); - //------------------------------------------------------------------------- // // constructor @@ -28,7 +26,6 @@ MOZ_DECL_CTOR_COUNTER(nsToolkit); //------------------------------------------------------------------------- nsToolkit::nsToolkit() { - MOZ_COUNT_CTOR(nsToolkit); NS_INIT_REFCNT(); mSharedGC = nsnull; } @@ -40,7 +37,6 @@ nsToolkit::nsToolkit() //------------------------------------------------------------------------- nsToolkit::~nsToolkit() { - MOZ_COUNT_DTOR(nsToolkit); if (mSharedGC) gdk_gc_unref(mSharedGC); } diff --git a/mozilla/widget/src/mac/nsToolkit.cpp b/mozilla/widget/src/mac/nsToolkit.cpp index e9845133300..fc8588810f4 100644 --- a/mozilla/widget/src/mac/nsToolkit.cpp +++ b/mozilla/widget/src/mac/nsToolkit.cpp @@ -74,7 +74,7 @@ void nsMacNSPREventQueueHandler::StartPumping() } ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "nsMacNSPREventQueueHandler"); + NS_LOG_ADDREF(this, mRefCnt, "nsMacNSPREventQueueHandler", sizeof(*this)); StartRepeating(); } diff --git a/mozilla/widget/src/xpwidgets/nsBaseWidget.cpp b/mozilla/widget/src/xpwidgets/nsBaseWidget.cpp index 45bcec01b94..64f96790fcc 100644 --- a/mozilla/widget/src/xpwidgets/nsBaseWidget.cpp +++ b/mozilla/widget/src/xpwidgets/nsBaseWidget.cpp @@ -35,39 +35,7 @@ static PRInt32 gNumWidgets; #endif // nsBaseWidget -#ifdef LOG_REFCNTS -extern "C" { - void __log_addref(void* p, int oldrc, int newrc); - void __log_release(void* p, int oldrc, int newrc); -} - -nsrefcnt nsBaseWidget::AddRef(void) -{ - NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); - __log_addref((void*) this, mRefCnt, mRefCnt + 1); - ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "nsBaseWidget"); - return mRefCnt; -} - -nsrefcnt nsBaseWidget::Release(void) -{ - __log_release((void*) this, mRefCnt, mRefCnt - 1); - NS_PRECONDITION(0 != mRefCnt, "dup release"); - --mRefCnt; - NS_LOG_RELEASE(this, mRefCnt, "nsBaseWidget"); - if (mRefCnt == 0) { - NS_DELETEXPCOM(this); - return 0; - } - return mRefCnt; -} - -NS_IMPL_QUERY_INTERFACE1(nsBaseWidget, nsIWidget) -#else NS_IMPL_ISUPPORTS1(nsBaseWidget, nsIWidget) -#endif - // nsBaseWidget::Enumerator NS_IMPL_ISUPPORTS2(nsBaseWidget::Enumerator, nsIBidirectionalEnumerator, nsIEnumerator) @@ -79,8 +47,6 @@ NS_IMPL_ISUPPORTS2(nsBaseWidget::Enumerator, nsIBidirectionalEnumerator, nsIEnum // //------------------------------------------------------------------------- -MOZ_DECL_CTOR_COUNTER(nsBaseWidget); - nsBaseWidget::nsBaseWidget() : mClientData(nsnull) , mEventCallback(nsnull) @@ -103,7 +69,6 @@ nsBaseWidget::nsBaseWidget() #endif , mZIndex(0) { - MOZ_COUNT_CTOR(nsBaseWidget); #ifdef NOISY_WIDGET_LEAKS gNumWidgets++; printf("WIDGETS+ = %d\n", gNumWidgets); @@ -122,7 +87,6 @@ nsBaseWidget::nsBaseWidget() //------------------------------------------------------------------------- nsBaseWidget::~nsBaseWidget() { - MOZ_COUNT_DTOR(nsBaseWidget); #ifdef NOISY_WIDGET_LEAKS gNumWidgets--; printf("WIDGETS- = %d\n", gNumWidgets); diff --git a/mozilla/xpcom/base/nsAgg.h b/mozilla/xpcom/base/nsAgg.h index 84b7bd6a775..c2b3741ed07 100644 --- a/mozilla/xpcom/base/nsAgg.h +++ b/mozilla/xpcom/base/nsAgg.h @@ -100,7 +100,7 @@ _class::Internal::AddRef(void) \ _class* agg = (_class*)((char*)(this) - offsetof(_class, fAggregated)); \ NS_PRECONDITION(PRInt32(agg->mRefCnt) >= 0, "illegal refcnt"); \ ++agg->mRefCnt; \ - NS_LOG_ADDREF(this, agg->mRefCnt, #_class); \ + NS_LOG_ADDREF(this, agg->mRefCnt, #_class, sizeof(*this)); \ return agg->mRefCnt; \ } \ \ diff --git a/mozilla/xpcom/base/nsISupportsUtils.h b/mozilla/xpcom/base/nsISupportsUtils.h index 724c7992bdd..54aad2b905e 100644 --- a/mozilla/xpcom/base/nsISupportsUtils.h +++ b/mozilla/xpcom/base/nsISupportsUtils.h @@ -39,17 +39,17 @@ // under VC++ (Windows), we don't have autoconf yet #if defined(_MSC_VER) && (_MSC_VER>=1100) - // VC++ 5.0 and greater implement template specialization, 4.2 is unknown + // VC++ 5.0 and greater implement template specialization, 4.2 is unknown #define HAVE_CPP_SPECIALIZATION #endif #ifdef HAVE_CPP_SPECIALIZATION - #define NSCAP_FEATURE_HIDE_NSISUPPORTS_GETIID + #define NSCAP_FEATURE_HIDE_NSISUPPORTS_GETIID #endif /*@{*/ -//////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// /** * IID for the nsISupports interface @@ -76,20 +76,6 @@ typedef unsigned long nsrefcnt; typedef PRUint32 nsrefcnt; #endif -/** - * "Bloaty" is a facility to dump statistics on object allocations and - * refcounting. To turn it on, you must define BLOATY in this file, and - * rebuild the world. (That seems easier than hacking makefiles to ensure - * that environment variables get checked everywhere.) - */ -#ifdef DEBUG_warren -#define BLOATY 1 -#endif - -#ifdef BLOATY -#define MOZ_LOG_REFCNT 1 -#endif - #include "nsTraceRefcnt.h" /** @@ -189,7 +175,7 @@ protected: \ nsrefcnt mRefCnt; \ public: -//////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// /** * Initialize the reference count variable. Add this to each and every @@ -207,7 +193,7 @@ NS_IMETHODIMP_(nsrefcnt) _class::AddRef(void) \ { \ NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); \ ++mRefCnt; \ - NS_LOG_ADDREF(this, mRefCnt, #_class); \ + NS_LOG_ADDREF(this, mRefCnt, #_class, sizeof(*this)); \ return mRefCnt; \ } @@ -228,7 +214,7 @@ NS_IMETHODIMP_(nsrefcnt) _class::Release(void) \ return mRefCnt; \ } -//////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// /* * Some convenience macros for implementing QueryInterface @@ -298,7 +284,7 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ NS_IMPL_QUERY_BODY(_i3) \ NS_IMPL_QUERY_TAIL(_i1) -#define NS_IMPL_QUERY_INTERFACE4(_class, _i1, _i2, _i3, _i4) \ +#define NS_IMPL_QUERY_INTERFACE4(_class, _i1, _i2, _i3, _i4) \ NS_IMPL_QUERY_HEAD(_class) \ NS_IMPL_QUERY_BODY(_i1) \ NS_IMPL_QUERY_BODY(_i2) \ @@ -306,7 +292,7 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ NS_IMPL_QUERY_BODY(_i4) \ NS_IMPL_QUERY_TAIL(_i1) -#define NS_IMPL_QUERY_INTERFACE5(_class, _i1, _i2, _i3, _i4, _i5) \ +#define NS_IMPL_QUERY_INTERFACE5(_class, _i1, _i2, _i3, _i4, _i5) \ NS_IMPL_QUERY_HEAD(_class) \ NS_IMPL_QUERY_BODY(_i1) \ NS_IMPL_QUERY_BODY(_i2) \ @@ -316,14 +302,14 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ NS_IMPL_QUERY_TAIL(_i1) - /* - The following macro is deprecated. We need to switch all instances - to |NS_IMPL_QUERY_INTERFACE1|, or |NS_IMPL_QUERY_INTERFACE0| depending - on how they were using it. - */ +/* + The following macro is deprecated. We need to switch all instances + to |NS_IMPL_QUERY_INTERFACE1|, or |NS_IMPL_QUERY_INTERFACE0| depending + on how they were using it. +*/ #define NS_IMPL_QUERY_INTERFACE(_class,_classiiddef) \ -NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ +NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ { \ if (NULL == aInstancePtr) { \ return NS_ERROR_NULL_POINTER; \ @@ -379,13 +365,13 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ NS_IMPL_QUERY_INTERFACE3(_class, _i1, _i2, _i3) #define NS_IMPL_ISUPPORTS4(_class, _i1, _i2, _i3, _i4) \ - NS_IMPL_ADDREF(_class) \ - NS_IMPL_RELEASE(_class) \ + NS_IMPL_ADDREF(_class) \ + NS_IMPL_RELEASE(_class) \ NS_IMPL_QUERY_INTERFACE4(_class, _i1, _i2, _i3, _i4) #define NS_IMPL_ISUPPORTS5(_class, _i1, _i2, _i3, _i4, _i5) \ - NS_IMPL_ADDREF(_class) \ - NS_IMPL_RELEASE(_class) \ + NS_IMPL_ADDREF(_class) \ + NS_IMPL_RELEASE(_class) \ NS_IMPL_QUERY_INTERFACE5(_class, _i1, _i2, _i3, _i4, _i5) //////////////////////////////////////////////////////////////////////////////// @@ -417,36 +403,36 @@ public: \ * Note that I didn't make these inlined because they're virtual methods. */ -#define NS_IMPL_ADDREF_INHERITED(Class, Super) \ -NS_IMETHODIMP_(nsrefcnt) Class::AddRef(void) \ -{ \ - return Super::AddRef(); \ -} \ +#define NS_IMPL_ADDREF_INHERITED(Class, Super) \ +NS_IMETHODIMP_(nsrefcnt) Class::AddRef(void) \ +{ \ + return Super::AddRef(); \ +} \ -#define NS_IMPL_RELEASE_INHERITED(Class, Super) \ -NS_IMETHODIMP_(nsrefcnt) Class::Release(void) \ -{ \ - return Super::Release(); \ -} \ +#define NS_IMPL_RELEASE_INHERITED(Class, Super) \ +NS_IMETHODIMP_(nsrefcnt) Class::Release(void) \ +{ \ + return Super::Release(); \ +} \ -#define NS_IMPL_QUERY_INTERFACE_INHERITED(Class, Super, AdditionalInterface) \ -NS_IMETHODIMP Class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ -{ \ - if (!aInstancePtr) return NS_ERROR_NULL_POINTER; \ - if (aIID.Equals(AdditionalInterface::GetIID())) { \ - *aInstancePtr = NS_STATIC_CAST(AdditionalInterface*, this); \ - NS_ADDREF_THIS(); \ - return NS_OK; \ - } \ - return Super::QueryInterface(aIID, aInstancePtr); \ -} \ +#define NS_IMPL_QUERY_INTERFACE_INHERITED(Class,Super,AdditionalInterface) \ +NS_IMETHODIMP Class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ +{ \ + if (!aInstancePtr) return NS_ERROR_NULL_POINTER; \ + if (aIID.Equals(AdditionalInterface::GetIID())) { \ + *aInstancePtr = NS_STATIC_CAST(AdditionalInterface*, this); \ + NS_ADDREF_THIS(); \ + return NS_OK; \ + } \ + return Super::QueryInterface(aIID, aInstancePtr); \ +} \ -#define NS_IMPL_ISUPPORTS_INHERITED(Class, Super, AdditionalInterface) \ - NS_IMPL_QUERY_INTERFACE_INHERITED(Class, Super, AdditionalInterface) \ - NS_IMPL_ADDREF_INHERITED(Class, Super) \ - NS_IMPL_RELEASE_INHERITED(Class, Super) \ +#define NS_IMPL_ISUPPORTS_INHERITED(Class, Super, AdditionalInterface) \ + NS_IMPL_QUERY_INTERFACE_INHERITED(Class, Super, AdditionalInterface) \ + NS_IMPL_ADDREF_INHERITED(Class, Super) \ + NS_IMPL_RELEASE_INHERITED(Class, Super) \ -//////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// /** * @@ -482,6 +468,7 @@ NS_IMETHODIMP Class::QueryInterface(REFNSIID aIID, void** aInstancePtr) NS_IMETHODIMP_(nsrefcnt) _class::AddRef(void) \ { \ NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); \ + NS_LOG_ADDREF(this, mRefCnt+1, #_class, sizeof(*this)); \ return PR_AtomicIncrement((PRInt32*)&mRefCnt); \ } @@ -490,20 +477,21 @@ NS_IMETHODIMP_(nsrefcnt) _class::AddRef(void) \ * @param _class The name of the class implementing the method */ -#define NS_IMPL_THREADSAFE_RELEASE(_class) \ -nsrefcnt _class::Release(void) \ -{ \ - nsrefcnt count; \ - NS_PRECONDITION(0 != mRefCnt, "dup release"); \ - count = PR_AtomicDecrement((PRInt32 *)&mRefCnt); \ - if (0 == count) { \ - NS_DELETEXPCOM(this); \ - return 0; \ - } \ - return count; \ +#define NS_IMPL_THREADSAFE_RELEASE(_class) \ +nsrefcnt _class::Release(void) \ +{ \ + nsrefcnt count; \ + NS_PRECONDITION(0 != mRefCnt, "dup release"); \ + NS_LOG_RELEASE(this, mRefCnt-1, #_class); \ + count = PR_AtomicDecrement((PRInt32 *)&mRefCnt); \ + if (0 == count) { \ + NS_DELETEXPCOM(this); \ + return 0; \ + } \ + return count; \ } -//////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// /* * Some convenience macros for implementing QueryInterface @@ -530,7 +518,7 @@ nsrefcnt _class::Release(void) \ } #define NS_IMPL_THREADSAFE_QUERY_INTERFACE(_class,_classiiddef) \ -NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ +NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ { \ if (NULL == aInstancePtr) { \ return NS_ERROR_NULL_POINTER; \ @@ -600,9 +588,9 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ #endif /* !NS_MT_SUPPORTED */ -//////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// // Debugging Macros -//////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// /** * Macro for instantiating a new object that implements nsISupports. @@ -612,45 +600,29 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ * @param _result Where the new instance pointer is stored * @param _type The type of object to call "new" with. */ -#ifdef MOZ_TRACE_XPCOM_REFCNT -#define NS_NEWXPCOM(_result,_type) \ - PR_BEGIN_MACRO \ - _result = new _type(); \ - nsTraceRefcnt::Create(_result, #_type, __FILE__, __LINE__); \ +#define NS_NEWXPCOM(_result,_type) \ + PR_BEGIN_MACRO \ + _result = new _type(); \ + NS_LOG_NEW_XPCOM(_result, #_type, sizeof(_type), __FILE__, __LINE__); \ PR_END_MACRO -#else -#define NS_NEWXPCOM(_result,_type) \ - _result = new _type() -#endif /** * Macro for deleting an object that implements nsISupports. * Use this in your Release methods to allow for refcnt tracing. * @param _ptr The object to delete. */ -#ifdef MOZ_TRACE_XPCOM_REFCNT -#define NS_DELETEXPCOM(_ptr) \ - PR_BEGIN_MACRO \ - nsTraceRefcnt::Destroy((_ptr), __FILE__, __LINE__); \ - delete (_ptr); \ +#define NS_DELETEXPCOM(_ptr) \ + PR_BEGIN_MACRO \ + NS_LOG_DELETE_XPCOM((_ptr), __FILE__, __LINE__); \ + delete (_ptr); \ PR_END_MACRO -#else -#define NS_DELETEXPCOM(_ptr) \ - delete (_ptr) -#endif /** * Macro for adding a reference to an interface. * @param _ptr The interface pointer. */ -#ifdef MOZ_TRACE_XPCOM_REFCNT -#define NS_ADDREF(_ptr) \ - ((nsrefcnt) nsTraceRefcnt::AddRef((_ptr), (_ptr)->AddRef(), \ - __FILE__, __LINE__)) -#else #define NS_ADDREF(_ptr) \ - (_ptr)->AddRef() -#endif + NS_LOG_ADDREF_CALL((_ptr), (_ptr)->AddRef(), __FILE__, __LINE__) /** * Macro for adding a reference to this. This macro should be used @@ -658,70 +630,46 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ * from the pointers primary type to nsISupports. This macro sidesteps * that entire problem. */ -#ifdef MOZ_TRACE_XPCOM_REFCNT #define NS_ADDREF_THIS() \ - ((nsrefcnt) nsTraceRefcnt::AddRef(this, AddRef(), __FILE__, __LINE__)) -#else -#define NS_ADDREF_THIS() \ - AddRef() -#endif + NS_LOG_ADDREF_CALL(this, AddRef(), __FILE__, __LINE__) /** * Macro for adding a reference to an interface that checks for NULL. * @param _ptr The interface pointer. */ -#ifdef MOZ_TRACE_XPCOM_REFCNT #define NS_IF_ADDREF(_ptr) \ ((0 != (_ptr)) \ - ? ((nsrefcnt) nsTraceRefcnt::AddRef((_ptr), (_ptr)->AddRef(), __FILE__, \ - __LINE__)) \ + ? NS_LOG_ADDREF_CALL((_ptr), (_ptr)->AddRef(), __FILE__, __LINE__) \ : 0) -#else -#define NS_IF_ADDREF(_ptr) \ - ((0 != (_ptr)) ? (_ptr)->AddRef() : 0) -#endif /** * Macro for releasing a reference to an interface. * - * Note that when MOZ_TRACE_XPCOM_REFCNT is defined that the release will + * Note that when NS_LOSING_ARCHITECTURE is defined that the release will * be done before the trace message is logged. If the reference count * goes to zero and implementation of Release logs a message, the two * messages will be logged out of order. * * @param _ptr The interface pointer. */ -#ifdef MOZ_TRACE_XPCOM_REFCNT #define NS_RELEASE(_ptr) \ PR_BEGIN_MACRO \ - nsTraceRefcnt::Release((_ptr), (_ptr)->Release(), __FILE__, __LINE__); \ - (_ptr) = 0; \ + NS_LOG_RELEASE_CALL((_ptr), (_ptr)->Release(), __FILE__, __LINE__); \ + (_ptr) = 0; \ PR_END_MACRO -#else -#define NS_RELEASE(_ptr) \ - PR_BEGIN_MACRO \ - (_ptr)->Release(); \ - (_ptr) = 0; \ - PR_END_MACRO -#endif /** * Macro for releasing a reference to an interface. * - * Note that when MOZ_TRACE_XPCOM_REFCNT is defined that the release will + * Note that when NS_LOSING_ARCHITECTURE is defined that the release will * be done before the trace message is logged. If the reference count * goes to zero and implementation of Release logs a message, the two * messages will be logged out of order. * * @param _ptr The interface pointer. */ -#ifdef MOZ_TRACE_XPCOM_REFCNT -#define NS_RELEASE_THIS() \ - nsTraceRefcnt::Release(this, Release(), __FILE__, __LINE__) -#else -#define NS_RELEASE_THIS() \ - Release() -#endif +#define NS_RELEASE_THIS() \ + NS_LOG_RELEASE_CALL(this, Release(), __FILE__, __LINE__) /** * Macro for releasing a reference to an interface, except that this @@ -729,159 +677,130 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ * The interface pointer argument will only be NULLed if the reference count * goes to zero. * - * Note that when MOZ_TRACE_XPCOM_REFCNT is defined that the release will + * Note that when NS_LOSING_ARCHITECTURE is defined that the release will * be done before the trace message is logged. If the reference count * goes to zero and implementation of Release logs a message, the two * messages will be logged out of order. * * @param _ptr The interface pointer. */ -#ifdef MOZ_TRACE_XPCOM_REFCNT -#define NS_RELEASE2(_ptr, _result) \ - PR_BEGIN_MACRO \ - _result = ((nsrefcnt) nsTraceRefcnt::Release((_ptr), (_ptr)->Release(), \ - __FILE__, __LINE__)); \ - if (0 == (_result)) (_ptr) = 0; \ +#define NS_RELEASE2(_ptr,_rv) \ + PR_BEGIN_MACRO \ + _rv = NS_LOG_RELEASE_CALL((_ptr), (_ptr)->Release(),__FILE__,__LINE__); \ + if (0 == (_rv)) (_ptr) = 0; \ PR_END_MACRO -#else -#define NS_RELEASE2(_ptr, _result) \ - PR_BEGIN_MACRO \ - _result = (_ptr)->Release(); \ - if (0 == (_result)) (_ptr) = 0; \ - PR_END_MACRO -#endif /** * Macro for releasing a reference to an interface that checks for NULL; * - * Note that when MOZ_TRACE_XPCOM_REFCNT is defined that the release will + * Note that when NS_LOSING_ARCHITECTURE is defined that the release will * be done before the trace message is logged. If the reference count * goes to zero and implementation of Release logs a message, the two * messages will be logged out of order. * * @param _ptr The interface pointer. */ -#ifdef MOZ_TRACE_XPCOM_REFCNT -#define NS_IF_RELEASE(_ptr) \ - PR_BEGIN_MACRO \ - if (_ptr) { \ - (nsrefcnt) nsTraceRefcnt::Release((_ptr), (_ptr)->Release(), \ - __FILE__, __LINE__); \ - (_ptr) = 0; \ - } \ +#define NS_IF_RELEASE(_ptr) \ + PR_BEGIN_MACRO \ + if (_ptr) { \ + NS_LOG_RELEASE_CALL((_ptr), (_ptr)->Release(), __FILE__, __LINE__); \ + (_ptr) = 0; \ + } \ PR_END_MACRO -#else -#define NS_IF_RELEASE(_ptr) \ - PR_BEGIN_MACRO \ - if (_ptr) { \ - (_ptr)->Release(); \ - (_ptr) = 0; \ - } \ - PR_END_MACRO -#endif -#ifdef MOZ_LOG_REFCNT -#define NS_LOG_ADDREF(_ptr, _refcnt, _class) \ - nsTraceRefcnt::LogAddRef((_ptr), (_refcnt), (_class), (sizeof(*this))) +/////////////////////////////////////////////////////////////////////////////// -#define NS_LOG_RELEASE(_ptr, _refcnt, _class) \ - nsTraceRefcnt::LogRelease((_ptr), (_refcnt), (_class), (sizeof(*this))) - -#else -#define NS_LOG_ADDREF(_ptr, _refcnt, _class) -#define NS_LOG_RELEASE(_ptr, _refcnt, _class) -#endif - -//////////////////////////////////////////////////////////////////////////////// - -// A type-safe interface for calling |QueryInterface()|. A similar implementation -// exists in "nsCOMPtr.h" for use with |nsCOMPtr|s. +// A type-safe interface for calling |QueryInterface()|. A similar +// implementation exists in "nsCOMPtr.h" for use with |nsCOMPtr|s. extern "C++" { - // ...because some one is accidentally including this file inside an |extern "C"| +// ...because some one is accidentally including this file inside +// an |extern "C"| class nsISupports; template struct nsCOMTypeInfo - { - static const nsIID& GetIID() { return T::GetIID(); } - }; +{ + static const nsIID& GetIID() { return T::GetIID(); } +}; #ifdef NSCAP_FEATURE_HIDE_NSISUPPORTS_GETIID - template <> - struct nsCOMTypeInfo - { - static const nsIID& GetIID() { static nsIID iid = NS_ISUPPORTS_IID; return iid; } - }; + template <> + struct nsCOMTypeInfo + { + static const nsIID& GetIID() { + static nsIID iid = NS_ISUPPORTS_IID; return iid; + } + }; #endif #define NS_GET_IID(T) nsCOMTypeInfo::GetIID() +// a type-safe shortcut for calling the |QueryInterface()| member function template inline nsresult CallQueryInterface( nsISupports* aSource, DestinationType** aDestination ) - // a type-safe shortcut for calling the |QueryInterface()| member function - { - NS_PRECONDITION(aSource, "null parameter"); +{ + NS_PRECONDITION(aSource, "null parameter"); NS_PRECONDITION(aDestination, "null parameter"); - return aSource->QueryInterface(nsCOMTypeInfo::GetIID(), (void**)aDestination); - } + return aSource->QueryInterface(nsCOMTypeInfo::GetIID(), (void**)aDestination); +} } // extern "C++" -//////////////////////////////////////////////////////////////////////////////// -// Macros for checking the trueness of an expression passed in within an +/////////////////////////////////////////////////////////////////////////////// +// Macros for checking the trueness of an expression passed in within an // interface implementation. -//////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// -#define NS_ENSURE(x, ret) \ -PR_BEGIN_MACRO \ - if(NS_WARN_IF_FALSE(x, "NS_ENSURE(" #x ") failed")) \ - return ret; \ -PR_END_MACRO +#define NS_ENSURE(x, ret) \ + PR_BEGIN_MACRO \ + if(NS_WARN_IF_FALSE(x, "NS_ENSURE(" #x ") failed")) \ + return ret; \ + PR_END_MACRO #define NS_ENSURE_NOT(x, ret) \ -NS_ENSURE(!(x), ret) + NS_ENSURE(!(x), ret) -//////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// // Macros for checking results -//////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// -#define NS_ENSURE_SUCCESS(res, ret) \ -NS_ENSURE(NS_SUCCEEDED(res), ret) +#define NS_ENSURE_SUCCESS(res, ret) \ + NS_ENSURE(NS_SUCCEEDED(res), ret) -//////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// // Macros for checking state and arguments upon entering interface boundaries -//////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// #define NS_ENSURE_ARG(arg) \ -NS_ENSURE(arg, NS_ERROR_INVALID_ARG) + NS_ENSURE(arg, NS_ERROR_INVALID_ARG) #define NS_ENSURE_ARG_POINTER(arg) \ -NS_ENSURE(arg, NS_ERROR_INVALID_POINTER) + NS_ENSURE(arg, NS_ERROR_INVALID_POINTER) #define NS_ENSURE_ARG_MIN(arg, min) \ -NS_ENSURE((arg) >= min, NS_ERROR_INVALID_ARG) + NS_ENSURE((arg) >= min, NS_ERROR_INVALID_ARG) #define NS_ENSURE_ARG_MAX(arg, max) \ -NS_ENSURE((arg) <= min, NS_ERROR_INVALID_ARG) + NS_ENSURE((arg) <= min, NS_ERROR_INVALID_ARG) #define NS_ENSURE_ARG_RANGE(arg, min, max) \ -NS_ENSURE(((arg) >= min) && ((arg) <= max), NS_ERROR_INVALID_ARG) + NS_ENSURE(((arg) >= min) && ((arg) <= max), NS_ERROR_INVALID_ARG) #define NS_ENSURE_STATE(state) \ -NS_ENSURE(state, NS_ERROR_UNEXPECTED) + NS_ENSURE(state, NS_ERROR_UNEXPECTED) #define NS_ENSURE_NO_AGGREGATION(outer) \ -NS_ENSURE_NOT(outer, NS_ERROR_NO_AGGREGATION) + NS_ENSURE_NOT(outer, NS_ERROR_NO_AGGREGATION) #define NS_ENSURE_PROPER_AGGREGATION(outer, iid) \ -NS_ENSURE_NOT(outer && !iid.Equals(NS_GET_IID(nsISupports)), NS_ERROR_INVALID_ARG) + NS_ENSURE_NOT(outer && !iid.Equals(NS_GET_IID(nsISupports)), NS_ERROR_INVALID_ARG) -//////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// #endif /* __nsISupportsUtils_h */ diff --git a/mozilla/xpcom/build/nsXPComInit.cpp b/mozilla/xpcom/build/nsXPComInit.cpp index c707ebae514..25768d49138 100644 --- a/mozilla/xpcom/build/nsXPComInit.cpp +++ b/mozilla/xpcom/build/nsXPComInit.cpp @@ -25,9 +25,6 @@ #include "nsAllocator.h" #include "nsArena.h" -#if 0 -#include "nsBuffer.h" -#endif #include "nsByteBuffer.h" #ifdef PAGE_MANAGER #include "nsPageMgr.h" @@ -55,9 +52,6 @@ static NS_DEFINE_CID(kAllocatorCID, NS_ALLOCATOR_CID); // ds static NS_DEFINE_CID(kArenaCID, NS_ARENA_CID); -#if 0 -static NS_DEFINE_CID(kBufferCID, NS_BUFFER_CID); -#endif static NS_DEFINE_CID(kByteBufferCID, NS_BYTEBUFFER_CID); #ifdef PAGE_MANAGER static NS_DEFINE_CID(kPageManagerCID, NS_PAGEMANAGER_CID); @@ -491,16 +485,14 @@ nsresult NS_COM NS_ShutdownXPCOM(nsIServiceManager* servMgr) NS_PurgeAtomTable(); -#ifdef BLOATY - NS_DumpBloatStatistics(); -#endif - -#if defined(DEBUG) && (defined(_WIN32) || defined(XP_UNIX)) +#ifdef NS_BUILD_REFCNT_LOGGING +#if defined(_WIN32) || defined(XP_UNIX) if (getenv("MOZ_DUMP_LEAKS")) { - nsTraceRefcnt::DumpLeaks(stderr); - nsTraceRefcnt::FlushCtorRegistry(); + nsTraceRefcnt::DumpStatistics(); } #endif + nsTraceRefcnt::ResetStatistics(); +#endif #ifdef GC_LEAK_DETECTOR // Shutdown the GC. @@ -509,5 +501,3 @@ nsresult NS_COM NS_ShutdownXPCOM(nsIServiceManager* servMgr) return NS_OK; } - -////////////////////////////////////////////////////////////////////////////// diff --git a/mozilla/xpcom/ds/nsAtomTable.cpp b/mozilla/xpcom/ds/nsAtomTable.cpp index 2e9c3ae6a12..e66ba85de48 100644 --- a/mozilla/xpcom/ds/nsAtomTable.cpp +++ b/mozilla/xpcom/ds/nsAtomTable.cpp @@ -28,7 +28,7 @@ static nsrefcnt gAtoms; static struct PLHashTable* gAtomHashTable; -#if defined(DEBUG_kipp) && (defined(XP_UNIX) || defined(XP_PC)) +#if defined(DEBUG) && (defined(XP_UNIX) || defined(XP_PC)) static PRIntn DumpAtomLeaks(PLHashEntry *he, PRIntn index, void *arg) { @@ -46,7 +46,7 @@ DumpAtomLeaks(PLHashEntry *he, PRIntn index, void *arg) NS_COM void NS_PurgeAtomTable(void) { if (gAtomHashTable) { -#if defined(DEBUG_kipp) && (defined(XP_UNIX) || defined(XP_PC)) +#if defined(DEBUG) && (defined(XP_UNIX) || defined(XP_PC)) if (gAtoms) { if (getenv("MOZ_DUMP_ATOM_LEAKS")) { printf("*** leaking %d atoms\n", gAtoms); @@ -59,12 +59,8 @@ NS_COM void NS_PurgeAtomTable(void) } } -MOZ_DECL_CTOR_COUNTER(AtomImpl); - AtomImpl::AtomImpl() { - MOZ_COUNT_CTOR(AtomImpl); - NS_INIT_REFCNT(); // Every live atom holds a reference on the atom hashtable gAtoms++; @@ -72,8 +68,6 @@ AtomImpl::AtomImpl() AtomImpl::~AtomImpl() { - MOZ_COUNT_DTOR(AtomImpl); - NS_PRECONDITION(nsnull != gAtomHashTable, "null atom hashtable"); if (nsnull != gAtomHashTable) { PL_HashTableRemove(gAtomHashTable, mString); @@ -87,38 +81,7 @@ AtomImpl::~AtomImpl() } } -#ifdef LOG_ATOM_REFCNTS -extern "C" { - void __log_addref(void* p, int oldrc, int newrc); - void __log_release(void* p, int oldrc, int newrc); -} - -nsrefcnt AtomImpl::AddRef(void) -{ - NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); - __log_addref((void*) this, mRefCnt, mRefCnt + 1); - ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "AtomImpl"); - return mRefCnt; -} - -nsrefcnt AtomImpl::Release(void) -{ - __log_release((void*) this, mRefCnt, mRefCnt - 1); - NS_PRECONDITION(0 != mRefCnt, "dup release"); - --mRefCnt; - NS_LOG_RELEASE(this, mRefCnt, "AtomImpl"); - if (mRefCnt == 0) { - NS_DELETEXPCOM(this); - return 0; - } - return mRefCnt; -} - -NS_IMPL_QUERY_INTERFACE1(AtomImpl, nsIAtom) -#else NS_IMPL_ISUPPORTS1(AtomImpl, nsIAtom) -#endif /* LOG_ATOM_REFCNTS */ void* AtomImpl::operator new(size_t size, const PRUnichar* us, PRInt32 uslen) { diff --git a/mozilla/xpcom/ds/nsSizeOfHandler.cpp b/mozilla/xpcom/ds/nsSizeOfHandler.cpp index 40d5194e2f5..592ef3df33f 100644 --- a/mozilla/xpcom/ds/nsSizeOfHandler.cpp +++ b/mozilla/xpcom/ds/nsSizeOfHandler.cpp @@ -105,13 +105,10 @@ PointerCompareKeys(void* key1, void* key2) return key1 == key2; } -MOZ_DECL_CTOR_COUNTER(nsSizeOfHandler); - nsSizeOfHandler::nsSizeOfHandler() : mTotalSize(0), mTotalCount(0) { - MOZ_COUNT_CTOR(nsSizeOfHandler); NS_INIT_REFCNT(); mTotalSize = 0; mSizeTable = PL_NewHashTable(32, (PLHashFunction) PointerHashKey, @@ -146,7 +143,6 @@ nsSizeOfHandler::RemoveSizeEntry(PLHashEntry* he, PRIntn i, void* arg) nsSizeOfHandler::~nsSizeOfHandler() { - MOZ_COUNT_DTOR(nsSizeOfHandler); if (nsnull != mObjectTable) { PL_HashTableEnumerateEntries(mObjectTable, RemoveObjectEntry, 0); PL_HashTableDestroy(mObjectTable); diff --git a/mozilla/xpcom/glue/nsISupportsUtils.h b/mozilla/xpcom/glue/nsISupportsUtils.h index 724c7992bdd..54aad2b905e 100644 --- a/mozilla/xpcom/glue/nsISupportsUtils.h +++ b/mozilla/xpcom/glue/nsISupportsUtils.h @@ -39,17 +39,17 @@ // under VC++ (Windows), we don't have autoconf yet #if defined(_MSC_VER) && (_MSC_VER>=1100) - // VC++ 5.0 and greater implement template specialization, 4.2 is unknown + // VC++ 5.0 and greater implement template specialization, 4.2 is unknown #define HAVE_CPP_SPECIALIZATION #endif #ifdef HAVE_CPP_SPECIALIZATION - #define NSCAP_FEATURE_HIDE_NSISUPPORTS_GETIID + #define NSCAP_FEATURE_HIDE_NSISUPPORTS_GETIID #endif /*@{*/ -//////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// /** * IID for the nsISupports interface @@ -76,20 +76,6 @@ typedef unsigned long nsrefcnt; typedef PRUint32 nsrefcnt; #endif -/** - * "Bloaty" is a facility to dump statistics on object allocations and - * refcounting. To turn it on, you must define BLOATY in this file, and - * rebuild the world. (That seems easier than hacking makefiles to ensure - * that environment variables get checked everywhere.) - */ -#ifdef DEBUG_warren -#define BLOATY 1 -#endif - -#ifdef BLOATY -#define MOZ_LOG_REFCNT 1 -#endif - #include "nsTraceRefcnt.h" /** @@ -189,7 +175,7 @@ protected: \ nsrefcnt mRefCnt; \ public: -//////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// /** * Initialize the reference count variable. Add this to each and every @@ -207,7 +193,7 @@ NS_IMETHODIMP_(nsrefcnt) _class::AddRef(void) \ { \ NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); \ ++mRefCnt; \ - NS_LOG_ADDREF(this, mRefCnt, #_class); \ + NS_LOG_ADDREF(this, mRefCnt, #_class, sizeof(*this)); \ return mRefCnt; \ } @@ -228,7 +214,7 @@ NS_IMETHODIMP_(nsrefcnt) _class::Release(void) \ return mRefCnt; \ } -//////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// /* * Some convenience macros for implementing QueryInterface @@ -298,7 +284,7 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ NS_IMPL_QUERY_BODY(_i3) \ NS_IMPL_QUERY_TAIL(_i1) -#define NS_IMPL_QUERY_INTERFACE4(_class, _i1, _i2, _i3, _i4) \ +#define NS_IMPL_QUERY_INTERFACE4(_class, _i1, _i2, _i3, _i4) \ NS_IMPL_QUERY_HEAD(_class) \ NS_IMPL_QUERY_BODY(_i1) \ NS_IMPL_QUERY_BODY(_i2) \ @@ -306,7 +292,7 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ NS_IMPL_QUERY_BODY(_i4) \ NS_IMPL_QUERY_TAIL(_i1) -#define NS_IMPL_QUERY_INTERFACE5(_class, _i1, _i2, _i3, _i4, _i5) \ +#define NS_IMPL_QUERY_INTERFACE5(_class, _i1, _i2, _i3, _i4, _i5) \ NS_IMPL_QUERY_HEAD(_class) \ NS_IMPL_QUERY_BODY(_i1) \ NS_IMPL_QUERY_BODY(_i2) \ @@ -316,14 +302,14 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ NS_IMPL_QUERY_TAIL(_i1) - /* - The following macro is deprecated. We need to switch all instances - to |NS_IMPL_QUERY_INTERFACE1|, or |NS_IMPL_QUERY_INTERFACE0| depending - on how they were using it. - */ +/* + The following macro is deprecated. We need to switch all instances + to |NS_IMPL_QUERY_INTERFACE1|, or |NS_IMPL_QUERY_INTERFACE0| depending + on how they were using it. +*/ #define NS_IMPL_QUERY_INTERFACE(_class,_classiiddef) \ -NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ +NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ { \ if (NULL == aInstancePtr) { \ return NS_ERROR_NULL_POINTER; \ @@ -379,13 +365,13 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ NS_IMPL_QUERY_INTERFACE3(_class, _i1, _i2, _i3) #define NS_IMPL_ISUPPORTS4(_class, _i1, _i2, _i3, _i4) \ - NS_IMPL_ADDREF(_class) \ - NS_IMPL_RELEASE(_class) \ + NS_IMPL_ADDREF(_class) \ + NS_IMPL_RELEASE(_class) \ NS_IMPL_QUERY_INTERFACE4(_class, _i1, _i2, _i3, _i4) #define NS_IMPL_ISUPPORTS5(_class, _i1, _i2, _i3, _i4, _i5) \ - NS_IMPL_ADDREF(_class) \ - NS_IMPL_RELEASE(_class) \ + NS_IMPL_ADDREF(_class) \ + NS_IMPL_RELEASE(_class) \ NS_IMPL_QUERY_INTERFACE5(_class, _i1, _i2, _i3, _i4, _i5) //////////////////////////////////////////////////////////////////////////////// @@ -417,36 +403,36 @@ public: \ * Note that I didn't make these inlined because they're virtual methods. */ -#define NS_IMPL_ADDREF_INHERITED(Class, Super) \ -NS_IMETHODIMP_(nsrefcnt) Class::AddRef(void) \ -{ \ - return Super::AddRef(); \ -} \ +#define NS_IMPL_ADDREF_INHERITED(Class, Super) \ +NS_IMETHODIMP_(nsrefcnt) Class::AddRef(void) \ +{ \ + return Super::AddRef(); \ +} \ -#define NS_IMPL_RELEASE_INHERITED(Class, Super) \ -NS_IMETHODIMP_(nsrefcnt) Class::Release(void) \ -{ \ - return Super::Release(); \ -} \ +#define NS_IMPL_RELEASE_INHERITED(Class, Super) \ +NS_IMETHODIMP_(nsrefcnt) Class::Release(void) \ +{ \ + return Super::Release(); \ +} \ -#define NS_IMPL_QUERY_INTERFACE_INHERITED(Class, Super, AdditionalInterface) \ -NS_IMETHODIMP Class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ -{ \ - if (!aInstancePtr) return NS_ERROR_NULL_POINTER; \ - if (aIID.Equals(AdditionalInterface::GetIID())) { \ - *aInstancePtr = NS_STATIC_CAST(AdditionalInterface*, this); \ - NS_ADDREF_THIS(); \ - return NS_OK; \ - } \ - return Super::QueryInterface(aIID, aInstancePtr); \ -} \ +#define NS_IMPL_QUERY_INTERFACE_INHERITED(Class,Super,AdditionalInterface) \ +NS_IMETHODIMP Class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ +{ \ + if (!aInstancePtr) return NS_ERROR_NULL_POINTER; \ + if (aIID.Equals(AdditionalInterface::GetIID())) { \ + *aInstancePtr = NS_STATIC_CAST(AdditionalInterface*, this); \ + NS_ADDREF_THIS(); \ + return NS_OK; \ + } \ + return Super::QueryInterface(aIID, aInstancePtr); \ +} \ -#define NS_IMPL_ISUPPORTS_INHERITED(Class, Super, AdditionalInterface) \ - NS_IMPL_QUERY_INTERFACE_INHERITED(Class, Super, AdditionalInterface) \ - NS_IMPL_ADDREF_INHERITED(Class, Super) \ - NS_IMPL_RELEASE_INHERITED(Class, Super) \ +#define NS_IMPL_ISUPPORTS_INHERITED(Class, Super, AdditionalInterface) \ + NS_IMPL_QUERY_INTERFACE_INHERITED(Class, Super, AdditionalInterface) \ + NS_IMPL_ADDREF_INHERITED(Class, Super) \ + NS_IMPL_RELEASE_INHERITED(Class, Super) \ -//////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// /** * @@ -482,6 +468,7 @@ NS_IMETHODIMP Class::QueryInterface(REFNSIID aIID, void** aInstancePtr) NS_IMETHODIMP_(nsrefcnt) _class::AddRef(void) \ { \ NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); \ + NS_LOG_ADDREF(this, mRefCnt+1, #_class, sizeof(*this)); \ return PR_AtomicIncrement((PRInt32*)&mRefCnt); \ } @@ -490,20 +477,21 @@ NS_IMETHODIMP_(nsrefcnt) _class::AddRef(void) \ * @param _class The name of the class implementing the method */ -#define NS_IMPL_THREADSAFE_RELEASE(_class) \ -nsrefcnt _class::Release(void) \ -{ \ - nsrefcnt count; \ - NS_PRECONDITION(0 != mRefCnt, "dup release"); \ - count = PR_AtomicDecrement((PRInt32 *)&mRefCnt); \ - if (0 == count) { \ - NS_DELETEXPCOM(this); \ - return 0; \ - } \ - return count; \ +#define NS_IMPL_THREADSAFE_RELEASE(_class) \ +nsrefcnt _class::Release(void) \ +{ \ + nsrefcnt count; \ + NS_PRECONDITION(0 != mRefCnt, "dup release"); \ + NS_LOG_RELEASE(this, mRefCnt-1, #_class); \ + count = PR_AtomicDecrement((PRInt32 *)&mRefCnt); \ + if (0 == count) { \ + NS_DELETEXPCOM(this); \ + return 0; \ + } \ + return count; \ } -//////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// /* * Some convenience macros for implementing QueryInterface @@ -530,7 +518,7 @@ nsrefcnt _class::Release(void) \ } #define NS_IMPL_THREADSAFE_QUERY_INTERFACE(_class,_classiiddef) \ -NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ +NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ { \ if (NULL == aInstancePtr) { \ return NS_ERROR_NULL_POINTER; \ @@ -600,9 +588,9 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ #endif /* !NS_MT_SUPPORTED */ -//////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// // Debugging Macros -//////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// /** * Macro for instantiating a new object that implements nsISupports. @@ -612,45 +600,29 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ * @param _result Where the new instance pointer is stored * @param _type The type of object to call "new" with. */ -#ifdef MOZ_TRACE_XPCOM_REFCNT -#define NS_NEWXPCOM(_result,_type) \ - PR_BEGIN_MACRO \ - _result = new _type(); \ - nsTraceRefcnt::Create(_result, #_type, __FILE__, __LINE__); \ +#define NS_NEWXPCOM(_result,_type) \ + PR_BEGIN_MACRO \ + _result = new _type(); \ + NS_LOG_NEW_XPCOM(_result, #_type, sizeof(_type), __FILE__, __LINE__); \ PR_END_MACRO -#else -#define NS_NEWXPCOM(_result,_type) \ - _result = new _type() -#endif /** * Macro for deleting an object that implements nsISupports. * Use this in your Release methods to allow for refcnt tracing. * @param _ptr The object to delete. */ -#ifdef MOZ_TRACE_XPCOM_REFCNT -#define NS_DELETEXPCOM(_ptr) \ - PR_BEGIN_MACRO \ - nsTraceRefcnt::Destroy((_ptr), __FILE__, __LINE__); \ - delete (_ptr); \ +#define NS_DELETEXPCOM(_ptr) \ + PR_BEGIN_MACRO \ + NS_LOG_DELETE_XPCOM((_ptr), __FILE__, __LINE__); \ + delete (_ptr); \ PR_END_MACRO -#else -#define NS_DELETEXPCOM(_ptr) \ - delete (_ptr) -#endif /** * Macro for adding a reference to an interface. * @param _ptr The interface pointer. */ -#ifdef MOZ_TRACE_XPCOM_REFCNT -#define NS_ADDREF(_ptr) \ - ((nsrefcnt) nsTraceRefcnt::AddRef((_ptr), (_ptr)->AddRef(), \ - __FILE__, __LINE__)) -#else #define NS_ADDREF(_ptr) \ - (_ptr)->AddRef() -#endif + NS_LOG_ADDREF_CALL((_ptr), (_ptr)->AddRef(), __FILE__, __LINE__) /** * Macro for adding a reference to this. This macro should be used @@ -658,70 +630,46 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ * from the pointers primary type to nsISupports. This macro sidesteps * that entire problem. */ -#ifdef MOZ_TRACE_XPCOM_REFCNT #define NS_ADDREF_THIS() \ - ((nsrefcnt) nsTraceRefcnt::AddRef(this, AddRef(), __FILE__, __LINE__)) -#else -#define NS_ADDREF_THIS() \ - AddRef() -#endif + NS_LOG_ADDREF_CALL(this, AddRef(), __FILE__, __LINE__) /** * Macro for adding a reference to an interface that checks for NULL. * @param _ptr The interface pointer. */ -#ifdef MOZ_TRACE_XPCOM_REFCNT #define NS_IF_ADDREF(_ptr) \ ((0 != (_ptr)) \ - ? ((nsrefcnt) nsTraceRefcnt::AddRef((_ptr), (_ptr)->AddRef(), __FILE__, \ - __LINE__)) \ + ? NS_LOG_ADDREF_CALL((_ptr), (_ptr)->AddRef(), __FILE__, __LINE__) \ : 0) -#else -#define NS_IF_ADDREF(_ptr) \ - ((0 != (_ptr)) ? (_ptr)->AddRef() : 0) -#endif /** * Macro for releasing a reference to an interface. * - * Note that when MOZ_TRACE_XPCOM_REFCNT is defined that the release will + * Note that when NS_LOSING_ARCHITECTURE is defined that the release will * be done before the trace message is logged. If the reference count * goes to zero and implementation of Release logs a message, the two * messages will be logged out of order. * * @param _ptr The interface pointer. */ -#ifdef MOZ_TRACE_XPCOM_REFCNT #define NS_RELEASE(_ptr) \ PR_BEGIN_MACRO \ - nsTraceRefcnt::Release((_ptr), (_ptr)->Release(), __FILE__, __LINE__); \ - (_ptr) = 0; \ + NS_LOG_RELEASE_CALL((_ptr), (_ptr)->Release(), __FILE__, __LINE__); \ + (_ptr) = 0; \ PR_END_MACRO -#else -#define NS_RELEASE(_ptr) \ - PR_BEGIN_MACRO \ - (_ptr)->Release(); \ - (_ptr) = 0; \ - PR_END_MACRO -#endif /** * Macro for releasing a reference to an interface. * - * Note that when MOZ_TRACE_XPCOM_REFCNT is defined that the release will + * Note that when NS_LOSING_ARCHITECTURE is defined that the release will * be done before the trace message is logged. If the reference count * goes to zero and implementation of Release logs a message, the two * messages will be logged out of order. * * @param _ptr The interface pointer. */ -#ifdef MOZ_TRACE_XPCOM_REFCNT -#define NS_RELEASE_THIS() \ - nsTraceRefcnt::Release(this, Release(), __FILE__, __LINE__) -#else -#define NS_RELEASE_THIS() \ - Release() -#endif +#define NS_RELEASE_THIS() \ + NS_LOG_RELEASE_CALL(this, Release(), __FILE__, __LINE__) /** * Macro for releasing a reference to an interface, except that this @@ -729,159 +677,130 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \ * The interface pointer argument will only be NULLed if the reference count * goes to zero. * - * Note that when MOZ_TRACE_XPCOM_REFCNT is defined that the release will + * Note that when NS_LOSING_ARCHITECTURE is defined that the release will * be done before the trace message is logged. If the reference count * goes to zero and implementation of Release logs a message, the two * messages will be logged out of order. * * @param _ptr The interface pointer. */ -#ifdef MOZ_TRACE_XPCOM_REFCNT -#define NS_RELEASE2(_ptr, _result) \ - PR_BEGIN_MACRO \ - _result = ((nsrefcnt) nsTraceRefcnt::Release((_ptr), (_ptr)->Release(), \ - __FILE__, __LINE__)); \ - if (0 == (_result)) (_ptr) = 0; \ +#define NS_RELEASE2(_ptr,_rv) \ + PR_BEGIN_MACRO \ + _rv = NS_LOG_RELEASE_CALL((_ptr), (_ptr)->Release(),__FILE__,__LINE__); \ + if (0 == (_rv)) (_ptr) = 0; \ PR_END_MACRO -#else -#define NS_RELEASE2(_ptr, _result) \ - PR_BEGIN_MACRO \ - _result = (_ptr)->Release(); \ - if (0 == (_result)) (_ptr) = 0; \ - PR_END_MACRO -#endif /** * Macro for releasing a reference to an interface that checks for NULL; * - * Note that when MOZ_TRACE_XPCOM_REFCNT is defined that the release will + * Note that when NS_LOSING_ARCHITECTURE is defined that the release will * be done before the trace message is logged. If the reference count * goes to zero and implementation of Release logs a message, the two * messages will be logged out of order. * * @param _ptr The interface pointer. */ -#ifdef MOZ_TRACE_XPCOM_REFCNT -#define NS_IF_RELEASE(_ptr) \ - PR_BEGIN_MACRO \ - if (_ptr) { \ - (nsrefcnt) nsTraceRefcnt::Release((_ptr), (_ptr)->Release(), \ - __FILE__, __LINE__); \ - (_ptr) = 0; \ - } \ +#define NS_IF_RELEASE(_ptr) \ + PR_BEGIN_MACRO \ + if (_ptr) { \ + NS_LOG_RELEASE_CALL((_ptr), (_ptr)->Release(), __FILE__, __LINE__); \ + (_ptr) = 0; \ + } \ PR_END_MACRO -#else -#define NS_IF_RELEASE(_ptr) \ - PR_BEGIN_MACRO \ - if (_ptr) { \ - (_ptr)->Release(); \ - (_ptr) = 0; \ - } \ - PR_END_MACRO -#endif -#ifdef MOZ_LOG_REFCNT -#define NS_LOG_ADDREF(_ptr, _refcnt, _class) \ - nsTraceRefcnt::LogAddRef((_ptr), (_refcnt), (_class), (sizeof(*this))) +/////////////////////////////////////////////////////////////////////////////// -#define NS_LOG_RELEASE(_ptr, _refcnt, _class) \ - nsTraceRefcnt::LogRelease((_ptr), (_refcnt), (_class), (sizeof(*this))) - -#else -#define NS_LOG_ADDREF(_ptr, _refcnt, _class) -#define NS_LOG_RELEASE(_ptr, _refcnt, _class) -#endif - -//////////////////////////////////////////////////////////////////////////////// - -// A type-safe interface for calling |QueryInterface()|. A similar implementation -// exists in "nsCOMPtr.h" for use with |nsCOMPtr|s. +// A type-safe interface for calling |QueryInterface()|. A similar +// implementation exists in "nsCOMPtr.h" for use with |nsCOMPtr|s. extern "C++" { - // ...because some one is accidentally including this file inside an |extern "C"| +// ...because some one is accidentally including this file inside +// an |extern "C"| class nsISupports; template struct nsCOMTypeInfo - { - static const nsIID& GetIID() { return T::GetIID(); } - }; +{ + static const nsIID& GetIID() { return T::GetIID(); } +}; #ifdef NSCAP_FEATURE_HIDE_NSISUPPORTS_GETIID - template <> - struct nsCOMTypeInfo - { - static const nsIID& GetIID() { static nsIID iid = NS_ISUPPORTS_IID; return iid; } - }; + template <> + struct nsCOMTypeInfo + { + static const nsIID& GetIID() { + static nsIID iid = NS_ISUPPORTS_IID; return iid; + } + }; #endif #define NS_GET_IID(T) nsCOMTypeInfo::GetIID() +// a type-safe shortcut for calling the |QueryInterface()| member function template inline nsresult CallQueryInterface( nsISupports* aSource, DestinationType** aDestination ) - // a type-safe shortcut for calling the |QueryInterface()| member function - { - NS_PRECONDITION(aSource, "null parameter"); +{ + NS_PRECONDITION(aSource, "null parameter"); NS_PRECONDITION(aDestination, "null parameter"); - return aSource->QueryInterface(nsCOMTypeInfo::GetIID(), (void**)aDestination); - } + return aSource->QueryInterface(nsCOMTypeInfo::GetIID(), (void**)aDestination); +} } // extern "C++" -//////////////////////////////////////////////////////////////////////////////// -// Macros for checking the trueness of an expression passed in within an +/////////////////////////////////////////////////////////////////////////////// +// Macros for checking the trueness of an expression passed in within an // interface implementation. -//////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// -#define NS_ENSURE(x, ret) \ -PR_BEGIN_MACRO \ - if(NS_WARN_IF_FALSE(x, "NS_ENSURE(" #x ") failed")) \ - return ret; \ -PR_END_MACRO +#define NS_ENSURE(x, ret) \ + PR_BEGIN_MACRO \ + if(NS_WARN_IF_FALSE(x, "NS_ENSURE(" #x ") failed")) \ + return ret; \ + PR_END_MACRO #define NS_ENSURE_NOT(x, ret) \ -NS_ENSURE(!(x), ret) + NS_ENSURE(!(x), ret) -//////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// // Macros for checking results -//////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// -#define NS_ENSURE_SUCCESS(res, ret) \ -NS_ENSURE(NS_SUCCEEDED(res), ret) +#define NS_ENSURE_SUCCESS(res, ret) \ + NS_ENSURE(NS_SUCCEEDED(res), ret) -//////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// // Macros for checking state and arguments upon entering interface boundaries -//////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// #define NS_ENSURE_ARG(arg) \ -NS_ENSURE(arg, NS_ERROR_INVALID_ARG) + NS_ENSURE(arg, NS_ERROR_INVALID_ARG) #define NS_ENSURE_ARG_POINTER(arg) \ -NS_ENSURE(arg, NS_ERROR_INVALID_POINTER) + NS_ENSURE(arg, NS_ERROR_INVALID_POINTER) #define NS_ENSURE_ARG_MIN(arg, min) \ -NS_ENSURE((arg) >= min, NS_ERROR_INVALID_ARG) + NS_ENSURE((arg) >= min, NS_ERROR_INVALID_ARG) #define NS_ENSURE_ARG_MAX(arg, max) \ -NS_ENSURE((arg) <= min, NS_ERROR_INVALID_ARG) + NS_ENSURE((arg) <= min, NS_ERROR_INVALID_ARG) #define NS_ENSURE_ARG_RANGE(arg, min, max) \ -NS_ENSURE(((arg) >= min) && ((arg) <= max), NS_ERROR_INVALID_ARG) + NS_ENSURE(((arg) >= min) && ((arg) <= max), NS_ERROR_INVALID_ARG) #define NS_ENSURE_STATE(state) \ -NS_ENSURE(state, NS_ERROR_UNEXPECTED) + NS_ENSURE(state, NS_ERROR_UNEXPECTED) #define NS_ENSURE_NO_AGGREGATION(outer) \ -NS_ENSURE_NOT(outer, NS_ERROR_NO_AGGREGATION) + NS_ENSURE_NOT(outer, NS_ERROR_NO_AGGREGATION) #define NS_ENSURE_PROPER_AGGREGATION(outer, iid) \ -NS_ENSURE_NOT(outer && !iid.Equals(NS_GET_IID(nsISupports)), NS_ERROR_INVALID_ARG) + NS_ENSURE_NOT(outer && !iid.Equals(NS_GET_IID(nsISupports)), NS_ERROR_INVALID_ARG) -//////////////////////////////////////////////////////////////////////////////// +/////////////////////////////////////////////////////////////////////////////// #endif /* __nsISupportsUtils_h */ diff --git a/mozilla/xpcom/io/nsFileSpec.cpp b/mozilla/xpcom/io/nsFileSpec.cpp index c66720ee516..49f45daa44e 100644 --- a/mozilla/xpcom/io/nsFileSpec.cpp +++ b/mozilla/xpcom/io/nsFileSpec.cpp @@ -817,11 +817,11 @@ void nsFileSpec::MakeUnique() = nsFileSpecHelpers::kMaxCoreLeafNameLength - nsCRT::strlen(suffix) - 1; if ((int)nsCRT::strlen(leafName) > (int)kMaxRootLength) leafName[kMaxRootLength] = '\0'; - for (short index = 1; index < 1000 && Exists(); index++) + for (short indx = 1; indx < 1000 && Exists(); indx++) { // start with "Picture-1.jpg" after "Picture.jpg" exists char newName[nsFileSpecHelpers::kMaxFilenameLength + 1]; - sprintf(newName, "%s-%d%s", leafName, index, suffix); + sprintf(newName, "%s-%d%s", leafName, indx, suffix); SetLeafName(newName); } if (*suffix) diff --git a/mozilla/xpcom/io/nsSegmentedBuffer.h b/mozilla/xpcom/io/nsSegmentedBuffer.h index f0c268b87cc..a8654fcb700 100644 --- a/mozilla/xpcom/io/nsSegmentedBuffer.h +++ b/mozilla/xpcom/io/nsSegmentedBuffer.h @@ -49,10 +49,10 @@ public: PRUint32 GetSize() { return GetSegmentCount() * mSegmentSize; } - char* GetSegment(PRUint32 index) { - NS_ASSERTION(0 <= index && index < GetSegmentCount(), + char* GetSegment(PRUint32 indx) { + NS_ASSERTION(0 <= indx && indx < GetSegmentCount(), "index out of bounds"); - PRInt32 i = ModSegArraySize(mFirstSegmentIndex + (PRInt32)index); + PRInt32 i = ModSegArraySize(mFirstSegmentIndex + (PRInt32)indx); return mSegmentArray[i]; } diff --git a/mozilla/xpcom/proxy/src/nsProxyEventObject.cpp b/mozilla/xpcom/proxy/src/nsProxyEventObject.cpp index ae2db550083..b2181a655c3 100644 --- a/mozilla/xpcom/proxy/src/nsProxyEventObject.cpp +++ b/mozilla/xpcom/proxy/src/nsProxyEventObject.cpp @@ -212,7 +212,7 @@ nsProxyEventObject::AddRef(void) NS_PRECONDITION(mRoot, "bad root"); ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "nsProxyEventObject"); + NS_LOG_ADDREF(this, mRefCnt, "nsProxyEventObject", sizeof(*this)); if(1 == mRefCnt && mRoot && mRoot != this) NS_ADDREF(mRoot); diff --git a/mozilla/xpcom/proxy/tests/proxytests.cpp b/mozilla/xpcom/proxy/tests/proxytests.cpp index 9811d17e71b..d65cf86bee0 100644 --- a/mozilla/xpcom/proxy/tests/proxytests.cpp +++ b/mozilla/xpcom/proxy/tests/proxytests.cpp @@ -175,7 +175,7 @@ void TestCase_TwoClassesOneInterface(void *arg) kProxyObjectManagerIID, (nsISupports **)&manager); - printf("ProxyObjectManager: %d \n", manager); + printf("ProxyObjectManager: %p \n", manager); PR_ASSERT(manager); diff --git a/mozilla/xpcom/tests/FilesTest.cpp b/mozilla/xpcom/tests/FilesTest.cpp index 835eec29fc6..f77290de4dc 100644 --- a/mozilla/xpcom/tests/FilesTest.cpp +++ b/mozilla/xpcom/tests/FilesTest.cpp @@ -611,7 +611,7 @@ int FilesTest::DiskSpace() PRInt64 bytes = systemDir.GetDiskSpaceAvailable(); - printf("OS Drive has %ld bytes free\n", bytes); + printf("OS Drive has %lld bytes free\n", bytes); return Inspect(); } diff --git a/mozilla/xpcom/tests/TestFactory.cpp b/mozilla/xpcom/tests/TestFactory.cpp index 0831a8569ad..557dc48c5f4 100644 --- a/mozilla/xpcom/tests/TestFactory.cpp +++ b/mozilla/xpcom/tests/TestFactory.cpp @@ -29,7 +29,6 @@ NS_DEFINE_IID(kTestClassIID, NS_ITESTCLASS_IID); int main(int argc, char **argv) { nsresult rv; - nsIServiceManager* servMgr; rv = nsComponentManager::AutoRegister(nsIComponentManager::NS_Startup, NULL /* default */); diff --git a/mozilla/xpcom/tests/windows/TestCOM.cpp b/mozilla/xpcom/tests/windows/TestCOM.cpp index 616a7733fb9..62e28818931 100644 --- a/mozilla/xpcom/tests/windows/TestCOM.cpp +++ b/mozilla/xpcom/tests/windows/TestCOM.cpp @@ -62,7 +62,7 @@ NS_IMPL_QUERY_INTERFACE(nsTestCom, kITestComIID); nsrefcnt nsTestCom::AddRef() { nsrefcnt res = ++mRefCnt; - NS_LOG_ADDREF(this, mRefCnt, "nsTestCom"); + NS_LOG_ADDREF(this, mRefCnt, "nsTestCom", sizeof(*this)); cout << "nsTestCom: Adding ref = " << res << "\n"; return res; } diff --git a/mozilla/xpfe/browser/src/nsBrowserInstance.cpp b/mozilla/xpfe/browser/src/nsBrowserInstance.cpp index b28615eca62..ddf8cce5bf8 100644 --- a/mozilla/xpfe/browser/src/nsBrowserInstance.cpp +++ b/mozilla/xpfe/browser/src/nsBrowserInstance.cpp @@ -150,11 +150,8 @@ static nsresult setAttribute( nsIWebShell *shell, // nsBrowserAppCore ///////////////////////////////////////////////////////////////////////// -MOZ_DECL_CTOR_COUNTER(nsBrowserAppCore); - nsBrowserAppCore::nsBrowserAppCore() { - MOZ_COUNT_CTOR(nsBrowserAppCore); mContentWindow = nsnull; mContentScriptContext = nsnull; mWebShellWin = nsnull; @@ -169,7 +166,6 @@ nsBrowserAppCore::nsBrowserAppCore() nsBrowserAppCore::~nsBrowserAppCore() { - MOZ_COUNT_DTOR(nsBrowserAppCore); NS_IF_RELEASE(mSHistory); }