| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 const MemoryDumpCallback& callback); | 110 const MemoryDumpCallback& callback); |
| 111 | 111 |
| 112 // Same as above (still asynchronous), but without callback. | 112 // Same as above (still asynchronous), but without callback. |
| 113 void RequestGlobalDump(MemoryDumpType dump_type, | 113 void RequestGlobalDump(MemoryDumpType dump_type, |
| 114 MemoryDumpLevelOfDetail level_of_detail); | 114 MemoryDumpLevelOfDetail level_of_detail); |
| 115 | 115 |
| 116 // TraceLog::EnabledStateObserver implementation. | 116 // TraceLog::EnabledStateObserver implementation. |
| 117 void OnTraceLogEnabled() override; | 117 void OnTraceLogEnabled() override; |
| 118 void OnTraceLogDisabled() override; | 118 void OnTraceLogDisabled() override; |
| 119 | 119 |
| 120 // Enable heap profiling if kEnableHeapProfiling is specified. |
| 121 void EnableHeapProfilingIfNeeded(); |
| 122 |
| 120 // Returns true if the dump mode is allowed for current tracing session. | 123 // Returns true if the dump mode is allowed for current tracing session. |
| 121 bool IsDumpModeAllowed(MemoryDumpLevelOfDetail dump_mode); | 124 bool IsDumpModeAllowed(MemoryDumpLevelOfDetail dump_mode); |
| 122 | 125 |
| 123 // Returns the MemoryDumpSessionState object, which is shared by all the | 126 // Returns the MemoryDumpSessionState object, which is shared by all the |
| 124 // ProcessMemoryDump and MemoryAllocatorDump instances through all the tracing | 127 // ProcessMemoryDump and MemoryAllocatorDump instances through all the tracing |
| 125 // session lifetime. | 128 // session lifetime. |
| 126 const scoped_refptr<MemoryDumpSessionState>& session_state_for_testing() | 129 const scoped_refptr<MemoryDumpSessionState>& session_state_for_testing() |
| 127 const { | 130 const { |
| 128 return session_state_; | 131 return session_state_; |
| 129 } | 132 } |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 static const int kMaxConsecutiveFailuresCount; | 305 static const int kMaxConsecutiveFailuresCount; |
| 303 static const char* const kSystemAllocatorPoolName; | 306 static const char* const kSystemAllocatorPoolName; |
| 304 | 307 |
| 305 MemoryDumpManager(); | 308 MemoryDumpManager(); |
| 306 ~MemoryDumpManager() override; | 309 ~MemoryDumpManager() override; |
| 307 | 310 |
| 308 static void SetInstanceForTesting(MemoryDumpManager* instance); | 311 static void SetInstanceForTesting(MemoryDumpManager* instance); |
| 309 static void FinalizeDumpAndAddToTrace( | 312 static void FinalizeDumpAndAddToTrace( |
| 310 std::unique_ptr<ProcessMemoryDumpAsyncState> pmd_async_state); | 313 std::unique_ptr<ProcessMemoryDumpAsyncState> pmd_async_state); |
| 311 | 314 |
| 312 // Enable heap profiling if kEnableHeapProfiling is specified. | |
| 313 void EnableHeapProfilingIfNeeded(); | |
| 314 | |
| 315 // Internal, used only by MemoryDumpManagerDelegate. | 315 // Internal, used only by MemoryDumpManagerDelegate. |
| 316 // Creates a memory dump for the current process and appends it to the trace. | 316 // Creates a memory dump for the current process and appends it to the trace. |
| 317 // |callback| will be invoked asynchronously upon completion on the same | 317 // |callback| will be invoked asynchronously upon completion on the same |
| 318 // thread on which CreateProcessDump() was called. | 318 // thread on which CreateProcessDump() was called. |
| 319 void CreateProcessDump(const MemoryDumpRequestArgs& args, | 319 void CreateProcessDump(const MemoryDumpRequestArgs& args, |
| 320 const MemoryDumpCallback& callback); | 320 const MemoryDumpCallback& callback); |
| 321 | 321 |
| 322 // Calls InvokeOnMemoryDump() for the next MDP on the task runner specified by | 322 // Calls InvokeOnMemoryDump() for the next MDP on the task runner specified by |
| 323 // the MDP while registration. On failure to do so, skips and continues to | 323 // the MDP while registration. On failure to do so, skips and continues to |
| 324 // next MDP. | 324 // next MDP. |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 } | 425 } |
| 426 | 426 |
| 427 private: | 427 private: |
| 428 DISALLOW_COPY_AND_ASSIGN(MemoryDumpManagerDelegate); | 428 DISALLOW_COPY_AND_ASSIGN(MemoryDumpManagerDelegate); |
| 429 }; | 429 }; |
| 430 | 430 |
| 431 } // namespace trace_event | 431 } // namespace trace_event |
| 432 } // namespace base | 432 } // namespace base |
| 433 | 433 |
| 434 #endif // BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ | 434 #endif // BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ |
| OLD | NEW |