Chromium Code Reviews| Index: third_party/WebKit/Source/core/events/EventTarget.h |
| diff --git a/third_party/WebKit/Source/core/events/EventTarget.h b/third_party/WebKit/Source/core/events/EventTarget.h |
| index c5dfe998778d8bc5502d0c75bc8102f74c6c9d5a..b789c84441cecc17edffc4b4e86c064c3f56d6c4 100644 |
| --- a/third_party/WebKit/Source/core/events/EventTarget.h |
| +++ b/third_party/WebKit/Source/core/events/EventTarget.h |
| @@ -83,12 +83,10 @@ public: |
| // EventTarget, follow these steps: |
| // - Make your IDL interface inherit from EventTarget. |
| // Optionally add "attribute EventHandler onfoo;" attributes. |
| -// - Inherit from EventTargetWithInlineData (only in rare cases should you use |
| -// EventTarget directly); or, if you want YourClass to be inherited from |
| -// RefCountedGarbageCollected<YourClass> in addition to EventTargetWithInlineData, |
| -// inherit from RefCountedGarbageCollectedEventTargetWithInlineData<YourClass>. |
| +// - Inherit from EventTargetWithInlineData<YourClass> (only in rare cases |
| +// should you use EventTarget directly). |
| // - In your class declaration, EventTargetWithInlineData (or |
| -// RefCountedGarbageCollectedEventTargetWithInlineData<>) must come first in |
| +// EventTargetWithInlineData<>) must come first in |
| // the base class list. If your class is non-final, classes inheriting from |
| // your class need to come first, too. |
| // - Figure out if you now need to inherit from ActiveDOMObject as well. |
| @@ -106,7 +104,7 @@ public: |
| // return ActiveDOMObject::executionContext (if you are an ActiveDOMObject) |
| // or the document you're in. |
| // - Your trace() method will need to call EventTargetWithInlineData::trace |
| -// or RefCountedGarbageCollectedEventTargetWithInlineData<YourClass>::trace, |
| +// or EventTargetWithInlineData<YourClass>::trace, |
| // depending on the base class of your class. |
| // |
| // Optionally, add a FooEvent.idl class, but that's outside the scope of this |
| @@ -195,33 +193,8 @@ private: |
| // object. However, we intentionally use it as a part of object for performance, |
| // assuming that no one extracts a pointer of |
| // EventTargetWithInlineData::m_eventTargetData and store it to a Member etc. |
| -class GC_PLUGIN_IGNORE("513199") CORE_EXPORT EventTargetWithInlineData : public EventTarget { |
| -public: |
| - DEFINE_INLINE_VIRTUAL_TRACE() |
| - { |
| - visitor->trace(m_eventTargetData); |
| - EventTarget::trace(visitor); |
| - } |
| - |
| -protected: |
| - EventTargetData* eventTargetData() final { return &m_eventTargetData; } |
| - EventTargetData& ensureEventTargetData() final { return m_eventTargetData; } |
| - |
| -private: |
| - EventTargetData m_eventTargetData; |
| -}; |
| - |
| -// Base class for classes that wish to inherit from RefCountedGarbageCollected (in non-Oilpan world) and |
| -// EventTargetWithInlineData (in both worlds). For details about how to use this class template, see the comments for |
| -// EventTargetWithInlineData above. |
| -// |
| -// This class template exists to circumvent Oilpan's "leftmost class rule", where the Oilpan classes must come first in |
| -// the base class list to avoid memory offset adjustment. In non-Oilpan world, RefCountedGarbageCollected<T> must come |
| -// first, but in Oilpan world EventTargetWithInlineData needs to come first. This class templates does the required |
| -// #if-switch here, in order to avoid a lot of "#if ENABLE(OILPAN)"-s sprinkled in the derived classes. |
| -#if ENABLE(OILPAN) |
| template <typename T> |
| -class RefCountedGarbageCollectedEventTargetWithInlineData : public EventTargetWithInlineData { |
| +class GC_PLUGIN_IGNORE("513199") CORE_EXPORT EventTargetWithInlineData : public EventTarget { |
|
haraken
2016/04/06 11:23:56
tasak@ told me that this doesn't work because of M
|
| public: |
| GC_PLUGIN_IGNORE("491488") |
| void* operator new(size_t size) |
| @@ -235,16 +208,17 @@ public: |
| DEFINE_INLINE_VIRTUAL_TRACE() |
| { |
| - EventTargetWithInlineData::trace(visitor); |
| + visitor->trace(m_eventTargetData); |
| + EventTarget::trace(visitor); |
| } |
| + |
| +protected: |
| + EventTargetData* eventTargetData() final { return &m_eventTargetData; } |
| + EventTargetData& ensureEventTargetData() final { return m_eventTargetData; } |
| + |
| +private: |
| + EventTargetData m_eventTargetData; |
| }; |
| -#else |
| -template <typename T> |
| -class RefCountedGarbageCollectedEventTargetWithInlineData : public RefCountedGarbageCollected<T>, public EventTargetWithInlineData { |
| -public: |
| - DEFINE_INLINE_VIRTUAL_TRACE() { EventTargetWithInlineData::trace(visitor); } |
| -}; |
| -#endif |
| // FIXME: These macros should be split into separate DEFINE and DECLARE |
| // macros to avoid causing so many header includes. |