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

Side by Side Diff: third_party/WebKit/Source/platform/PartitionAllocMemoryDumpProvider.cpp

Issue 2830093003: Replace uses of hash_map in //base (Closed)
Patch Set: iOS Created 3 years, 7 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 unified diff | Download patch
OLDNEW
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 <unordered_map>
8
7 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
8 #include "base/trace_event/heap_profiler_allocation_context.h" 10 #include "base/trace_event/heap_profiler_allocation_context.h"
9 #include "base/trace_event/heap_profiler_allocation_context_tracker.h" 11 #include "base/trace_event/heap_profiler_allocation_context_tracker.h"
10 #include "base/trace_event/heap_profiler_allocation_register.h" 12 #include "base/trace_event/heap_profiler_allocation_register.h"
11 #include "base/trace_event/process_memory_dump.h" 13 #include "base/trace_event/process_memory_dump.h"
12 #include "base/trace_event/trace_event_memory_overhead.h" 14 #include "base/trace_event/trace_event_memory_overhead.h"
13 #include "platform/wtf/allocator/Partitions.h" 15 #include "platform/wtf/allocator/Partitions.h"
14 #include "platform/wtf/text/WTFString.h" 16 #include "platform/wtf/text/WTFString.h"
15 17
16 namespace blink { 18 namespace blink {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 131
130 bool PartitionAllocMemoryDumpProvider::OnMemoryDump( 132 bool PartitionAllocMemoryDumpProvider::OnMemoryDump(
131 const base::trace_event::MemoryDumpArgs& args, 133 const base::trace_event::MemoryDumpArgs& args,
132 base::trace_event::ProcessMemoryDump* memory_dump) { 134 base::trace_event::ProcessMemoryDump* memory_dump) {
133 using base::trace_event::MemoryDumpLevelOfDetail; 135 using base::trace_event::MemoryDumpLevelOfDetail;
134 136
135 MemoryDumpLevelOfDetail level_of_detail = args.level_of_detail; 137 MemoryDumpLevelOfDetail level_of_detail = args.level_of_detail;
136 if (is_heap_profiling_enabled_) { 138 if (is_heap_profiling_enabled_) {
137 // Overhead should always be reported, regardless of light vs. heavy. 139 // Overhead should always be reported, regardless of light vs. heavy.
138 base::trace_event::TraceEventMemoryOverhead overhead; 140 base::trace_event::TraceEventMemoryOverhead overhead;
139 base::hash_map<base::trace_event::AllocationContext, 141 std::unordered_map<base::trace_event::AllocationContext,
140 base::trace_event::AllocationMetrics> 142 base::trace_event::AllocationMetrics>
141 metrics_by_context; 143 metrics_by_context;
142 { 144 {
143 MutexLocker locker(allocation_register_mutex_); 145 MutexLocker locker(allocation_register_mutex_);
144 // Dump only the overhead estimation in non-detailed dumps. 146 // Dump only the overhead estimation in non-detailed dumps.
145 if (level_of_detail == MemoryDumpLevelOfDetail::DETAILED) { 147 if (level_of_detail == MemoryDumpLevelOfDetail::DETAILED) {
146 for (const auto& alloc_size : *allocation_register_) { 148 for (const auto& alloc_size : *allocation_register_) {
147 base::trace_event::AllocationMetrics& metrics = 149 base::trace_event::AllocationMetrics& metrics =
148 metrics_by_context[alloc_size.context]; 150 metrics_by_context[alloc_size.context];
149 metrics.size += alloc_size.size; 151 metrics.size += alloc_size.size;
150 metrics.count++; 152 metrics.count++;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 allocation_register_->Insert(address, size, context); 217 allocation_register_->Insert(address, size, context);
216 } 218 }
217 219
218 void PartitionAllocMemoryDumpProvider::Remove(void* address) { 220 void PartitionAllocMemoryDumpProvider::Remove(void* address) {
219 MutexLocker locker(allocation_register_mutex_); 221 MutexLocker locker(allocation_register_mutex_);
220 if (allocation_register_) 222 if (allocation_register_)
221 allocation_register_->Remove(address); 223 allocation_register_->Remove(address);
222 } 224 }
223 225
224 } // namespace blink 226 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698