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

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

Issue 2830093003: Replace uses of hash_map in //base (Closed)
Patch Set: WebKit callers Created 3 years, 8 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 "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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698