Chromium Code Reviews| Index: Source/platform/Supplementable.h | 
| diff --git a/Source/platform/Supplementable.h b/Source/platform/Supplementable.h | 
| index a15d59cabe3ade8cb9958434e6fa48b60b83ee02..bbe5c0639c3408d44a071a75213d54f955f863ef 100644 | 
| --- a/Source/platform/Supplementable.h | 
| +++ b/Source/platform/Supplementable.h | 
| @@ -100,13 +100,11 @@ struct SupplementableTraits; | 
| template<typename T> | 
| struct SupplementableTraits<T, true> { | 
| typedef RawPtr<SupplementBase<T, true> > SupplementArgumentType; | 
| - typedef HeapHashMap<const char*, Member<SupplementBase<T, true> >, PtrHash<const char*> > SupplementMap; | 
| }; | 
| template<typename T> | 
| struct SupplementableTraits<T, false> { | 
| typedef PassOwnPtr<SupplementBase<T, false> > SupplementArgumentType; | 
| - typedef HashMap<const char*, OwnPtr<SupplementBase<T, false> >, PtrHash<const char*> > SupplementMap; | 
| }; | 
| template<bool> | 
| @@ -119,6 +117,10 @@ template<> | 
| class SupplementTracing<false> { | 
| public: | 
| virtual ~SupplementTracing() { } | 
| + // FIXME: Oilpan: this trace() method is only provided to minimize | 
| + // the use of ENABLE(OILPAN) for Supplements deriving from the | 
| + // transition type WillBeHeapSupplement<>. Remove when that | 
| + // transition type is (or its use is greatly reduced.) | 
| 
 
haraken
2014/09/23 02:33:46
is => is gone
 
sof
2014/09/23 05:21:08
Thanks, done.
 
 | 
| virtual void trace(Visitor*) { } | 
| }; | 
| @@ -145,9 +147,32 @@ public: | 
| } | 
| }; | 
| +template<typename T, bool isGarbageCollected> | 
| +class SupplementableTracing; | 
| + | 
| +template<typename T> | 
| +class SupplementableTracing<T, true> : public GarbageCollectedMixin { | 
| +public: | 
| + virtual void trace(Visitor* visitor) | 
| + { | 
| + visitor->trace(m_supplements); | 
| + } | 
| + | 
| +protected: | 
| + typedef HeapHashMap<const char*, Member<SupplementBase<T, true> >, PtrHash<const char*> > SupplementMap; | 
| + SupplementMap m_supplements; | 
| +}; | 
| + | 
| +template<typename T> | 
| +class SupplementableTracing<T, false> { | 
| +protected: | 
| + typedef HashMap<const char*, OwnPtr<SupplementBase<T, false> >, PtrHash<const char*> > SupplementMap; | 
| + SupplementMap m_supplements; | 
| +}; | 
| + | 
| // Helper class for implementing Supplementable and HeapSupplementable. | 
| template<typename T, bool isGarbageCollected = false> | 
| -class SupplementableBase { | 
| +class SupplementableBase : public SupplementableTracing<T, isGarbageCollected> { | 
| public: | 
| void provideSupplement(const char* key, typename SupplementableTraits<T, isGarbageCollected>::SupplementArgumentType supplement) | 
| { | 
| @@ -175,17 +200,6 @@ public: | 
| #endif | 
| } | 
| - // We have a trace method in the SupplementableBase class to ensure we have | 
| - // the vtable at the first word of the object. However we don't trace the | 
| - // m_supplements here, but in the partially specialized template subclasses | 
| - // since we only want to trace it for garbage collected classes. | 
| - virtual void trace(Visitor*) { } | 
| - | 
| - // FIXME: Oilpan: Make private and remove this ignore once PersistentHeapSupplementable is removed again. | 
| -protected: | 
| - GC_PLUGIN_IGNORE("") | 
| - typename SupplementableTraits<T, isGarbageCollected>::SupplementMap m_supplements; | 
| - | 
| #if ENABLE(ASSERT) | 
| protected: | 
| SupplementableBase() : m_threadId(currentThread()) { } | 
| @@ -195,38 +209,17 @@ private: | 
| #endif | 
| }; | 
| -// This class is used to make an on-heap class supplementable. Its supplements | 
| -// must be HeapSupplement. | 
| template<typename T> | 
| class HeapSupplement : public SupplementBase<T, true> { }; | 
| -// FIXME: Oilpan: Move GarbageCollectedMixin to SupplementableBase<T, true> once PersistentHeapSupplementable is removed again. | 
| template<typename T> | 
| -class GC_PLUGIN_IGNORE("http://crbug.com/395036") HeapSupplementable : public SupplementableBase<T, true>, public GarbageCollectedMixin { | 
| -public: | 
| - virtual void trace(Visitor* visitor) OVERRIDE | 
| - { | 
| - visitor->trace(this->m_supplements); | 
| - SupplementableBase<T, true>::trace(visitor); | 
| - } | 
| -}; | 
| +class HeapSupplementable : public SupplementableBase<T, true> { }; | 
| template<typename T> | 
| class Supplement : public SupplementBase<T, false> { }; | 
| -// This class is used to make an off-heap class supplementable with off-heap | 
| -// supplements (Supplement). | 
| template<typename T> | 
| -class GC_PLUGIN_IGNORE("http://crbug.com/395036") Supplementable : public SupplementableBase<T, false> { | 
| -public: | 
| - virtual void trace(Visitor* visitor) | 
| - { | 
| - // No tracing of off-heap supplements. We should not have any Supplementable | 
| - // object on the heap. | 
| - COMPILE_ASSERT(!IsGarbageCollectedType<T>::value, GarbageCollectedObjectMustBeHeapSupplementable); | 
| - SupplementableBase<T, false>::trace(visitor); | 
| - } | 
| -}; | 
| +class Supplementable : public SupplementableBase<T, false> { }; | 
| template<typename T> | 
| struct ThreadingTrait<SupplementBase<T, true> > { |