| 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 "content/child/web_process_memory_dump_impl.h" | 5 #include "content/child/web_process_memory_dump_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/memory/discardable_memory.h" | 9 #include "base/memory/discardable_memory.h" |
| 10 #include "base/trace_event/process_memory_dump.h" | 10 #include "base/trace_event/process_memory_dump.h" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 107 |
| 108 // 2) Move and transfer the ownership of the WebMemoryAllocatorDump wrappers. | 108 // 2) Move and transfer the ownership of the WebMemoryAllocatorDump wrappers. |
| 109 const size_t expected_final_size = memory_allocator_dumps_.size() + | 109 const size_t expected_final_size = memory_allocator_dumps_.size() + |
| 110 other_impl->memory_allocator_dumps_.size(); | 110 other_impl->memory_allocator_dumps_.size(); |
| 111 while (!other_impl->memory_allocator_dumps_.empty()) { | 111 while (!other_impl->memory_allocator_dumps_.empty()) { |
| 112 auto first_entry = other_impl->memory_allocator_dumps_.begin(); | 112 auto first_entry = other_impl->memory_allocator_dumps_.begin(); |
| 113 base::trace_event::MemoryAllocatorDump* memory_allocator_dump = | 113 base::trace_event::MemoryAllocatorDump* memory_allocator_dump = |
| 114 first_entry->first; | 114 first_entry->first; |
| 115 memory_allocator_dumps_.set( | 115 memory_allocator_dumps_.set( |
| 116 memory_allocator_dump, | 116 memory_allocator_dump, |
| 117 other_impl->memory_allocator_dumps_.take_and_erase(first_entry).Pass()); | 117 other_impl->memory_allocator_dumps_.take_and_erase(first_entry)); |
| 118 } | 118 } |
| 119 DCHECK_EQ(expected_final_size, memory_allocator_dumps_.size()); | 119 DCHECK_EQ(expected_final_size, memory_allocator_dumps_.size()); |
| 120 DCHECK(other_impl->memory_allocator_dumps_.empty()); | 120 DCHECK(other_impl->memory_allocator_dumps_.empty()); |
| 121 } | 121 } |
| 122 | 122 |
| 123 void WebProcessMemoryDumpImpl::addOwnershipEdge( | 123 void WebProcessMemoryDumpImpl::addOwnershipEdge( |
| 124 blink::WebMemoryAllocatorDumpGuid source, | 124 blink::WebMemoryAllocatorDumpGuid source, |
| 125 blink::WebMemoryAllocatorDumpGuid target, | 125 blink::WebMemoryAllocatorDumpGuid target, |
| 126 int importance) { | 126 int importance) { |
| 127 process_memory_dump_->AddOwnershipEdge( | 127 process_memory_dump_->AddOwnershipEdge( |
| (...skipping 28 matching lines...) Expand all Loading... |
| 156 WebProcessMemoryDumpImpl::CreateDiscardableMemoryAllocatorDump( | 156 WebProcessMemoryDumpImpl::CreateDiscardableMemoryAllocatorDump( |
| 157 const std::string& name, | 157 const std::string& name, |
| 158 base::DiscardableMemory* discardable) { | 158 base::DiscardableMemory* discardable) { |
| 159 base::trace_event::MemoryAllocatorDump* dump = | 159 base::trace_event::MemoryAllocatorDump* dump = |
| 160 discardable->CreateMemoryAllocatorDump(name.c_str(), | 160 discardable->CreateMemoryAllocatorDump(name.c_str(), |
| 161 process_memory_dump_); | 161 process_memory_dump_); |
| 162 return createWebMemoryAllocatorDump(dump); | 162 return createWebMemoryAllocatorDump(dump); |
| 163 } | 163 } |
| 164 | 164 |
| 165 } // namespace content | 165 } // namespace content |
| OLD | NEW |