| 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" |
| 11 #include "base/memory/shared_memory_tracker.h" |
| 11 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
| 12 #include "base/threading/thread_task_runner_handle.h" | 13 #include "base/threading/thread_task_runner_handle.h" |
| 13 #include "base/trace_event/memory_dump_manager.h" | 14 #include "base/trace_event/memory_dump_manager.h" |
| 14 #include "cc/base/container_util.h" | 15 #include "cc/base/container_util.h" |
| 15 #include "cc/debug/traced_value.h" | 16 #include "cc/debug/traced_value.h" |
| 16 #include "cc/resources/scoped_resource.h" | 17 #include "cc/resources/scoped_resource.h" |
| 17 #include "gpu/command_buffer/client/gles2_interface.h" | 18 #include "gpu/command_buffer/client/gles2_interface.h" |
| 18 #include "ui/gfx/gpu_memory_buffer_tracing.h" | 19 #include "ui/gfx/gpu_memory_buffer_tracing.h" |
| 19 | 20 |
| 20 using base::trace_event::MemoryAllocatorDump; | 21 using base::trace_event::MemoryAllocatorDump; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 base::trace_event::MemoryDumpManager::GetInstance() | 116 base::trace_event::MemoryDumpManager::GetInstance() |
| 116 ->GetTracingProcessId(); | 117 ->GetTracingProcessId(); |
| 117 MemoryAllocatorDumpGuid shared_buffer_guid = | 118 MemoryAllocatorDumpGuid shared_buffer_guid = |
| 118 gfx::GetGpuMemoryBufferGUIDForTracing(tracing_process_id, buffer_id); | 119 gfx::GetGpuMemoryBufferGUIDForTracing(tracing_process_id, buffer_id); |
| 119 pmd->CreateSharedGlobalAllocatorDump(shared_buffer_guid); | 120 pmd->CreateSharedGlobalAllocatorDump(shared_buffer_guid); |
| 120 | 121 |
| 121 // By creating an edge with a higher |importance| (w.r.t. browser-side dumps) | 122 // 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. | 123 // the tracing UI will account the effective size of the buffer to 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); |
| 126 |
| 127 base::SharedMemoryHandle shared_memory_handle = |
| 128 gpu_memory_buffer->GetHandle().handle; |
| 129 base::SharedMemoryTracker::AddOwnershipEdgeToSharedGlobalDump( |
| 130 pmd, shared_buffer_guid, shared_memory_handle, buffer_size_in_bytes); |
| 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, |
| 129 ResourceProvider* resource_provider, | 135 ResourceProvider* resource_provider, |
| 130 bool use_partial_raster, | 136 bool use_partial_raster, |
| 131 int max_staging_buffer_usage_in_bytes) | 137 int max_staging_buffer_usage_in_bytes) |
| 132 : task_runner_(task_runner), | 138 : task_runner_(task_runner), |
| 133 worker_context_provider_(worker_context_provider), | 139 worker_context_provider_(worker_context_provider), |
| 134 resource_provider_(resource_provider), | 140 resource_provider_(resource_provider), |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 // Release all buffers, regardless of how recently they were used. | 452 // Release all buffers, regardless of how recently they were used. |
| 447 ReleaseBuffersNotUsedSince(base::TimeTicks() + base::TimeDelta::Max()); | 453 ReleaseBuffersNotUsedSince(base::TimeTicks() + base::TimeDelta::Max()); |
| 448 } break; | 454 } break; |
| 449 case base::MemoryState::UNKNOWN: | 455 case base::MemoryState::UNKNOWN: |
| 450 // NOT_REACHED. | 456 // NOT_REACHED. |
| 451 break; | 457 break; |
| 452 } | 458 } |
| 453 } | 459 } |
| 454 | 460 |
| 455 } // namespace cc | 461 } // namespace cc |
| OLD | NEW |