Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(524)

Side by Side Diff: Source/core/events/EventTarget.h

Issue 316443004: Oilpan: Remove ref counting from EventTarget and all uses of Pass/RefPtr<EventTarget>. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebase Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/events/Event.cpp ('k') | Source/core/events/EventTarget.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 : public WillBeGarbageCollectedMixin { 75 class EventTarget : public WillBeGarbageCollectedMixin {
76 public: 76 public:
77 #if !ENABLE(OILPAN)
77 void ref() { refEventTarget(); } 78 void ref() { refEventTarget(); }
78 void deref() { derefEventTarget(); } 79 void deref() { derefEventTarget(); }
80 #endif
79 81
80 virtual const AtomicString& interfaceName() const = 0; 82 virtual const AtomicString& interfaceName() const = 0;
81 virtual ExecutionContext* executionContext() const = 0; 83 virtual ExecutionContext* executionContext() const = 0;
82 84
83 virtual Node* toNode(); 85 virtual Node* toNode();
84 virtual DOMWindow* toDOMWindow(); 86 virtual DOMWindow* toDOMWindow();
85 virtual MessagePort* toMessagePort(); 87 virtual MessagePort* toMessagePort();
86 88
87 // FIXME: first 2 args to addEventListener and removeEventListener should 89 // FIXME: first 2 args to addEventListener and removeEventListener should
88 // be required (per spec), but throwing TypeError breaks legacy content. 90 // be required (per spec), but throwing TypeError breaks legacy content.
(...skipping 24 matching lines...) Expand all
113 virtual void trace(Visitor*) { } 115 virtual void trace(Visitor*) { }
114 116
115 protected: 117 protected:
116 virtual ~EventTarget(); 118 virtual ~EventTarget();
117 119
118 // Subclasses should likely not override these themselves; instead, they sho uld subclass EventTargetWithInlineData. 120 // Subclasses should likely not override these themselves; instead, they sho uld subclass EventTargetWithInlineData.
119 virtual EventTargetData* eventTargetData() = 0; 121 virtual EventTargetData* eventTargetData() = 0;
120 virtual EventTargetData& ensureEventTargetData() = 0; 122 virtual EventTargetData& ensureEventTargetData() = 0;
121 123
122 private: 124 private:
125 #if !ENABLE(OILPAN)
123 // Subclasses should likely not override these themselves; instead, they sho uld use the REFCOUNTED_EVENT_TARGET() macro. 126 // Subclasses should likely not override these themselves; instead, they sho uld use the REFCOUNTED_EVENT_TARGET() macro.
124 virtual void refEventTarget() = 0; 127 virtual void refEventTarget() = 0;
125 virtual void derefEventTarget() = 0; 128 virtual void derefEventTarget() = 0;
129 #endif
126 130
127 DOMWindow* executingWindow(); 131 DOMWindow* executingWindow();
128 void fireEventListeners(Event*, EventTargetData*, EventListenerVector&); 132 void fireEventListeners(Event*, EventTargetData*, EventListenerVector&);
129 void countLegacyEvents(const AtomicString& legacyTypeName, EventListenerVect or*, EventListenerVector*); 133 void countLegacyEvents(const AtomicString& legacyTypeName, EventListenerVect or*, EventListenerVector*);
130 134
131 bool clearAttributeEventListener(const AtomicString& eventType); 135 bool clearAttributeEventListener(const AtomicString& eventType);
132 136
133 friend class EventListenerIterator; 137 friend class EventListenerIterator;
134 }; 138 };
135 139
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 inline bool EventTarget::hasCapturingEventListeners(const AtomicString& eventTyp e) 210 inline bool EventTarget::hasCapturingEventListeners(const AtomicString& eventTyp e)
207 { 211 {
208 EventTargetData* d = eventTargetData(); 212 EventTargetData* d = eventTargetData();
209 if (!d) 213 if (!d)
210 return false; 214 return false;
211 return d->eventListenerMap.containsCapturing(eventType); 215 return d->eventListenerMap.containsCapturing(eventType);
212 } 216 }
213 217
214 } // namespace WebCore 218 } // namespace WebCore
215 219
220 #if ENABLE(OILPAN)
216 #define DEFINE_EVENT_TARGET_REFCOUNTING(baseClass) \ 221 #define DEFINE_EVENT_TARGET_REFCOUNTING(baseClass) \
217 public: \ 222 public: \
218 using baseClass::ref; \ 223 using baseClass::ref; \
224 using baseClass::deref; \
225 private: \
226 typedef int thisIsHereToForceASemiColonAfterThisEventTargetMacro
227 #define DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(baseClass)
228 #else
229 #define DEFINE_EVENT_TARGET_REFCOUNTING(baseClass) \
230 public: \
231 using baseClass::ref; \
219 using baseClass::deref; \ 232 using baseClass::deref; \
220 private: \ 233 private: \
221 virtual void refEventTarget() OVERRIDE FINAL { ref(); } \ 234 virtual void refEventTarget() OVERRIDE FINAL { ref(); } \
222 virtual void derefEventTarget() OVERRIDE FINAL { deref(); } \ 235 virtual void derefEventTarget() OVERRIDE FINAL { deref(); } \
223 typedef int thisIsHereToForceASemiColonAfterThisEventTargetMacro 236 typedef int thisIsHereToForceASemiColonAfterThisEventTargetMacro
237 #define DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(baseClass) DEFINE_EVENT_ TARGET_REFCOUNTING(baseClass)
238 #endif
224 239
225 // Use this macro if your EventTarget subclass is also a subclass of WTF::RefCou nted. 240 // Use this macro if your EventTarget subclass is also a subclass of WTF::RefCou nted.
226 // A ref-counted class that uses a different method of refcounting should use DE FINE_EVENT_TARGET_REFCOUNTING directly. 241 // A ref-counted class that uses a different method of refcounting should use DE FINE_EVENT_TARGET_REFCOUNTING directly.
227 // Both of these macros are meant to be placed just before the "public:" section of the class declaration. 242 // Both of these macros are meant to be placed just before the "public:" section of the class declaration.
228 #define REFCOUNTED_EVENT_TARGET(className) DEFINE_EVENT_TARGET_REFCOUNTING(RefCo untedWillBeRefCountedGarbageCollected<className>) 243 #define REFCOUNTED_EVENT_TARGET(className) DEFINE_EVENT_TARGET_REFCOUNTING(RefCo untedWillBeRefCountedGarbageCollected<className>)
229 244
230 #endif // EventTarget_h 245 #endif // EventTarget_h
OLDNEW
« no previous file with comments | « Source/core/events/Event.cpp ('k') | Source/core/events/EventTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698