Bug 603844: Annotate some xlst classes with leak logging. r=sicking sr=dbaron

This commit is contained in:
Kyle Huey 2010-12-02 11:15:48 -05:00
Родитель 0be52ce062
Коммит 8a69f2baf2
10 изменённых файлов: 87 добавлений и 1 удалений

Просмотреть файл

@ -58,9 +58,11 @@ public:
txOutputTransaction(txTransactionType aType)
: mType(aType)
{
MOZ_COUNT_CTOR(txOutputTransaction);
}
virtual ~txOutputTransaction()
{
MOZ_COUNT_DTOR(txOutputTransaction);
}
txTransactionType mType;
};
@ -72,6 +74,11 @@ public:
: txOutputTransaction(aType),
mLength(aLength)
{
MOZ_COUNT_CTOR_INHERITED(txCharacterTransaction, txOutputTransaction);
}
virtual ~txCharacterTransaction()
{
MOZ_COUNT_DTOR_INHERITED(txCharacterTransaction, txOutputTransaction);
}
PRUint32 mLength;
};
@ -83,6 +90,11 @@ public:
: txOutputTransaction(eCommentTransaction),
mValue(aValue)
{
MOZ_COUNT_CTOR_INHERITED(txCommentTransaction, txOutputTransaction);
}
virtual ~txCommentTransaction()
{
MOZ_COUNT_DTOR_INHERITED(txCommentTransaction, txOutputTransaction);
}
nsString mValue;
};
@ -95,6 +107,11 @@ public:
mTarget(aTarget),
mData(aData)
{
MOZ_COUNT_CTOR_INHERITED(txPITransaction, txOutputTransaction);
}
virtual ~txPITransaction()
{
MOZ_COUNT_DTOR_INHERITED(txPITransaction, txOutputTransaction);
}
nsString mTarget;
nsString mData;
@ -111,6 +128,11 @@ public:
mLowercaseLocalName(aLowercaseLocalName),
mNsID(aNsID)
{
MOZ_COUNT_CTOR_INHERITED(txStartElementAtomTransaction, txOutputTransaction);
}
virtual ~txStartElementAtomTransaction()
{
MOZ_COUNT_DTOR_INHERITED(txStartElementAtomTransaction, txOutputTransaction);
}
nsCOMPtr<nsIAtom> mPrefix;
nsCOMPtr<nsIAtom> mLocalName;
@ -128,6 +150,11 @@ public:
mLocalName(aLocalName),
mNsID(aNsID)
{
MOZ_COUNT_CTOR_INHERITED(txStartElementTransaction, txOutputTransaction);
}
virtual ~txStartElementTransaction()
{
MOZ_COUNT_DTOR_INHERITED(txStartElementTransaction, txOutputTransaction);
}
nsCOMPtr<nsIAtom> mPrefix;
nsString mLocalName;
@ -146,6 +173,11 @@ public:
mNsID(aNsID),
mValue(aValue)
{
MOZ_COUNT_CTOR_INHERITED(txAttributeTransaction, txOutputTransaction);
}
virtual ~txAttributeTransaction()
{
MOZ_COUNT_DTOR_INHERITED(txAttributeTransaction, txOutputTransaction);
}
nsCOMPtr<nsIAtom> mPrefix;
nsString mLocalName;
@ -166,6 +198,11 @@ public:
mNsID(aNsID),
mValue(aValue)
{
MOZ_COUNT_CTOR_INHERITED(txAttributeAtomTransaction, txOutputTransaction);
}
virtual ~txAttributeAtomTransaction()
{
MOZ_COUNT_DTOR_INHERITED(txAttributeAtomTransaction, txOutputTransaction);
}
nsCOMPtr<nsIAtom> mPrefix;
nsCOMPtr<nsIAtom> mLocalName;
@ -176,9 +213,15 @@ public:
txBufferingHandler::txBufferingHandler() : mCanAddAttribute(PR_FALSE)
{
MOZ_COUNT_CTOR(txBufferingHandler);
mBuffer = new txResultBuffer();
}
txBufferingHandler::~txBufferingHandler()
{
MOZ_COUNT_DTOR(txBufferingHandler);
}
nsresult
txBufferingHandler::attribute(nsIAtom* aPrefix, nsIAtom* aLocalName,
nsIAtom* aLowercaseLocalName, PRInt32 aNsID,
@ -343,8 +386,14 @@ txBufferingHandler::startElement(nsIAtom* aPrefix,
return mBuffer->addTransaction(transaction);
}
txResultBuffer::txResultBuffer()
{
MOZ_COUNT_CTOR(txResultBuffer);
}
txResultBuffer::~txResultBuffer()
{
MOZ_COUNT_DTOR(txResultBuffer);
for (PRUint32 i = 0, len = mTransactions.Length(); i < len; ++i) {
delete mTransactions[i];
}

Просмотреть файл

@ -51,6 +51,7 @@ class txCharacterTransaction;
class txResultBuffer
{
public:
txResultBuffer();
~txResultBuffer();
nsresult addTransaction(txOutputTransaction* aTransaction);
@ -69,6 +70,7 @@ class txBufferingHandler : public txAXMLEventHandler
{
public:
txBufferingHandler();
virtual ~txBufferingHandler();
TX_DECL_TXAXMLEVENTHANDLER

Просмотреть файл

@ -155,7 +155,7 @@ txExecutionState::init(const txXPathNode& aNode,
mInitialEvalContext = mEvalContext;
// Set up output and result-handler
txAXMLEventHandler* handler = 0;
txAXMLEventHandler* handler;
rv = mOutputHandlerFactory->
createHandlerWith(mStylesheet->getOutputFormat(), &handler);
NS_ENSURE_SUCCESS(rv, rv);

Просмотреть файл

@ -62,16 +62,23 @@ txMozillaTextOutput::txMozillaTextOutput(nsIDOMDocument* aSourceDocument,
nsIDOMDocument* aResultDocument,
nsITransformObserver* aObserver)
{
MOZ_COUNT_CTOR(txMozillaTextOutput);
mObserver = do_GetWeakReference(aObserver);
createResultDocument(aSourceDocument, aResultDocument);
}
txMozillaTextOutput::txMozillaTextOutput(nsIDOMDocumentFragment* aDest)
{
MOZ_COUNT_CTOR(txMozillaTextOutput);
mTextParent = do_QueryInterface(aDest);
mDocument = mTextParent->GetOwnerDoc();
}
txMozillaTextOutput::~txMozillaTextOutput()
{
MOZ_COUNT_DTOR(txMozillaTextOutput);
}
nsresult
txMozillaTextOutput::attribute(nsIAtom* aPrefix, nsIAtom* aLocalName,
nsIAtom* aLowercaseLocalName,

Просмотреть файл

@ -58,6 +58,7 @@ public:
nsIDOMDocument* aResultDocument,
nsITransformObserver* aObserver);
txMozillaTextOutput(nsIDOMDocumentFragment* aDest);
virtual ~txMozillaTextOutput();
TX_DECL_TXAXMLEVENTHANDLER
TX_DECL_TXAOUTPUTXMLEVENTHANDLER

Просмотреть файл

@ -94,6 +94,7 @@ txMozillaXMLOutput::txMozillaXMLOutput(const nsSubstring& aRootName,
mRootContentCreated(PR_FALSE),
mNoFixup(PR_FALSE)
{
MOZ_COUNT_CTOR(txMozillaXMLOutput);
if (aObserver) {
mNotifier = new txTransformNotifier();
if (mNotifier) {
@ -118,6 +119,7 @@ txMozillaXMLOutput::txMozillaXMLOutput(txOutputFormat* aFormat,
mRootContentCreated(PR_FALSE),
mNoFixup(aNoFixup)
{
MOZ_COUNT_CTOR(txMozillaXMLOutput);
mOutputFormat.merge(*aFormat);
mOutputFormat.setFromDefaults();
@ -131,6 +133,11 @@ txMozillaXMLOutput::txMozillaXMLOutput(txOutputFormat* aFormat,
}
}
txMozillaXMLOutput::~txMozillaXMLOutput()
{
MOZ_COUNT_DTOR(txMozillaXMLOutput);
}
nsresult
txMozillaXMLOutput::attribute(nsIAtom* aPrefix,
nsIAtom* aLocalName,

Просмотреть файл

@ -102,6 +102,7 @@ public:
txMozillaXMLOutput(txOutputFormat* aFormat,
nsIDOMDocumentFragment* aFragment,
PRBool aNoFixup);
~txMozillaXMLOutput();
TX_DECL_TXAXMLEVENTHANDLER
TX_DECL_TXAOUTPUTXMLEVENTHANDLER

Просмотреть файл

@ -45,6 +45,12 @@
txUnknownHandler::txUnknownHandler(txExecutionState* aEs)
: mEs(aEs)
{
MOZ_COUNT_CTOR_INHERITED(txUnknownHandler, txBufferingHandler);
}
txUnknownHandler::~txUnknownHandler()
{
MOZ_COUNT_DTOR_INHERITED(txUnknownHandler, txBufferingHandler);
}
nsresult

Просмотреть файл

@ -48,6 +48,7 @@ class txUnknownHandler : public txBufferingHandler
{
public:
txUnknownHandler(txExecutionState* aEs);
virtual ~txUnknownHandler();
nsresult endDocument(nsresult aResult);
nsresult startElement(nsIAtom* aPrefix, nsIAtom* aName,

Просмотреть файл

@ -53,11 +53,21 @@ PR_BEGIN_MACRO \
NS_LogCtor((void*)this, #_type, sizeof(*this)); \
PR_END_MACRO
#define MOZ_COUNT_CTOR_INHERITED(_type, _base) \
PR_BEGIN_MACRO \
NS_LogCtor((void*)this, #_type, sizeof(*this) - sizeof(_base)); \
PR_END_MACRO
#define MOZ_COUNT_DTOR(_type) \
PR_BEGIN_MACRO \
NS_LogDtor((void*)this, #_type, sizeof(*this)); \
PR_END_MACRO
#define MOZ_COUNT_DTOR_INHERITED(_type, _base) \
PR_BEGIN_MACRO \
NS_LogDtor((void*)this, #_type, sizeof(*this) - sizeof(_base)); \
PR_END_MACRO
/* nsCOMPtr.h allows these macros to be defined by clients
* These logging functions require dynamic_cast<void*>, so they don't
* do anything useful if we don't have dynamic_cast<void*>. */
@ -74,7 +84,9 @@ PR_END_MACRO
#define NS_LOG_ADDREF(_p, _rc, _type, _size)
#define NS_LOG_RELEASE(_p, _rc, _type)
#define MOZ_COUNT_CTOR(_type)
#define MOZ_COUNT_CTOR_INHERITED(_type, _base)
#define MOZ_COUNT_DTOR(_type)
#define MOZ_COUNT_DTOR_INHERITED(_type, _base)
#endif /* NS_BUILD_REFCNT_LOGGING */