Chromium Code Reviews| Index: Source/heap/Visitor.h |
| diff --git a/Source/heap/Visitor.h b/Source/heap/Visitor.h |
| index 80623bf29531b79daa213ccdecb17877dff4bd6d..aa44fda6245165eb48a571e5d62e4cd06ace11e0 100644 |
| --- a/Source/heap/Visitor.h |
| +++ b/Source/heap/Visitor.h |
| @@ -52,6 +52,7 @@ |
| namespace WebCore { |
| class FinalizedHeapObjectHeader; |
| +template<typename T> class GarbageCollected; |
| template<typename T> class GarbageCollectedFinalized; |
| class HeapObjectHeader; |
| template<typename T> class Member; |
| @@ -92,6 +93,20 @@ struct GCInfo { |
| }; |
| // Template struct to detect whether type T inherits from |
| +// GarbageCollected. |
| +template<typename T> |
| +struct IsGarbageCollected { |
|
Mads Ager (chromium)
2014/02/18 06:50:50
Can we use WTF::IsSubclassOfTemplate here?
WTF::I
Vyacheslav Egorov (Chromium)
2014/02/18 09:37:44
Done.
|
| + typedef char TrueType; |
| + struct FalseType { |
| + char dummy[2]; |
| + }; |
| + template<typename U> static TrueType has(GarbageCollected<U>*); |
| + static FalseType has(...); |
| + static bool const value = sizeof(has(static_cast<T*>(0))) == sizeof(TrueType); |
| +}; |
| + |
| + |
| +// Template struct to detect whether type T inherits from |
| // GarbageCollectedFinalized. |
| template<typename T> |
| struct IsGarbageCollectedFinalized { |
|
Mads Ager (chromium)
2014/02/18 06:50:50
I think we can get rid of this one as well and use
|