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_MEMORY_DUMP_MANAGER_H_ | 5 #ifndef BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ |
6 #define BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ | 6 #define BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/atomicops.h" | 10 #include "base/atomicops.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // It should not return nullptr after the manager has been initialized. | 95 // It should not return nullptr after the manager has been initialized. |
96 const char* system_allocator_pool_name() const { | 96 const char* system_allocator_pool_name() const { |
97 return system_allocator_pool_name_; | 97 return system_allocator_pool_name_; |
98 }; | 98 }; |
99 | 99 |
100 // Tells the initialization phase to skip scheduling periodic memory dumps. | 100 // Tells the initialization phase to skip scheduling periodic memory dumps. |
101 void DisablePeriodicDumpsForTesting() { | 101 void DisablePeriodicDumpsForTesting() { |
102 disable_periodic_dumps_for_testing_ = true; | 102 disable_periodic_dumps_for_testing_ = true; |
103 } | 103 } |
104 | 104 |
| 105 // When true, calling RegisterMemoryDumpProvider is a no-op. |
| 106 bool ignore_dumper_registrations_for_testing() const { |
| 107 return ignore_dumper_registrations_for_testing_; |
| 108 } |
| 109 |
| 110 void set_ignore_dumper_registrations_for_testing(bool ignore) { |
| 111 ignore_dumper_registrations_for_testing_ = ignore; |
| 112 } |
| 113 |
| 114 |
105 private: | 115 private: |
106 friend struct DefaultDeleter<MemoryDumpManager>; // For the testing instance. | 116 friend struct DefaultDeleter<MemoryDumpManager>; // For the testing instance. |
107 friend struct DefaultSingletonTraits<MemoryDumpManager>; | 117 friend struct DefaultSingletonTraits<MemoryDumpManager>; |
108 friend class MemoryDumpManagerDelegate; | 118 friend class MemoryDumpManagerDelegate; |
109 friend class MemoryDumpManagerTest; | 119 friend class MemoryDumpManagerTest; |
110 FRIEND_TEST_ALL_PREFIXES(MemoryDumpManagerTest, DisableFailingDumpers); | 120 FRIEND_TEST_ALL_PREFIXES(MemoryDumpManagerTest, DisableFailingDumpers); |
111 FRIEND_TEST_ALL_PREFIXES(MemoryDumpManagerTest, | 121 FRIEND_TEST_ALL_PREFIXES(MemoryDumpManagerTest, |
112 UnregisterDumperFromThreadWhileDumping); | 122 UnregisterDumperFromThreadWhileDumping); |
113 | 123 |
114 // Descriptor struct used to hold information about registered MDPs. It is | 124 // Descriptor struct used to hold information about registered MDPs. It is |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 // For time-triggered periodic dumps. | 227 // For time-triggered periodic dumps. |
218 RepeatingTimer<MemoryDumpManager> periodic_dump_timer_; | 228 RepeatingTimer<MemoryDumpManager> periodic_dump_timer_; |
219 | 229 |
220 // The unique id of the child process. This is created only for tracing and is | 230 // The unique id of the child process. This is created only for tracing and is |
221 // expected to be valid only when tracing is enabled. | 231 // expected to be valid only when tracing is enabled. |
222 uint64 tracing_process_id_; | 232 uint64 tracing_process_id_; |
223 | 233 |
224 // Name of the allocated_objects dump. | 234 // Name of the allocated_objects dump. |
225 const char* system_allocator_pool_name_; | 235 const char* system_allocator_pool_name_; |
226 | 236 |
227 // Skips the auto-registration of the core dumpers during Initialize(). | 237 // When true, calling RegisterMemoryDumpProvider is a no-op. |
228 bool skip_core_dumpers_auto_registration_for_testing_; | 238 bool ignore_dumper_registrations_for_testing_; |
229 | 239 |
230 // When true, the initialization phase does not start the periodic memory | 240 // When true, the initialization phase does not start the periodic memory |
231 // dumps. | 241 // dumps. |
232 // TODO(primiano): This should go into TraceConfig. https://goo.gl/5Hj3o0. | 242 // TODO(primiano): This should go into TraceConfig. https://goo.gl/5Hj3o0. |
233 bool disable_periodic_dumps_for_testing_; | 243 bool disable_periodic_dumps_for_testing_; |
234 | 244 |
235 DISALLOW_COPY_AND_ASSIGN(MemoryDumpManager); | 245 DISALLOW_COPY_AND_ASSIGN(MemoryDumpManager); |
236 }; | 246 }; |
237 | 247 |
238 // The delegate is supposed to be long lived (read: a Singleton) and thread | 248 // The delegate is supposed to be long lived (read: a Singleton) and thread |
(...skipping 21 matching lines...) Expand all Loading... |
260 } | 270 } |
261 | 271 |
262 private: | 272 private: |
263 DISALLOW_COPY_AND_ASSIGN(MemoryDumpManagerDelegate); | 273 DISALLOW_COPY_AND_ASSIGN(MemoryDumpManagerDelegate); |
264 }; | 274 }; |
265 | 275 |
266 } // namespace trace_event | 276 } // namespace trace_event |
267 } // namespace base | 277 } // namespace base |
268 | 278 |
269 #endif // BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ | 279 #endif // BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ |
OLD | NEW |