| 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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 void ProcessMemoryDump::AddOwnershipEdge(const MemoryAllocatorDumpGuid& source, | 335 void ProcessMemoryDump::AddOwnershipEdge(const MemoryAllocatorDumpGuid& source, |
| 336 const MemoryAllocatorDumpGuid& target, | 336 const MemoryAllocatorDumpGuid& target, |
| 337 int importance) { | 337 int importance) { |
| 338 allocator_dumps_edges_.push_back( | 338 allocator_dumps_edges_.push_back( |
| 339 {source, target, importance, kEdgeTypeOwnership}); | 339 {source, target, importance, kEdgeTypeOwnership}); |
| 340 } | 340 } |
| 341 | 341 |
| 342 void ProcessMemoryDump::AddOwnershipEdge( | 342 void ProcessMemoryDump::AddOwnershipEdge( |
| 343 const MemoryAllocatorDumpGuid& source, | 343 const MemoryAllocatorDumpGuid& source, |
| 344 const MemoryAllocatorDumpGuid& target) { | 344 const MemoryAllocatorDumpGuid& target) { |
| 345 AddOwnershipEdge(source, target, 0 /* importance */); | 345 AddOwnershipEdge(source, target, kDefaultImportance); |
| 346 } | 346 } |
| 347 | 347 |
| 348 void ProcessMemoryDump::AddSuballocation(const MemoryAllocatorDumpGuid& source, | 348 void ProcessMemoryDump::AddSuballocation(const MemoryAllocatorDumpGuid& source, |
| 349 const std::string& target_node_name) { | 349 const std::string& target_node_name) { |
| 350 // Do not create new dumps for suballocations in background mode. | 350 // Do not create new dumps for suballocations in background mode. |
| 351 if (dump_args_.level_of_detail == MemoryDumpLevelOfDetail::BACKGROUND) | 351 if (dump_args_.level_of_detail == MemoryDumpLevelOfDetail::BACKGROUND) |
| 352 return; | 352 return; |
| 353 | 353 |
| 354 std::string child_mad_name = target_node_name + "/__" + source.ToString(); | 354 std::string child_mad_name = target_node_name + "/__" + source.ToString(); |
| 355 MemoryAllocatorDump* target_child_mad = CreateAllocatorDump(child_mad_name); | 355 MemoryAllocatorDump* target_child_mad = CreateAllocatorDump(child_mad_name); |
| 356 AddOwnershipEdge(source, target_child_mad->guid()); | 356 AddOwnershipEdge(source, target_child_mad->guid()); |
| 357 } | 357 } |
| 358 | 358 |
| 359 MemoryAllocatorDump* ProcessMemoryDump::GetBlackHoleMad() { | 359 MemoryAllocatorDump* ProcessMemoryDump::GetBlackHoleMad() { |
| 360 DCHECK(is_black_hole_non_fatal_for_testing_); | 360 DCHECK(is_black_hole_non_fatal_for_testing_); |
| 361 if (!black_hole_mad_) | 361 if (!black_hole_mad_) |
| 362 black_hole_mad_.reset(new MemoryAllocatorDump("discarded", this)); | 362 black_hole_mad_.reset(new MemoryAllocatorDump("discarded", this)); |
| 363 return black_hole_mad_.get(); | 363 return black_hole_mad_.get(); |
| 364 } | 364 } |
| 365 | 365 |
| 366 } // namespace trace_event | 366 } // namespace trace_event |
| 367 } // namespace base | 367 } // namespace base |
| OLD | NEW |