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