Index: cc/raster/staging_buffer_pool.cc |
diff --git a/cc/raster/staging_buffer_pool.cc b/cc/raster/staging_buffer_pool.cc |
index 3cb4b14dfe6da1bc99c0e6ecd259413f1c281a51..2cd1db1abf335770aa7fdb16d2d8541dceeeb1a1 100644 |
--- a/cc/raster/staging_buffer_pool.cc |
+++ b/cc/raster/staging_buffer_pool.cc |
@@ -8,6 +8,7 @@ |
#include "base/memory/memory_coordinator_client_registry.h" |
#include "base/memory/ptr_util.h" |
+#include "base/memory/shared_memory_tracker.h" |
#include "base/strings/stringprintf.h" |
#include "base/threading/thread_task_runner_handle.h" |
#include "base/trace_event/memory_dump_manager.h" |
@@ -15,7 +16,6 @@ |
#include "cc/debug/traced_value.h" |
#include "cc/resources/scoped_resource.h" |
#include "gpu/command_buffer/client/gles2_interface.h" |
-#include "ui/gfx/gpu_memory_buffer_tracing.h" |
using base::trace_event::MemoryAllocatorDump; |
using base::trace_event::MemoryAllocatorDumpGuid; |
@@ -110,18 +110,25 @@ void StagingBuffer::OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd, |
buffer_dump->AddScalar("free_size", MemoryAllocatorDump::kUnitsBytes, |
in_free_list ? buffer_size_in_bytes : 0); |
- // Emit an ownership edge towards a global allocator dump node. |
- const uint64_t tracing_process_id = |
- base::trace_event::MemoryDumpManager::GetInstance() |
- ->GetTracingProcessId(); |
- auto shared_buffer_guid = |
- gpu_memory_buffer->GetGUIDForTracing(tracing_process_id); |
- pmd->CreateSharedGlobalAllocatorDump(shared_buffer_guid); |
- |
- // By creating an edge with a higher |importance| (w.r.t. browser-side dumps) |
- // the tracing UI will account the effective size of the buffer to the child. |
- const int kImportance = 2; |
- pmd->AddOwnershipEdge(buffer_dump->guid(), shared_buffer_guid, kImportance); |
+ base::SharedMemory* shared_memory = gpu_memory_buffer->GetSharedMemory(); |
+ if (shared_memory) { |
+ base::SharedMemoryTracker::AddOwnershipEdges(pmd, buffer_dump->guid(), |
+ *shared_memory); |
+ } else { |
+ // Emit an ownership edge towards a global allocator dump node. |
+ const uint64_t tracing_process_id = |
+ base::trace_event::MemoryDumpManager::GetInstance() |
+ ->GetTracingProcessId(); |
+ auto shared_buffer_guid = |
+ gpu_memory_buffer->GetGUIDForTracing(tracing_process_id); |
+ pmd->CreateSharedGlobalAllocatorDump(shared_buffer_guid); |
+ |
+ // By creating an edge with a higher |importance| (w.r.t. browser-side |
+ // dumps) the tracing UI will account the effective size of the buffer to |
+ // the child. |
+ const int kImportance = 2; |
+ pmd->AddOwnershipEdge(buffer_dump->guid(), shared_buffer_guid, kImportance); |
+ } |
} |
StagingBufferPool::StagingBufferPool(base::SequencedTaskRunner* task_runner, |