Backed out changeset 13819d2e9bd8 (Bug 551298) due to Linux debug mochitest-5 orange

This commit is contained in:
Daniel Holbert 2010-04-01 09:37:26 -07:00
Родитель ca50c7092d
Коммит 9a588376e3
11 изменённых файлов: 220 добавлений и 22 удалений

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

@ -124,7 +124,36 @@ public:
PRUint32 Serial() const { return mSerial; } PRUint32 Serial() const { return mSerial; }
void SetSerial(PRUint32 aIndex) { mSerial = aIndex; } void SetSerial(PRUint32 aIndex) { mSerial = aIndex; }
NS_INLINE_DECL_REFCOUNTING(nsSMILInstanceTime) nsrefcnt AddRef()
{
if (mRefCnt == PR_UINT32_MAX) {
NS_WARNING("refcount overflow, leaking nsSMILInstanceTime");
return mRefCnt;
}
NS_ASSERT_OWNINGTHREAD(_class);
NS_ABORT_IF_FALSE(_mOwningThread.GetThread() == PR_GetCurrentThread(),
"nsSMILInstanceTime addref isn't thread-safe!");
++mRefCnt;
NS_LOG_ADDREF(this, mRefCnt, "nsSMILInstanceTime", sizeof(*this));
return mRefCnt;
}
nsrefcnt Release()
{
if (mRefCnt == PR_UINT32_MAX) {
NS_WARNING("refcount overflow, leaking nsSMILInstanceTime");
return mRefCnt;
}
NS_ABORT_IF_FALSE(_mOwningThread.GetThread() == PR_GetCurrentThread(),
"nsSMILInstanceTime release isn't thread-safe!");
--mRefCnt;
NS_LOG_RELEASE(this, mRefCnt, "nsSMILInstanceTime");
if (mRefCnt == 0) {
delete this;
return 0;
}
return mRefCnt;
}
protected: protected:
void SetBaseInterval(nsSMILInterval* aBaseInterval); void SetBaseInterval(nsSMILInterval* aBaseInterval);
@ -133,6 +162,9 @@ protected:
nsSMILTimeValue mTime; nsSMILTimeValue mTime;
nsAutoRefCnt mRefCnt;
NS_DECL_OWNINGTHREAD
// Internal flags used for represent behaviour of different instance times` // Internal flags used for represent behaviour of different instance times`
enum { enum {
// Indicates if this instance time should be removed when the owning timed // Indicates if this instance time should be removed when the owning timed

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

@ -46,7 +46,6 @@
#include "nsClassHashtable.h" #include "nsClassHashtable.h"
#include "nsTArray.h" #include "nsTArray.h"
#include "nsCycleCollectionParticipant.h" #include "nsCycleCollectionParticipant.h"
#include "nsISupportsImpl.h"
class nsXBLPrototypeBinding; class nsXBLPrototypeBinding;
class nsIContent; class nsIContent;
@ -78,7 +77,24 @@ public:
* which are queued to fire their constructors. * which are queued to fire their constructors.
*/ */
NS_INLINE_DECL_REFCOUNTING(nsXBLBinding) nsrefcnt AddRef()
{
++mRefCnt;
NS_LOG_ADDREF(this, mRefCnt, "nsXBLBinding", sizeof(nsXBLBinding));
return mRefCnt;
}
nsrefcnt Release()
{
--mRefCnt;
NS_LOG_RELEASE(this, mRefCnt, "nsXBLBinding");
if (mRefCnt == 0) {
mRefCnt = 1;
delete this;
return 0;
}
return mRefCnt;
}
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(nsXBLBinding) NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(nsXBLBinding)
@ -156,6 +172,7 @@ public:
// MEMBER VARIABLES // MEMBER VARIABLES
protected: protected:
nsAutoRefCnt mRefCnt;
nsXBLPrototypeBinding* mPrototypeBinding; // Weak, but we're holding a ref to the docinfo nsXBLPrototypeBinding* mPrototypeBinding; // Weak, but we're holding a ref to the docinfo
nsCOMPtr<nsIContent> mContent; // Strong. Our anonymous content stays around with us. nsCOMPtr<nsIContent> mContent; // Strong. Our anonymous content stays around with us.
nsRefPtr<nsXBLBinding> mNextBinding; // Strong. The derived binding owns the base class bindings. nsRefPtr<nsXBLBinding> mNextBinding; // Strong. The derived binding owns the base class bindings.

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

@ -57,6 +57,19 @@ nsXBLInsertionPoint::~nsXBLInsertionPoint()
} }
} }
nsrefcnt
nsXBLInsertionPoint::Release()
{
--mRefCnt;
NS_LOG_RELEASE(this, mRefCnt, "nsXBLInsertionPoint");
if (mRefCnt == 0) {
mRefCnt = 1;
delete this;
return 0;
}
return mRefCnt;
}
NS_IMPL_CYCLE_COLLECTION_CLASS(nsXBLInsertionPoint) NS_IMPL_CYCLE_COLLECTION_CLASS(nsXBLInsertionPoint)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_NATIVE(nsXBLInsertionPoint) NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_NATIVE(nsXBLInsertionPoint)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMARRAY(mElements) NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMARRAY(mElements)

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

