| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 break; | 69 break; |
| 70 default: | 70 default: |
| 71 NOTREACHED(); | 71 NOTREACHED(); |
| 72 return false; | 72 return false; |
| 73 } | 73 } |
| 74 WebProcessMemoryDumpImpl web_pmd_impl(args.level_of_detail, pmd); | 74 WebProcessMemoryDumpImpl web_pmd_impl(args.level_of_detail, pmd); |
| 75 | 75 |
| 76 if (args.level_of_detail == MemoryDumpLevelOfDetail::DETAILED && | 76 if (args.level_of_detail == MemoryDumpLevelOfDetail::DETAILED && |
| 77 web_memory_dump_provider_->supportsHeapProfiling() && | 77 web_memory_dump_provider_->supportsHeapProfiling() && |
| 78 g_heap_profiling_enabled) { | 78 g_heap_profiling_enabled) { |
| 79 HeapDumpWriter writer(pmd->session_state()->stack_frame_deduplicator()); | 79 HeapDumpWriter writer(pmd->session_state()->stack_frame_deduplicator(), |
| 80 pmd->session_state()->type_name_deduplicator()); |
| 80 TraceEventMemoryOverhead overhead; | 81 TraceEventMemoryOverhead overhead; |
| 81 | 82 |
| 82 { | 83 { |
| 83 AutoLock lock(g_allocation_register_lock.Get()); | 84 AutoLock lock(g_allocation_register_lock.Get()); |
| 84 for (const auto& alloc_size : *g_allocation_register) | 85 for (const auto& alloc_size : *g_allocation_register) |
| 85 writer.InsertAllocation(alloc_size.context, alloc_size.size); | 86 writer.InsertAllocation(alloc_size.context, alloc_size.size); |
| 86 | 87 |
| 87 g_allocation_register->EstimateTraceMemoryOverhead(&overhead); | 88 g_allocation_register->EstimateTraceMemoryOverhead(&overhead); |
| 88 } | 89 } |
| 89 | 90 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 116 web_memory_dump_provider_->onHeapProfilingEnabled(ReportAllocation, | 117 web_memory_dump_provider_->onHeapProfilingEnabled(ReportAllocation, |
| 117 ReportFree); | 118 ReportFree); |
| 118 } else { | 119 } else { |
| 119 web_memory_dump_provider_->onHeapProfilingEnabled(nullptr, nullptr); | 120 web_memory_dump_provider_->onHeapProfilingEnabled(nullptr, nullptr); |
| 120 } | 121 } |
| 121 | 122 |
| 122 g_heap_profiling_enabled = enabled; | 123 g_heap_profiling_enabled = enabled; |
| 123 } | 124 } |
| 124 | 125 |
| 125 } // namespace content | 126 } // namespace content |
| OLD | NEW |