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