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 BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ | 5 #ifndef BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ |
6 #define BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ | 6 #define BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 12 matching lines...) Expand all Loading... | |
23 #include "base/trace_event/process_memory_totals.h" | 23 #include "base/trace_event/process_memory_totals.h" |
24 #include "build/build_config.h" | 24 #include "build/build_config.h" |
25 | 25 |
26 // Define COUNT_RESIDENT_BYTES_SUPPORTED if platform supports counting of the | 26 // Define COUNT_RESIDENT_BYTES_SUPPORTED if platform supports counting of the |
27 // resident memory. | 27 // resident memory. |
28 #if (defined(OS_POSIX) && !defined(OS_NACL)) || defined(OS_WIN) | 28 #if (defined(OS_POSIX) && !defined(OS_NACL)) || defined(OS_WIN) |
29 #define COUNT_RESIDENT_BYTES_SUPPORTED | 29 #define COUNT_RESIDENT_BYTES_SUPPORTED |
30 #endif | 30 #endif |
31 | 31 |
32 namespace base { | 32 namespace base { |
33 | |
34 class UnguessableToken; | |
35 | |
33 namespace trace_event { | 36 namespace trace_event { |
34 | 37 |
35 class MemoryDumpSessionState; | 38 class MemoryDumpSessionState; |
36 class TracedValue; | 39 class TracedValue; |
37 | 40 |
38 // ProcessMemoryDump is as a strongly typed container which holds the dumps | 41 // ProcessMemoryDump is as a strongly typed container which holds the dumps |
39 // produced by the MemoryDumpProvider(s) for a specific process. | 42 // produced by the MemoryDumpProvider(s) for a specific process. |
40 class BASE_EXPORT ProcessMemoryDump { | 43 class BASE_EXPORT ProcessMemoryDump { |
41 public: | 44 public: |
42 struct MemoryAllocatorDumpEdge { | 45 struct MemoryAllocatorDumpEdge { |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 void AddOwnershipEdge(const MemoryAllocatorDumpGuid& source, | 144 void AddOwnershipEdge(const MemoryAllocatorDumpGuid& source, |
142 const MemoryAllocatorDumpGuid& target); | 145 const MemoryAllocatorDumpGuid& target); |
143 | 146 |
144 // Adds edges that can be overriden by a later or earlier call to | 147 // Adds edges that can be overriden by a later or earlier call to |
145 // AddOwnershipEdge() with the same source and target with a different | 148 // AddOwnershipEdge() with the same source and target with a different |
146 // |importance| value. | 149 // |importance| value. |
147 void AddOverridableOwnershipEdge(const MemoryAllocatorDumpGuid& source, | 150 void AddOverridableOwnershipEdge(const MemoryAllocatorDumpGuid& source, |
148 const MemoryAllocatorDumpGuid& target, | 151 const MemoryAllocatorDumpGuid& target, |
149 int importance); | 152 int importance); |
150 | 153 |
154 // Creates ownership edges for memory backed by base::SharedMemory. Handles | |
155 // the case of cross process sharing and importnace of ownership for the case | |
156 // with and without the base::SharedMemory dump provider. The new version | |
157 // should just use global dumps created by SharedMemoryTracker and this | |
158 // function handles the transition until we get SharedMemory IDs through mojo | |
159 // channel crbug.com/713763. | |
160 // |client_local_dump_guid| The guid of the local dump created by the client | |
161 // of base::SharedMemory. | |
162 // |client_global_dump_guid| The global guid given by the clients to create | |
163 // ownership edges of their own. These global dumps will no longer be required | |
164 // after the transition. | |
165 // |shared_memory_guid| The ID of the base::SharedMemory that is assigned | |
166 // globally, used to create global dump edges in the new model. | |
167 // |importance| Importance of the global dump edges to say if the current | |
168 // process owns the memory segment. | |
169 // |is_weak| Tells if the global dump created should be a weak dump. | |
170 void CreateSharedMemoryOwnershipEdge( | |
171 const MemoryAllocatorDumpGuid& client_local_dump_guid, | |
172 const MemoryAllocatorDumpGuid& client_global_dump_guid, | |
173 const UnguessableToken& shared_memory_guid, | |
174 int importance); | |
175 void CreateWeakSharedMemoryOwnershipEdge( | |
176 const MemoryAllocatorDumpGuid& client_local_dump_guid, | |
177 const MemoryAllocatorDumpGuid& client_global_dump_guid, | |
178 const UnguessableToken& shared_memory_guid, | |
179 int importance, | |
180 bool is_weak); | |
hajimehoshi
2017/06/07 04:58:04
Exposing the last argument |is_weak| is odd. I'd c
ssid
2017/06/08 00:05:58
Oh yes. fixed.
| |
181 | |
151 const AllocatorDumpEdgesMap& allocator_dumps_edges_for_testing() const { | 182 const AllocatorDumpEdgesMap& allocator_dumps_edges_for_testing() const { |
152 return allocator_dumps_edges_; | 183 return allocator_dumps_edges_; |
153 } | 184 } |
154 | 185 |
155 // Utility method to add a suballocation relationship with the following | 186 // Utility method to add a suballocation relationship with the following |
156 // semantics: |source| is suballocated from |target_node_name|. | 187 // semantics: |source| is suballocated from |target_node_name|. |
157 // This creates a child node of |target_node_name| and adds an ownership edge | 188 // This creates a child node of |target_node_name| and adds an ownership edge |
158 // between |source| and the new child node. As a result, the UI will not | 189 // between |source| and the new child node. As a result, the UI will not |
159 // account the memory of |source| in the target node. | 190 // account the memory of |source| in the target node. |
160 void AddSuballocation(const MemoryAllocatorDumpGuid& source, | 191 void AddSuballocation(const MemoryAllocatorDumpGuid& source, |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
227 // background mode are disabled for testing. | 258 // background mode are disabled for testing. |
228 static bool is_black_hole_non_fatal_for_testing_; | 259 static bool is_black_hole_non_fatal_for_testing_; |
229 | 260 |
230 DISALLOW_COPY_AND_ASSIGN(ProcessMemoryDump); | 261 DISALLOW_COPY_AND_ASSIGN(ProcessMemoryDump); |
231 }; | 262 }; |
232 | 263 |
233 } // namespace trace_event | 264 } // namespace trace_event |
234 } // namespace base | 265 } // namespace base |
235 | 266 |
236 #endif // BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ | 267 #endif // BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ |
OLD | NEW |