| Index: components/discardable_memory/common/discardable_shared_memory_heap.cc
|
| diff --git a/components/discardable_memory/common/discardable_shared_memory_heap.cc b/components/discardable_memory/common/discardable_shared_memory_heap.cc
|
| index 7eacbeeec77e03d56bbe2efe6edd459c30cdc4d1..199f8fe58eb84a7c2f58fc14834ea81aa148f1dd 100644
|
| --- a/components/discardable_memory/common/discardable_shared_memory_heap.cc
|
| +++ b/components/discardable_memory/common/discardable_shared_memory_heap.cc
|
| @@ -11,6 +11,7 @@
|
| #include "base/macros.h"
|
| #include "base/memory/discardable_shared_memory.h"
|
| #include "base/memory/ptr_util.h"
|
| +#include "base/memory/shared_memory_tracker.h"
|
| #include "base/strings/stringprintf.h"
|
| #include "base/trace_event/memory_dump_manager.h"
|
|
|
| @@ -416,33 +417,8 @@ void DiscardableSharedMemoryHeap::OnMemoryDump(
|
| base::trace_event::MemoryAllocatorDump::kUnitsBytes,
|
| locked_objects_size_in_bytes);
|
|
|
| - // Emit an ownership edge towards a global allocator dump node. This allows
|
| - // to avoid double-counting segments when both browser and client process emit
|
| - // them. In the special case of single-process-mode, this will be the only
|
| - // dumper active and the single ownership edge will become a no-op in the UI.
|
| - // The global dump is created as a weak dump so that the segment is removed if
|
| - // the browser does not dump it (segment was purged).
|
| - const uint64_t tracing_process_id =
|
| - base::trace_event::MemoryDumpManager::GetInstance()
|
| - ->GetTracingProcessId();
|
| - base::trace_event::MemoryAllocatorDumpGuid shared_segment_guid =
|
| - GetSegmentGUIDForTracing(tracing_process_id, segment_id);
|
| - // TODO(ssid): Make this weak once the GUID created is consistent
|
| - // crbug.com/661257.
|
| - pmd->CreateSharedGlobalAllocatorDump(shared_segment_guid);
|
| -
|
| - // The size is added to the global dump so that it gets propagated to both the
|
| - // dumps associated.
|
| - pmd->GetSharedGlobalAllocatorDump(shared_segment_guid)
|
| - ->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
|
| - base::trace_event::MemoryAllocatorDump::kUnitsBytes,
|
| - allocated_objects_size_in_bytes);
|
| -
|
| - // By creating an edge with a higher |importance| (w.r.t. browser-side dumps)
|
| - // the tracing UI will account the effective size of the segment to the
|
| - // client.
|
| - const int kImportance = 2;
|
| - pmd->AddOwnershipEdge(segment_dump->guid(), shared_segment_guid, kImportance);
|
| + base::SharedMemoryTracker::AddOwnershipEdges(pmd, obj_dump->guid(),
|
| + shared_memory->shared_memory());
|
| }
|
|
|
| // static
|
|
|