Chromium Code Reviews| 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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 189 // Base class for classes that wish to inherit from RefCountedGarbageCollected ( in non-Oilpan world) and | 189 // Base class for classes that wish to inherit from RefCountedGarbageCollected ( in non-Oilpan world) and |
| 190 // EventTargetWithInlineData (in both worlds). For details about how to use this class template, see the comments for | 190 // EventTargetWithInlineData (in both worlds). For details about how to use this class template, see the comments for |
| 191 // EventTargetWithInlineData above. | 191 // EventTargetWithInlineData above. |
| 192 // | 192 // |
| 193 // This class template exists to circumvent Oilpan's "leftmost class rule", wher e the Oilpan classes must come first in | 193 // This class template exists to circumvent Oilpan's "leftmost class rule", wher e the Oilpan classes must come first in |
| 194 // the base class list to avoid memory offset adjustment. In non-Oilpan world, R efCountedGarbageCollected<T> must come | 194 // the base class list to avoid memory offset adjustment. In non-Oilpan world, R efCountedGarbageCollected<T> must come |
| 195 // first, but in Oilpan world EventTargetWithInlineData needs to come first. Thi s class templates does the required | 195 // first, but in Oilpan world EventTargetWithInlineData needs to come first. Thi s class templates does the required |
| 196 // #if-switch here, in order to avoid a lot of "#if ENABLE(OILPAN)"-s sprinkled in the derived classes. | 196 // #if-switch here, in order to avoid a lot of "#if ENABLE(OILPAN)"-s sprinkled in the derived classes. |
| 197 #if ENABLE(OILPAN) | 197 #if ENABLE(OILPAN) |
| 198 template <typename T> | 198 template <typename T> |
| 199 class RefCountedGarbageCollectedEventTargetWithInlineData : public EventTargetWi thInlineData { }; | 199 class RefCountedGarbageCollectedEventTargetWithInlineData : public EventTargetWi thInlineData { |
| 200 public: | |
| 201 GC_PLUGIN_IGNORE("491488") | |
| 202 void* operator new(size_t size) | |
|
haraken
2015/06/01 08:42:52
I'm OK with this approach, but it's error-prone th
haraken
2015/06/01 09:12:58
You can implement the verirication(s) in a follow-
sof
2015/06/01 14:51:36
Will followup, at least for the latter one.
| |
| 203 { | |
| 204 // If T is eagerly finalized, it needs to be allocated accordingly. | |
| 205 // Redefinition of the operator is needed to accomplish that, as otherwi se | |
| 206 // it would be allocated using GarbageCollected<EventTarget>'s operator new. | |
| 207 // EventTarget is not eagerly finalized. | |
| 208 return allocateObject(size, IsEagerlyFinalizedType<T>::value); | |
| 209 } | |
| 210 }; | |
| 200 #else | 211 #else |
| 201 template <typename T> | 212 template <typename T> |
| 202 class RefCountedGarbageCollectedEventTargetWithInlineData : public RefCountedGar bageCollected<T>, public EventTargetWithInlineData { | 213 class RefCountedGarbageCollectedEventTargetWithInlineData : public RefCountedGar bageCollected<T>, public EventTargetWithInlineData { |
| 203 public: | 214 public: |
| 204 DEFINE_INLINE_VIRTUAL_TRACE() { EventTargetWithInlineData::trace(visitor); } | 215 DEFINE_INLINE_VIRTUAL_TRACE() { EventTargetWithInlineData::trace(visitor); } |
| 205 }; | 216 }; |
| 206 #endif | 217 #endif |
| 207 | 218 |
| 208 // FIXME: These macros should be split into separate DEFINE and DECLARE | 219 // FIXME: These macros should be split into separate DEFINE and DECLARE |
| 209 // macros to avoid causing so many header includes. | 220 // macros to avoid causing so many header includes. |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 295 #define DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(baseClass) DEFINE_EVENT_ TARGET_REFCOUNTING(baseClass) | 306 #define DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(baseClass) DEFINE_EVENT_ TARGET_REFCOUNTING(baseClass) |
| 296 | 307 |
| 297 #endif // ENABLE(OILPAN) | 308 #endif // ENABLE(OILPAN) |
| 298 | 309 |
| 299 // Use this macro if your EventTarget subclass is also a subclass of WTF::RefCou nted. | 310 // Use this macro if your EventTarget subclass is also a subclass of WTF::RefCou nted. |
| 300 // A ref-counted class that uses a different method of refcounting should use DE FINE_EVENT_TARGET_REFCOUNTING directly. | 311 // A ref-counted class that uses a different method of refcounting should use DE FINE_EVENT_TARGET_REFCOUNTING directly. |
| 301 // Both of these macros are meant to be placed just before the "public:" section of the class declaration. | 312 // Both of these macros are meant to be placed just before the "public:" section of the class declaration. |
| 302 #define REFCOUNTED_EVENT_TARGET(className) DEFINE_EVENT_TARGET_REFCOUNTING_WILL_ BE_REMOVED(RefCounted<className>) | 313 #define REFCOUNTED_EVENT_TARGET(className) DEFINE_EVENT_TARGET_REFCOUNTING_WILL_ BE_REMOVED(RefCounted<className>) |
| 303 | 314 |
| 304 #endif // EventTarget_h | 315 #endif // EventTarget_h |
| OLD | NEW |