diff --git a/mozilla/htmlparser/src/CNavDTD.cpp b/mozilla/htmlparser/src/CNavDTD.cpp index 31b50cca48c..be058a8224c 100644 --- a/mozilla/htmlparser/src/CNavDTD.cpp +++ b/mozilla/htmlparser/src/CNavDTD.cpp @@ -138,11 +138,9 @@ public: class CTagHandlerRegister { public: - CTagHandlerRegister() : mTagHandlerDeque(new CTagHandlerDeallocator()) { - } + CTagHandlerRegister(); - ~CTagHandlerRegister() { - } + ~CTagHandlerRegister(); void RegisterTagHandler(nsITagHandler *aTagHandler){ mTagHandlerDeque.Push(aTagHandler); @@ -161,6 +159,17 @@ public: CTagFinder mTagFinder; }; +MOZ_DECL_CTOR_COUNTER(CTagHandlerRegister); + +CTagHandlerRegister::CTagHandlerRegister() : mTagHandlerDeque(new CTagHandlerDeallocator()) +{ + MOZ_COUNT_CTOR(CTagHandlerRegister); +} + +CTagHandlerRegister::~CTagHandlerRegister() +{ + MOZ_COUNT_DTOR(CTagHandlerRegister); +} /************************************************************************ The CTagHandlerRegister for a CNavDTD. @@ -1243,9 +1252,6 @@ nsresult CNavDTD::HandleStartToken(CToken* aToken) { result=HandleDefaultStartToken(aToken,theChildTag,*theNode); break; - case eHTMLTag_userdefined: - break; //drop them on the floor for now... - case eHTMLTag_script: theHeadIsParent=(!mHasOpenBody); //intentionally fall through... mHasOpenScript=PR_TRUE; @@ -1783,7 +1789,8 @@ nsresult CNavDTD::CollectSkippedContent(nsCParserNode& aNode,PRInt32 &aCount) { theStr+=theTempStr; theRecycler->RecycleToken(theNextToken); } - + // Let's hope that this does not hamper the PERFORMANCE!! + mLineNumber += (theStr).CountChar(kNewLine); aNode.SetSkippedContent(theStr); return NS_OK; } diff --git a/mozilla/htmlparser/src/CParserContext.cpp b/mozilla/htmlparser/src/CParserContext.cpp index f7f284166ef..241c1051499 100644 --- a/mozilla/htmlparser/src/CParserContext.cpp +++ b/mozilla/htmlparser/src/CParserContext.cpp @@ -20,7 +20,7 @@ #include "CParserContext.h" #include "nsToken.h" - +MOZ_DECL_CTOR_COUNTER(CParserContext); /** * Your friendly little constructor. Ok, it's not the friendly, but the only guy * using it is the parser. @@ -33,6 +33,8 @@ CParserContext::CParserContext(nsScanner* aScanner,void* aKey,nsIStreamObserver* mSourceType() //,mTokenDeque(gTokenDeallocator) { + MOZ_COUNT_CTOR(CParserContext); + mScanner=aScanner; mKey=aKey; mPrevContext=0; @@ -57,6 +59,8 @@ CParserContext::CParserContext(nsScanner* aScanner,void* aKey,nsIStreamObserver* */ CParserContext::~CParserContext(){ + MOZ_COUNT_DTOR(CParserContext); + if(mScanner) delete mScanner; diff --git a/mozilla/htmlparser/src/nsDTDUtils.cpp b/mozilla/htmlparser/src/nsDTDUtils.cpp index 2b4b76395e3..a23c4b52376 100644 --- a/mozilla/htmlparser/src/nsDTDUtils.cpp +++ b/mozilla/htmlparser/src/nsDTDUtils.cpp @@ -24,6 +24,10 @@ #include "nsIObserverService.h" #include "nsIServiceManager.h" +MOZ_DECL_CTOR_COUNTER(nsEntryStack); +MOZ_DECL_CTOR_COUNTER(nsDTDContext); +MOZ_DECL_CTOR_COUNTER(CTokenRecycler); +MOZ_DECL_CTOR_COUNTER(CObserverService); /*************************************************************** First, define the tagstack class @@ -36,6 +40,9 @@ * @update gess 04/22/99 */ nsEntryStack::nsEntryStack() { + + MOZ_COUNT_CTOR(nsEntryStack); + mCapacity=0; mCount=0; mEntries=0; @@ -47,6 +54,9 @@ nsEntryStack::nsEntryStack() { * @update gess 04/22/99 */ nsEntryStack::~nsEntryStack() { + + MOZ_COUNT_DTOR(nsEntryStack); + if(mEntries) delete [] mEntries; mCount=mCapacity=0; @@ -189,6 +199,9 @@ PRInt32 nsEntryStack::GetTopmostIndexOf(eHTMLTags aTag) const { * @update gess9/10/98 */ nsDTDContext::nsDTDContext() : mStack(), mSkipped(0), mStyles(0) { + + MOZ_COUNT_CTOR(nsDTDContext); + #ifdef NS_DEBUG nsCRT::zero(mTags,sizeof(mTags)); #endif @@ -200,6 +213,9 @@ nsDTDContext::nsDTDContext() : mStack(), mSkipped(0), mStyles(0) { * @update gess9/10/98 */ nsDTDContext::~nsDTDContext() { + + MOZ_COUNT_DTOR(nsDTDContext); + PRInt32 theSize=mSkipped.GetSize(); if(theSize>0) { CTokenDeallocator theDeallocator; @@ -427,6 +443,9 @@ PRInt32 nsDTDContext::TokenCountAt(PRInt32 aID) * @param */ CTokenRecycler::CTokenRecycler() : nsITokenRecycler(),mEmpty("") { + + MOZ_COUNT_CTOR(CTokenRecycler); + int i=0; for(i=0;i") + } if(kNotFound==theBestAltPos) { const PRUnichar* theBuf=aString.GetUnicode(); findpos=aString.Length()-3; @@ -1884,7 +1888,7 @@ const nsParserError * CErrorToken::GetError(void) // Doctype decl token -CDoctypeDeclToken::CDoctypeDeclToken() : CHTMLToken(eHTMLTag_unknown) { +CDoctypeDeclToken::CDoctypeDeclToken(eHTMLTags aTag) : CHTMLToken(aTag) { } nsresult CDoctypeDeclToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode) { diff --git a/mozilla/htmlparser/src/nsHTMLTokens.h b/mozilla/htmlparser/src/nsHTMLTokens.h index b1982ea0073..98694a91ddc 100644 --- a/mozilla/htmlparser/src/nsHTMLTokens.h +++ b/mozilla/htmlparser/src/nsHTMLTokens.h @@ -387,7 +387,7 @@ protected: class CDoctypeDeclToken: public CHTMLToken { public: - CDoctypeDeclToken(); + CDoctypeDeclToken(eHTMLTags aTag=eHTMLTag_unknown); virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode); virtual const char* GetClassName(void); virtual PRInt32 GetTokenType(void); diff --git a/mozilla/htmlparser/src/nsScanner.cpp b/mozilla/htmlparser/src/nsScanner.cpp index 5f48379c797..eeed4a01946 100644 --- a/mozilla/htmlparser/src/nsScanner.cpp +++ b/mozilla/htmlparser/src/nsScanner.cpp @@ -37,6 +37,7 @@ const int kBufsize=1; const int kBufsize=64; #endif +MOZ_DECL_CTOR_COUNTER(nsScanner); /** * Use this constructor if you want i/o to be based on @@ -50,6 +51,8 @@ const int kBufsize=64; nsScanner::nsScanner(nsString& anHTMLString, const nsString& aCharset, nsCharsetSource aSource) : mBuffer(anHTMLString), mFilename(""), mUnicodeXferBuf("") { + MOZ_COUNT_CTOR(nsScanner); + mTotalRead=mBuffer.Length(); mIncremental=PR_FALSE; mOwnsStream=PR_FALSE; @@ -74,6 +77,8 @@ nsScanner::nsScanner(nsString& anHTMLString, const nsString& aCharset, nsCharset nsScanner::nsScanner(nsString& aFilename,PRBool aCreateStream, const nsString& aCharset, nsCharsetSource aSource) : mBuffer(""), mFilename(aFilename), mUnicodeXferBuf("") { + MOZ_COUNT_CTOR(nsScanner); + mIncremental=PR_TRUE; mOffset=0; mMarkPos=0; @@ -100,7 +105,9 @@ nsScanner::nsScanner(nsString& aFilename,PRBool aCreateStream, const nsString& a */ nsScanner::nsScanner(nsString& aFilename,nsInputStream& aStream,const nsString& aCharset, nsCharsetSource aSource) : mBuffer(""), mFilename(aFilename) , mUnicodeXferBuf("") -{ +{ + MOZ_COUNT_CTOR(nsScanner); + mIncremental=PR_FALSE; mOffset=0; mMarkPos=0; @@ -177,6 +184,9 @@ nsresult nsScanner::SetDocumentCharset(const nsString& aCharset , nsCharsetSourc * @return */ nsScanner::~nsScanner() { + + MOZ_COUNT_DTOR(nsScanner); + if(mInputStream) { mInputStream->close(); if(mOwnsStream) diff --git a/mozilla/htmlparser/src/nsTokenHandler.cpp b/mozilla/htmlparser/src/nsTokenHandler.cpp index 12b5e380ca0..36abdc0c8a9 100644 --- a/mozilla/htmlparser/src/nsTokenHandler.cpp +++ b/mozilla/htmlparser/src/nsTokenHandler.cpp @@ -30,6 +30,7 @@ #include "nsToken.h" #include "nsIParser.h" +MOZ_DECL_CTOR_COUNTER(CTokenHandler); /** * @@ -39,6 +40,9 @@ * @return */ CTokenHandler::CTokenHandler(dispatchFP aFP,PRInt32 aType){ + + MOZ_COUNT_CTOR(CTokenHandler); + mType=aType; mFP=aFP; } @@ -52,6 +56,7 @@ CTokenHandler::CTokenHandler(dispatchFP aFP,PRInt32 aType){ * @return */ CTokenHandler::~CTokenHandler(){ + MOZ_COUNT_DTOR(CTokenHandler); } diff --git a/mozilla/parser/htmlparser/src/CNavDTD.cpp b/mozilla/parser/htmlparser/src/CNavDTD.cpp index 31b50cca48c..be058a8224c 100644 --- a/mozilla/parser/htmlparser/src/CNavDTD.cpp +++ b/mozilla/parser/htmlparser/src/CNavDTD.cpp @@ -138,11 +138,9 @@ public: class CTagHandlerRegister { public: - CTagHandlerRegister() : mTagHandlerDeque(new CTagHandlerDeallocator()) { - } + CTagHandlerRegister(); - ~CTagHandlerRegister() { - } + ~CTagHandlerRegister(); void RegisterTagHandler(nsITagHandler *aTagHandler){ mTagHandlerDeque.Push(aTagHandler); @@ -161,6 +159,17 @@ public: CTagFinder mTagFinder; }; +MOZ_DECL_CTOR_COUNTER(CTagHandlerRegister); + +CTagHandlerRegister::CTagHandlerRegister() : mTagHandlerDeque(new CTagHandlerDeallocator()) +{ + MOZ_COUNT_CTOR(CTagHandlerRegister); +} + +CTagHandlerRegister::~CTagHandlerRegister() +{ + MOZ_COUNT_DTOR(CTagHandlerRegister); +} /************************************************************************ The CTagHandlerRegister for a CNavDTD. @@ -1243,9 +1252,6 @@ nsresult CNavDTD::HandleStartToken(CToken* aToken) { result=HandleDefaultStartToken(aToken,theChildTag,*theNode); break; - case eHTMLTag_userdefined: - break; //drop them on the floor for now... - case eHTMLTag_script: theHeadIsParent=(!mHasOpenBody); //intentionally fall through... mHasOpenScript=PR_TRUE; @@ -1783,7 +1789,8 @@ nsresult CNavDTD::CollectSkippedContent(nsCParserNode& aNode,PRInt32 &aCount) { theStr+=theTempStr; theRecycler->RecycleToken(theNextToken); } - + // Let's hope that this does not hamper the PERFORMANCE!! + mLineNumber += (theStr).CountChar(kNewLine); aNode.SetSkippedContent(theStr); return NS_OK; } diff --git a/mozilla/parser/htmlparser/src/CParserContext.cpp b/mozilla/parser/htmlparser/src/CParserContext.cpp index f7f284166ef..241c1051499 100644 --- a/mozilla/parser/htmlparser/src/CParserContext.cpp +++ b/mozilla/parser/htmlparser/src/CParserContext.cpp @@ -20,7 +20,7 @@ #include "CParserContext.h" #include "nsToken.h" - +MOZ_DECL_CTOR_COUNTER(CParserContext); /** * Your friendly little constructor. Ok, it's not the friendly, but the only guy * using it is the parser. @@ -33,6 +33,8 @@ CParserContext::CParserContext(nsScanner* aScanner,void* aKey,nsIStreamObserver* mSourceType() //,mTokenDeque(gTokenDeallocator) { + MOZ_COUNT_CTOR(CParserContext); + mScanner=aScanner; mKey=aKey; mPrevContext=0; @@ -57,6 +59,8 @@ CParserContext::CParserContext(nsScanner* aScanner,void* aKey,nsIStreamObserver* */ CParserContext::~CParserContext(){ + MOZ_COUNT_DTOR(CParserContext); + if(mScanner) delete mScanner; diff --git a/mozilla/parser/htmlparser/src/nsDTDUtils.cpp b/mozilla/parser/htmlparser/src/nsDTDUtils.cpp index 2b4b76395e3..a23c4b52376 100644 --- a/mozilla/parser/htmlparser/src/nsDTDUtils.cpp +++ b/mozilla/parser/htmlparser/src/nsDTDUtils.cpp @@ -24,6 +24,10 @@ #include "nsIObserverService.h" #include "nsIServiceManager.h" +MOZ_DECL_CTOR_COUNTER(nsEntryStack); +MOZ_DECL_CTOR_COUNTER(nsDTDContext); +MOZ_DECL_CTOR_COUNTER(CTokenRecycler); +MOZ_DECL_CTOR_COUNTER(CObserverService); /*************************************************************** First, define the tagstack class @@ -36,6 +40,9 @@ * @update gess 04/22/99 */ nsEntryStack::nsEntryStack() { + + MOZ_COUNT_CTOR(nsEntryStack); + mCapacity=0; mCount=0; mEntries=0; @@ -47,6 +54,9 @@ nsEntryStack::nsEntryStack() { * @update gess 04/22/99 */ nsEntryStack::~nsEntryStack() { + + MOZ_COUNT_DTOR(nsEntryStack); + if(mEntries) delete [] mEntries; mCount=mCapacity=0; @@ -189,6 +199,9 @@ PRInt32 nsEntryStack::GetTopmostIndexOf(eHTMLTags aTag) const { * @update gess9/10/98 */ nsDTDContext::nsDTDContext() : mStack(), mSkipped(0), mStyles(0) { + + MOZ_COUNT_CTOR(nsDTDContext); + #ifdef NS_DEBUG nsCRT::zero(mTags,sizeof(mTags)); #endif @@ -200,6 +213,9 @@ nsDTDContext::nsDTDContext() : mStack(), mSkipped(0), mStyles(0) { * @update gess9/10/98 */ nsDTDContext::~nsDTDContext() { + + MOZ_COUNT_DTOR(nsDTDContext); + PRInt32 theSize=mSkipped.GetSize(); if(theSize>0) { CTokenDeallocator theDeallocator; @@ -427,6 +443,9 @@ PRInt32 nsDTDContext::TokenCountAt(PRInt32 aID) * @param */ CTokenRecycler::CTokenRecycler() : nsITokenRecycler(),mEmpty("") { + + MOZ_COUNT_CTOR(CTokenRecycler); + int i=0; for(i=0;i") + } if(kNotFound==theBestAltPos) { const PRUnichar* theBuf=aString.GetUnicode(); findpos=aString.Length()-3; @@ -1884,7 +1888,7 @@ const nsParserError * CErrorToken::GetError(void) // Doctype decl token -CDoctypeDeclToken::CDoctypeDeclToken() : CHTMLToken(eHTMLTag_unknown) { +CDoctypeDeclToken::CDoctypeDeclToken(eHTMLTags aTag) : CHTMLToken(aTag) { } nsresult CDoctypeDeclToken::Consume(PRUnichar aChar, nsScanner& aScanner,PRInt32 aMode) { diff --git a/mozilla/parser/htmlparser/src/nsHTMLTokens.h b/mozilla/parser/htmlparser/src/nsHTMLTokens.h index b1982ea0073..98694a91ddc 100644 --- a/mozilla/parser/htmlparser/src/nsHTMLTokens.h +++ b/mozilla/parser/htmlparser/src/nsHTMLTokens.h @@ -387,7 +387,7 @@ protected: class CDoctypeDeclToken: public CHTMLToken { public: - CDoctypeDeclToken(); + CDoctypeDeclToken(eHTMLTags aTag=eHTMLTag_unknown); virtual nsresult Consume(PRUnichar aChar,nsScanner& aScanner,PRInt32 aMode); virtual const char* GetClassName(void); virtual PRInt32 GetTokenType(void); diff --git a/mozilla/parser/htmlparser/src/nsScanner.cpp b/mozilla/parser/htmlparser/src/nsScanner.cpp index 5f48379c797..eeed4a01946 100644 --- a/mozilla/parser/htmlparser/src/nsScanner.cpp +++ b/mozilla/parser/htmlparser/src/nsScanner.cpp @@ -37,6 +37,7 @@ const int kBufsize=1; const int kBufsize=64; #endif +MOZ_DECL_CTOR_COUNTER(nsScanner); /** * Use this constructor if you want i/o to be based on @@ -50,6 +51,8 @@ const int kBufsize=64; nsScanner::nsScanner(nsString& anHTMLString, const nsString& aCharset, nsCharsetSource aSource) : mBuffer(anHTMLString), mFilename(""), mUnicodeXferBuf("") { + MOZ_COUNT_CTOR(nsScanner); + mTotalRead=mBuffer.Length(); mIncremental=PR_FALSE; mOwnsStream=PR_FALSE; @@ -74,6 +77,8 @@ nsScanner::nsScanner(nsString& anHTMLString, const nsString& aCharset, nsCharset nsScanner::nsScanner(nsString& aFilename,PRBool aCreateStream, const nsString& aCharset, nsCharsetSource aSource) : mBuffer(""), mFilename(aFilename), mUnicodeXferBuf("") { + MOZ_COUNT_CTOR(nsScanner); + mIncremental=PR_TRUE; mOffset=0; mMarkPos=0; @@ -100,7 +105,9 @@ nsScanner::nsScanner(nsString& aFilename,PRBool aCreateStream, const nsString& a */ nsScanner::nsScanner(nsString& aFilename,nsInputStream& aStream,const nsString& aCharset, nsCharsetSource aSource) : mBuffer(""), mFilename(aFilename) , mUnicodeXferBuf("") -{ +{ + MOZ_COUNT_CTOR(nsScanner); + mIncremental=PR_FALSE; mOffset=0; mMarkPos=0; @@ -177,6 +184,9 @@ nsresult nsScanner::SetDocumentCharset(const nsString& aCharset , nsCharsetSourc * @return */ nsScanner::~nsScanner() { + + MOZ_COUNT_DTOR(nsScanner); + if(mInputStream) { mInputStream->close(); if(mOwnsStream) diff --git a/mozilla/parser/htmlparser/src/nsTokenHandler.cpp b/mozilla/parser/htmlparser/src/nsTokenHandler.cpp index 12b5e380ca0..36abdc0c8a9 100644 --- a/mozilla/parser/htmlparser/src/nsTokenHandler.cpp +++ b/mozilla/parser/htmlparser/src/nsTokenHandler.cpp @@ -30,6 +30,7 @@ #include "nsToken.h" #include "nsIParser.h" +MOZ_DECL_CTOR_COUNTER(CTokenHandler); /** * @@ -39,6 +40,9 @@ * @return */ CTokenHandler::CTokenHandler(dispatchFP aFP,PRInt32 aType){ + + MOZ_COUNT_CTOR(CTokenHandler); + mType=aType; mFP=aFP; } @@ -52,6 +56,7 @@ CTokenHandler::CTokenHandler(dispatchFP aFP,PRInt32 aType){ * @return */ CTokenHandler::~CTokenHandler(){ + MOZ_COUNT_DTOR(CTokenHandler); }