OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef GCInfo_h | 5 #ifndef GCInfo_h |
6 #define GCInfo_h | 6 #define GCInfo_h |
7 | 7 |
8 #include "platform/heap/Visitor.h" | 8 #include "platform/heap/Visitor.h" |
9 #include "wtf/Assertions.h" | 9 #include "wtf/Assertions.h" |
10 #include "wtf/Atomics.h" | 10 #include "wtf/Atomics.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 // inherits from GarbageCollected or GarbageCollectedFinalized. | 112 // inherits from GarbageCollected or GarbageCollectedFinalized. |
113 struct GCInfo { | 113 struct GCInfo { |
114 using GetClassNameCallback = const String (*)(); | 114 using GetClassNameCallback = const String (*)(); |
115 | 115 |
116 bool hasFinalizer() const { return m_nonTrivialFinalizer; } | 116 bool hasFinalizer() const { return m_nonTrivialFinalizer; } |
117 bool hasVTable() const { return m_hasVTable; } | 117 bool hasVTable() const { return m_hasVTable; } |
118 TraceCallback m_trace; | 118 TraceCallback m_trace; |
119 FinalizationCallback m_finalize; | 119 FinalizationCallback m_finalize; |
120 bool m_nonTrivialFinalizer; | 120 bool m_nonTrivialFinalizer; |
121 bool m_hasVTable; | 121 bool m_hasVTable; |
122 #if ENABLE(GC_PROFILING) | 122 #if ENABLE(DETAILED_MEMORY_INFRA) |
123 const String className() const { return m_className(); } | 123 const String className() const { return m_className(); } |
124 GetClassNameCallback m_className; | 124 GetClassNameCallback m_className; |
125 #endif | 125 #endif |
126 }; | 126 }; |
127 | 127 |
128 #if ENABLE(ASSERT) | 128 #if ENABLE(ASSERT) |
129 PLATFORM_EXPORT void assertObjectHasGCInfo(const void*, size_t gcInfoIndex); | 129 PLATFORM_EXPORT void assertObjectHasGCInfo(const void*, size_t gcInfoIndex); |
130 #endif | 130 #endif |
131 | 131 |
132 class GCInfoTable { | 132 class GCInfoTable { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 template<typename T> | 167 template<typename T> |
168 struct GCInfoAtBase { | 168 struct GCInfoAtBase { |
169 static size_t index() | 169 static size_t index() |
170 { | 170 { |
171 static_assert(sizeof(T), "T must be fully defined"); | 171 static_assert(sizeof(T), "T must be fully defined"); |
172 static const GCInfo gcInfo = { | 172 static const GCInfo gcInfo = { |
173 TraceTrait<T>::trace, | 173 TraceTrait<T>::trace, |
174 FinalizerTrait<T>::finalize, | 174 FinalizerTrait<T>::finalize, |
175 FinalizerTrait<T>::nonTrivialFinalizer, | 175 FinalizerTrait<T>::nonTrivialFinalizer, |
176 WTF::IsPolymorphic<T>::value, | 176 WTF::IsPolymorphic<T>::value, |
177 #if ENABLE(GC_PROFILING) | 177 #if ENABLE(DETAILED_MEMORY_INFRA) |
178 TypenameStringTrait<T>::get | 178 TypenameStringTrait<T>::get |
179 #endif | 179 #endif |
180 }; | 180 }; |
181 RETURN_GCINFO_INDEX(); | 181 RETURN_GCINFO_INDEX(); |
182 } | 182 } |
183 }; | 183 }; |
184 | 184 |
185 template<typename T, bool = WTF::IsSubclassOfTemplate<typename WTF::RemoveConst<
T>::Type, GarbageCollected>::value> struct GetGarbageCollectedBase; | 185 template<typename T, bool = WTF::IsSubclassOfTemplate<typename WTF::RemoveConst<
T>::Type, GarbageCollected>::value> struct GetGarbageCollectedBase; |
186 | 186 |
187 template<typename T> | 187 template<typename T> |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 template<typename T, size_t inlineCapacity> | 223 template<typename T, size_t inlineCapacity> |
224 struct GCInfoTrait<HeapVector<T, inlineCapacity>> : public GCInfoTrait<Vector<T,
inlineCapacity, HeapAllocator>> { }; | 224 struct GCInfoTrait<HeapVector<T, inlineCapacity>> : public GCInfoTrait<Vector<T,
inlineCapacity, HeapAllocator>> { }; |
225 template<typename T, size_t inlineCapacity> | 225 template<typename T, size_t inlineCapacity> |
226 struct GCInfoTrait<HeapDeque<T, inlineCapacity>> : public GCInfoTrait<Deque<T, i
nlineCapacity, HeapAllocator>> { }; | 226 struct GCInfoTrait<HeapDeque<T, inlineCapacity>> : public GCInfoTrait<Deque<T, i
nlineCapacity, HeapAllocator>> { }; |
227 template<typename T, typename U, typename V> | 227 template<typename T, typename U, typename V> |
228 struct GCInfoTrait<HeapHashCountedSet<T, U, V>> : public GCInfoTrait<HashCounted
Set<T, U, V, HeapAllocator>> { }; | 228 struct GCInfoTrait<HeapHashCountedSet<T, U, V>> : public GCInfoTrait<HashCounted
Set<T, U, V, HeapAllocator>> { }; |
229 | 229 |
230 } // namespace blink | 230 } // namespace blink |
231 | 231 |
232 #endif | 232 #endif |
OLD | NEW |