Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Unified Diff: components/discardable_memory/common/discardable_shared_memory_heap.cc

Issue 2535213002: [WIP] Add SharedMemoryTracker to dump base::SharedMemory usage
Patch Set: (rebase) Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
« no previous file with comments | « cc/resources/shared_bitmap.cc ('k') | components/discardable_memory/service/discardable_shared_memory_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698