| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 uint64_t buffer_size_in_bytes = | 105 uint64_t buffer_size_in_bytes = |
| 106 ResourceUtil::UncheckedSizeInBytes<uint64_t>(size, format); | 106 ResourceUtil::UncheckedSizeInBytes<uint64_t>(size, format); |
| 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()->tracing_process_id(); |
| 116 ->GetTracingProcessId(); | |
| 117 MemoryAllocatorDumpGuid shared_buffer_guid = | 116 MemoryAllocatorDumpGuid shared_buffer_guid = |
| 118 gfx::GetGpuMemoryBufferGUIDForTracing(tracing_process_id, buffer_id); | 117 gfx::GetGpuMemoryBufferGUIDForTracing(tracing_process_id, buffer_id); |
| 119 pmd->CreateSharedGlobalAllocatorDump(shared_buffer_guid); | 118 pmd->CreateSharedGlobalAllocatorDump(shared_buffer_guid); |
| 120 | 119 |
| 121 // By creating an edge with a higher |importance| (w.r.t. browser-side dumps) | 120 // 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. | 121 // the tracing UI will account the effective size of the buffer to the child. |
| 123 const int kImportance = 2; | 122 const int kImportance = 2; |
| 124 pmd->AddOwnershipEdge(buffer_dump->guid(), shared_buffer_guid, kImportance); | 123 pmd->AddOwnershipEdge(buffer_dump->guid(), shared_buffer_guid, kImportance); |
| 125 } | 124 } |
| 126 | 125 |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 } | 431 } |
| 433 } | 432 } |
| 434 | 433 |
| 435 void StagingBufferPool::OnPurgeMemory() { | 434 void StagingBufferPool::OnPurgeMemory() { |
| 436 base::AutoLock lock(lock_); | 435 base::AutoLock lock(lock_); |
| 437 // Release all buffers, regardless of how recently they were used. | 436 // Release all buffers, regardless of how recently they were used. |
| 438 ReleaseBuffersNotUsedSince(base::TimeTicks() + base::TimeDelta::Max()); | 437 ReleaseBuffersNotUsedSince(base::TimeTicks() + base::TimeDelta::Max()); |
| 439 } | 438 } |
| 440 | 439 |
| 441 } // namespace cc | 440 } // namespace cc |
| OLD | NEW |