зеркало из https://github.com/mozilla/pjs.git
Bug 385082, make nsDOMEvents ccollectable (to fix leak in wordpress.com), r+sr=peterv
This commit is contained in:
Родитель
f7bc5bcfc4
Коммит
1a538787ac
|
@ -141,10 +141,9 @@ nsDOMEvent::~nsDOMEvent()
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF(nsDOMEvent)
|
||||
NS_IMPL_RELEASE(nsDOMEvent)
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMEvent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsDOMEvent)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMEvent)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNSEvent)
|
||||
|
@ -152,6 +151,62 @@ NS_INTERFACE_MAP_BEGIN(nsDOMEvent)
|
|||
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(Event)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDOMEvent)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDOMEvent)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDOMEvent)
|
||||
if (tmp->mEventIsInternal) {
|
||||
tmp->mEvent->target = nsnull;
|
||||
tmp->mEvent->currentTarget = nsnull;
|
||||
tmp->mEvent->originalTarget = nsnull;
|
||||
switch (tmp->mEvent->eventStructType) {
|
||||
case NS_MOUSE_EVENT:
|
||||
case NS_MOUSE_SCROLL_EVENT:
|
||||
NS_STATIC_CAST(nsMouseEvent_base*, tmp->mEvent)->relatedTarget = nsnull;
|
||||
break;
|
||||
case NS_XUL_COMMAND_EVENT:
|
||||
NS_STATIC_CAST(nsXULCommandEvent*, tmp->mEvent)->sourceEvent = nsnull;
|
||||
break;
|
||||
case NS_MUTATION_EVENT:
|
||||
NS_STATIC_CAST(nsMutationEvent*, tmp->mEvent)->mRelatedNode = nsnull;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mPresContext);
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mTmpRealOriginalTarget)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mExplicitOriginalTarget)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMEvent)
|
||||
if (tmp->mEventIsInternal) {
|
||||
cb.NoteXPCOMChild(tmp->mEvent->target);
|
||||
cb.NoteXPCOMChild(tmp->mEvent->currentTarget);
|
||||
cb.NoteXPCOMChild(tmp->mEvent->originalTarget);
|
||||
switch (tmp->mEvent->eventStructType) {
|
||||
case NS_MOUSE_EVENT:
|
||||
case NS_MOUSE_SCROLL_EVENT:
|
||||
cb.NoteXPCOMChild(
|
||||
NS_STATIC_CAST(nsMouseEvent_base*, tmp->mEvent)->relatedTarget);
|
||||
break;
|
||||
case NS_XUL_COMMAND_EVENT:
|
||||
cb.NoteXPCOMChild(
|
||||
NS_STATIC_CAST(nsXULCommandEvent*, tmp->mEvent)->sourceEvent);
|
||||
break;
|
||||
case NS_MUTATION_EVENT:
|
||||
cb.NoteXPCOMChild(
|
||||
NS_STATIC_CAST(nsMutationEvent*, tmp->mEvent)->mRelatedNode);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mPresContext)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTmpRealOriginalTarget)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mExplicitOriginalTarget)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
// nsIDOMEventInterface
|
||||
NS_METHOD nsDOMEvent::GetType(nsAString& aType)
|
||||
{
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#include "nsPresContext.h"
|
||||
#include "nsPoint.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
|
||||
class nsIContent;
|
||||
class nsIScrollableView;
|
||||
|
@ -140,7 +141,8 @@ public:
|
|||
nsDOMEvent(nsPresContext* aPresContext, nsEvent* aEvent);
|
||||
virtual ~nsDOMEvent();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsDOMEvent, nsIDOMEvent)
|
||||
|
||||
// nsIDOMEvent Interface
|
||||
NS_DECL_NSIDOMEVENT
|
||||
|
|
|
@ -103,10 +103,20 @@ nsDOMUIEvent::nsDOMUIEvent(nsPresContext* aPresContext, nsGUIEvent* aEvent)
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMUIEvent)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsDOMUIEvent, nsDOMEvent)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mView)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsDOMUIEvent, nsDOMEvent)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mView)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsDOMUIEvent, nsDOMEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDOMUIEvent, nsDOMEvent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsDOMUIEvent)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMUIEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMUIEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNSUIEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIPrivateCompositionEvent)
|
||||
|
|
|
@ -54,6 +54,7 @@ public:
|
|||
nsDOMUIEvent(nsPresContext* aPresContext, nsGUIEvent* aEvent);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMUIEvent, nsDOMEvent)
|
||||
|
||||
// nsIDOMUIEvent Interface
|
||||
NS_DECL_NSIDOMUIEVENT
|
||||
|
|
Загрузка…
Ссылка в новой задаче