| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 : has_process_totals_(false), | 157 : has_process_totals_(false), |
| 158 has_process_mmaps_(false), | 158 has_process_mmaps_(false), |
| 159 session_state_(std::move(session_state)), | 159 session_state_(std::move(session_state)), |
| 160 dump_args_(dump_args) {} | 160 dump_args_(dump_args) {} |
| 161 | 161 |
| 162 ProcessMemoryDump::~ProcessMemoryDump() {} | 162 ProcessMemoryDump::~ProcessMemoryDump() {} |
| 163 | 163 |
| 164 MemoryAllocatorDump* ProcessMemoryDump::CreateAllocatorDump( | 164 MemoryAllocatorDump* ProcessMemoryDump::CreateAllocatorDump( |
| 165 const std::string& absolute_name) { | 165 const std::string& absolute_name) { |
| 166 return AddAllocatorDumpInternal( | 166 return AddAllocatorDumpInternal( |
| 167 WrapUnique(new MemoryAllocatorDump(absolute_name, this))); | 167 MakeUnique<MemoryAllocatorDump>(absolute_name, this)); |
| 168 } | 168 } |
| 169 | 169 |
| 170 MemoryAllocatorDump* ProcessMemoryDump::CreateAllocatorDump( | 170 MemoryAllocatorDump* ProcessMemoryDump::CreateAllocatorDump( |
| 171 const std::string& absolute_name, | 171 const std::string& absolute_name, |
| 172 const MemoryAllocatorDumpGuid& guid) { | 172 const MemoryAllocatorDumpGuid& guid) { |
| 173 return AddAllocatorDumpInternal( | 173 return AddAllocatorDumpInternal( |
| 174 WrapUnique(new MemoryAllocatorDump(absolute_name, this, guid))); | 174 MakeUnique<MemoryAllocatorDump>(absolute_name, this, guid)); |
| 175 } | 175 } |
| 176 | 176 |
| 177 MemoryAllocatorDump* ProcessMemoryDump::AddAllocatorDumpInternal( | 177 MemoryAllocatorDump* ProcessMemoryDump::AddAllocatorDumpInternal( |
| 178 std::unique_ptr<MemoryAllocatorDump> mad) { | 178 std::unique_ptr<MemoryAllocatorDump> mad) { |
| 179 // In background mode return the black hole dump, if invalid dump name is | 179 // In background mode return the black hole dump, if invalid dump name is |
| 180 // given. | 180 // given. |
| 181 if (dump_args_.level_of_detail == MemoryDumpLevelOfDetail::BACKGROUND && | 181 if (dump_args_.level_of_detail == MemoryDumpLevelOfDetail::BACKGROUND && |
| 182 !IsMemoryAllocatorDumpNameWhitelisted(mad->absolute_name())) { | 182 !IsMemoryAllocatorDumpNameWhitelisted(mad->absolute_name())) { |
| 183 return GetBlackHoleMad(); | 183 return GetBlackHoleMad(); |
| 184 } | 184 } |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 | 364 |
| 365 MemoryAllocatorDump* ProcessMemoryDump::GetBlackHoleMad() { | 365 MemoryAllocatorDump* ProcessMemoryDump::GetBlackHoleMad() { |
| 366 DCHECK(is_black_hole_non_fatal_for_testing_); | 366 DCHECK(is_black_hole_non_fatal_for_testing_); |
| 367 if (!black_hole_mad_) | 367 if (!black_hole_mad_) |
| 368 black_hole_mad_.reset(new MemoryAllocatorDump("discarded", this)); | 368 black_hole_mad_.reset(new MemoryAllocatorDump("discarded", this)); |
| 369 return black_hole_mad_.get(); | 369 return black_hole_mad_.get(); |
| 370 } | 370 } |
| 371 | 371 |
| 372 } // namespace trace_event | 372 } // namespace trace_event |
| 373 } // namespace base | 373 } // namespace base |
| OLD | NEW |