Bug 931571, part 11 - Turn nsDiscriminatedUnion's Traverse function into a method. r=froydnj

This commit is contained in:
Andrew McCreight 2015-07-23 12:28:30 -07:00
Родитель 2cca253ff3
Коммит 4bdbcd2020
3 изменённых файлов: 10 добавлений и 12 удалений

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

@ -79,7 +79,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(XPCVariant)
cb.NoteJSObject(&val.toObject());
}
nsVariant::Traverse(tmp->mData, cb);
tmp->mData.Traverse(cb);
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(XPCVariant)

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

@ -1636,22 +1636,21 @@ nsDiscriminatedUnion::Cleanup()
mType = nsIDataType::VTYPE_EMPTY;
}
/* static */ void
nsVariant::Traverse(const nsDiscriminatedUnion& aData,
nsCycleCollectionTraversalCallback& aCb)
void
nsDiscriminatedUnion::Traverse(nsCycleCollectionTraversalCallback& aCb) const
{
switch (aData.mType) {
switch (mType) {
case nsIDataType::VTYPE_INTERFACE:
case nsIDataType::VTYPE_INTERFACE_IS:
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(aCb, "mData");
aCb.NoteXPCOMChild(aData.u.iface.mInterfaceValue);
aCb.NoteXPCOMChild(u.iface.mInterfaceValue);
break;
case nsIDataType::VTYPE_ARRAY:
switch (aData.u.array.mArrayType) {
switch (u.array.mArrayType) {
case nsIDataType::VTYPE_INTERFACE:
case nsIDataType::VTYPE_INTERFACE_IS: {
nsISupports** p = (nsISupports**)aData.u.array.mArrayValue;
for (uint32_t i = aData.u.array.mArrayCount; i > 0; ++p, --i) {
nsISupports** p = (nsISupports**)u.array.mArrayValue;
for (uint32_t i = u.array.mArrayCount; i > 0; ++p, --i) {
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(aCb, "mData[i]");
aCb.NoteXPCOMChild(*p);
}

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

@ -101,6 +101,8 @@ public:
nsresult SetToEmpty();
nsresult SetToEmptyArray();
void Traverse(nsCycleCollectionTraversalCallback& aCb) const;
private:
nsresult ToManageableNumber(nsDiscriminatedUnion* aOutData) const;
void FreeArray();
@ -176,9 +178,6 @@ public:
nsVariant();
static void Traverse(const nsDiscriminatedUnion& aData,
nsCycleCollectionTraversalCallback& aCb);
private:
~nsVariant();