Chromium Code Reviews| Index: Source/wtf/Deque.h |
| diff --git a/Source/wtf/Deque.h b/Source/wtf/Deque.h |
| index 60eb8cfbe2c88d8f95231496efd8bcb717b580b8..ba354e23744677579254716fe65799271ef42808 100644 |
| --- a/Source/wtf/Deque.h |
| +++ b/Source/wtf/Deque.h |
| @@ -226,6 +226,12 @@ namespace WTF { |
| : m_start(0) |
| , m_end(0) |
| { |
| + // Unused buffer slots are initialized to zero so that the visitor and the |
| + // finalizer can visit them safely. canInitializeWithMemset tells us |
| + // that the class does not expect matching constructor and |
| + // destructor calls as long as the memory is zeroed. |
|
haraken
2015/04/22 05:29:40
Or can we add these static_assert to Vector::trace
sof
2015/04/22 16:05:21
It makes some sense to keep it associated with the
|
| + static_assert(!Allocator::isGarbageCollected || !VectorTraits<T>::needsDestruction || VectorTraits<T>::canInitializeWithMemset, "class has problems with finalizers called on cleared memory"); |
| + static_assert(!WTF::IsPolymorphic<T>::value || !VectorTraits<T>::canInitializeWithMemset, "cannot initialize with memset if there is a vtable"); |
| } |
| template<typename T, size_t inlineCapacity, typename Allocator> |