OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "gpu/command_buffer/client/mapped_memory.h" | 5 #include "gpu/command_buffer/client/mapped_memory.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
11 #include <functional> | 11 #include <functional> |
12 | 12 |
13 #include "base/atomic_sequence_num.h" | 13 #include "base/atomic_sequence_num.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
16 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
17 #include "base/thread_task_runner_handle.h" | 17 #include "base/threading/thread_task_runner_handle.h" |
18 #include "base/trace_event/memory_dump_manager.h" | 18 #include "base/trace_event/memory_dump_manager.h" |
19 #include "base/trace_event/trace_event.h" | 19 #include "base/trace_event/trace_event.h" |
20 #include "gpu/command_buffer/client/cmd_buffer_helper.h" | 20 #include "gpu/command_buffer/client/cmd_buffer_helper.h" |
21 #include "gpu/command_buffer/client/shared_memory_limits.h" | 21 #include "gpu/command_buffer/client/shared_memory_limits.h" |
22 #include "gpu/command_buffer/common/buffer.h" | 22 #include "gpu/command_buffer/common/buffer.h" |
23 | 23 |
24 namespace gpu { | 24 namespace gpu { |
25 namespace { | 25 namespace { |
26 | 26 |
27 // Generates process-unique IDs to use for tracing a MappedMemoryManager's | 27 // Generates process-unique IDs to use for tracing a MappedMemoryManager's |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 void ScopedMappedMemoryPtr::Reset(uint32_t new_size) { | 212 void ScopedMappedMemoryPtr::Reset(uint32_t new_size) { |
213 Release(); | 213 Release(); |
214 | 214 |
215 if (new_size) { | 215 if (new_size) { |
216 buffer_ = mapped_memory_manager_->Alloc(new_size, &shm_id_, &shm_offset_); | 216 buffer_ = mapped_memory_manager_->Alloc(new_size, &shm_id_, &shm_offset_); |
217 size_ = buffer_ ? new_size : 0; | 217 size_ = buffer_ ? new_size : 0; |
218 } | 218 } |
219 } | 219 } |
220 | 220 |
221 } // namespace gpu | 221 } // namespace gpu |
OLD | NEW |