OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | 5 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 base::trace_event::MemoryAllocatorDump::kUnitsBytes, | 165 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
166 buffer_size_in_bytes); | 166 buffer_size_in_bytes); |
167 | 167 |
168 // Create the cross-process ownership edge. If the client creates a | 168 // Create the cross-process ownership edge. If the client creates a |
169 // corresponding dump for the same buffer, this will avoid to | 169 // corresponding dump for the same buffer, this will avoid to |
170 // double-count them in tracing. If, instead, no other process will emit a | 170 // double-count them in tracing. If, instead, no other process will emit a |
171 // dump with the same guid, the segment will be accounted to the browser. | 171 // dump with the same guid, the segment will be accounted to the browser. |
172 uint64_t client_tracing_process_id = | 172 uint64_t client_tracing_process_id = |
173 ClientIdToTracingProcessId(client_id); | 173 ClientIdToTracingProcessId(client_id); |
174 | 174 |
175 base::trace_event::MemoryAllocatorDumpGuid shared_buffer_guid = | 175 base::trace_event::MemoryAllocatorDumpGuid shared_buffer_guid; |
176 gfx::GetGpuMemoryBufferGUIDForTracing(client_tracing_process_id, | 176 if (buffer.second.type == gfx::SHARED_MEMORY_BUFFER) { |
177 buffer_id); | 177 shared_buffer_guid = gfx::GetSharedMemoryGUIDForTracing( |
| 178 client_tracing_process_id, buffer_id); |
| 179 } else { |
| 180 shared_buffer_guid = gfx::GetGenericSharedGpuMemoryGUIDForTracing( |
| 181 client_tracing_process_id, buffer_id); |
| 182 } |
178 pmd->CreateSharedGlobalAllocatorDump(shared_buffer_guid); | 183 pmd->CreateSharedGlobalAllocatorDump(shared_buffer_guid); |
179 pmd->AddOwnershipEdge(dump->guid(), shared_buffer_guid); | 184 pmd->AddOwnershipEdge(dump->guid(), shared_buffer_guid); |
180 } | 185 } |
181 } | 186 } |
182 | 187 |
183 return true; | 188 return true; |
184 } | 189 } |
185 | 190 |
186 void BrowserGpuMemoryBufferManager::ChildProcessDeletedGpuMemoryBuffer( | 191 void BrowserGpuMemoryBufferManager::ChildProcessDeletedGpuMemoryBuffer( |
187 gfx::GpuMemoryBufferId id, | 192 gfx::GpuMemoryBufferId id, |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 format(format), | 469 format(format), |
465 usage(usage), | 470 usage(usage), |
466 gpu_host_id(gpu_host_id) {} | 471 gpu_host_id(gpu_host_id) {} |
467 | 472 |
468 BrowserGpuMemoryBufferManager::BufferInfo::BufferInfo(const BufferInfo& other) = | 473 BrowserGpuMemoryBufferManager::BufferInfo::BufferInfo(const BufferInfo& other) = |
469 default; | 474 default; |
470 | 475 |
471 BrowserGpuMemoryBufferManager::BufferInfo::~BufferInfo() {} | 476 BrowserGpuMemoryBufferManager::BufferInfo::~BufferInfo() {} |
472 | 477 |
473 } // namespace content | 478 } // namespace content |
OLD | NEW |