@ -50,7 +50,15 @@ public:
nsXBLInsertionPoint(nsIContent* aParentElement, PRUint32 aIndex, nsIContent* aDefContent); nsXBLInsertionPoint(nsIContent* aParentElement, PRUint32 aIndex, nsIContent* aDefContent);
~nsXBLInsertionPoint(); ~nsXBLInsertionPoint();
NS_INLINE_DECL_REFCOUNTING(nsXBLInsertionPoint) nsrefcnt AddRef()
{
++mRefCnt;
NS_LOG_ADDREF(this, mRefCnt, "nsXBLInsertionPoint",
sizeof(nsXBLInsertionPoint));
return mRefCnt;
}
nsrefcnt Release();
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(nsXBLInsertionPoint) NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(nsXBLInsertionPoint)
@ -82,6 +90,7 @@ public:
void UnbindDefaultContent(); void UnbindDefaultContent();
protected: protected:
nsAutoRefCnt mRefCnt;
nsIContent* mParentElement; // This ref is weak. The parent of the <children> element. nsIContent* mParentElement; // This ref is weak. The parent of the <children> element.
PRInt32 mIndex; // The index of this insertion point. -1 is a pseudo-point. PRInt32 mIndex; // The index of this insertion point. -1 is a pseudo-point.
nsCOMArray<nsIContent> mElements; // An array of elements present at the insertion point. nsCOMArray<nsIContent> mElements; // An array of elements present at the insertion point.

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

@ -207,12 +207,27 @@ public:
nsXBLInsertionPointEntry::ReleasePool(); nsXBLInsertionPointEntry::ReleasePool();
} }
NS_INLINE_DECL_REFCOUNTING(nsXBLInsertionPointEntry) nsrefcnt AddRef() {
++mRefCnt;
NS_LOG_ADDREF(this, mRefCnt, "nsXBLInsertionPointEntry", sizeof(nsXBLInsertionPointEntry));
return mRefCnt;
}
nsrefcnt Release() {
--mRefCnt;
NS_LOG_RELEASE(this, mRefCnt, "nsXBLInsertionPointEntry");
if (mRefCnt == 0) {
Destroy(this);
return 0;
}
return mRefCnt;
}
protected: protected:
nsCOMPtr<nsIContent> mInsertionParent; nsCOMPtr<nsIContent> mInsertionParent;
nsCOMPtr<nsIContent> mDefaultContent; nsCOMPtr<nsIContent> mDefaultContent;
PRUint32 mInsertionIndex; PRUint32 mInsertionIndex;
nsAutoRefCnt mRefCnt;
nsXBLInsertionPointEntry(nsIContent* aParent) nsXBLInsertionPointEntry(nsIContent* aParent)
: mInsertionParent(aParent), : mInsertionParent(aParent),

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

