| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 // child-process side, without having to know its own child process id. | 90 // child-process side, without having to know its own child process id. |
| 91 uint64 GetTracingProcessId() const; | 91 uint64 GetTracingProcessId() const; |
| 92 | 92 |
| 93 // Returns the name for a the allocated_objects dump. Use this to declare | 93 // Returns the name for a the allocated_objects dump. Use this to declare |
| 94 // suballocator dumps from other dump providers. | 94 // suballocator dumps from other dump providers. |
| 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. |
| 101 void DisablePeriodicDumpsForTesting() { |
| 102 disable_periodic_dumps_for_testing_ = true; |
| 103 } |
| 104 |
| 100 private: | 105 private: |
| 101 friend struct DefaultDeleter<MemoryDumpManager>; // For the testing instance. | 106 friend struct DefaultDeleter<MemoryDumpManager>; // For the testing instance. |
| 102 friend struct DefaultSingletonTraits<MemoryDumpManager>; | 107 friend struct DefaultSingletonTraits<MemoryDumpManager>; |
| 103 friend class MemoryDumpManagerDelegate; | 108 friend class MemoryDumpManagerDelegate; |
| 104 friend class MemoryDumpManagerTest; | 109 friend class MemoryDumpManagerTest; |
| 105 FRIEND_TEST_ALL_PREFIXES(MemoryDumpManagerTest, DisableFailingDumpers); | 110 FRIEND_TEST_ALL_PREFIXES(MemoryDumpManagerTest, DisableFailingDumpers); |
| 106 FRIEND_TEST_ALL_PREFIXES(MemoryDumpManagerTest, | 111 FRIEND_TEST_ALL_PREFIXES(MemoryDumpManagerTest, |
| 107 UnregisterDumperFromThreadWhileDumping); | 112 UnregisterDumperFromThreadWhileDumping); |
| 108 | 113 |
| 109 // Descriptor struct used to hold information about registered MDPs. It is | 114 // Descriptor struct used to hold information about registered MDPs. It is |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 // The unique id of the child process. This is created only for tracing and is | 220 // The unique id of the child process. This is created only for tracing and is |
| 216 // expected to be valid only when tracing is enabled. | 221 // expected to be valid only when tracing is enabled. |
| 217 uint64 tracing_process_id_; | 222 uint64 tracing_process_id_; |
| 218 | 223 |
| 219 // Name of the allocated_objects dump. | 224 // Name of the allocated_objects dump. |
| 220 const char* system_allocator_pool_name_; | 225 const char* system_allocator_pool_name_; |
| 221 | 226 |
| 222 // Skips the auto-registration of the core dumpers during Initialize(). | 227 // Skips the auto-registration of the core dumpers during Initialize(). |
| 223 bool skip_core_dumpers_auto_registration_for_testing_; | 228 bool skip_core_dumpers_auto_registration_for_testing_; |
| 224 | 229 |
| 230 // When true, the initialization phase does not start the periodic memory |
| 231 // dumps. |
| 232 // TODO(primiano): This should go into TraceConfig. https://goo.gl/5Hj3o0. |
| 233 bool disable_periodic_dumps_for_testing_; |
| 234 |
| 225 DISALLOW_COPY_AND_ASSIGN(MemoryDumpManager); | 235 DISALLOW_COPY_AND_ASSIGN(MemoryDumpManager); |
| 226 }; | 236 }; |
| 227 | 237 |
| 228 // The delegate is supposed to be long lived (read: a Singleton) and thread | 238 // The delegate is supposed to be long lived (read: a Singleton) and thread |
| 229 // safe (i.e. should expect calls from any thread and handle thread hopping). | 239 // safe (i.e. should expect calls from any thread and handle thread hopping). |
| 230 class BASE_EXPORT MemoryDumpManagerDelegate { | 240 class BASE_EXPORT MemoryDumpManagerDelegate { |
| 231 public: | 241 public: |
| 232 virtual void RequestGlobalMemoryDump(const MemoryDumpRequestArgs& args, | 242 virtual void RequestGlobalMemoryDump(const MemoryDumpRequestArgs& args, |
| 233 const MemoryDumpCallback& callback) = 0; | 243 const MemoryDumpCallback& callback) = 0; |
| 234 | 244 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 250 } | 260 } |
| 251 | 261 |
| 252 private: | 262 private: |
| 253 DISALLOW_COPY_AND_ASSIGN(MemoryDumpManagerDelegate); | 263 DISALLOW_COPY_AND_ASSIGN(MemoryDumpManagerDelegate); |
| 254 }; | 264 }; |
| 255 | 265 |
| 256 } // namespace trace_event | 266 } // namespace trace_event |
| 257 } // namespace base | 267 } // namespace base |
| 258 | 268 |
| 259 #endif // BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ | 269 #endif // BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ |
| OLD | NEW |