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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 const std::string& absolute_name, | 163 const std::string& absolute_name, |
164 const MemoryAllocatorDumpGuid& guid) { | 164 const MemoryAllocatorDumpGuid& guid) { |
165 return AddAllocatorDumpInternal( | 165 return AddAllocatorDumpInternal( |
166 WrapUnique(new MemoryAllocatorDump(absolute_name, this, guid))); | 166 WrapUnique(new MemoryAllocatorDump(absolute_name, this, guid))); |
167 } | 167 } |
168 | 168 |
169 MemoryAllocatorDump* ProcessMemoryDump::AddAllocatorDumpInternal( | 169 MemoryAllocatorDump* ProcessMemoryDump::AddAllocatorDumpInternal( |
170 std::unique_ptr<MemoryAllocatorDump> mad) { | 170 std::unique_ptr<MemoryAllocatorDump> mad) { |
171 auto insertion_result = allocator_dumps_.insert( | 171 auto insertion_result = allocator_dumps_.insert( |
172 std::make_pair(mad->absolute_name(), std::move(mad))); | 172 std::make_pair(mad->absolute_name(), std::move(mad))); |
173 DCHECK(insertion_result.second) << "Duplicate name: " << mad->absolute_name(); | 173 MemoryAllocatorDump* inserted_mad = insertion_result.first->second.get(); |
174 return insertion_result.first->second.get(); | 174 DCHECK(insertion_result.second) << "Duplicate name: " |
| 175 << inserted_mad->absolute_name(); |
| 176 return inserted_mad; |
175 } | 177 } |
176 | 178 |
177 MemoryAllocatorDump* ProcessMemoryDump::GetAllocatorDump( | 179 MemoryAllocatorDump* ProcessMemoryDump::GetAllocatorDump( |
178 const std::string& absolute_name) const { | 180 const std::string& absolute_name) const { |
179 auto it = allocator_dumps_.find(absolute_name); | 181 auto it = allocator_dumps_.find(absolute_name); |
180 return it == allocator_dumps_.end() ? nullptr : it->second.get(); | 182 return it == allocator_dumps_.end() ? nullptr : it->second.get(); |
181 } | 183 } |
182 | 184 |
183 MemoryAllocatorDump* ProcessMemoryDump::GetOrCreateAllocatorDump( | 185 MemoryAllocatorDump* ProcessMemoryDump::GetOrCreateAllocatorDump( |
184 const std::string& absolute_name) { | 186 const std::string& absolute_name) { |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 | 315 |
314 void ProcessMemoryDump::AddSuballocation(const MemoryAllocatorDumpGuid& source, | 316 void ProcessMemoryDump::AddSuballocation(const MemoryAllocatorDumpGuid& source, |
315 const std::string& target_node_name) { | 317 const std::string& target_node_name) { |
316 std::string child_mad_name = target_node_name + "/__" + source.ToString(); | 318 std::string child_mad_name = target_node_name + "/__" + source.ToString(); |
317 MemoryAllocatorDump* target_child_mad = CreateAllocatorDump(child_mad_name); | 319 MemoryAllocatorDump* target_child_mad = CreateAllocatorDump(child_mad_name); |
318 AddOwnershipEdge(source, target_child_mad->guid()); | 320 AddOwnershipEdge(source, target_child_mad->guid()); |
319 } | 321 } |
320 | 322 |
321 } // namespace trace_event | 323 } // namespace trace_event |
322 } // namespace base | 324 } // namespace base |
OLD | NEW |