| 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 #include "base/trace_event/memory_dump_manager.h" | 5 #include "base/trace_event/memory_dump_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/atomic_sequence_num.h" | 10 #include "base/atomic_sequence_num.h" |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 MemoryDumpType dump_type, | 381 MemoryDumpType dump_type, |
| 382 MemoryDumpLevelOfDetail level_of_detail) { | 382 MemoryDumpLevelOfDetail level_of_detail) { |
| 383 RequestGlobalDump(dump_type, level_of_detail, MemoryDumpCallback()); | 383 RequestGlobalDump(dump_type, level_of_detail, MemoryDumpCallback()); |
| 384 } | 384 } |
| 385 | 385 |
| 386 void MemoryDumpManager::CreateProcessDump(const MemoryDumpRequestArgs& args, | 386 void MemoryDumpManager::CreateProcessDump(const MemoryDumpRequestArgs& args, |
| 387 const MemoryDumpCallback& callback) { | 387 const MemoryDumpCallback& callback) { |
| 388 TRACE_EVENT_NESTABLE_ASYNC_BEGIN0(kTraceCategory, "ProcessMemoryDump", | 388 TRACE_EVENT_NESTABLE_ASYNC_BEGIN0(kTraceCategory, "ProcessMemoryDump", |
| 389 TRACE_ID_MANGLE(args.dump_guid)); | 389 TRACE_ID_MANGLE(args.dump_guid)); |
| 390 | 390 |
| 391 // If argument filter is enabled then only background mode dumps should be | |
| 392 // allowed. In case the trace config passed for background tracing session | |
| 393 // missed the allowed modes argument, it crashes here instead of creating | |
| 394 // unexpected dumps. | |
| 395 if (TraceLog::GetInstance() | |
| 396 ->GetCurrentTraceConfig() | |
| 397 .IsArgumentFilterEnabled()) { | |
| 398 CHECK_EQ(MemoryDumpLevelOfDetail::BACKGROUND, args.level_of_detail); | |
| 399 } | |
| 400 | |
| 401 std::unique_ptr<ProcessMemoryDumpAsyncState> pmd_async_state; | 391 std::unique_ptr<ProcessMemoryDumpAsyncState> pmd_async_state; |
| 402 { | 392 { |
| 403 AutoLock lock(lock_); | 393 AutoLock lock(lock_); |
| 404 | 394 |
| 405 // |dump_thread_| can be nullptr is tracing was disabled before reaching | 395 // |dump_thread_| can be nullptr is tracing was disabled before reaching |
| 406 // here. SetupNextMemoryDump() is robust enough to tolerate it and will | 396 // here. SetupNextMemoryDump() is robust enough to tolerate it and will |
| 407 // NACK the dump. | 397 // NACK the dump. |
| 408 pmd_async_state.reset(new ProcessMemoryDumpAsyncState( | 398 pmd_async_state.reset(new ProcessMemoryDumpAsyncState( |
| 409 args, dump_providers_, session_state_, callback, | 399 args, dump_providers_, session_state_, callback, |
| 410 dump_thread_ ? dump_thread_->task_runner() : nullptr)); | 400 dump_thread_ ? dump_thread_->task_runner() : nullptr)); |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 if (heavy_dump_rate_ > 0 && periodic_dumps_count_ % heavy_dump_rate_ == 0) | 864 if (heavy_dump_rate_ > 0 && periodic_dumps_count_ % heavy_dump_rate_ == 0) |
| 875 level_of_detail = MemoryDumpLevelOfDetail::DETAILED; | 865 level_of_detail = MemoryDumpLevelOfDetail::DETAILED; |
| 876 ++periodic_dumps_count_; | 866 ++periodic_dumps_count_; |
| 877 | 867 |
| 878 MemoryDumpManager::GetInstance()->RequestGlobalDump( | 868 MemoryDumpManager::GetInstance()->RequestGlobalDump( |
| 879 MemoryDumpType::PERIODIC_INTERVAL, level_of_detail); | 869 MemoryDumpType::PERIODIC_INTERVAL, level_of_detail); |
| 880 } | 870 } |
| 881 | 871 |
| 882 } // namespace trace_event | 872 } // namespace trace_event |
| 883 } // namespace base | 873 } // namespace base |
| OLD | NEW |