@ -404,12 +404,14 @@ public:
txCompileObserver(txMozillaXSLTProcessor* aProcessor, txCompileObserver(txMozillaXSLTProcessor* aProcessor,
nsILoadGroup* aLoadGroup); nsILoadGroup* aLoadGroup);
TX_DECL_ACOMPILEOBSERVER TX_DECL_ACOMPILEOBSERVER;
NS_INLINE_DECL_REFCOUNTING(txCompileObserver)
nsresult startLoad(nsIURI* aUri, txStylesheetCompiler* aCompiler, nsresult startLoad(nsIURI* aUri, txStylesheetCompiler* aCompiler,
nsIPrincipal* aSourcePrincipal); nsIPrincipal* aSourcePrincipal);
protected:
nsAutoRefCnt mRefCnt;
private: private:
nsRefPtr<txMozillaXSLTProcessor> mProcessor; nsRefPtr<txMozillaXSLTProcessor> mProcessor;
nsCOMPtr<nsILoadGroup> mLoadGroup; nsCOMPtr<nsILoadGroup> mLoadGroup;
@ -427,6 +429,23 @@ txCompileObserver::txCompileObserver(txMozillaXSLTProcessor* aProcessor,
{ {
} }
nsrefcnt
txCompileObserver::AddRef()
{
return ++mRefCnt;
}
nsrefcnt
txCompileObserver::Release()
{
if (--mRefCnt == 0) {
mRefCnt = 1; //stabilize
delete this;
return 0;
}
return mRefCnt;
}
nsresult nsresult
txCompileObserver::loadURI(const nsAString& aUri, txCompileObserver::loadURI(const nsAString& aUri,
const nsAString& aReferrerUri, const nsAString& aReferrerUri,
@ -639,11 +658,11 @@ class txSyncCompileObserver : public txACompileObserver
public: public:
txSyncCompileObserver(txMozillaXSLTProcessor* aProcessor); txSyncCompileObserver(txMozillaXSLTProcessor* aProcessor);
TX_DECL_ACOMPILEOBSERVER TX_DECL_ACOMPILEOBSERVER;
NS_INLINE_DECL_REFCOUNTING(txSyncCompileObserver)
protected: protected:
nsRefPtr<txMozillaXSLTProcessor> mProcessor; nsRefPtr<txMozillaXSLTProcessor> mProcessor;
nsAutoRefCnt mRefCnt;
}; };
txSyncCompileObserver::txSyncCompileObserver(txMozillaXSLTProcessor* aProcessor) txSyncCompileObserver::txSyncCompileObserver(txMozillaXSLTProcessor* aProcessor)
@ -651,6 +670,23 @@ txSyncCompileObserver::txSyncCompileObserver(txMozillaXSLTProcessor* aProcessor)
{ {
} }
nsrefcnt
txSyncCompileObserver::AddRef()
{
return ++mRefCnt;
}
nsrefcnt
txSyncCompileObserver::Release()
{
if (--mRefCnt == 0) {
mRefCnt = 1; //stabilize
delete this;
return 0;
}
return mRefCnt;
}
nsresult nsresult
txSyncCompileObserver::loadURI(const nsAString& aUri, txSyncCompileObserver::loadURI(const nsAString& aUri,
const nsAString& aReferrerUri, const nsAString& aReferrerUri,

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

@ -64,8 +64,7 @@ class txDriver : public txACompileObserver
const XML_Char *aSystemId, const XML_Char *aSystemId,
const XML_Char *aPublicId); const XML_Char *aPublicId);
TX_DECL_ACOMPILEOBSERVER TX_DECL_ACOMPILEOBSERVER;
NS_INLINE_DECL_REFCOUNTING(txDriver)
nsRefPtr<txStylesheetCompiler> mCompiler; nsRefPtr<txStylesheetCompiler> mCompiler;
protected: protected:
@ -74,6 +73,7 @@ class txDriver : public txACompileObserver
// keep track of the nsresult returned by the handlers, expat forgets them // keep track of the nsresult returned by the handlers, expat forgets them
nsresult mRV; nsresult mRV;
XML_Parser mExpatParser; XML_Parser mExpatParser;
nsAutoRefCnt mRefCnt;
}; };
nsresult nsresult
@ -338,6 +338,23 @@ txDriver::createErrorString()
* txACompileObserver implementation * txACompileObserver implementation
*/ */
nsrefcnt
txDriver::AddRef()
{
return ++mRefCnt;
}
nsrefcnt
txDriver::Release()
{
if (--mRefCnt == 0) {
mRefCnt = 1; //stabilize
delete this;
return 0;
}
return mRefCnt;
}
void void
txDriver::onDoneCompiling(txStylesheetCompiler* aCompiler, nsresult aResult, txDriver::onDoneCompiling(txStylesheetCompiler* aCompiler, nsresult aResult,
const PRUnichar *aErrorText, const PRUnichar *aParam) const PRUnichar *aErrorText, const PRUnichar *aParam)

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

