Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Google Inc. All rights reserved. | 3 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 219 // postfix ++ intentionally omitted | 219 // postfix ++ intentionally omitted |
| 220 Iterator& operator--() { Base::decrement(); return *this; } | 220 Iterator& operator--() { Base::decrement(); return *this; } |
| 221 // postfix -- intentionally omitted | 221 // postfix -- intentionally omitted |
| 222 }; | 222 }; |
| 223 | 223 |
| 224 template<typename T, size_t inlineCapacity, typename Allocator> | 224 template<typename T, size_t inlineCapacity, typename Allocator> |
| 225 inline Deque<T, inlineCapacity, Allocator>::Deque() | 225 inline Deque<T, inlineCapacity, Allocator>::Deque() |
| 226 : m_start(0) | 226 : m_start(0) |
| 227 , m_end(0) | 227 , m_end(0) |
| 228 { | 228 { |
| 229 // Unused buffer slots are initialized to zero so that the visitor and t he | |
| 230 // finalizer can visit them safely. canInitializeWithMemset tells us | |
| 231 // that the class does not expect matching constructor and | |
| 232 // 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
| |
| 233 static_assert(!Allocator::isGarbageCollected || !VectorTraits<T>::needsD estruction || VectorTraits<T>::canInitializeWithMemset, "class has problems with finalizers called on cleared memory"); | |
| 234 static_assert(!WTF::IsPolymorphic<T>::value || !VectorTraits<T>::canInit ializeWithMemset, "cannot initialize with memset if there is a vtable"); | |
| 229 } | 235 } |
| 230 | 236 |
| 231 template<typename T, size_t inlineCapacity, typename Allocator> | 237 template<typename T, size_t inlineCapacity, typename Allocator> |
| 232 inline Deque<T, inlineCapacity, Allocator>::Deque(const Deque<T, inlineCapac ity, Allocator>& other) | 238 inline Deque<T, inlineCapacity, Allocator>::Deque(const Deque<T, inlineCapac ity, Allocator>& other) |
| 233 : m_buffer(other.m_buffer.capacity()) | 239 : m_buffer(other.m_buffer.capacity()) |
| 234 , m_start(other.m_start) | 240 , m_start(other.m_start) |
| 235 , m_end(other.m_end) | 241 , m_end(other.m_end) |
| 236 { | 242 { |
| 237 const T* otherBuffer = other.m_buffer.buffer(); | 243 const T* otherBuffer = other.m_buffer.buffer(); |
| 238 if (m_start <= m_end) | 244 if (m_start <= m_end) |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 566 struct NeedsTracing<Deque<T, N>> { | 572 struct NeedsTracing<Deque<T, N>> { |
| 567 static const bool value = false; | 573 static const bool value = false; |
| 568 }; | 574 }; |
| 569 #endif | 575 #endif |
| 570 | 576 |
| 571 } // namespace WTF | 577 } // namespace WTF |
| 572 | 578 |
| 573 using WTF::Deque; | 579 using WTF::Deque; |
| 574 | 580 |
| 575 #endif // WTF_Deque_h | 581 #endif // WTF_Deque_h |
| OLD | NEW |