Chromium Code Reviews| 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 "base/atomic_sequence_num.h" | 7 #include "base/atomic_sequence_num.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 287 DCHECK(valid_size); | 287 DCHECK(valid_size); |
| 288 | 288 |
| 289 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, | 289 dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize, |
| 290 base::trace_event::MemoryAllocatorDump::kUnitsBytes, | 290 base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
| 291 buffer_size_in_bytes); | 291 buffer_size_in_bytes); |
| 292 | 292 |
| 293 // Create the cross-process ownership edge. If the client creates a | 293 // Create the cross-process ownership edge. If the client creates a |
| 294 // corresponding dump for the same buffer, this will avoid to | 294 // corresponding dump for the same buffer, this will avoid to |
| 295 // double-count them in tracing. If, instead, no other process will emit a | 295 // double-count them in tracing. If, instead, no other process will emit a |
| 296 // dump with the same guid, the segment will be accounted to the browser. | 296 // dump with the same guid, the segment will be accounted to the browser. |
| 297 const uint64 client_tracing_process_id = base::trace_event:: | 297 uint64 client_tracing_process_id = base::trace_event::MemoryDumpManager:: |
| 298 MemoryDumpManager::ChildProcessIdToTracingProcessId(client_id); | 298 ChildProcessIdToTracingProcessId(client_id); |
| 299 | |
| 300 if (client_id == gpu_client_id_) { | |
|
ericrk
2015/07/28 21:02:33
A bit of a hack... we're hitting a similar issue t
reveman
2015/07/28 21:38:49
Can you add a GpuClientIdToTracingProcessId functi
ericrk
2015/07/29 18:46:46
Added a function ClientIdToTracingProcessId which
| |
| 301 // The browser process doesn't use a client ID to generate its tracing | |
| 302 // ID. Instead it uses a fixed tracing ID. If client_id == | |
| 303 // gpu_client_id_, then this surface is owned by the browser, so get our | |
| 304 // current tracing ID. | |
| 305 client_tracing_process_id = | |
| 306 base::trace_event::MemoryDumpManager::GetInstance() | |
| 307 ->tracing_process_id(); | |
| 308 } | |
| 309 | |
| 299 base::trace_event::MemoryAllocatorDumpGuid shared_buffer_guid = | 310 base::trace_event::MemoryAllocatorDumpGuid shared_buffer_guid = |
| 300 gfx::GetGpuMemoryBufferGUIDForTracing(client_tracing_process_id, | 311 gfx::GetGpuMemoryBufferGUIDForTracing(client_tracing_process_id, |
| 301 buffer_id); | 312 buffer_id); |
| 302 pmd->CreateSharedGlobalAllocatorDump(shared_buffer_guid); | 313 pmd->CreateSharedGlobalAllocatorDump(shared_buffer_guid); |
| 303 pmd->AddOwnershipEdge(dump->guid(), shared_buffer_guid); | 314 pmd->AddOwnershipEdge(dump->guid(), shared_buffer_guid); |
| 304 } | 315 } |
| 305 } | 316 } |
| 306 | 317 |
| 307 return true; | 318 return true; |
| 308 } | 319 } |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 584 } | 595 } |
| 585 | 596 |
| 586 GpuProcessHost* host = GpuProcessHost::FromID(buffer_it->second.gpu_host_id); | 597 GpuProcessHost* host = GpuProcessHost::FromID(buffer_it->second.gpu_host_id); |
| 587 if (host) | 598 if (host) |
| 588 host->DestroyGpuMemoryBuffer(id, client_id, sync_point); | 599 host->DestroyGpuMemoryBuffer(id, client_id, sync_point); |
| 589 | 600 |
| 590 buffers.erase(buffer_it); | 601 buffers.erase(buffer_it); |
| 591 } | 602 } |
| 592 | 603 |
| 593 } // namespace content | 604 } // namespace content |
| OLD | NEW |