OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/child/web_memory_dump_provider_adapter.h" | 5 #include "content/child/web_memory_dump_provider_adapter.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/synchronization/lock.h" | 8 #include "base/synchronization/lock.h" |
9 #include "base/trace_event/heap_profiler_allocation_context.h" | 9 #include "base/trace_event/heap_profiler_allocation_context.h" |
10 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" | 10 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 TraceEventMemoryOverhead overhead; | 82 TraceEventMemoryOverhead overhead; |
83 | 83 |
84 { | 84 { |
85 AutoLock lock(g_allocation_register_lock.Get()); | 85 AutoLock lock(g_allocation_register_lock.Get()); |
86 for (const auto& alloc_size : *g_allocation_register) | 86 for (const auto& alloc_size : *g_allocation_register) |
87 writer.InsertAllocation(alloc_size.context, alloc_size.size); | 87 writer.InsertAllocation(alloc_size.context, alloc_size.size); |
88 | 88 |
89 g_allocation_register->EstimateTraceMemoryOverhead(&overhead); | 89 g_allocation_register->EstimateTraceMemoryOverhead(&overhead); |
90 } | 90 } |
91 | 91 |
92 pmd->AddHeapDump("partition_alloc", writer.WriteHeapDump()); | 92 pmd->AddHeapDump("partition_alloc", HeapDumpWriter::Write(writer.Dump())); |
93 overhead.DumpInto("tracing/heap_profiler", pmd); | 93 overhead.DumpInto("tracing/heap_profiler", pmd); |
94 } | 94 } |
95 | 95 |
96 return web_memory_dump_provider_->onMemoryDump(level, &web_pmd_impl); | 96 return web_memory_dump_provider_->onMemoryDump(level, &web_pmd_impl); |
97 } | 97 } |
98 | 98 |
99 void WebMemoryDumpProviderAdapter::OnHeapProfilingEnabled(bool enabled) { | 99 void WebMemoryDumpProviderAdapter::OnHeapProfilingEnabled(bool enabled) { |
100 if (!web_memory_dump_provider_->supportsHeapProfiling()) | 100 if (!web_memory_dump_provider_->supportsHeapProfiling()) |
101 return; | 101 return; |
102 | 102 |
(...skipping 15 matching lines...) Expand all Loading... |
118 web_memory_dump_provider_->onHeapProfilingEnabled(ReportAllocation, | 118 web_memory_dump_provider_->onHeapProfilingEnabled(ReportAllocation, |
119 ReportFree); | 119 ReportFree); |
120 } else { | 120 } else { |
121 web_memory_dump_provider_->onHeapProfilingEnabled(nullptr, nullptr); | 121 web_memory_dump_provider_->onHeapProfilingEnabled(nullptr, nullptr); |
122 } | 122 } |
123 | 123 |
124 g_heap_profiling_enabled = enabled; | 124 g_heap_profiling_enabled = enabled; |
125 } | 125 } |
126 | 126 |
127 } // namespace content | 127 } // namespace content |
OLD | NEW |