| 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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 static const bool nonTrivialFinalizer = inlineCapacity && VectorTraits<T>::n
eedsDestruction; | 149 static const bool nonTrivialFinalizer = inlineCapacity && VectorTraits<T>::n
eedsDestruction; |
| 150 static void finalize(void* obj) { FinalizerTraitImpl<Deque<T, inlineCapacity
, HeapAllocator>, nonTrivialFinalizer>::finalize(obj); } | 150 static void finalize(void* obj) { FinalizerTraitImpl<Deque<T, inlineCapacity
, HeapAllocator>, nonTrivialFinalizer>::finalize(obj); } |
| 151 }; | 151 }; |
| 152 | 152 |
| 153 template<typename Table> | 153 template<typename Table> |
| 154 struct FinalizerTrait<HeapHashTableBacking<Table>> { | 154 struct FinalizerTrait<HeapHashTableBacking<Table>> { |
| 155 static const bool nonTrivialFinalizer = !WTF::IsTriviallyDestructible<typena
me Table::ValueType>::value; | 155 static const bool nonTrivialFinalizer = !WTF::IsTriviallyDestructible<typena
me Table::ValueType>::value; |
| 156 static void finalize(void* obj) { FinalizerTraitImpl<HeapHashTableBacking<Ta
ble>, nonTrivialFinalizer>::finalize(obj); } | 156 static void finalize(void* obj) { FinalizerTraitImpl<HeapHashTableBacking<Ta
ble>, nonTrivialFinalizer>::finalize(obj); } |
| 157 }; | 157 }; |
| 158 | 158 |
| 159 // TODO(haraken): Replace this GCInfoTraits with FinalizerTraits. | |
| 160 template<typename T, typename Traits> | 159 template<typename T, typename Traits> |
| 161 struct GCInfoTrait<HeapVectorBacking<T, Traits>> { | 160 struct FinalizerTrait<HeapVectorBacking<T, Traits>> { |
| 162 static size_t index() | 161 static const bool nonTrivialFinalizer = Traits::needsDestruction; |
| 163 { | 162 static void finalize(void* obj) { FinalizerTraitImpl<HeapVectorBacking<T, Tr
aits>, nonTrivialFinalizer>::finalize(obj); } |
| 164 using TargetType = HeapVectorBacking<T, Traits>; | |
| 165 static const GCInfo gcInfo = { | |
| 166 TraceTrait<TargetType>::trace, | |
| 167 FinalizerTrait<TargetType>::finalize, | |
| 168 Traits::needsDestruction, | |
| 169 false, // We don't support embedded objects in HeapVectors with vtab
les. | |
| 170 #if ENABLE(GC_PROFILING) | |
| 171 TypenameStringTrait<TargetType>::get() | |
| 172 #endif | |
| 173 }; | |
| 174 RETURN_GCINFO_INDEX(); | |
| 175 } | |
| 176 }; | 163 }; |
| 177 | 164 |
| 178 template<typename T, typename U, typename V, typename W, typename X> class HeapH
ashMap; | 165 template<typename T, typename U, typename V, typename W, typename X> class HeapH
ashMap; |
| 179 template<typename T, typename U, typename V> class HeapHashSet; | 166 template<typename T, typename U, typename V> class HeapHashSet; |
| 180 template<typename T, typename U, typename V> class HeapLinkedHashSet; | 167 template<typename T, typename U, typename V> class HeapLinkedHashSet; |
| 181 template<typename T, size_t inlineCapacity, typename U> class HeapListHashSet; | 168 template<typename T, size_t inlineCapacity, typename U> class HeapListHashSet; |
| 182 template<typename T, size_t inlineCapacity> class HeapVector; | 169 template<typename T, size_t inlineCapacity> class HeapVector; |
| 183 template<typename T, size_t inlineCapacity> class HeapDeque; | 170 template<typename T, size_t inlineCapacity> class HeapDeque; |
| 184 template<typename T, typename U, typename V> class HeapHashCountedSet; | 171 template<typename T, typename U, typename V> class HeapHashCountedSet; |
| 185 | 172 |
| 186 template<typename T, typename U, typename V, typename W, typename X> | 173 template<typename T, typename U, typename V, typename W, typename X> |
| 187 struct GCInfoTrait<HeapHashMap<T, U, V, W, X>> : public GCInfoTrait<HashMap<T, U
, V, W, X, HeapAllocator>> { }; | 174 struct GCInfoTrait<HeapHashMap<T, U, V, W, X>> : public GCInfoTrait<HashMap<T, U
, V, W, X, HeapAllocator>> { }; |
| 188 template<typename T, typename U, typename V> | 175 template<typename T, typename U, typename V> |
| 189 struct GCInfoTrait<HeapHashSet<T, U, V>> : public GCInfoTrait<HashSet<T, U, V, H
eapAllocator>> { }; | 176 struct GCInfoTrait<HeapHashSet<T, U, V>> : public GCInfoTrait<HashSet<T, U, V, H
eapAllocator>> { }; |
| 190 template<typename T, typename U, typename V> | 177 template<typename T, typename U, typename V> |
| 191 struct GCInfoTrait<HeapLinkedHashSet<T, U, V>> : public GCInfoTrait<LinkedHashSe
t<T, U, V, HeapAllocator>> { }; | 178 struct GCInfoTrait<HeapLinkedHashSet<T, U, V>> : public GCInfoTrait<LinkedHashSe
t<T, U, V, HeapAllocator>> { }; |
| 192 template<typename T, size_t inlineCapacity, typename U> | 179 template<typename T, size_t inlineCapacity, typename U> |
| 193 struct GCInfoTrait<HeapListHashSet<T, inlineCapacity, U>> : public GCInfoTrait<L
istHashSet<T, inlineCapacity, U, HeapListHashSetAllocator<T, inlineCapacity>>> {
}; | 180 struct GCInfoTrait<HeapListHashSet<T, inlineCapacity, U>> : public GCInfoTrait<L
istHashSet<T, inlineCapacity, U, HeapListHashSetAllocator<T, inlineCapacity>>> {
}; |
| 194 template<typename T, size_t inlineCapacity> | 181 template<typename T, size_t inlineCapacity> |
| 195 struct GCInfoTrait<HeapVector<T, inlineCapacity>> : public GCInfoTrait<Vector<T,
inlineCapacity, HeapAllocator>> { }; | 182 struct GCInfoTrait<HeapVector<T, inlineCapacity>> : public GCInfoTrait<Vector<T,
inlineCapacity, HeapAllocator>> { }; |
| 196 template<typename T, size_t inlineCapacity> | 183 template<typename T, size_t inlineCapacity> |
| 197 struct GCInfoTrait<HeapDeque<T, inlineCapacity>> : public GCInfoTrait<Deque<T, i
nlineCapacity, HeapAllocator>> { }; | 184 struct GCInfoTrait<HeapDeque<T, inlineCapacity>> : public GCInfoTrait<Deque<T, i
nlineCapacity, HeapAllocator>> { }; |
| 198 template<typename T, typename U, typename V> | 185 template<typename T, typename U, typename V> |
| 199 struct GCInfoTrait<HeapHashCountedSet<T, U, V>> : public GCInfoTrait<HashCounted
Set<T, U, V, HeapAllocator>> { }; | 186 struct GCInfoTrait<HeapHashCountedSet<T, U, V>> : public GCInfoTrait<HashCounted
Set<T, U, V, HeapAllocator>> { }; |
| 200 | 187 |
| 201 } // namespace blink | 188 } // namespace blink |
| 202 | 189 |
| 203 #endif | 190 #endif |
| OLD | NEW |