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

Unified Diff: content/common/discardable_shared_memory_heap.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: Fixing comments. 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: content/common/discardable_shared_memory_heap.cc
diff --git a/content/common/discardable_shared_memory_heap.cc b/content/common/discardable_shared_memory_heap.cc
index 958fa82554efecf5d9c4dee25bb6206cf7e891c9..b94e5f8d58601d4a05bec05bb9db17b552b8943e 100644
--- a/content/common/discardable_shared_memory_heap.cc
+++ b/content/common/discardable_shared_memory_heap.cc
@@ -22,6 +22,8 @@ bool IsInFreeList(DiscardableSharedMemoryHeap::Span* span) {
return span->previous() || span->next();
}
+const char kDiscardableSegmentsDumpName[] = "discardable/segments";
reveman 2015/07/30 16:00:59 We've been avoiding explicit constants for dump na
ssid 2015/07/30 20:05:15 Done.
+
} // namespace
DiscardableSharedMemoryHeap::Span::Span(
@@ -225,6 +227,7 @@ size_t DiscardableSharedMemoryHeap::GetSizeOfFreeLists() const {
bool DiscardableSharedMemoryHeap::OnMemoryDump(
base::trace_event::ProcessMemoryDump* pmd) {
+ CreateAllocatedObjectsDump(pmd);
reveman 2015/07/30 16:00:59 I think it should be the responsibility of the Dis
ssid 2015/07/30 20:05:15 Yes, But then since i placed the method in this cl
std::for_each(
memory_segments_.begin(), memory_segments_.end(),
[pmd](const ScopedMemorySegment* segment) {
@@ -356,8 +359,8 @@ void DiscardableSharedMemoryHeap::OnMemoryDump(
offset += span->length_;
}
- std::string segment_dump_name =
- base::StringPrintf("discardable/segment_%d", segment_id);
+ std::string segment_dump_name = base::StringPrintf(
+ "%s/segment_%d", kDiscardableSegmentsDumpName, segment_id);
base::trace_event::MemoryAllocatorDump* segment_dump =
pmd->CreateAllocatorDump(segment_dump_name);
segment_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
@@ -391,6 +394,22 @@ void DiscardableSharedMemoryHeap::OnMemoryDump(
}
// static
+void DiscardableSharedMemoryHeap::CreateAllocatedObjectsDump(
+ base::trace_event::ProcessMemoryDump* pmd) {
+ base::trace_event::MemoryAllocatorDump* objects_dump =
+ pmd->CreateAllocatorDump(
+ base::DiscardableSharedMemory::kAllocatedObjectsDumpName);
+ base::trace_event::MemoryAllocatorDump* discardable_segments_dump =
+ pmd->CreateAllocatorDump(kDiscardableSegmentsDumpName);
+
+ // The discardable memory segments will be dumped with
+ // kDiscardableSegmentsDumpName 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());
+}
+
+// static
base::trace_event::MemoryAllocatorDumpGuid
DiscardableSharedMemoryHeap::GetSegmentGUIDForTracing(uint64 tracing_process_id,
int32 segment_id) {

Powered by Google App Engine
This is Rietveld 408576698