| 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 // EventTargetWithInlineData above. | 216 // EventTargetWithInlineData above. |
| 217 // | 217 // |
| 218 // This class template exists to circumvent Oilpan's "leftmost class rule", wher
e the Oilpan classes must come first in | 218 // This class template exists to circumvent Oilpan's "leftmost class rule", wher
e the Oilpan classes must come first in |
| 219 // the base class list to avoid memory offset adjustment. In non-Oilpan world, R
efCountedGarbageCollected<T> must come | 219 // the base class list to avoid memory offset adjustment. In non-Oilpan world, R
efCountedGarbageCollected<T> must come |
| 220 // first, but in Oilpan world EventTargetWithInlineData needs to come first. Thi
s class templates does the required | 220 // first, but in Oilpan world EventTargetWithInlineData needs to come first. Thi
s class templates does the required |
| 221 // #if-switch here, in order to avoid a lot of "#if ENABLE(OILPAN)"-s sprinkled
in the derived classes. | 221 // #if-switch here, in order to avoid a lot of "#if ENABLE(OILPAN)"-s sprinkled
in the derived classes. |
| 222 #if ENABLE(OILPAN) | 222 #if ENABLE(OILPAN) |
| 223 template <typename T> | 223 template <typename T> |
| 224 class RefCountedGarbageCollectedEventTargetWithInlineData : public EventTargetWi
thInlineData { | 224 class RefCountedGarbageCollectedEventTargetWithInlineData : public EventTargetWi
thInlineData { |
| 225 public: | 225 public: |
| 226 GC_PLUGIN_IGNORE("491488") | |
| 227 void* operator new(size_t size) | |
| 228 { | |
| 229 // If T is eagerly finalized, it needs to be allocated accordingly. | |
| 230 // Redefinition of the operator is needed to accomplish that, as otherwi
se | |
| 231 // it would be allocated using GarbageCollected<EventTarget>'s operator
new. | |
| 232 // EventTarget is not eagerly finalized. | |
| 233 return allocateObject(size, IsEagerlyFinalizedType<T>::value); | |
| 234 } | |
| 235 | |
| 236 DEFINE_INLINE_VIRTUAL_TRACE() | 226 DEFINE_INLINE_VIRTUAL_TRACE() |
| 237 { | 227 { |
| 228 static_assert(!IsEagerlyFinalizedType<T>::value, "EventTargets do not su
pport eager finalization."); |
| 238 EventTargetWithInlineData::trace(visitor); | 229 EventTargetWithInlineData::trace(visitor); |
| 239 } | 230 } |
| 240 }; | 231 }; |
| 241 #else | 232 #else |
| 242 template <typename T> | 233 template <typename T> |
| 243 class RefCountedGarbageCollectedEventTargetWithInlineData : public RefCountedGar
bageCollected<T>, public EventTargetWithInlineData { | 234 class RefCountedGarbageCollectedEventTargetWithInlineData : public RefCountedGar
bageCollected<T>, public EventTargetWithInlineData { |
| 244 public: | 235 public: |
| 245 DEFINE_INLINE_VIRTUAL_TRACE() { EventTargetWithInlineData::trace(visitor); } | 236 DEFINE_INLINE_VIRTUAL_TRACE() { EventTargetWithInlineData::trace(visitor); } |
| 246 }; | 237 }; |
| 247 #endif | 238 #endif |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 using baseClass::deref; \ | 312 using baseClass::deref; \ |
| 322 private: \ | 313 private: \ |
| 323 void refEventTarget() final { ref(); } \ | 314 void refEventTarget() final { ref(); } \ |
| 324 void derefEventTarget() final { deref(); } \ | 315 void derefEventTarget() final { deref(); } \ |
| 325 typedef int thisIsHereToForceASemiColonAfterThisEventTargetMacro | 316 typedef int thisIsHereToForceASemiColonAfterThisEventTargetMacro |
| 326 #define REFCOUNTED_EVENT_TARGET(baseClass) DEFINE_EVENT_TARGET_REFCOUNTING(RefCo
unted<baseClass>) | 317 #define REFCOUNTED_EVENT_TARGET(baseClass) DEFINE_EVENT_TARGET_REFCOUNTING(RefCo
unted<baseClass>) |
| 327 #define REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(baseClass) DEFINE_EVENT_TARGET
_REFCOUNTING(RefCountedGarbageCollected<baseClass>) | 318 #define REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(baseClass) DEFINE_EVENT_TARGET
_REFCOUNTING(RefCountedGarbageCollected<baseClass>) |
| 328 #endif // ENABLE(OILPAN) | 319 #endif // ENABLE(OILPAN) |
| 329 | 320 |
| 330 #endif // EventTarget_h | 321 #endif // EventTarget_h |
| OLD | NEW |