| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // EventTarget directly); or, if you want YourClass to be inherited from | 78 // EventTarget directly); or, if you want YourClass to be inherited from |
| 79 // RefCountedGarbageCollected<YourClass> in addition to EventTargetWithInlineD
ata, | 79 // RefCountedGarbageCollected<YourClass> in addition to EventTargetWithInlineD
ata, |
| 80 // inherit from RefCountedGarbageCollectedEventTargetWithInlineData<YourClass>
. | 80 // inherit from RefCountedGarbageCollectedEventTargetWithInlineData<YourClass>
. |
| 81 // - In your class declaration, EventTargetWithInlineData (or | 81 // - In your class declaration, EventTargetWithInlineData (or |
| 82 // RefCountedGarbageCollectedEventTargetWithInlineData<>) must come first in | 82 // RefCountedGarbageCollectedEventTargetWithInlineData<>) must come first in |
| 83 // the base class list. If your class is non-final, classes inheriting from | 83 // the base class list. If your class is non-final, classes inheriting from |
| 84 // your class need to come first, too. | 84 // your class need to come first, too. |
| 85 // - Figure out if you now need to inherit from ActiveDOMObject as well. | 85 // - Figure out if you now need to inherit from ActiveDOMObject as well. |
| 86 // - In your class declaration, you will typically use | 86 // - In your class declaration, you will typically use |
| 87 // REFCOUNTED_EVENT_TARGET(YourClass) if YourClass is a RefCounted<>, | 87 // REFCOUNTED_EVENT_TARGET(YourClass) if YourClass is a RefCounted<>, |
| 88 // or DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(OtherRefCounted<YourClas
s>) | 88 // or REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(OtherRefCounted<YourClass>) |
| 89 // if YourClass uses a different kind of reference counting template such as | 89 // if YourClass uses a different kind of reference counting template such as |
| 90 // RefCountedGarbageCollected<YourClass>. | 90 // RefCountedGarbageCollected<YourClass>. |
| 91 // - Make sure to include this header file in your .h file, or you will get | 91 // - Make sure to include this header file in your .h file, or you will get |
| 92 // very strange compiler errors. | 92 // very strange compiler errors. |
| 93 // - If you added an onfoo attribute, use DEFINE_ATTRIBUTE_EVENT_LISTENER(foo) | 93 // - If you added an onfoo attribute, use DEFINE_ATTRIBUTE_EVENT_LISTENER(foo) |
| 94 // in your class declaration. | 94 // in your class declaration. |
| 95 // - Override EventTarget::interfaceName() and executionContext(). The former | 95 // - Override EventTarget::interfaceName() and executionContext(). The former |
| 96 // will typically return EventTargetNames::YourClassName. The latter will | 96 // will typically return EventTargetNames::YourClassName. The latter will |
| 97 // return ActiveDOMObject::executionContext (if you are an ActiveDOMObject) | 97 // return ActiveDOMObject::executionContext (if you are an ActiveDOMObject) |
| 98 // or the document you're in. | 98 // or the document you're in. |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 inline bool EventTarget::hasCapturingEventListeners(const AtomicString& eventTyp
e) | 273 inline bool EventTarget::hasCapturingEventListeners(const AtomicString& eventTyp
e) |
| 274 { | 274 { |
| 275 EventTargetData* d = eventTargetData(); | 275 EventTargetData* d = eventTargetData(); |
| 276 if (!d) | 276 if (!d) |
| 277 return false; | 277 return false; |
| 278 return d->eventListenerMap.containsCapturing(eventType); | 278 return d->eventListenerMap.containsCapturing(eventType); |
| 279 } | 279 } |
| 280 | 280 |
| 281 } // namespace blink | 281 } // namespace blink |
| 282 | 282 |
| 283 // If the EventTarget class is RefCounted on non-oilpan builds, |
| 284 // use REFCOUNTED_EVENT_TARGET. |
| 285 // If the EventTarget class is RefCountedGarbageCollected on non-oilpan builds, |
| 286 // use REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET. |
| 283 #if ENABLE(OILPAN) | 287 #if ENABLE(OILPAN) |
| 284 | |
| 285 #define DEFINE_EVENT_TARGET_REFCOUNTING(baseClass) | 288 #define DEFINE_EVENT_TARGET_REFCOUNTING(baseClass) |
| 286 #define DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(baseClass) | 289 #define REFCOUNTED_EVENT_TARGET(baseClass) |
| 287 | 290 #define REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(baseClass) |
| 288 #else // !ENABLE(OILPAN) | 291 #else // !ENABLE(OILPAN) |
| 289 | |
| 290 #define DEFINE_EVENT_TARGET_REFCOUNTING(baseClass) \ | 292 #define DEFINE_EVENT_TARGET_REFCOUNTING(baseClass) \ |
| 291 public: \ | 293 public: \ |
| 292 using baseClass::ref; \ | 294 using baseClass::ref; \ |
| 293 using baseClass::deref; \ | 295 using baseClass::deref; \ |
| 294 private: \ | 296 private: \ |
| 295 virtual void refEventTarget() override final { ref(); } \ | 297 virtual void refEventTarget() override final { ref(); } \ |
| 296 virtual void derefEventTarget() override final { deref(); } \ | 298 virtual void derefEventTarget() override final { deref(); } \ |
| 297 typedef int thisIsHereToForceASemiColonAfterThisEventTargetMacro | 299 typedef int thisIsHereToForceASemiColonAfterThisEventTargetMacro |
| 298 #define DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(baseClass) DEFINE_EVENT_
TARGET_REFCOUNTING(baseClass) | 300 #define REFCOUNTED_EVENT_TARGET(baseClass) DEFINE_EVENT_TARGET_REFCOUNTING(RefCo
unted<baseClass>) |
| 299 | 301 #define REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(baseClass) DEFINE_EVENT_TARGET
_REFCOUNTING(RefCountedGarbageCollected<baseClass>) |
| 300 #endif // ENABLE(OILPAN) | 302 #endif // ENABLE(OILPAN) |
| 301 | 303 |
| 302 // Use this macro if your EventTarget subclass is also a subclass of WTF::RefCou
nted. | |
| 303 // A ref-counted class that uses a different method of refcounting should use DE
FINE_EVENT_TARGET_REFCOUNTING directly. | |
| 304 // Both of these macros are meant to be placed just before the "public:" section
of the class declaration. | |
| 305 #define REFCOUNTED_EVENT_TARGET(className) DEFINE_EVENT_TARGET_REFCOUNTING_WILL_
BE_REMOVED(RefCounted<className>) | |
| 306 | |
| 307 #endif // EventTarget_h | 304 #endif // EventTarget_h |
| OLD | NEW |