Index: cc/resources/resource_provider.cc |
diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc |
index 6547109d3a5f35a9a409073f1a0bc3d6b93041c2..9957cf744a416074ea63c2fe46edece3b3b21dd5 100644 |
--- a/cc/resources/resource_provider.cc |
+++ b/cc/resources/resource_provider.cc |
@@ -13,6 +13,7 @@ |
#include "base/atomic_sequence_num.h" |
#include "base/macros.h" |
+#include "base/memory/shared_memory_tracker.h" |
#include "base/metrics/histogram.h" |
#include "base/numerics/safe_math.h" |
#include "base/stl_util.h" |
@@ -2127,10 +2128,12 @@ bool ResourceProvider::OnMemoryDump( |
// Resources may be shared across processes and require a shared GUID to |
// prevent double counting the memory. |
base::trace_event::MemoryAllocatorDumpGuid guid; |
+ base::SharedMemoryHandle shared_memory_handle; |
switch (resource.type) { |
case RESOURCE_TYPE_GPU_MEMORY_BUFFER: |
guid = gfx::GetGpuMemoryBufferGUIDForTracing( |
tracing_process_id, resource.gpu_memory_buffer->GetHandle().id); |
+ shared_memory_handle = resource.gpu_memory_buffer->GetHandle().handle; |
break; |
case RESOURCE_TYPE_GL_TEXTURE: |
DCHECK(resource.gl_id); |
@@ -2142,6 +2145,9 @@ bool ResourceProvider::OnMemoryDump( |
case RESOURCE_TYPE_BITMAP: |
DCHECK(resource.has_shared_bitmap_id); |
guid = GetSharedBitmapGUIDForTracing(resource.shared_bitmap_id); |
+ auto shared_memory = resource.shared_bitmap->shared_memory(); |
+ if (shared_memory) |
+ shared_memory_handle = shared_memory->handle(); |
break; |
} |
@@ -2150,6 +2156,10 @@ bool ResourceProvider::OnMemoryDump( |
const int kImportance = 2; |
pmd->CreateSharedGlobalAllocatorDump(guid); |
pmd->AddOwnershipEdge(dump->guid(), guid, kImportance); |
+ if (shared_memory_handle != base::SharedMemory::NULLHandle()) { |
+ base::SharedMemoryTracker::AddOwnershipEdgeToSharedGlobalDump( |
+ pmd, guid, shared_memory_handle, total_bytes); |
+ } |
} |
return true; |