Bug 750424 - Make nsXULPrototypeNode an nsISupports (r=smaug)

This commit is contained in:
Bill McCloskey 2012-04-30 15:54:16 -07:00
Родитель 799eae8b67
Коммит 9bf329bcdd
3 изменённых файлов: 17 добавлений и 26 удалений

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

@ -371,8 +371,7 @@ NS_TrustedNewXULElement(nsIContent** aResult, already_AddRefed<nsINodeInfo> aNod
NS_IMPL_CYCLE_COLLECTION_CLASS(nsXULElement)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXULElement,
nsStyledElement)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mPrototype,
nsXULPrototypeElement)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mPrototype)
{
nsXULSlots* slots = static_cast<nsXULSlots*>(tmp->GetExistingSlots());
if (slots) {
@ -2526,7 +2525,7 @@ nsXULElement::RecompileScriptEventListeners()
}
NS_IMPL_CYCLE_COLLECTION_CLASS(nsXULPrototypeNode)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_NATIVE(nsXULPrototypeNode)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsXULPrototypeNode)
if (tmp->mType == nsXULPrototypeNode::eType_Element) {
static_cast<nsXULPrototypeElement*>(tmp)->Unlink();
}
@ -2534,7 +2533,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_NATIVE(nsXULPrototypeNode)
static_cast<nsXULPrototypeScript*>(tmp)->UnlinkJSObjects();
}
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_BEGIN(nsXULPrototypeNode)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsXULPrototypeNode)
if (tmp->mType == nsXULPrototypeNode::eType_Element) {
nsXULPrototypeElement *elem =
static_cast<nsXULPrototypeElement*>(tmp);
@ -2550,14 +2549,13 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_BEGIN(nsXULPrototypeNode)
}
}
for (i = 0; i < elem->mChildren.Length(); ++i) {
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_PTR(elem->mChildren[i].get(),
nsXULPrototypeNode,
"mChildren[i]")
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mChildren[i]");
cb.NoteXPCOMChild(elem->mChildren[i]);
}
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_TRACE_NATIVE_BEGIN(nsXULPrototypeNode)
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsXULPrototypeNode)
if (tmp->mType == nsXULPrototypeNode::eType_Element) {
nsXULPrototypeElement *elem =
static_cast<nsXULPrototypeElement*>(tmp);
@ -2577,8 +2575,13 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_NATIVE_BEGIN(nsXULPrototypeNode)
"mScriptObject.mObject")
}
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(nsXULPrototypeNode, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(nsXULPrototypeNode, Release)
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsXULPrototypeNode)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsXULPrototypeNode)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsXULPrototypeNode)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
//----------------------------------------------------------------------
//

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

@ -187,14 +187,14 @@ public:
*/
class nsXULPrototypeNode
class nsXULPrototypeNode : public nsISupports
{
public:
enum Type { eType_Element, eType_Script, eType_Text, eType_PI };
Type mType;
nsAutoRefCnt mRefCnt;
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
virtual ~nsXULPrototypeNode() {}
virtual nsresult Serialize(nsIObjectOutputStream* aStream,
@ -210,17 +210,6 @@ public:
virtual PRUint32 ClassSize() = 0;
#endif
void AddRef() {
++mRefCnt;
NS_LOG_ADDREF(this, mRefCnt, ClassName(), ClassSize());
}
void Release()
{
--mRefCnt;
NS_LOG_RELEASE(this, mRefCnt, ClassName());
if (mRefCnt == 0)
delete this;
}
/**
* The prototype document must call ReleaseSubtree when it is going
* away. This makes the parents through the tree stop owning their
@ -231,7 +220,7 @@ public:
*/
virtual void ReleaseSubtree() { }
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(nsXULPrototypeNode)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsXULPrototypeNode)
protected:
nsXULPrototypeNode(Type aType)

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

@ -204,8 +204,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsXULPrototypeDocument)
if (nsCCUncollectableMarker::InGeneration(cb, tmp->mCCGeneration)) {
return NS_SUCCESS_INTERRUPTED_TRAVERSE;
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mRoot,
nsXULPrototypeElement)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mRoot)
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mGlobalObject");
cb.NoteXPCOMChild(static_cast<nsIScriptGlobalObject*>(tmp->mGlobalObject));
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mNodeInfoManager,