From 3cb0e1a7ca6ea356a6072c50bc159470aee92ff3 Mon Sep 17 00:00:00 2001 From: Henri Sivonen Date: Thu, 12 Feb 2009 10:30:41 +0200 Subject: [PATCH] Count CTOR/DTOR in HTML5 parser; remove debug NS_WARNINGS --- content/html/parser/src/nsHtml5AttributeName.cpp | 3 +++ content/html/parser/src/nsHtml5AttributeName.h | 1 + content/html/parser/src/nsHtml5ElementName.cpp | 4 ++++ content/html/parser/src/nsHtml5ElementName.h | 1 + content/html/parser/src/nsHtml5HtmlAttributes.cpp | 3 +++ content/html/parser/src/nsHtml5HtmlAttributes.h | 1 + content/html/parser/src/nsHtml5MetaScanner.cpp | 1 + content/html/parser/src/nsHtml5MetaScanner.h | 1 + content/html/parser/src/nsHtml5MetaScannerCppSupplement.h | 3 +++ content/html/parser/src/nsHtml5Parser.cpp | 3 --- content/html/parser/src/nsHtml5Portability.h | 1 + content/html/parser/src/nsHtml5StackNode.cpp | 6 ++++++ content/html/parser/src/nsHtml5StackNode.h | 1 + content/html/parser/src/nsHtml5Tokenizer.cpp | 6 ++++++ content/html/parser/src/nsHtml5Tokenizer.h | 1 + content/html/parser/src/nsHtml5TreeBuilder.cpp | 5 +++++ content/html/parser/src/nsHtml5TreeBuilder.h | 1 + content/html/parser/src/nsHtml5TreeBuilderCppSupplement.h | 3 +++ content/html/parser/src/nsHtml5UTF16Buffer.cpp | 2 ++ content/html/parser/src/nsHtml5UTF16Buffer.h | 1 + content/html/parser/src/nsHtml5UTF16BufferCppSupplement.h | 5 +++++ 21 files changed, 50 insertions(+), 3 deletions(-) diff --git a/content/html/parser/src/nsHtml5AttributeName.cpp b/content/html/parser/src/nsHtml5AttributeName.cpp index 0884934c841..e281439aa2d 100644 --- a/content/html/parser/src/nsHtml5AttributeName.cpp +++ b/content/html/parser/src/nsHtml5AttributeName.cpp @@ -33,6 +33,7 @@ #include "nsINameSpaceManager.h" #include "nsIContent.h" #include "nsIDocument.h" +#include "nsTraceRefcnt.h" #include "jArray.h" #include "nsHtml5DocumentMode.h" #include "nsHtml5ArrayCopy.h" @@ -135,6 +136,7 @@ nsHtml5AttributeName::nsHtml5AttributeName(PRInt32* uri, nsIAtom** local, nsIAto local(local), prefix(prefix) { + MOZ_COUNT_CTOR(nsHtml5AttributeName); } nsHtml5AttributeName* @@ -151,6 +153,7 @@ nsHtml5AttributeName::release() nsHtml5AttributeName::~nsHtml5AttributeName() { + MOZ_COUNT_DTOR(nsHtml5AttributeName); nsHtml5Portability::releaseLocal(local[0]); delete[] local; } diff --git a/content/html/parser/src/nsHtml5AttributeName.h b/content/html/parser/src/nsHtml5AttributeName.h index 00e72c64614..c8f643d5e05 100644 --- a/content/html/parser/src/nsHtml5AttributeName.h +++ b/content/html/parser/src/nsHtml5AttributeName.h @@ -34,6 +34,7 @@ #include "nsINameSpaceManager.h" #include "nsIContent.h" #include "nsIDocument.h" +#include "nsTraceRefcnt.h" #include "jArray.h" #include "nsHtml5DocumentMode.h" #include "nsHtml5ArrayCopy.h" diff --git a/content/html/parser/src/nsHtml5ElementName.cpp b/content/html/parser/src/nsHtml5ElementName.cpp index 91d715e0fff..a4aac3ff674 100644 --- a/content/html/parser/src/nsHtml5ElementName.cpp +++ b/content/html/parser/src/nsHtml5ElementName.cpp @@ -33,6 +33,7 @@ #include "nsINameSpaceManager.h" #include "nsIContent.h" #include "nsIDocument.h" +#include "nsTraceRefcnt.h" #include "jArray.h" #include "nsHtml5DocumentMode.h" #include "nsHtml5ArrayCopy.h" @@ -95,6 +96,7 @@ nsHtml5ElementName::nsHtml5ElementName(nsIAtom* name, nsIAtom* camelCaseName, PR scoping(scoping), fosterParenting(fosterParenting) { + MOZ_COUNT_CTOR(nsHtml5ElementName); } @@ -106,6 +108,7 @@ nsHtml5ElementName::nsHtml5ElementName(nsIAtom* name) scoping(PR_FALSE), fosterParenting(PR_FALSE) { + MOZ_COUNT_CTOR(nsHtml5ElementName); } void @@ -116,6 +119,7 @@ nsHtml5ElementName::release() nsHtml5ElementName::~nsHtml5ElementName() { + MOZ_COUNT_DTOR(nsHtml5ElementName); nsHtml5Portability::releaseLocal(name); } diff --git a/content/html/parser/src/nsHtml5ElementName.h b/content/html/parser/src/nsHtml5ElementName.h index 483f398e890..56bb1297697 100644 --- a/content/html/parser/src/nsHtml5ElementName.h +++ b/content/html/parser/src/nsHtml5ElementName.h @@ -34,6 +34,7 @@ #include "nsINameSpaceManager.h" #include "nsIContent.h" #include "nsIDocument.h" +#include "nsTraceRefcnt.h" #include "jArray.h" #include "nsHtml5DocumentMode.h" #include "nsHtml5ArrayCopy.h" diff --git a/content/html/parser/src/nsHtml5HtmlAttributes.cpp b/content/html/parser/src/nsHtml5HtmlAttributes.cpp index 58cddcf5bf3..bd51a5b61b3 100644 --- a/content/html/parser/src/nsHtml5HtmlAttributes.cpp +++ b/content/html/parser/src/nsHtml5HtmlAttributes.cpp @@ -34,6 +34,7 @@ #include "nsINameSpaceManager.h" #include "nsIContent.h" #include "nsIDocument.h" +#include "nsTraceRefcnt.h" #include "jArray.h" #include "nsHtml5DocumentMode.h" #include "nsHtml5ArrayCopy.h" @@ -61,11 +62,13 @@ nsHtml5HtmlAttributes::nsHtml5HtmlAttributes(PRInt32 mode) names(jArray(5)), values(jArray(5)) { + MOZ_COUNT_CTOR(nsHtml5HtmlAttributes); } nsHtml5HtmlAttributes::~nsHtml5HtmlAttributes() { + MOZ_COUNT_DTOR(nsHtml5HtmlAttributes); clear(0); names.release(); values.release(); diff --git a/content/html/parser/src/nsHtml5HtmlAttributes.h b/content/html/parser/src/nsHtml5HtmlAttributes.h index eb9b00f8993..8d8ff45946c 100644 --- a/content/html/parser/src/nsHtml5HtmlAttributes.h +++ b/content/html/parser/src/nsHtml5HtmlAttributes.h @@ -35,6 +35,7 @@ #include "nsINameSpaceManager.h" #include "nsIContent.h" #include "nsIDocument.h" +#include "nsTraceRefcnt.h" #include "jArray.h" #include "nsHtml5DocumentMode.h" #include "nsHtml5ArrayCopy.h" diff --git a/content/html/parser/src/nsHtml5MetaScanner.cpp b/content/html/parser/src/nsHtml5MetaScanner.cpp index 9bdf48d47e0..42c321ee381 100644 --- a/content/html/parser/src/nsHtml5MetaScanner.cpp +++ b/content/html/parser/src/nsHtml5MetaScanner.cpp @@ -34,6 +34,7 @@ #include "nsINameSpaceManager.h" #include "nsIContent.h" #include "nsIDocument.h" +#include "nsTraceRefcnt.h" #include "jArray.h" #include "nsHtml5DocumentMode.h" #include "nsHtml5ArrayCopy.h" diff --git a/content/html/parser/src/nsHtml5MetaScanner.h b/content/html/parser/src/nsHtml5MetaScanner.h index 93574db3342..7a2c796fc53 100644 --- a/content/html/parser/src/nsHtml5MetaScanner.h +++ b/content/html/parser/src/nsHtml5MetaScanner.h @@ -35,6 +35,7 @@ #include "nsINameSpaceManager.h" #include "nsIContent.h" #include "nsIDocument.h" +#include "nsTraceRefcnt.h" #include "jArray.h" #include "nsHtml5DocumentMode.h" #include "nsHtml5ArrayCopy.h" diff --git a/content/html/parser/src/nsHtml5MetaScannerCppSupplement.h b/content/html/parser/src/nsHtml5MetaScannerCppSupplement.h index f81d0d1b93b..df27fb009d5 100644 --- a/content/html/parser/src/nsHtml5MetaScannerCppSupplement.h +++ b/content/html/parser/src/nsHtml5MetaScannerCppSupplement.h @@ -39,6 +39,7 @@ #include "nsServiceManagerUtils.h" #include "nsICharsetAlias.h" #include "nsEncoderDecoderUtils.h" +#include "nsTraceRefcnt.h" static NS_DEFINE_CID(kCharsetAliasCID, NS_CHARSETALIAS_CID); @@ -51,10 +52,12 @@ nsHtml5MetaScanner::nsHtml5MetaScanner() strBufLen(0), strBuf(jArray(36)) { + MOZ_COUNT_CTOR(nsHtml5MetaScanner); } nsHtml5MetaScanner::~nsHtml5MetaScanner() { + MOZ_COUNT_DTOR(nsHtml5MetaScanner); strBuf.release(); } diff --git a/content/html/parser/src/nsHtml5Parser.cpp b/content/html/parser/src/nsHtml5Parser.cpp index 821750ecb1a..eee71fe0b07 100644 --- a/content/html/parser/src/nsHtml5Parser.cpp +++ b/content/html/parser/src/nsHtml5Parser.cpp @@ -578,10 +578,8 @@ ParserWriteFunc(nsIInputStream* aInStream, { nsHtml5Parser* parser = static_cast (aHtml5Parser); if (parser->HasDecoder()) { - NS_WARNING("not siffing\n"); return parser->WriteStreamBytes((const PRUint8*)aFromSegment, aCount, aWriteCount); } else { - NS_WARNING("sniffing"); return parser->SniffStreamBytes((const PRUint8*)aFromSegment, aCount, aWriteCount); } } @@ -593,7 +591,6 @@ nsHtml5Parser::OnDataAvailable(nsIRequest* aRequest, PRUint32 aSourceOffset, PRUint32 aLength) { - NS_WARNING("OnDataAvailable FFFF\n"); NS_PRECONDITION((eOnStart == mStreamListenerState || eOnDataAvail == mStreamListenerState), "Error: OnStartRequest() must be called before OnDataAvailable()"); diff --git a/content/html/parser/src/nsHtml5Portability.h b/content/html/parser/src/nsHtml5Portability.h index 5f42c8248ae..b3da1330c8d 100644 --- a/content/html/parser/src/nsHtml5Portability.h +++ b/content/html/parser/src/nsHtml5Portability.h @@ -34,6 +34,7 @@ #include "nsINameSpaceManager.h" #include "nsIContent.h" #include "nsIDocument.h" +#include "nsTraceRefcnt.h" #include "jArray.h" #include "nsHtml5DocumentMode.h" #include "nsHtml5ArrayCopy.h" diff --git a/content/html/parser/src/nsHtml5StackNode.cpp b/content/html/parser/src/nsHtml5StackNode.cpp index fcd669964a6..b0844fce281 100644 --- a/content/html/parser/src/nsHtml5StackNode.cpp +++ b/content/html/parser/src/nsHtml5StackNode.cpp @@ -34,6 +34,7 @@ #include "nsINameSpaceManager.h" #include "nsIContent.h" #include "nsIDocument.h" +#include "nsTraceRefcnt.h" #include "jArray.h" #include "nsHtml5DocumentMode.h" #include "nsHtml5ArrayCopy.h" @@ -66,6 +67,7 @@ nsHtml5StackNode::nsHtml5StackNode(PRInt32 group, PRInt32 ns, nsIAtom* name, nsI fosterParenting(fosterParenting), tainted(PR_FALSE) { + MOZ_COUNT_CTOR(nsHtml5StackNode); nsHtml5Portability::retainLocal(name); nsHtml5Portability::retainLocal(popName); nsHtml5Portability::retainElement(node); @@ -83,6 +85,7 @@ nsHtml5StackNode::nsHtml5StackNode(PRInt32 ns, nsHtml5ElementName* elementName, fosterParenting(elementName->fosterParenting), tainted(PR_FALSE) { + MOZ_COUNT_CTOR(nsHtml5StackNode); nsHtml5Portability::retainLocal(name); nsHtml5Portability::retainLocal(popName); nsHtml5Portability::retainElement(node); @@ -100,6 +103,7 @@ nsHtml5StackNode::nsHtml5StackNode(PRInt32 ns, nsHtml5ElementName* elementName, fosterParenting(elementName->fosterParenting), tainted(PR_FALSE) { + MOZ_COUNT_CTOR(nsHtml5StackNode); nsHtml5Portability::retainLocal(name); nsHtml5Portability::retainLocal(popName); nsHtml5Portability::retainElement(node); @@ -117,6 +121,7 @@ nsHtml5StackNode::nsHtml5StackNode(PRInt32 ns, nsHtml5ElementName* elementName, fosterParenting(PR_FALSE), tainted(PR_FALSE) { + MOZ_COUNT_CTOR(nsHtml5StackNode); nsHtml5Portability::retainLocal(name); nsHtml5Portability::retainLocal(popName); nsHtml5Portability::retainElement(node); @@ -125,6 +130,7 @@ nsHtml5StackNode::nsHtml5StackNode(PRInt32 ns, nsHtml5ElementName* elementName, nsHtml5StackNode::~nsHtml5StackNode() { + MOZ_COUNT_DTOR(nsHtml5StackNode); nsHtml5Portability::releaseLocal(name); nsHtml5Portability::releaseLocal(popName); nsHtml5Portability::releaseElement(node); diff --git a/content/html/parser/src/nsHtml5StackNode.h b/content/html/parser/src/nsHtml5StackNode.h index fdb86b5036d..e1697e642b3 100644 --- a/content/html/parser/src/nsHtml5StackNode.h +++ b/content/html/parser/src/nsHtml5StackNode.h @@ -35,6 +35,7 @@ #include "nsINameSpaceManager.h" #include "nsIContent.h" #include "nsIDocument.h" +#include "nsTraceRefcnt.h" #include "jArray.h" #include "nsHtml5DocumentMode.h" #include "nsHtml5ArrayCopy.h" diff --git a/content/html/parser/src/nsHtml5Tokenizer.cpp b/content/html/parser/src/nsHtml5Tokenizer.cpp index 16b7de9395e..b7280ba5acb 100644 --- a/content/html/parser/src/nsHtml5Tokenizer.cpp +++ b/content/html/parser/src/nsHtml5Tokenizer.cpp @@ -36,6 +36,7 @@ #include "nsINameSpaceManager.h" #include "nsIContent.h" #include "nsIDocument.h" +#include "nsTraceRefcnt.h" #include "jArray.h" #include "nsHtml5DocumentMode.h" #include "nsHtml5ArrayCopy.h" @@ -63,6 +64,7 @@ nsHtml5Tokenizer::nsHtml5Tokenizer(nsHtml5TreeBuilder* tokenHandler, nsHtml5Pars bmpChar(jArray(1)), astralChar(jArray(2)) { + MOZ_COUNT_CTOR(nsHtml5Tokenizer); } void @@ -75,6 +77,7 @@ nsHtml5Tokenizer::initLocation(nsString* newPublicId, nsString* newSystemId) nsHtml5Tokenizer::~nsHtml5Tokenizer() { + MOZ_COUNT_DTOR(nsHtml5Tokenizer); bmpChar.release(); astralChar.release(); } @@ -2520,6 +2523,9 @@ nsHtml5Tokenizer::handleNcrValue(PRInt32 returnState) emitOrAppendOne(nsHtml5Tokenizer::REPLACEMENT_CHARACTER, returnState); } else if (isNonCharacter(value)) { + emitOrAppendOne(nsHtml5Tokenizer::REPLACEMENT_CHARACTER, returnState); + } else if (value >= 0xFDD0 && value <= 0xFDEF) { + emitOrAppendOne(nsHtml5Tokenizer::REPLACEMENT_CHARACTER, returnState); } else if (value <= 0xFFFF) { PRUnichar ch = (PRUnichar) value; diff --git a/content/html/parser/src/nsHtml5Tokenizer.h b/content/html/parser/src/nsHtml5Tokenizer.h index 3cbcd801c88..4cc4e916211 100644 --- a/content/html/parser/src/nsHtml5Tokenizer.h +++ b/content/html/parser/src/nsHtml5Tokenizer.h @@ -37,6 +37,7 @@ #include "nsINameSpaceManager.h" #include "nsIContent.h" #include "nsIDocument.h" +#include "nsTraceRefcnt.h" #include "jArray.h" #include "nsHtml5DocumentMode.h" #include "nsHtml5ArrayCopy.h" diff --git a/content/html/parser/src/nsHtml5TreeBuilder.cpp b/content/html/parser/src/nsHtml5TreeBuilder.cpp index bc272e5145d..2407f8db905 100644 --- a/content/html/parser/src/nsHtml5TreeBuilder.cpp +++ b/content/html/parser/src/nsHtml5TreeBuilder.cpp @@ -36,6 +36,7 @@ #include "nsINameSpaceManager.h" #include "nsIContent.h" #include "nsIDocument.h" +#include "nsTraceRefcnt.h" #include "jArray.h" #include "nsHtml5DocumentMode.h" #include "nsHtml5ArrayCopy.h" @@ -519,6 +520,10 @@ nsHtml5TreeBuilder::eof() void nsHtml5TreeBuilder::endTokenization() { + nsHtml5Portability::releaseElement(formPointer); + formPointer = nsnull; + nsHtml5Portability::releaseElement(headPointer); + headPointer = nsnull; while (currentPtr > -1) { stack[currentPtr]->release(); currentPtr--; diff --git a/content/html/parser/src/nsHtml5TreeBuilder.h b/content/html/parser/src/nsHtml5TreeBuilder.h index ca0efaa2032..362433290e2 100644 --- a/content/html/parser/src/nsHtml5TreeBuilder.h +++ b/content/html/parser/src/nsHtml5TreeBuilder.h @@ -37,6 +37,7 @@ #include "nsINameSpaceManager.h" #include "nsIContent.h" #include "nsIDocument.h" +#include "nsTraceRefcnt.h" #include "jArray.h" #include "nsHtml5DocumentMode.h" #include "nsHtml5ArrayCopy.h" diff --git a/content/html/parser/src/nsHtml5TreeBuilderCppSupplement.h b/content/html/parser/src/nsHtml5TreeBuilderCppSupplement.h index e010cfbb78f..99ac3f049a0 100644 --- a/content/html/parser/src/nsHtml5TreeBuilderCppSupplement.h +++ b/content/html/parser/src/nsHtml5TreeBuilderCppSupplement.h @@ -51,6 +51,7 @@ #include "nsIFormControl.h" #include "nsNodeUtils.h" #include "nsIStyleSheetLinkingElement.h" +#include "nsTraceRefcnt.h" // this really should be autogenerated... jArray nsHtml5TreeBuilder::ISINDEX_PROMPT = jArray(); @@ -63,10 +64,12 @@ nsHtml5TreeBuilder::nsHtml5TreeBuilder(nsHtml5Parser* aParser) formPointer(nsnull), headPointer(nsnull) { + MOZ_COUNT_CTOR(nsHtml5TreeBuilder); } nsHtml5TreeBuilder::~nsHtml5TreeBuilder() { + MOZ_COUNT_DTOR(nsHtml5TreeBuilder); delete MARKER; } diff --git a/content/html/parser/src/nsHtml5UTF16Buffer.cpp b/content/html/parser/src/nsHtml5UTF16Buffer.cpp index f4d17e668ba..6e46dbfbda8 100644 --- a/content/html/parser/src/nsHtml5UTF16Buffer.cpp +++ b/content/html/parser/src/nsHtml5UTF16Buffer.cpp @@ -33,6 +33,7 @@ #include "nsINameSpaceManager.h" #include "nsIContent.h" #include "nsIDocument.h" +#include "nsTraceRefcnt.h" #include "jArray.h" #include "nsHtml5DocumentMode.h" #include "nsHtml5ArrayCopy.h" @@ -59,6 +60,7 @@ nsHtml5UTF16Buffer::nsHtml5UTF16Buffer(PRUnichar* buffer, PRInt32 start, PRInt32 start(start), end(end) { + MOZ_COUNT_CTOR(nsHtml5UTF16Buffer); } PRInt32 diff --git a/content/html/parser/src/nsHtml5UTF16Buffer.h b/content/html/parser/src/nsHtml5UTF16Buffer.h index c6f69b4210a..7d8e4aacb78 100644 --- a/content/html/parser/src/nsHtml5UTF16Buffer.h +++ b/content/html/parser/src/nsHtml5UTF16Buffer.h @@ -34,6 +34,7 @@ #include "nsINameSpaceManager.h" #include "nsIContent.h" #include "nsIDocument.h" +#include "nsTraceRefcnt.h" #include "jArray.h" #include "nsHtml5DocumentMode.h" #include "nsHtml5ArrayCopy.h" diff --git a/content/html/parser/src/nsHtml5UTF16BufferCppSupplement.h b/content/html/parser/src/nsHtml5UTF16BufferCppSupplement.h index aeaa8fc544a..36644c40162 100644 --- a/content/html/parser/src/nsHtml5UTF16BufferCppSupplement.h +++ b/content/html/parser/src/nsHtml5UTF16BufferCppSupplement.h @@ -35,6 +35,8 @@ * * ***** END LICENSE BLOCK ***** */ +#include "nsTraceRefcnt.h" + nsHtml5UTF16Buffer::nsHtml5UTF16Buffer(PRInt32 size) : buffer(new PRUnichar[size]), start(0), @@ -42,6 +44,7 @@ nsHtml5UTF16Buffer::nsHtml5UTF16Buffer(PRInt32 size) next(nsnull), key(nsnull) { + MOZ_COUNT_CTOR(nsHtml5UTF16Buffer); } nsHtml5UTF16Buffer::nsHtml5UTF16Buffer(void* key) @@ -51,9 +54,11 @@ nsHtml5UTF16Buffer::nsHtml5UTF16Buffer(void* key) next(nsnull), key(key) { + MOZ_COUNT_CTOR(nsHtml5UTF16Buffer); } nsHtml5UTF16Buffer::~nsHtml5UTF16Buffer() { + MOZ_COUNT_DTOR(nsHtml5UTF16Buffer); delete[] buffer; }