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 auto shared_buffer_guid = |
118 gfx::GetGpuMemoryBufferGUIDForTracing(tracing_process_id, buffer_id); | 118 gpu_memory_buffer->GetHandle().GetGUIDForTracing(tracing_process_id); |
reveman
2017/04/17 13:21:06
We shouldn't be using the handle for non-IPC thing
hajimehoshi
2017/04/18 08:21:58
Done.
| |
119 pmd->CreateSharedGlobalAllocatorDump(shared_buffer_guid); | 119 pmd->CreateSharedGlobalAllocatorDump(shared_buffer_guid); |
120 | 120 |
121 // By creating an edge with a higher |importance| (w.r.t. browser-side dumps) | 121 // 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. | 122 // the tracing UI will account the effective size of the buffer to the child. |
123 const int kImportance = 2; | 123 const int kImportance = 2; |
124 pmd->AddOwnershipEdge(buffer_dump->guid(), shared_buffer_guid, kImportance); | 124 pmd->AddOwnershipEdge(buffer_dump->guid(), shared_buffer_guid, kImportance); |
125 } | 125 } |
126 | 126 |
127 StagingBufferPool::StagingBufferPool(base::SequencedTaskRunner* task_runner, | 127 StagingBufferPool::StagingBufferPool(base::SequencedTaskRunner* task_runner, |
128 ContextProvider* worker_context_provider, | 128 ContextProvider* worker_context_provider, |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
432 } | 432 } |
433 } | 433 } |
434 | 434 |
435 void StagingBufferPool::OnPurgeMemory() { | 435 void StagingBufferPool::OnPurgeMemory() { |
436 base::AutoLock lock(lock_); | 436 base::AutoLock lock(lock_); |
437 // Release all buffers, regardless of how recently they were used. | 437 // Release all buffers, regardless of how recently they were used. |
438 ReleaseBuffersNotUsedSince(base::TimeTicks() + base::TimeDelta::Max()); | 438 ReleaseBuffersNotUsedSince(base::TimeTicks() + base::TimeDelta::Max()); |
439 } | 439 } |
440 | 440 |
441 } // namespace cc | 441 } // namespace cc |
OLD | NEW |