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 <vector> | 11 #include <vector> |
| 12 |
11 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
12 #include "base/macros.h" | 14 #include "base/macros.h" |
13 #include "base/trace_event/heap_profiler_allocation_context.h" | 15 #include "base/trace_event/heap_profiler_allocation_context.h" |
14 #include "base/trace_event/memory_dump_request_args.h" | 16 #include "base/trace_event/memory_dump_request_args.h" |
15 #include "platform/PlatformExport.h" | 17 #include "platform/PlatformExport.h" |
16 #include "platform/instrumentation/tracing/web_memory_allocator_dump.h" | 18 #include "platform/instrumentation/tracing/web_memory_allocator_dump.h" |
17 #include "platform/wtf/HashMap.h" | 19 #include "platform/wtf/HashMap.h" |
18 #include "platform/wtf/text/WTFString.h" | 20 #include "platform/wtf/text/WTFString.h" |
19 | 21 |
20 class SkTraceMemoryDump; | 22 class SkTraceMemoryDump; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 const base::trace_event::ProcessMemoryDump* process_memory_dump() const { | 119 const base::trace_event::ProcessMemoryDump* process_memory_dump() const { |
118 return process_memory_dump_; | 120 return process_memory_dump_; |
119 } | 121 } |
120 | 122 |
121 blink::WebMemoryAllocatorDump* CreateDiscardableMemoryAllocatorDump( | 123 blink::WebMemoryAllocatorDump* CreateDiscardableMemoryAllocatorDump( |
122 const std::string& name, | 124 const std::string& name, |
123 base::DiscardableMemory* discardable); | 125 base::DiscardableMemory* discardable); |
124 | 126 |
125 // Dumps heap memory usage. |allocatorName| is used as an absolute name for | 127 // Dumps heap memory usage. |allocatorName| is used as an absolute name for |
126 // base::trace_event::ProcessMemoryDump::DumpHeapUsage(). | 128 // base::trace_event::ProcessMemoryDump::DumpHeapUsage(). |
127 void DumpHeapUsage(const base::hash_map<base::trace_event::AllocationContext, | 129 void DumpHeapUsage( |
128 base::trace_event::AllocationMetrics>& | 130 const std::unordered_map<base::trace_event::AllocationContext, |
129 metrics_by_context, | 131 base::trace_event::AllocationMetrics>& |
130 base::trace_event::TraceEventMemoryOverhead& overhead, | 132 metrics_by_context, |
131 const char* allocator_name); | 133 base::trace_event::TraceEventMemoryOverhead& overhead, |
| 134 const char* allocator_name); |
132 | 135 |
133 private: | 136 private: |
134 FRIEND_TEST_ALL_PREFIXES(WebProcessMemoryDumpTest, IntegrationTest); | 137 FRIEND_TEST_ALL_PREFIXES(WebProcessMemoryDumpTest, IntegrationTest); |
135 | 138 |
136 blink::WebMemoryAllocatorDump* CreateWebMemoryAllocatorDump( | 139 blink::WebMemoryAllocatorDump* CreateWebMemoryAllocatorDump( |
137 base::trace_event::MemoryAllocatorDump* memory_allocator_dump); | 140 base::trace_event::MemoryAllocatorDump* memory_allocator_dump); |
138 | 141 |
139 // Only for the case of ProcessMemoryDump being owned (i.e. the default ctor). | 142 // Only for the case of ProcessMemoryDump being owned (i.e. the default ctor). |
140 std::unique_ptr<base::trace_event::ProcessMemoryDump> | 143 std::unique_ptr<base::trace_event::ProcessMemoryDump> |
141 owned_process_memory_dump_; | 144 owned_process_memory_dump_; |
(...skipping 17 matching lines...) Expand all Loading... |
159 // Stores SkTraceMemoryDump for the current ProcessMemoryDump. | 162 // Stores SkTraceMemoryDump for the current ProcessMemoryDump. |
160 std::vector<std::unique_ptr<skia::SkiaTraceMemoryDumpImpl>> | 163 std::vector<std::unique_ptr<skia::SkiaTraceMemoryDumpImpl>> |
161 sk_trace_dump_list_; | 164 sk_trace_dump_list_; |
162 | 165 |
163 DISALLOW_COPY_AND_ASSIGN(WebProcessMemoryDump); | 166 DISALLOW_COPY_AND_ASSIGN(WebProcessMemoryDump); |
164 }; | 167 }; |
165 | 168 |
166 } // namespace blink | 169 } // namespace blink |
167 | 170 |
168 #endif // WebProcessMemoryDump_h | 171 #endif // WebProcessMemoryDump_h |
OLD | NEW |