| 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/malloc_dump_provider.h" | 5 #include "base/trace_event/malloc_dump_provider.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/allocator/allocator_extension.h" | 9 #include "base/allocator/allocator_extension.h" |
| 10 #include "base/allocator/allocator_shim.h" | 10 #include "base/allocator/allocator_shim.h" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 if (allocation_register_) { | 184 if (allocation_register_) { |
| 185 if (args.level_of_detail == MemoryDumpLevelOfDetail::DETAILED) { | 185 if (args.level_of_detail == MemoryDumpLevelOfDetail::DETAILED) { |
| 186 for (const auto& alloc_size : *allocation_register_) | 186 for (const auto& alloc_size : *allocation_register_) |
| 187 bytes_by_context[alloc_size.context] += alloc_size.size; | 187 bytes_by_context[alloc_size.context] += alloc_size.size; |
| 188 } | 188 } |
| 189 allocation_register_->EstimateTraceMemoryOverhead(&overhead); | 189 allocation_register_->EstimateTraceMemoryOverhead(&overhead); |
| 190 } | 190 } |
| 191 } // lock(allocation_register_lock_) | 191 } // lock(allocation_register_lock_) |
| 192 | 192 |
| 193 if (!bytes_by_context.empty()) { | 193 if (!bytes_by_context.empty()) { |
| 194 scoped_ptr<TracedValue> heap_dump = ExportHeapDump( | 194 std::unique_ptr<TracedValue> heap_dump = ExportHeapDump( |
| 195 bytes_by_context, pmd->session_state()->stack_frame_deduplicator(), | 195 bytes_by_context, pmd->session_state()->stack_frame_deduplicator(), |
| 196 pmd->session_state()->type_name_deduplicator()); | 196 pmd->session_state()->type_name_deduplicator()); |
| 197 pmd->AddHeapDump("malloc", std::move(heap_dump)); | 197 pmd->AddHeapDump("malloc", std::move(heap_dump)); |
| 198 } | 198 } |
| 199 overhead.DumpInto("tracing/heap_profiler_malloc", pmd); | 199 overhead.DumpInto("tracing/heap_profiler_malloc", pmd); |
| 200 } | 200 } |
| 201 tid_dumping_heap_ = kInvalidThreadId; | 201 tid_dumping_heap_ = kInvalidThreadId; |
| 202 | 202 |
| 203 return true; | 203 return true; |
| 204 } | 204 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 tid_dumping_heap_ == PlatformThread::CurrentId()) | 252 tid_dumping_heap_ == PlatformThread::CurrentId()) |
| 253 return; | 253 return; |
| 254 AutoLock lock(allocation_register_lock_); | 254 AutoLock lock(allocation_register_lock_); |
| 255 if (!allocation_register_) | 255 if (!allocation_register_) |
| 256 return; | 256 return; |
| 257 allocation_register_->Remove(address); | 257 allocation_register_->Remove(address); |
| 258 } | 258 } |
| 259 | 259 |
| 260 } // namespace trace_event | 260 } // namespace trace_event |
| 261 } // namespace base | 261 } // namespace base |
| OLD | NEW |