Bug 570417 - All content iterators need to take part in cycle collection; r=jst

--HG--
extra : rebase_source : 9681fd61ea2fbaf376390ce85b8cb3c3d040c098
This commit is contained in:
Ehsan Akhgari 2010-06-08 00:31:44 -04:00
Родитель 35b2d40320
Коммит d00fd073af
1 изменённых файлов: 23 добавлений и 18 удалений

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

@ -122,7 +122,7 @@ public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(nsContentIterator)
nsContentIterator();
explicit nsContentIterator(PRBool aPre);
virtual ~nsContentIterator();
// nsIContentIterator interface methods ------------------------------
@ -208,25 +208,13 @@ private:
};
/*
* A simple iterator class for traversing the content in "open tag" order
*/
class nsPreContentIterator : public nsContentIterator
{
public:
nsPreContentIterator() { mPre = PR_TRUE; }
};
/******************************************************
* repository cruft
******************************************************/
nsresult NS_NewContentIterator(nsIContentIterator** aInstancePtrResult)
{
nsContentIterator * iter = new nsContentIterator();
nsContentIterator * iter = new nsContentIterator(PR_FALSE);
if (!iter) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -239,7 +227,7 @@ nsresult NS_NewContentIterator(nsIContentIterator** aInstancePtrResult)
nsresult NS_NewPreContentIterator(nsIContentIterator** aInstancePtrResult)
{
nsContentIterator * iter = new nsPreContentIterator();
nsContentIterator * iter = new nsContentIterator(PR_TRUE);
if (!iter) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -273,9 +261,9 @@ NS_IMPL_CYCLE_COLLECTION_4(nsContentIterator,
* constructor/destructor
******************************************************/
nsContentIterator::nsContentIterator() :
nsContentIterator::nsContentIterator(PRBool aPre) :
// don't need to explicitly initialize |nsCOMPtr|s, they will automatically be NULL
mCachedIndex(0), mIsDone(PR_FALSE), mPre(PR_FALSE)
mCachedIndex(0), mIsDone(PR_FALSE), mPre(aPre)
{
}
@ -1182,9 +1170,12 @@ nsContentIterator::GetCurrentNode()
class nsContentSubtreeIterator : public nsContentIterator
{
public:
nsContentSubtreeIterator() {}
nsContentSubtreeIterator() : nsContentIterator(PR_FALSE) {}
virtual ~nsContentSubtreeIterator() {}
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsContentSubtreeIterator, nsContentIterator)
// nsContentIterator overrides ------------------------------
virtual nsresult Init(nsINode* aRoot);
@ -1224,6 +1215,20 @@ protected:
nsAutoTArray<PRInt32, 8> mEndOffsets;
};
NS_IMPL_ADDREF_INHERITED(nsContentSubtreeIterator, nsContentIterator)
NS_IMPL_RELEASE_INHERITED(nsContentSubtreeIterator, nsContentIterator)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsContentSubtreeIterator)
NS_INTERFACE_MAP_END_INHERITING(nsContentIterator)
NS_IMPL_CYCLE_COLLECTION_CLASS(nsContentSubtreeIterator)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsContentSubtreeIterator, nsContentIterator)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mRange)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsContentSubtreeIterator, nsContentIterator)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mRange)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
nsresult NS_NewContentSubtreeIterator(nsIContentIterator** aInstancePtrResult);