| 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 "platform/web_process_memory_dump.h" | 5 #include "platform/web_process_memory_dump.h" |
| 6 | 6 |
| 7 #include "base/memory/discardable_memory.h" | 7 #include "base/memory/discardable_memory.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/trace_event/heap_profiler_heap_dump_writer.h" | 10 #include "base/trace_event/heap_profiler_heap_dump_writer.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 if (!memory_allocator_dump) | 67 if (!memory_allocator_dump) |
| 68 return nullptr; | 68 return nullptr; |
| 69 | 69 |
| 70 // Wrap it and return to blink. | 70 // Wrap it and return to blink. |
| 71 WebMemoryAllocatorDump* web_memory_allocator_dump = | 71 WebMemoryAllocatorDump* web_memory_allocator_dump = |
| 72 new WebMemoryAllocatorDump(memory_allocator_dump); | 72 new WebMemoryAllocatorDump(memory_allocator_dump); |
| 73 | 73 |
| 74 // memory_allocator_dumps_ will take ownership of | 74 // memory_allocator_dumps_ will take ownership of |
| 75 // |web_memory_allocator_dump|. | 75 // |web_memory_allocator_dump|. |
| 76 memory_allocator_dumps_.set( | 76 memory_allocator_dumps_.set( |
| 77 memory_allocator_dump, wrapUnique(web_memory_allocator_dump)); | 77 memory_allocator_dump, adoptPtr(web_memory_allocator_dump)); |
| 78 return web_memory_allocator_dump; | 78 return web_memory_allocator_dump; |
| 79 } | 79 } |
| 80 | 80 |
| 81 blink::WebMemoryAllocatorDump* WebProcessMemoryDump::getMemoryAllocatorDump( | 81 blink::WebMemoryAllocatorDump* WebProcessMemoryDump::getMemoryAllocatorDump( |
| 82 const String& absolute_name) const { | 82 const String& absolute_name) const { |
| 83 StringUTF8Adaptor adapter(absolute_name); | 83 StringUTF8Adaptor adapter(absolute_name); |
| 84 std::string name(adapter.data(), adapter.length()); | 84 std::string name(adapter.data(), adapter.length()); |
| 85 // Retrieve the base MemoryAllocatorDump object and then reverse lookup | 85 // Retrieve the base MemoryAllocatorDump object and then reverse lookup |
| 86 // its wrapper. | 86 // its wrapper. |
| 87 base::trace_event::MemoryAllocatorDump* memory_allocator_dump = | 87 base::trace_event::MemoryAllocatorDump* memory_allocator_dump = |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 180 |
| 181 void WebProcessMemoryDump::dumpHeapUsage( | 181 void WebProcessMemoryDump::dumpHeapUsage( |
| 182 const base::hash_map<base::trace_event::AllocationContext, | 182 const base::hash_map<base::trace_event::AllocationContext, |
| 183 base::trace_event::AllocationMetrics>& metrics_by_context, | 183 base::trace_event::AllocationMetrics>& metrics_by_context, |
| 184 base::trace_event::TraceEventMemoryOverhead& overhead, | 184 base::trace_event::TraceEventMemoryOverhead& overhead, |
| 185 const char* allocator_name) { | 185 const char* allocator_name) { |
| 186 process_memory_dump_->DumpHeapUsage(metrics_by_context, overhead, allocator_na
me); | 186 process_memory_dump_->DumpHeapUsage(metrics_by_context, overhead, allocator_na
me); |
| 187 } | 187 } |
| 188 | 188 |
| 189 } // namespace content | 189 } // namespace content |
| OLD | NEW |