| 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 "base/trace_event/process_memory_dump.h" | 5 #include "base/trace_event/process_memory_dump.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 mad->set_flags(MemoryAllocatorDump::Flags::WEAK); | 232 mad->set_flags(MemoryAllocatorDump::Flags::WEAK); |
| 233 return mad; | 233 return mad; |
| 234 } | 234 } |
| 235 | 235 |
| 236 MemoryAllocatorDump* ProcessMemoryDump::GetSharedGlobalAllocatorDump( | 236 MemoryAllocatorDump* ProcessMemoryDump::GetSharedGlobalAllocatorDump( |
| 237 const MemoryAllocatorDumpGuid& guid) const { | 237 const MemoryAllocatorDumpGuid& guid) const { |
| 238 return GetAllocatorDump(GetSharedGlobalAllocatorDumpName(guid)); | 238 return GetAllocatorDump(GetSharedGlobalAllocatorDumpName(guid)); |
| 239 } | 239 } |
| 240 | 240 |
| 241 void ProcessMemoryDump::DumpHeapUsage( | 241 void ProcessMemoryDump::DumpHeapUsage( |
| 242 const base::hash_map<base::trace_event::AllocationContext, | 242 const std::unordered_map<base::trace_event::AllocationContext, |
| 243 base::trace_event::AllocationMetrics>& metrics_by_context, | 243 base::trace_event::AllocationMetrics>& |
| 244 metrics_by_context, |
| 244 base::trace_event::TraceEventMemoryOverhead& overhead, | 245 base::trace_event::TraceEventMemoryOverhead& overhead, |
| 245 const char* allocator_name) { | 246 const char* allocator_name) { |
| 246 if (!metrics_by_context.empty()) { | 247 if (!metrics_by_context.empty()) { |
| 247 DCHECK_EQ(0ul, heap_dumps_.count(allocator_name)); | 248 DCHECK_EQ(0ul, heap_dumps_.count(allocator_name)); |
| 248 std::unique_ptr<TracedValue> heap_dump = ExportHeapDump( | 249 std::unique_ptr<TracedValue> heap_dump = ExportHeapDump( |
| 249 metrics_by_context, *session_state()); | 250 metrics_by_context, *session_state()); |
| 250 heap_dumps_[allocator_name] = std::move(heap_dump); | 251 heap_dumps_[allocator_name] = std::move(heap_dump); |
| 251 } | 252 } |
| 252 | 253 |
| 253 std::string base_name = base::StringPrintf("tracing/heap_profiler_%s", | 254 std::string base_name = base::StringPrintf("tracing/heap_profiler_%s", |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 | 359 |
| 359 MemoryAllocatorDump* ProcessMemoryDump::GetBlackHoleMad() { | 360 MemoryAllocatorDump* ProcessMemoryDump::GetBlackHoleMad() { |
| 360 DCHECK(is_black_hole_non_fatal_for_testing_); | 361 DCHECK(is_black_hole_non_fatal_for_testing_); |
| 361 if (!black_hole_mad_) | 362 if (!black_hole_mad_) |
| 362 black_hole_mad_.reset(new MemoryAllocatorDump("discarded", this)); | 363 black_hole_mad_.reset(new MemoryAllocatorDump("discarded", this)); |
| 363 return black_hole_mad_.get(); | 364 return black_hole_mad_.get(); |
| 364 } | 365 } |
| 365 | 366 |
| 366 } // namespace trace_event | 367 } // namespace trace_event |
| 367 } // namespace base | 368 } // namespace base |
| OLD | NEW |