| 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 ContiguousContainer_h | 5 #ifndef ContiguousContainer_h |
| 6 #define ContiguousContainer_h | 6 #define ContiguousContainer_h |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | |
| 9 #include "platform/PlatformExport.h" | 8 #include "platform/PlatformExport.h" |
| 10 #include "wtf/Alignment.h" | 9 #include "wtf/Alignment.h" |
| 11 #include "wtf/Allocator.h" | 10 #include "wtf/Allocator.h" |
| 12 #include "wtf/Compiler.h" | 11 #include "wtf/Compiler.h" |
| 13 #include "wtf/Noncopyable.h" | 12 #include "wtf/Noncopyable.h" |
| 14 #include "wtf/TypeTraits.h" | 13 #include "wtf/TypeTraits.h" |
| 15 #include "wtf/Vector.h" | 14 #include "wtf/Vector.h" |
| 16 #include <cstddef> | 15 #include <cstddef> |
| 17 #include <iterator> | 16 #include <iterator> |
| 18 #include <memory> | 17 #include <memory> |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 return *new (alignedAllocate(sizeof(DerivedElementType))) | 201 return *new (alignedAllocate(sizeof(DerivedElementType))) |
| 203 DerivedElementType(std::forward<Args>(args)...); | 202 DerivedElementType(std::forward<Args>(args)...); |
| 204 } | 203 } |
| 205 | 204 |
| 206 void removeLast() { | 205 void removeLast() { |
| 207 ASSERT(!isEmpty()); | 206 ASSERT(!isEmpty()); |
| 208 last().~BaseElementType(); | 207 last().~BaseElementType(); |
| 209 ContiguousContainerBase::removeLast(); | 208 ContiguousContainerBase::removeLast(); |
| 210 } | 209 } |
| 211 | 210 |
| 212 DISABLE_CFI_PERF | |
| 213 void clear() { | 211 void clear() { |
| 214 for (auto& element : *this) { | 212 for (auto& element : *this) { |
| 215 (void)element; // MSVC incorrectly reports this variable as unused. | 213 (void)element; // MSVC incorrectly reports this variable as unused. |
| 216 element.~BaseElementType(); | 214 element.~BaseElementType(); |
| 217 } | 215 } |
| 218 ContiguousContainerBase::clear(); | 216 ContiguousContainerBase::clear(); |
| 219 } | 217 } |
| 220 | 218 |
| 221 void swap(ContiguousContainer& other) { | 219 void swap(ContiguousContainer& other) { |
| 222 ContiguousContainerBase::swap(other); | 220 ContiguousContainerBase::swap(other); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 245 DCHECK_EQ(alignedSize % alignment, 0u); | 243 DCHECK_EQ(alignedSize % alignment, 0u); |
| 246 DCHECK_GE(alignedSize, size); | 244 DCHECK_GE(alignedSize, size); |
| 247 DCHECK_LT(alignedSize, size + alignment); | 245 DCHECK_LT(alignedSize, size + alignment); |
| 248 return alignedSize; | 246 return alignedSize; |
| 249 } | 247 } |
| 250 }; | 248 }; |
| 251 | 249 |
| 252 } // namespace blink | 250 } // namespace blink |
| 253 | 251 |
| 254 #endif // ContiguousContainer_h | 252 #endif // ContiguousContainer_h |
| OLD | NEW |