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 #include "platform/graphics/ContiguousContainer.h" | 5 #include "platform/graphics/ContiguousContainer.h" |
6 | 6 |
| 7 #include <algorithm> |
| 8 #include <memory> |
7 #include "wtf/Allocator.h" | 9 #include "wtf/Allocator.h" |
8 #include "wtf/ContainerAnnotations.h" | 10 #include "wtf/ContainerAnnotations.h" |
9 #include "wtf/PtrUtil.h" | 11 #include "wtf/PtrUtil.h" |
10 #include "wtf/allocator/Partitions.h" | 12 #include "wtf/allocator/Partitions.h" |
11 #include <algorithm> | |
12 #include <memory> | |
13 | 13 |
14 namespace blink { | 14 namespace blink { |
15 | 15 |
16 // Default number of max-sized elements to allocate space for, if there is no | 16 // Default number of max-sized elements to allocate space for, if there is no |
17 // initial buffer. | 17 // initial buffer. |
18 static const unsigned kDefaultInitialBufferSize = 32; | 18 static const unsigned kDefaultInitialBufferSize = 32; |
19 | 19 |
20 class ContiguousContainerBase::Buffer { | 20 class ContiguousContainerBase::Buffer { |
21 WTF_MAKE_NONCOPYABLE(Buffer); | 21 WTF_MAKE_NONCOPYABLE(Buffer); |
22 USING_FAST_MALLOC(Buffer); | 22 USING_FAST_MALLOC(Buffer); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 ASSERT(m_buffers.isEmpty() || m_endIndex == m_buffers.size() - 1); | 171 ASSERT(m_buffers.isEmpty() || m_endIndex == m_buffers.size() - 1); |
172 std::unique_ptr<Buffer> newBuffer = | 172 std::unique_ptr<Buffer> newBuffer = |
173 WTF::makeUnique<Buffer>(bufferSize, typeName); | 173 WTF::makeUnique<Buffer>(bufferSize, typeName); |
174 Buffer* bufferToReturn = newBuffer.get(); | 174 Buffer* bufferToReturn = newBuffer.get(); |
175 m_buffers.push_back(std::move(newBuffer)); | 175 m_buffers.push_back(std::move(newBuffer)); |
176 m_endIndex = m_buffers.size() - 1; | 176 m_endIndex = m_buffers.size() - 1; |
177 return bufferToReturn; | 177 return bufferToReturn; |
178 } | 178 } |
179 | 179 |
180 } // namespace blink | 180 } // namespace blink |
OLD | NEW |