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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 auto shared_buffer_guid = | 117 auto shared_buffer_guid = |
118 gpu_memory_buffer->GetGUIDForTracing(tracing_process_id); | 118 gpu_memory_buffer->GetGUIDForTracing(tracing_process_id); |
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 |
122 // the tracing UI will account the effective size of the buffer to the child. | 122 // dumps). the tracing UI will account the effective size of the buffer to |
| 123 // the child. |
123 const int kImportance = 2; | 124 const int kImportance = 2; |
124 pmd->AddOwnershipEdge(buffer_dump->guid(), shared_buffer_guid, kImportance); | 125 pmd->AddOwnershipEdge(buffer_dump->guid(), shared_buffer_guid, kImportance); |
125 } | 126 } |
126 | 127 |
127 StagingBufferPool::StagingBufferPool(base::SequencedTaskRunner* task_runner, | 128 StagingBufferPool::StagingBufferPool(base::SequencedTaskRunner* task_runner, |
128 ContextProvider* worker_context_provider, | 129 ContextProvider* worker_context_provider, |
129 ResourceProvider* resource_provider, | 130 ResourceProvider* resource_provider, |
130 bool use_partial_raster, | 131 bool use_partial_raster, |
131 int max_staging_buffer_usage_in_bytes) | 132 int max_staging_buffer_usage_in_bytes) |
132 : task_runner_(task_runner), | 133 : task_runner_(task_runner), |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 } | 434 } |
434 } | 435 } |
435 | 436 |
436 void StagingBufferPool::OnPurgeMemory() { | 437 void StagingBufferPool::OnPurgeMemory() { |
437 base::AutoLock lock(lock_); | 438 base::AutoLock lock(lock_); |
438 // Release all buffers, regardless of how recently they were used. | 439 // Release all buffers, regardless of how recently they were used. |
439 ReleaseBuffersNotUsedSince(base::TimeTicks() + base::TimeDelta::Max()); | 440 ReleaseBuffersNotUsedSince(base::TimeTicks() + base::TimeDelta::Max()); |
440 } | 441 } |
441 | 442 |
442 } // namespace cc | 443 } // namespace cc |
OLD | NEW |