Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "cc/raster/staging_buffer_pool.h" | 5 #include "cc/raster/staging_buffer_pool.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/memory/memory_coordinator_client_registry.h" | 9 #include "base/memory/memory_coordinator_client_registry.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 107 buffer_dump->AddScalar(MemoryAllocatorDump::kNameSize, | 107 buffer_dump->AddScalar(MemoryAllocatorDump::kNameSize, |
| 108 MemoryAllocatorDump::kUnitsBytes, | 108 MemoryAllocatorDump::kUnitsBytes, |
| 109 buffer_size_in_bytes); | 109 buffer_size_in_bytes); |
| 110 buffer_dump->AddScalar("free_size", MemoryAllocatorDump::kUnitsBytes, | 110 buffer_dump->AddScalar("free_size", MemoryAllocatorDump::kUnitsBytes, |
| 111 in_free_list ? buffer_size_in_bytes : 0); | 111 in_free_list ? buffer_size_in_bytes : 0); |
| 112 | 112 |
| 113 // Emit an ownership edge towards a global allocator dump node. | 113 // Emit an ownership edge towards a global allocator dump node. |
| 114 const uint64_t tracing_process_id = | 114 const uint64_t tracing_process_id = |
| 115 base::trace_event::MemoryDumpManager::GetInstance() | 115 base::trace_event::MemoryDumpManager::GetInstance() |
| 116 ->GetTracingProcessId(); | 116 ->GetTracingProcessId(); |
| 117 MemoryAllocatorDumpGuid shared_buffer_guid = | 117 MemoryAllocatorDumpGuid shared_buffer_guid; |
| 118 gfx::GetGpuMemoryBufferGUIDForTracing(tracing_process_id, buffer_id); | 118 if (gpu_memory_buffer->GetHandle().type == gfx::SHARED_MEMORY_BUFFER) { |
|
ericrk
2017/04/14 19:49:39
Why not use GetGUIDForTracing in this case?
hajimehoshi
2017/04/17 06:18:06
Oops, I forgot to do this. Done.
| |
| 119 shared_buffer_guid = | |
| 120 gfx::GetSharedMemoryGUIDForTracing(tracing_process_id, buffer_id); | |
| 121 } else { | |
| 122 shared_buffer_guid = gfx::GetGenericSharedGpuMemoryGUIDForTracing( | |
| 123 tracing_process_id, buffer_id); | |
| 124 } | |
| 119 pmd->CreateSharedGlobalAllocatorDump(shared_buffer_guid); | 125 pmd->CreateSharedGlobalAllocatorDump(shared_buffer_guid); |
| 120 | 126 |
| 121 // By creating an edge with a higher |importance| (w.r.t. browser-side dumps) | 127 // By creating an edge with a higher |importance| (w.r.t. browser-side dumps) |
| 122 // the tracing UI will account the effective size of the buffer to the child. | 128 // the tracing UI will account the effective size of the buffer to the child. |
| 123 const int kImportance = 2; | 129 const int kImportance = 2; |
| 124 pmd->AddOwnershipEdge(buffer_dump->guid(), shared_buffer_guid, kImportance); | 130 pmd->AddOwnershipEdge(buffer_dump->guid(), shared_buffer_guid, kImportance); |
| 125 } | 131 } |
| 126 | 132 |
| 127 StagingBufferPool::StagingBufferPool(base::SequencedTaskRunner* task_runner, | 133 StagingBufferPool::StagingBufferPool(base::SequencedTaskRunner* task_runner, |
| 128 ContextProvider* worker_context_provider, | 134 ContextProvider* worker_context_provider, |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 432 } | 438 } |
| 433 } | 439 } |
| 434 | 440 |
| 435 void StagingBufferPool::OnPurgeMemory() { | 441 void StagingBufferPool::OnPurgeMemory() { |
| 436 base::AutoLock lock(lock_); | 442 base::AutoLock lock(lock_); |
| 437 // Release all buffers, regardless of how recently they were used. | 443 // Release all buffers, regardless of how recently they were used. |
| 438 ReleaseBuffersNotUsedSince(base::TimeTicks() + base::TimeDelta::Max()); | 444 ReleaseBuffersNotUsedSince(base::TimeTicks() + base::TimeDelta::Max()); |
| 439 } | 445 } |
| 440 | 446 |
| 441 } // namespace cc | 447 } // namespace cc |
| OLD | NEW |