@ -44,7 +44,6 @@
#include "txList.h" #include "txList.h"
#include "txXSLTPatterns.h" #include "txXSLTPatterns.h"
#include "nsTPtrArray.h" #include "nsTPtrArray.h"
#include "nsISupportsImpl.h"
class txInstruction; class txInstruction;
class txToplevelItem; class txToplevelItem;
@ -69,7 +68,19 @@ public:
~txStylesheet(); ~txStylesheet();
nsresult init(); nsresult init();
NS_INLINE_DECL_REFCOUNTING(txStylesheet) nsrefcnt AddRef()
{
return ++mRefCnt;
}
nsrefcnt Release()
{
if (--mRefCnt == 0) {
mRefCnt = 1; //stabilize
delete this;
return 0;
}
return mRefCnt;
}
txInstruction* findTemplate(const txXPathNode& aNode, txInstruction* findTemplate(const txXPathNode& aNode,
const txExpandedName& aMode, const txExpandedName& aMode,
@ -148,6 +159,9 @@ private:
nsTPtrArray<txStripSpaceTest>& aFrameStripSpaceTests); nsTPtrArray<txStripSpaceTest>& aFrameStripSpaceTests);
nsresult addAttributeSet(txAttributeSetItem* aAttributeSetItem); nsresult addAttributeSet(txAttributeSetItem* aAttributeSetItem);
// Refcount
nsAutoRefCnt mRefCnt;
// List of ImportFrames // List of ImportFrames
txList mImportFrames; txList mImportFrames;

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

