Chromium Code Reviews| 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 "platform/PartitionAllocMemoryDumpProvider.h" | 5 #include "platform/PartitionAllocMemoryDumpProvider.h" |
| 6 | 6 |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "base/trace_event/heap_profiler_allocation_context.h" | 8 #include "base/trace_event/heap_profiler_allocation_context.h" |
| 9 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" | 9 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" |
| 10 #include "base/trace_event/heap_profiler_allocation_register.h" | 10 #include "base/trace_event/heap_profiler_allocation_register.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 129 | 129 |
| 130 bool PartitionAllocMemoryDumpProvider::OnMemoryDump( | 130 bool PartitionAllocMemoryDumpProvider::OnMemoryDump( |
| 131 const base::trace_event::MemoryDumpArgs& args, | 131 const base::trace_event::MemoryDumpArgs& args, |
| 132 base::trace_event::ProcessMemoryDump* memory_dump) { | 132 base::trace_event::ProcessMemoryDump* memory_dump) { |
| 133 using base::trace_event::MemoryDumpLevelOfDetail; | 133 using base::trace_event::MemoryDumpLevelOfDetail; |
| 134 | 134 |
| 135 MemoryDumpLevelOfDetail level_of_detail = args.level_of_detail; | 135 MemoryDumpLevelOfDetail level_of_detail = args.level_of_detail; |
| 136 if (is_heap_profiling_enabled_) { | 136 if (is_heap_profiling_enabled_) { |
| 137 // Overhead should always be reported, regardless of light vs. heavy. | 137 // Overhead should always be reported, regardless of light vs. heavy. |
| 138 base::trace_event::TraceEventMemoryOverhead overhead; | 138 base::trace_event::TraceEventMemoryOverhead overhead; |
| 139 base::hash_map<base::trace_event::AllocationContext, | 139 std::unordered_map<base::trace_event::AllocationContext, |
|
Łukasz Anforowicz
2017/04/24 18:46:10
IWYU: #include <unordered_map>?
| |
| 140 base::trace_event::AllocationMetrics> | 140 base::trace_event::AllocationMetrics> |
| 141 metrics_by_context; | 141 metrics_by_context; |
| 142 { | 142 { |
| 143 MutexLocker locker(allocation_register_mutex_); | 143 MutexLocker locker(allocation_register_mutex_); |
| 144 // Dump only the overhead estimation in non-detailed dumps. | 144 // Dump only the overhead estimation in non-detailed dumps. |
| 145 if (level_of_detail == MemoryDumpLevelOfDetail::DETAILED) { | 145 if (level_of_detail == MemoryDumpLevelOfDetail::DETAILED) { |
| 146 for (const auto& alloc_size : *allocation_register_) { | 146 for (const auto& alloc_size : *allocation_register_) { |
| 147 base::trace_event::AllocationMetrics& metrics = | 147 base::trace_event::AllocationMetrics& metrics = |
| 148 metrics_by_context[alloc_size.context]; | 148 metrics_by_context[alloc_size.context]; |
| 149 metrics.size += alloc_size.size; | 149 metrics.size += alloc_size.size; |
| 150 metrics.count++; | 150 metrics.count++; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 215 allocation_register_->Insert(address, size, context); | 215 allocation_register_->Insert(address, size, context); |
| 216 } | 216 } |
| 217 | 217 |
| 218 void PartitionAllocMemoryDumpProvider::Remove(void* address) { | 218 void PartitionAllocMemoryDumpProvider::Remove(void* address) { |
| 219 MutexLocker locker(allocation_register_mutex_); | 219 MutexLocker locker(allocation_register_mutex_); |
| 220 if (allocation_register_) | 220 if (allocation_register_) |
| 221 allocation_register_->Remove(address); | 221 allocation_register_->Remove(address); |
| 222 } | 222 } |
| 223 | 223 |
| 224 } // namespace blink | 224 } // namespace blink |
| OLD | NEW |