| 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 #ifndef WebProcessMemoryDump_h | 5 #ifndef WebProcessMemoryDump_h |
| 6 #define WebProcessMemoryDump_h | 6 #define WebProcessMemoryDump_h |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <unordered_map> | 10 #include <unordered_map> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/trace_event/heap_profiler_allocation_context.h" | 15 #include "base/trace_event/heap_profiler_allocation_context.h" |
| 16 #include "base/trace_event/memory_dump_request_args.h" | 16 #include "base/trace_event/memory_dump_request_args.h" |
| 17 #include "platform/PlatformExport.h" | 17 #include "platform/PlatformExport.h" |
| 18 #include "platform/instrumentation/tracing/web_memory_allocator_dump.h" | 18 #include "platform/instrumentation/tracing/web_memory_allocator_dump.h" |
| 19 #include "platform/wtf/HashMap.h" | 19 #include "platform/wtf/HashMap.h" |
| 20 #include "platform/wtf/text/WTFString.h" | 20 #include "platform/wtf/text/WTFString.h" |
| 21 | 21 |
| 22 class SkTraceMemoryDump; | 22 class SkTraceMemoryDump; |
| 23 | 23 |
| 24 namespace base { | 24 namespace base { |
| 25 class DiscardableMemory; | 25 class DiscardableMemory; |
| 26 namespace trace_event { | 26 namespace trace_event { |
| 27 class MemoryAllocatorDump; | 27 class MemoryAllocatorDump; |
| 28 class ProcessMemoryDump; | 28 class ProcessMemoryDump; |
| 29 class TraceEventMemoryOverhead; | |
| 30 } // namespace base | 29 } // namespace base |
| 31 } // namespace trace_event | 30 } // namespace trace_event |
| 32 | 31 |
| 33 namespace skia { | 32 namespace skia { |
| 34 class SkiaTraceMemoryDumpImpl; | 33 class SkiaTraceMemoryDumpImpl; |
| 35 } // namespace skia | 34 } // namespace skia |
| 36 | 35 |
| 37 namespace blink { | 36 namespace blink { |
| 38 | 37 |
| 39 // Used to specify the type of memory dump the WebProcessMemoryDump should | 38 // Used to specify the type of memory dump the WebProcessMemoryDump should |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 SkTraceMemoryDump* CreateDumpAdapterForSkia(const String& dump_name_prefix); | 116 SkTraceMemoryDump* CreateDumpAdapterForSkia(const String& dump_name_prefix); |
| 118 | 117 |
| 119 const base::trace_event::ProcessMemoryDump* process_memory_dump() const { | 118 const base::trace_event::ProcessMemoryDump* process_memory_dump() const { |
| 120 return process_memory_dump_; | 119 return process_memory_dump_; |
| 121 } | 120 } |
| 122 | 121 |
| 123 blink::WebMemoryAllocatorDump* CreateDiscardableMemoryAllocatorDump( | 122 blink::WebMemoryAllocatorDump* CreateDiscardableMemoryAllocatorDump( |
| 124 const std::string& name, | 123 const std::string& name, |
| 125 base::DiscardableMemory* discardable); | 124 base::DiscardableMemory* discardable); |
| 126 | 125 |
| 127 // Dumps heap memory usage. |allocatorName| is used as an absolute name for | |
| 128 // base::trace_event::ProcessMemoryDump::DumpHeapUsage(). | |
| 129 void DumpHeapUsage( | |
| 130 const std::unordered_map<base::trace_event::AllocationContext, | |
| 131 base::trace_event::AllocationMetrics>& | |
| 132 metrics_by_context, | |
| 133 base::trace_event::TraceEventMemoryOverhead& overhead, | |
| 134 const char* allocator_name); | |
| 135 | |
| 136 private: | 126 private: |
| 137 FRIEND_TEST_ALL_PREFIXES(WebProcessMemoryDumpTest, IntegrationTest); | 127 FRIEND_TEST_ALL_PREFIXES(WebProcessMemoryDumpTest, IntegrationTest); |
| 138 | 128 |
| 139 blink::WebMemoryAllocatorDump* CreateWebMemoryAllocatorDump( | 129 blink::WebMemoryAllocatorDump* CreateWebMemoryAllocatorDump( |
| 140 base::trace_event::MemoryAllocatorDump* memory_allocator_dump); | 130 base::trace_event::MemoryAllocatorDump* memory_allocator_dump); |
| 141 | 131 |
| 142 // Only for the case of ProcessMemoryDump being owned (i.e. the default ctor). | 132 // Only for the case of ProcessMemoryDump being owned (i.e. the default ctor). |
| 143 std::unique_ptr<base::trace_event::ProcessMemoryDump> | 133 std::unique_ptr<base::trace_event::ProcessMemoryDump> |
| 144 owned_process_memory_dump_; | 134 owned_process_memory_dump_; |
| 145 | 135 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 162 // Stores SkTraceMemoryDump for the current ProcessMemoryDump. | 152 // Stores SkTraceMemoryDump for the current ProcessMemoryDump. |
| 163 std::vector<std::unique_ptr<skia::SkiaTraceMemoryDumpImpl>> | 153 std::vector<std::unique_ptr<skia::SkiaTraceMemoryDumpImpl>> |
| 164 sk_trace_dump_list_; | 154 sk_trace_dump_list_; |
| 165 | 155 |
| 166 DISALLOW_COPY_AND_ASSIGN(WebProcessMemoryDump); | 156 DISALLOW_COPY_AND_ASSIGN(WebProcessMemoryDump); |
| 167 }; | 157 }; |
| 168 | 158 |
| 169 } // namespace blink | 159 } // namespace blink |
| 170 | 160 |
| 171 #endif // WebProcessMemoryDump_h | 161 #endif // WebProcessMemoryDump_h |
| OLD | NEW |