Count CTOR/DTOR in HTML5 parser; remove debug NS_WARNINGS

This commit is contained in:
Henri Sivonen 2009-02-12 10:30:41 +02:00
parent c26597853c
commit 3cb0e1a7ca
21 changed files with 50 additions and 3 deletions

View File

@ -33,6 +33,7 @@
#include "nsINameSpaceManager.h" #include "nsINameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5DocumentMode.h" #include "nsHtml5DocumentMode.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"
@ -135,6 +136,7 @@ nsHtml5AttributeName::nsHtml5AttributeName(PRInt32* uri, nsIAtom** local, nsIAto
local(local), local(local),
prefix(prefix) prefix(prefix)
{ {
MOZ_COUNT_CTOR(nsHtml5AttributeName);
} }
nsHtml5AttributeName* nsHtml5AttributeName*
@ -151,6 +153,7 @@ nsHtml5AttributeName::release()
nsHtml5AttributeName::~nsHtml5AttributeName() nsHtml5AttributeName::~nsHtml5AttributeName()
{ {
MOZ_COUNT_DTOR(nsHtml5AttributeName);
nsHtml5Portability::releaseLocal(local[0]); nsHtml5Portability::releaseLocal(local[0]);
delete[] local; delete[] local;
} }

View File

@ -34,6 +34,7 @@
#include "nsINameSpaceManager.h" #include "nsINameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5DocumentMode.h" #include "nsHtml5DocumentMode.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"

View File

@ -33,6 +33,7 @@
#include "nsINameSpaceManager.h" #include "nsINameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5DocumentMode.h" #include "nsHtml5DocumentMode.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"
@ -95,6 +96,7 @@ nsHtml5ElementName::nsHtml5ElementName(nsIAtom* name, nsIAtom* camelCaseName, PR
scoping(scoping), scoping(scoping),
fosterParenting(fosterParenting) fosterParenting(fosterParenting)
{ {
MOZ_COUNT_CTOR(nsHtml5ElementName);
} }
@ -106,6 +108,7 @@ nsHtml5ElementName::nsHtml5ElementName(nsIAtom* name)
scoping(PR_FALSE), scoping(PR_FALSE),
fosterParenting(PR_FALSE) fosterParenting(PR_FALSE)
{ {
MOZ_COUNT_CTOR(nsHtml5ElementName);
} }
void void
@ -116,6 +119,7 @@ nsHtml5ElementName::release()
nsHtml5ElementName::~nsHtml5ElementName() nsHtml5ElementName::~nsHtml5ElementName()
{ {
MOZ_COUNT_DTOR(nsHtml5ElementName);
nsHtml5Portability::releaseLocal(name); nsHtml5Portability::releaseLocal(name);
} }

View File

@ -34,6 +34,7 @@
#include "nsINameSpaceManager.h" #include "nsINameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5DocumentMode.h" #include "nsHtml5DocumentMode.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"

View File

@ -34,6 +34,7 @@
#include "nsINameSpaceManager.h" #include "nsINameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5DocumentMode.h" #include "nsHtml5DocumentMode.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"
@ -61,11 +62,13 @@ nsHtml5HtmlAttributes::nsHtml5HtmlAttributes(PRInt32 mode)
names(jArray<nsHtml5AttributeName*,PRInt32>(5)), names(jArray<nsHtml5AttributeName*,PRInt32>(5)),
values(jArray<nsString*,PRInt32>(5)) values(jArray<nsString*,PRInt32>(5))
{ {
MOZ_COUNT_CTOR(nsHtml5HtmlAttributes);
} }
nsHtml5HtmlAttributes::~nsHtml5HtmlAttributes() nsHtml5HtmlAttributes::~nsHtml5HtmlAttributes()
{ {
MOZ_COUNT_DTOR(nsHtml5HtmlAttributes);
clear(0); clear(0);
names.release(); names.release();
values.release(); values.release();

View File

@ -35,6 +35,7 @@
#include "nsINameSpaceManager.h" #include "nsINameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5DocumentMode.h" #include "nsHtml5DocumentMode.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"

View File

@ -34,6 +34,7 @@
#include "nsINameSpaceManager.h" #include "nsINameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5DocumentMode.h" #include "nsHtml5DocumentMode.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"

View File

@ -35,6 +35,7 @@
#include "nsINameSpaceManager.h" #include "nsINameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5DocumentMode.h" #include "nsHtml5DocumentMode.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"

View File

@ -39,6 +39,7 @@
#include "nsServiceManagerUtils.h" #include "nsServiceManagerUtils.h"
#include "nsICharsetAlias.h" #include "nsICharsetAlias.h"
#include "nsEncoderDecoderUtils.h" #include "nsEncoderDecoderUtils.h"
#include "nsTraceRefcnt.h"
static NS_DEFINE_CID(kCharsetAliasCID, NS_CHARSETALIAS_CID); static NS_DEFINE_CID(kCharsetAliasCID, NS_CHARSETALIAS_CID);
@ -51,10 +52,12 @@ nsHtml5MetaScanner::nsHtml5MetaScanner()
strBufLen(0), strBufLen(0),
strBuf(jArray<PRUnichar,PRInt32>(36)) strBuf(jArray<PRUnichar,PRInt32>(36))
{ {
MOZ_COUNT_CTOR(nsHtml5MetaScanner);
} }
nsHtml5MetaScanner::~nsHtml5MetaScanner() nsHtml5MetaScanner::~nsHtml5MetaScanner()
{ {
MOZ_COUNT_DTOR(nsHtml5MetaScanner);
strBuf.release(); strBuf.release();
} }

View File

@ -578,10 +578,8 @@ ParserWriteFunc(nsIInputStream* aInStream,
{ {
nsHtml5Parser* parser = static_cast<nsHtml5Parser*> (aHtml5Parser); nsHtml5Parser* parser = static_cast<nsHtml5Parser*> (aHtml5Parser);
if (parser->HasDecoder()) { if (parser->HasDecoder()) {
NS_WARNING("not siffing\n");
return parser->WriteStreamBytes((const PRUint8*)aFromSegment, aCount, aWriteCount); return parser->WriteStreamBytes((const PRUint8*)aFromSegment, aCount, aWriteCount);
} else { } else {
NS_WARNING("sniffing");
return parser->SniffStreamBytes((const PRUint8*)aFromSegment, aCount, aWriteCount); return parser->SniffStreamBytes((const PRUint8*)aFromSegment, aCount, aWriteCount);
} }
} }
@ -593,7 +591,6 @@ nsHtml5Parser::OnDataAvailable(nsIRequest* aRequest,
PRUint32 aSourceOffset, PRUint32 aSourceOffset,
PRUint32 aLength) PRUint32 aLength)
{ {
NS_WARNING("OnDataAvailable FFFF\n");
NS_PRECONDITION((eOnStart == mStreamListenerState || NS_PRECONDITION((eOnStart == mStreamListenerState ||
eOnDataAvail == mStreamListenerState), eOnDataAvail == mStreamListenerState),
"Error: OnStartRequest() must be called before OnDataAvailable()"); "Error: OnStartRequest() must be called before OnDataAvailable()");

View File

@ -34,6 +34,7 @@
#include "nsINameSpaceManager.h" #include "nsINameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5DocumentMode.h" #include "nsHtml5DocumentMode.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"

View File

@ -34,6 +34,7 @@
#include "nsINameSpaceManager.h" #include "nsINameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5DocumentMode.h" #include "nsHtml5DocumentMode.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"
@ -66,6 +67,7 @@ nsHtml5StackNode::nsHtml5StackNode(PRInt32 group, PRInt32 ns, nsIAtom* name, nsI
fosterParenting(fosterParenting), fosterParenting(fosterParenting),
tainted(PR_FALSE) tainted(PR_FALSE)
{ {
MOZ_COUNT_CTOR(nsHtml5StackNode);
nsHtml5Portability::retainLocal(name); nsHtml5Portability::retainLocal(name);
nsHtml5Portability::retainLocal(popName); nsHtml5Portability::retainLocal(popName);
nsHtml5Portability::retainElement(node); nsHtml5Portability::retainElement(node);
@ -83,6 +85,7 @@ nsHtml5StackNode::nsHtml5StackNode(PRInt32 ns, nsHtml5ElementName* elementName,
fosterParenting(elementName->fosterParenting), fosterParenting(elementName->fosterParenting),
tainted(PR_FALSE) tainted(PR_FALSE)
{ {
MOZ_COUNT_CTOR(nsHtml5StackNode);
nsHtml5Portability::retainLocal(name); nsHtml5Portability::retainLocal(name);
nsHtml5Portability::retainLocal(popName); nsHtml5Portability::retainLocal(popName);
nsHtml5Portability::retainElement(node); nsHtml5Portability::retainElement(node);
@ -100,6 +103,7 @@ nsHtml5StackNode::nsHtml5StackNode(PRInt32 ns, nsHtml5ElementName* elementName,
fosterParenting(elementName->fosterParenting), fosterParenting(elementName->fosterParenting),
tainted(PR_FALSE) tainted(PR_FALSE)
{ {
MOZ_COUNT_CTOR(nsHtml5StackNode);
nsHtml5Portability::retainLocal(name); nsHtml5Portability::retainLocal(name);
nsHtml5Portability::retainLocal(popName); nsHtml5Portability::retainLocal(popName);
nsHtml5Portability::retainElement(node); nsHtml5Portability::retainElement(node);
@ -117,6 +121,7 @@ nsHtml5StackNode::nsHtml5StackNode(PRInt32 ns, nsHtml5ElementName* elementName,
fosterParenting(PR_FALSE), fosterParenting(PR_FALSE),
tainted(PR_FALSE) tainted(PR_FALSE)
{ {
MOZ_COUNT_CTOR(nsHtml5StackNode);
nsHtml5Portability::retainLocal(name); nsHtml5Portability::retainLocal(name);
nsHtml5Portability::retainLocal(popName); nsHtml5Portability::retainLocal(popName);
nsHtml5Portability::retainElement(node); nsHtml5Portability::retainElement(node);
@ -125,6 +130,7 @@ nsHtml5StackNode::nsHtml5StackNode(PRInt32 ns, nsHtml5ElementName* elementName,
nsHtml5StackNode::~nsHtml5StackNode() nsHtml5StackNode::~nsHtml5StackNode()
{ {
MOZ_COUNT_DTOR(nsHtml5StackNode);
nsHtml5Portability::releaseLocal(name); nsHtml5Portability::releaseLocal(name);
nsHtml5Portability::releaseLocal(popName); nsHtml5Portability::releaseLocal(popName);
nsHtml5Portability::releaseElement(node); nsHtml5Portability::releaseElement(node);

View File

@ -35,6 +35,7 @@
#include "nsINameSpaceManager.h" #include "nsINameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5DocumentMode.h" #include "nsHtml5DocumentMode.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"

View File

@ -36,6 +36,7 @@
#include "nsINameSpaceManager.h" #include "nsINameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5DocumentMode.h" #include "nsHtml5DocumentMode.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"
@ -63,6 +64,7 @@ nsHtml5Tokenizer::nsHtml5Tokenizer(nsHtml5TreeBuilder* tokenHandler, nsHtml5Pars
bmpChar(jArray<PRUnichar,PRInt32>(1)), bmpChar(jArray<PRUnichar,PRInt32>(1)),
astralChar(jArray<PRUnichar,PRInt32>(2)) astralChar(jArray<PRUnichar,PRInt32>(2))
{ {
MOZ_COUNT_CTOR(nsHtml5Tokenizer);
} }
void void
@ -75,6 +77,7 @@ nsHtml5Tokenizer::initLocation(nsString* newPublicId, nsString* newSystemId)
nsHtml5Tokenizer::~nsHtml5Tokenizer() nsHtml5Tokenizer::~nsHtml5Tokenizer()
{ {
MOZ_COUNT_DTOR(nsHtml5Tokenizer);
bmpChar.release(); bmpChar.release();
astralChar.release(); astralChar.release();
} }
@ -2520,6 +2523,9 @@ nsHtml5Tokenizer::handleNcrValue(PRInt32 returnState)
emitOrAppendOne(nsHtml5Tokenizer::REPLACEMENT_CHARACTER, returnState); emitOrAppendOne(nsHtml5Tokenizer::REPLACEMENT_CHARACTER, returnState);
} else if (isNonCharacter(value)) { } else if (isNonCharacter(value)) {
emitOrAppendOne(nsHtml5Tokenizer::REPLACEMENT_CHARACTER, returnState);
} else if (value >= 0xFDD0 && value <= 0xFDEF) {
emitOrAppendOne(nsHtml5Tokenizer::REPLACEMENT_CHARACTER, returnState); emitOrAppendOne(nsHtml5Tokenizer::REPLACEMENT_CHARACTER, returnState);
} else if (value <= 0xFFFF) { } else if (value <= 0xFFFF) {
PRUnichar ch = (PRUnichar) value; PRUnichar ch = (PRUnichar) value;

View File

@ -37,6 +37,7 @@
#include "nsINameSpaceManager.h" #include "nsINameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5DocumentMode.h" #include "nsHtml5DocumentMode.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"

View File

@ -36,6 +36,7 @@
#include "nsINameSpaceManager.h" #include "nsINameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5DocumentMode.h" #include "nsHtml5DocumentMode.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"
@ -519,6 +520,10 @@ nsHtml5TreeBuilder::eof()
void void
nsHtml5TreeBuilder::endTokenization() nsHtml5TreeBuilder::endTokenization()
{ {
nsHtml5Portability::releaseElement(formPointer);
formPointer = nsnull;
nsHtml5Portability::releaseElement(headPointer);
headPointer = nsnull;
while (currentPtr > -1) { while (currentPtr > -1) {
stack[currentPtr]->release(); stack[currentPtr]->release();
currentPtr--; currentPtr--;

View File

@ -37,6 +37,7 @@
#include "nsINameSpaceManager.h" #include "nsINameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5DocumentMode.h" #include "nsHtml5DocumentMode.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"

View File

@ -51,6 +51,7 @@
#include "nsIFormControl.h" #include "nsIFormControl.h"
#include "nsNodeUtils.h" #include "nsNodeUtils.h"
#include "nsIStyleSheetLinkingElement.h" #include "nsIStyleSheetLinkingElement.h"
#include "nsTraceRefcnt.h"
// this really should be autogenerated... // this really should be autogenerated...
jArray<PRUnichar,PRInt32> nsHtml5TreeBuilder::ISINDEX_PROMPT = jArray<PRUnichar,PRInt32>(); jArray<PRUnichar,PRInt32> nsHtml5TreeBuilder::ISINDEX_PROMPT = jArray<PRUnichar,PRInt32>();
@ -63,10 +64,12 @@ nsHtml5TreeBuilder::nsHtml5TreeBuilder(nsHtml5Parser* aParser)
formPointer(nsnull), formPointer(nsnull),
headPointer(nsnull) headPointer(nsnull)
{ {
MOZ_COUNT_CTOR(nsHtml5TreeBuilder);
} }
nsHtml5TreeBuilder::~nsHtml5TreeBuilder() nsHtml5TreeBuilder::~nsHtml5TreeBuilder()
{ {
MOZ_COUNT_DTOR(nsHtml5TreeBuilder);
delete MARKER; delete MARKER;
} }

View File

@ -33,6 +33,7 @@
#include "nsINameSpaceManager.h" #include "nsINameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5DocumentMode.h" #include "nsHtml5DocumentMode.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"
@ -59,6 +60,7 @@ nsHtml5UTF16Buffer::nsHtml5UTF16Buffer(PRUnichar* buffer, PRInt32 start, PRInt32
start(start), start(start),
end(end) end(end)
{ {
MOZ_COUNT_CTOR(nsHtml5UTF16Buffer);
} }
PRInt32 PRInt32

View File

@ -34,6 +34,7 @@
#include "nsINameSpaceManager.h" #include "nsINameSpaceManager.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsTraceRefcnt.h"
#include "jArray.h" #include "jArray.h"
#include "nsHtml5DocumentMode.h" #include "nsHtml5DocumentMode.h"
#include "nsHtml5ArrayCopy.h" #include "nsHtml5ArrayCopy.h"

View File

@ -35,6 +35,8 @@
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
#include "nsTraceRefcnt.h"
nsHtml5UTF16Buffer::nsHtml5UTF16Buffer(PRInt32 size) nsHtml5UTF16Buffer::nsHtml5UTF16Buffer(PRInt32 size)
: buffer(new PRUnichar[size]), : buffer(new PRUnichar[size]),
start(0), start(0),
@ -42,6 +44,7 @@ nsHtml5UTF16Buffer::nsHtml5UTF16Buffer(PRInt32 size)
next(nsnull), next(nsnull),
key(nsnull) key(nsnull)
{ {
MOZ_COUNT_CTOR(nsHtml5UTF16Buffer);
} }
nsHtml5UTF16Buffer::nsHtml5UTF16Buffer(void* key) nsHtml5UTF16Buffer::nsHtml5UTF16Buffer(void* key)
@ -51,9 +54,11 @@ nsHtml5UTF16Buffer::nsHtml5UTF16Buffer(void* key)
next(nsnull), next(nsnull),
key(key) key(key)
{ {
MOZ_COUNT_CTOR(nsHtml5UTF16Buffer);
} }
nsHtml5UTF16Buffer::~nsHtml5UTF16Buffer() nsHtml5UTF16Buffer::~nsHtml5UTF16Buffer()
{ {
MOZ_COUNT_DTOR(nsHtml5UTF16Buffer);
delete[] buffer; delete[] buffer;
} }