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 #include "gpu/command_buffer/service/transfer_buffer_manager.h" | 5 #include "gpu/command_buffer/service/transfer_buffer_manager.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
| 10 #include <memory> |
10 | 11 |
11 #include "base/logging.h" | 12 #include "base/logging.h" |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "base/process/process_handle.h" | 13 #include "base/process/process_handle.h" |
14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
15 #include "base/thread_task_runner_handle.h" | 15 #include "base/thread_task_runner_handle.h" |
16 #include "base/trace_event/memory_allocator_dump.h" | 16 #include "base/trace_event/memory_allocator_dump.h" |
17 #include "base/trace_event/memory_dump_manager.h" | 17 #include "base/trace_event/memory_dump_manager.h" |
18 #include "base/trace_event/process_memory_dump.h" | 18 #include "base/trace_event/process_memory_dump.h" |
19 #include "base/trace_event/trace_event.h" | 19 #include "base/trace_event/trace_event.h" |
20 #include "gpu/command_buffer/common/cmd_buffer_common.h" | 20 #include "gpu/command_buffer/common/cmd_buffer_common.h" |
21 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 21 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
22 #include "gpu/command_buffer/service/memory_tracking.h" | 22 #include "gpu/command_buffer/service/memory_tracking.h" |
(...skipping 28 matching lines...) Expand all Loading... |
51 if (memory_tracker_) { | 51 if (memory_tracker_) { |
52 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( | 52 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( |
53 this, "gpu::TransferBufferManager", | 53 this, "gpu::TransferBufferManager", |
54 base::ThreadTaskRunnerHandle::Get()); | 54 base::ThreadTaskRunnerHandle::Get()); |
55 } | 55 } |
56 return true; | 56 return true; |
57 } | 57 } |
58 | 58 |
59 bool TransferBufferManager::RegisterTransferBuffer( | 59 bool TransferBufferManager::RegisterTransferBuffer( |
60 int32_t id, | 60 int32_t id, |
61 scoped_ptr<BufferBacking> buffer_backing) { | 61 std::unique_ptr<BufferBacking> buffer_backing) { |
62 if (id <= 0) { | 62 if (id <= 0) { |
63 DVLOG(0) << "Cannot register transfer buffer with non-positive ID."; | 63 DVLOG(0) << "Cannot register transfer buffer with non-positive ID."; |
64 return false; | 64 return false; |
65 } | 65 } |
66 | 66 |
67 // Fail if the ID is in use. | 67 // Fail if the ID is in use. |
68 if (registered_buffers_.find(id) != registered_buffers_.end()) { | 68 if (registered_buffers_.find(id) != registered_buffers_.end()) { |
69 DVLOG(0) << "Buffer ID already in use."; | 69 DVLOG(0) << "Buffer ID already in use."; |
70 return false; | 70 return false; |
71 } | 71 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 auto guid = | 125 auto guid = |
126 GetBufferGUIDForTracing(memory_tracker_->ClientTracingId(), buffer_id); | 126 GetBufferGUIDForTracing(memory_tracker_->ClientTracingId(), buffer_id); |
127 pmd->CreateSharedGlobalAllocatorDump(guid); | 127 pmd->CreateSharedGlobalAllocatorDump(guid); |
128 pmd->AddOwnershipEdge(dump->guid(), guid); | 128 pmd->AddOwnershipEdge(dump->guid(), guid); |
129 } | 129 } |
130 | 130 |
131 return true; | 131 return true; |
132 } | 132 } |
133 | 133 |
134 } // namespace gpu | 134 } // namespace gpu |
OLD | NEW |