@ -69,6 +69,27 @@ txStylesheetCompiler::txStylesheetCompiler(const nsAString& aStylesheetURI,
mStatus = init(aStylesheetURI, aStylesheet, aInsertPosition); mStatus = init(aStylesheetURI, aStylesheet, aInsertPosition);
} }
nsrefcnt
txStylesheetCompiler::AddRef()
{
++mRefCnt;
NS_LOG_ADDREF(this, mRefCnt, "txStylesheetCompiler", sizeof(*this));
return mRefCnt;
}
nsrefcnt
txStylesheetCompiler::Release()
{
--mRefCnt;
NS_LOG_RELEASE(this, mRefCnt, "txStylesheetCompiler");
if (mRefCnt == 0) {
mRefCnt = 1; //stabilize
delete this;
return 0;
}
return mRefCnt;
}
void void
txStylesheetCompiler::setBaseURI(const nsString& aBaseURI) txStylesheetCompiler::setBaseURI(const nsString& aBaseURI)
{ {

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

@ -77,8 +77,8 @@ public:
class txACompileObserver class txACompileObserver
{ {
public: public:
virtual void AddRef() = 0; virtual nsrefcnt AddRef() = 0;
virtual void Release() = 0; virtual nsrefcnt Release() = 0;
virtual nsresult loadURI(const nsAString& aUri, virtual nsresult loadURI(const nsAString& aUri,
const nsAString& aReferrerUri, const nsAString& aReferrerUri,
@ -90,11 +90,13 @@ public:
}; };
#define TX_DECL_ACOMPILEOBSERVER \ #define TX_DECL_ACOMPILEOBSERVER \
nsrefcnt AddRef(); \
nsrefcnt Release(); \
nsresult loadURI(const nsAString& aUri, const nsAString& aReferrerUri, \ nsresult loadURI(const nsAString& aUri, const nsAString& aReferrerUri, \
txStylesheetCompiler* aCompiler); \ txStylesheetCompiler* aCompiler); \
void onDoneCompiling(txStylesheetCompiler* aCompiler, nsresult aResult, \ void onDoneCompiling(txStylesheetCompiler* aCompiler, nsresult aResult, \
const PRUnichar *aErrorText = nsnull, \ const PRUnichar *aErrorText = nsnull, \
const PRUnichar *aParam = nsnull); const PRUnichar *aParam = nsnull)
class txStylesheetCompilerState : public txIParseContext class txStylesheetCompilerState : public txIParseContext
{ {
@ -213,6 +215,8 @@ public:
txStylesheet* aStylesheet, txStylesheet* aStylesheet,
txListIterator* aInsertPosition, txListIterator* aInsertPosition,
txACompileObserver* aObserver); txACompileObserver* aObserver);
virtual nsrefcnt AddRef();
virtual nsrefcnt Release();
void setBaseURI(const nsString& aBaseURI); void setBaseURI(const nsString& aBaseURI);
@ -231,8 +235,12 @@ public:
txStylesheet* getStylesheet(); txStylesheet* getStylesheet();
TX_DECL_ACOMPILEOBSERVER // txACompileObserver
NS_INLINE_DECL_REFCOUNTING(txStylesheetCompiler) nsresult loadURI(const nsAString& aUri, const nsAString& aReferrerUri,
txStylesheetCompiler* aCompiler);
void onDoneCompiling(txStylesheetCompiler* aCompiler, nsresult aResult,
const PRUnichar *aErrorText = nsnull,
const PRUnichar *aParam = nsnull);
private: private:
nsresult startElementInternal(PRInt32 aNamespaceID, nsIAtom* aLocalName, nsresult startElementInternal(PRInt32 aNamespaceID, nsIAtom* aLocalName,
@ -245,6 +253,7 @@ private:
nsresult ensureNewElementContext(); nsresult ensureNewElementContext();
nsresult maybeDoneCompiling(); nsresult maybeDoneCompiling();
nsAutoRefCnt mRefCnt;
nsString mCharacters; nsString mCharacters;
nsresult mStatus; nsresult mStatus;
}; };

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

@ -40,7 +40,6 @@
#include "nsAutoPtr.h" #include "nsAutoPtr.h"
#include "nsIAtom.h" #include "nsIAtom.h"
#include "nsIRDFResource.h" #include "nsIRDFResource.h"
#include "nsISupportsImpl.h"
class nsXULTemplateResultRDF; class nsXULTemplateResultRDF;
class nsBindingValues; class nsBindingValues;
@ -96,6 +95,9 @@ class RDFBindingSet
{ {
protected: protected:
// results hold a reference to a binding set in their nsBindingValues fields
PRInt32 mRefCnt;
// the number of bindings // the number of bindings
PRInt32 mCount; PRInt32 mCount;
@ -105,7 +107,8 @@ protected:
public: public:
RDFBindingSet() RDFBindingSet()
: mCount(0), : mRefCnt(0),
mCount(0),
mFirst(nsnull) mFirst(nsnull)
{ {
MOZ_COUNT_CTOR(RDFBindingSet); MOZ_COUNT_CTOR(RDFBindingSet);
@ -113,7 +116,19 @@ public:
~RDFBindingSet(); ~RDFBindingSet();
NS_INLINE_DECL_REFCOUNTING(RDFBindingSet) PRInt32 AddRef() {
mRefCnt++;
NS_LOG_ADDREF(this, mRefCnt, "RDFBindingSet", sizeof(*this));
return mRefCnt;
}
PRInt32 Release()
{
PRInt32 refcnt = --mRefCnt;
NS_LOG_RELEASE(this, refcnt, "RDFBindingSet");
if (refcnt == 0) delete this;
return refcnt;
}
PRInt32 Count() const { return mCount; } PRInt32 Count() const { return mCount; }