OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 GPU_COMMAND_BUFFER_CLIENT_MAPPED_MEMORY_H_ | 5 #ifndef GPU_COMMAND_BUFFER_CLIENT_MAPPED_MEMORY_H_ |
6 #define GPU_COMMAND_BUFFER_CLIENT_MAPPED_MEMORY_H_ | 6 #define GPU_COMMAND_BUFFER_CLIENT_MAPPED_MEMORY_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
| 11 #include <memory> |
| 12 |
11 #include "base/bind.h" | 13 #include "base/bind.h" |
12 #include "base/macros.h" | 14 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "base/trace_event/memory_dump_provider.h" | 15 #include "base/trace_event/memory_dump_provider.h" |
15 #include "gpu/command_buffer/client/fenced_allocator.h" | 16 #include "gpu/command_buffer/client/fenced_allocator.h" |
16 #include "gpu/command_buffer/common/buffer.h" | 17 #include "gpu/command_buffer/common/buffer.h" |
17 #include "gpu/gpu_export.h" | 18 #include "gpu/gpu_export.h" |
18 | 19 |
19 namespace gpu { | 20 namespace gpu { |
20 | 21 |
21 class CommandBufferHelper; | 22 class CommandBufferHelper; |
22 | 23 |
23 // Manages a shared memory segment. | 24 // Manages a shared memory segment. |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 } | 195 } |
195 return bytes_in_use; | 196 return bytes_in_use; |
196 } | 197 } |
197 | 198 |
198 // Used for testing | 199 // Used for testing |
199 size_t allocated_memory() const { | 200 size_t allocated_memory() const { |
200 return allocated_memory_; | 201 return allocated_memory_; |
201 } | 202 } |
202 | 203 |
203 private: | 204 private: |
204 typedef std::vector<scoped_ptr<MemoryChunk>> MemoryChunkVector; | 205 typedef std::vector<std::unique_ptr<MemoryChunk>> MemoryChunkVector; |
205 | 206 |
206 // size a chunk is rounded up to. | 207 // size a chunk is rounded up to. |
207 unsigned int chunk_size_multiple_; | 208 unsigned int chunk_size_multiple_; |
208 CommandBufferHelper* helper_; | 209 CommandBufferHelper* helper_; |
209 MemoryChunkVector chunks_; | 210 MemoryChunkVector chunks_; |
210 size_t allocated_memory_; | 211 size_t allocated_memory_; |
211 size_t max_free_bytes_; | 212 size_t max_free_bytes_; |
212 size_t max_allocated_bytes_; | 213 size_t max_allocated_bytes_; |
213 // A process-unique ID used for disambiguating memory dumps from different | 214 // A process-unique ID used for disambiguating memory dumps from different |
214 // mapped memory manager. | 215 // mapped memory manager. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 uint32_t shm_offset_; | 274 uint32_t shm_offset_; |
274 bool flush_after_release_; | 275 bool flush_after_release_; |
275 CommandBufferHelper* helper_; | 276 CommandBufferHelper* helper_; |
276 MappedMemoryManager* mapped_memory_manager_; | 277 MappedMemoryManager* mapped_memory_manager_; |
277 DISALLOW_COPY_AND_ASSIGN(ScopedMappedMemoryPtr); | 278 DISALLOW_COPY_AND_ASSIGN(ScopedMappedMemoryPtr); |
278 }; | 279 }; |
279 | 280 |
280 } // namespace gpu | 281 } // namespace gpu |
281 | 282 |
282 #endif // GPU_COMMAND_BUFFER_CLIENT_MAPPED_MEMORY_H_ | 283 #endif // GPU_COMMAND_BUFFER_CLIENT_MAPPED_MEMORY_H_ |
OLD | NEW |