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

Unified Diff: base/memory/discardable_memory_allocator.cc

Issue 1259333003: [tracing] Add SkResourceCache as suballocation to avoid double counting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@skia_v1
Patch Set: Nits. Created 5 years, 5 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: base/memory/discardable_memory_allocator.cc
diff --git a/base/memory/discardable_memory_allocator.cc b/base/memory/discardable_memory_allocator.cc
index 002a3ba5e4763c360dc0a96861d0c53758bdb3bc..99363fe40dfcaa9fbc6124258f2526b9b6be85a3 100644
--- a/base/memory/discardable_memory_allocator.cc
+++ b/base/memory/discardable_memory_allocator.cc
@@ -5,6 +5,8 @@
#include "base/memory/discardable_memory_allocator.h"
#include "base/logging.h"
+#include "base/trace_event/memory_allocator_dump.h"
+#include "base/trace_event/process_memory_dump.h"
namespace base {
namespace {
@@ -31,4 +33,24 @@ DiscardableMemoryAllocator* DiscardableMemoryAllocator::GetInstance() {
return g_allocator;
}
+// static
+const char* DiscardableMemoryAllocator::GetMemoryPoolNameForTracing() {
+ return "discardable/allocated_objects";
+}
+
+// static
+void DiscardableMemoryAllocator::CreateMemoryPoolDumpForTracing(
+ trace_event::ProcessMemoryDump* pmd) {
+ base::trace_event::MemoryAllocatorDump* objects_dump =
+ pmd->CreateAllocatorDump(GetMemoryPoolNameForTracing());
+ base::trace_event::MemoryAllocatorDump* discardable_segments_dump =
+ pmd->CreateAllocatorDump("discardable/segments");
reveman 2015/07/30 21:27:56 The use of segments is a detail of the allocator i
ssid 2015/07/31 12:59:40 Done.
+
+ // The discardable memory segments will be dumped with
+ // "discardable/segments" as the parent and will be owned by
+ // sub-allocations dumped with kAllocatedObjectsDumpName as their parent.
+ pmd->AddOwnershipEdge(objects_dump->guid(),
+ discardable_segments_dump->guid());
reveman 2015/07/30 21:27:56 same here. we shouldn't be referring to segments h
ssid 2015/07/31 12:59:40 Done.
+}
+
} // namespace base

Powered by Google App Engine
This is Rietveld 408576698