OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
6 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 6 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
7 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> | 7 * (C) 2007, 2008 Nikolas Zimmermann <zimmermann@kde.org> |
8 * | 8 * |
9 * Redistribution and use in source and binary forms, with or without | 9 * Redistribution and use in source and binary forms, with or without |
10 * modification, are permitted provided that the following conditions | 10 * modification, are permitted provided that the following conditions |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 struct EventTargetData { | 65 struct EventTargetData { |
66 WTF_MAKE_NONCOPYABLE(EventTargetData); WTF_MAKE_FAST_ALLOCATED; | 66 WTF_MAKE_NONCOPYABLE(EventTargetData); WTF_MAKE_FAST_ALLOCATED; |
67 public: | 67 public: |
68 EventTargetData(); | 68 EventTargetData(); |
69 ~EventTargetData(); | 69 ~EventTargetData(); |
70 | 70 |
71 EventListenerMap eventListenerMap; | 71 EventListenerMap eventListenerMap; |
72 OwnPtr<FiringEventIteratorVector> firingEventIterators; | 72 OwnPtr<FiringEventIteratorVector> firingEventIterators; |
73 }; | 73 }; |
74 | 74 |
75 class EventTarget { | 75 class EventTarget : public WillBeGarbageCollectedMixin { |
76 public: | 76 public: |
77 void ref() { refEventTarget(); } | 77 void ref() { refEventTarget(); } |
78 void deref() { derefEventTarget(); } | 78 void deref() { derefEventTarget(); } |
79 | 79 |
80 virtual const AtomicString& interfaceName() const = 0; | 80 virtual const AtomicString& interfaceName() const = 0; |
81 virtual ExecutionContext* executionContext() const = 0; | 81 virtual ExecutionContext* executionContext() const = 0; |
82 | 82 |
83 virtual Node* toNode(); | 83 virtual Node* toNode(); |
84 virtual DOMWindow* toDOMWindow(); | 84 virtual DOMWindow* toDOMWindow(); |
85 virtual MessagePort* toMessagePort(); | 85 virtual MessagePort* toMessagePort(); |
(...skipping 17 matching lines...) Expand all Loading... |
103 EventListener* getAttributeEventListener(const AtomicString& eventType); | 103 EventListener* getAttributeEventListener(const AtomicString& eventType); |
104 | 104 |
105 bool hasEventListeners() const; | 105 bool hasEventListeners() const; |
106 bool hasEventListeners(const AtomicString& eventType) const; | 106 bool hasEventListeners(const AtomicString& eventType) const; |
107 bool hasCapturingEventListeners(const AtomicString& eventType); | 107 bool hasCapturingEventListeners(const AtomicString& eventType); |
108 const EventListenerVector& getEventListeners(const AtomicString& eventType); | 108 const EventListenerVector& getEventListeners(const AtomicString& eventType); |
109 Vector<AtomicString> eventTypes(); | 109 Vector<AtomicString> eventTypes(); |
110 | 110 |
111 bool fireEventListeners(Event*); | 111 bool fireEventListeners(Event*); |
112 | 112 |
| 113 virtual void trace(Visitor*) { } |
| 114 |
113 protected: | 115 protected: |
114 virtual ~EventTarget(); | 116 virtual ~EventTarget(); |
115 | 117 |
116 // Subclasses should likely not override these themselves; instead, they sho
uld subclass EventTargetWithInlineData. | 118 // Subclasses should likely not override these themselves; instead, they sho
uld subclass EventTargetWithInlineData. |
117 virtual EventTargetData* eventTargetData() = 0; | 119 virtual EventTargetData* eventTargetData() = 0; |
118 virtual EventTargetData& ensureEventTargetData() = 0; | 120 virtual EventTargetData& ensureEventTargetData() = 0; |
119 | 121 |
120 private: | 122 private: |
121 // Subclasses should likely not override these themselves; instead, they sho
uld use the REFCOUNTED_EVENT_TARGET() macro. | 123 // Subclasses should likely not override these themselves; instead, they sho
uld use the REFCOUNTED_EVENT_TARGET() macro. |
122 virtual void refEventTarget() = 0; | 124 virtual void refEventTarget() = 0; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 using baseClass::ref; \ | 218 using baseClass::ref; \ |
217 using baseClass::deref; \ | 219 using baseClass::deref; \ |
218 private: \ | 220 private: \ |
219 virtual void refEventTarget() OVERRIDE FINAL { ref(); } \ | 221 virtual void refEventTarget() OVERRIDE FINAL { ref(); } \ |
220 virtual void derefEventTarget() OVERRIDE FINAL { deref(); } \ | 222 virtual void derefEventTarget() OVERRIDE FINAL { deref(); } \ |
221 typedef int thisIsHereToForceASemiColonAfterThisEventTargetMacro | 223 typedef int thisIsHereToForceASemiColonAfterThisEventTargetMacro |
222 | 224 |
223 // Use this macro if your EventTarget subclass is also a subclass of WTF::RefCou
nted. | 225 // Use this macro if your EventTarget subclass is also a subclass of WTF::RefCou
nted. |
224 // A ref-counted class that uses a different method of refcounting should use DE
FINE_EVENT_TARGET_REFCOUNTING directly. | 226 // A ref-counted class that uses a different method of refcounting should use DE
FINE_EVENT_TARGET_REFCOUNTING directly. |
225 // Both of these macros are meant to be placed just before the "public:" section
of the class declaration. | 227 // Both of these macros are meant to be placed just before the "public:" section
of the class declaration. |
226 #define REFCOUNTED_EVENT_TARGET(className) DEFINE_EVENT_TARGET_REFCOUNTING(RefCo
unted<className>) | 228 #define REFCOUNTED_EVENT_TARGET(className) DEFINE_EVENT_TARGET_REFCOUNTING(RefCo
untedWillBeRefCountedGarbageCollected<className>) |
227 | 229 |
228 #endif // EventTarget_h | 230 #endif // EventTarget_h |
OLD | NEW |