| 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/allocator/features.h" | 10 #include "base/allocator/features.h" |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 476 MemoryDumpRequestArgs args = {guid, dump_type, level_of_detail}; | 476 MemoryDumpRequestArgs args = {guid, dump_type, level_of_detail}; |
| 477 delegate->RequestGlobalMemoryDump(args, wrapped_callback); | 477 delegate->RequestGlobalMemoryDump(args, wrapped_callback); |
| 478 } | 478 } |
| 479 | 479 |
| 480 void MemoryDumpManager::RequestGlobalDump( | 480 void MemoryDumpManager::RequestGlobalDump( |
| 481 MemoryDumpType dump_type, | 481 MemoryDumpType dump_type, |
| 482 MemoryDumpLevelOfDetail level_of_detail) { | 482 MemoryDumpLevelOfDetail level_of_detail) { |
| 483 RequestGlobalDump(dump_type, level_of_detail, MemoryDumpCallback()); | 483 RequestGlobalDump(dump_type, level_of_detail, MemoryDumpCallback()); |
| 484 } | 484 } |
| 485 | 485 |
| 486 bool MemoryDumpManager::IsDumpProviderRegisteredForTesting( |
| 487 MemoryDumpProvider* provider) { |
| 488 AutoLock lock(lock_); |
| 489 |
| 490 for (const auto& info : dump_providers_) { |
| 491 if (info->dump_provider == provider) |
| 492 return true; |
| 493 } |
| 494 return false; |
| 495 } |
| 496 |
| 486 void MemoryDumpManager::CreateProcessDump(const MemoryDumpRequestArgs& args, | 497 void MemoryDumpManager::CreateProcessDump(const MemoryDumpRequestArgs& args, |
| 487 const MemoryDumpCallback& callback) { | 498 const MemoryDumpCallback& callback) { |
| 488 TRACE_EVENT_NESTABLE_ASYNC_BEGIN0(kTraceCategory, "ProcessMemoryDump", | 499 TRACE_EVENT_NESTABLE_ASYNC_BEGIN0(kTraceCategory, "ProcessMemoryDump", |
| 489 TRACE_ID_MANGLE(args.dump_guid)); | 500 TRACE_ID_MANGLE(args.dump_guid)); |
| 490 | 501 |
| 491 // If argument filter is enabled then only background mode dumps should be | 502 // If argument filter is enabled then only background mode dumps should be |
| 492 // allowed. In case the trace config passed for background tracing session | 503 // allowed. In case the trace config passed for background tracing session |
| 493 // missed the allowed modes argument, it crashes here instead of creating | 504 // missed the allowed modes argument, it crashes here instead of creating |
| 494 // unexpected dumps. | 505 // unexpected dumps. |
| 495 if (TraceLog::GetInstance() | 506 if (TraceLog::GetInstance() |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 965 if (iter == process_dumps.end()) { | 976 if (iter == process_dumps.end()) { |
| 966 std::unique_ptr<ProcessMemoryDump> new_pmd( | 977 std::unique_ptr<ProcessMemoryDump> new_pmd( |
| 967 new ProcessMemoryDump(session_state, dump_args)); | 978 new ProcessMemoryDump(session_state, dump_args)); |
| 968 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first; | 979 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first; |
| 969 } | 980 } |
| 970 return iter->second.get(); | 981 return iter->second.get(); |
| 971 } | 982 } |
| 972 | 983 |
| 973 } // namespace trace_event | 984 } // namespace trace_event |
| 974 } // namespace base | 985 } // namespace base |
| OLD | NEW |