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 auto mdp_iter = dump_providers_.begin(); | |
Primiano Tucci (use gerrit)
2017/03/15 12:44:40
you can use C++11 foreach these days, which is qui
hjd
2017/03/15 14:23:12
Done, thanks!
| |
491 for (; mdp_iter != dump_providers_.end(); ++mdp_iter) { | |
492 if ((*mdp_iter)->dump_provider == provider) | |
493 return true; | |
494 } | |
495 return false; | |
496 } | |
497 | |
486 void MemoryDumpManager::CreateProcessDump(const MemoryDumpRequestArgs& args, | 498 void MemoryDumpManager::CreateProcessDump(const MemoryDumpRequestArgs& args, |
487 const MemoryDumpCallback& callback) { | 499 const MemoryDumpCallback& callback) { |
488 TRACE_EVENT_NESTABLE_ASYNC_BEGIN0(kTraceCategory, "ProcessMemoryDump", | 500 TRACE_EVENT_NESTABLE_ASYNC_BEGIN0(kTraceCategory, "ProcessMemoryDump", |
489 TRACE_ID_MANGLE(args.dump_guid)); | 501 TRACE_ID_MANGLE(args.dump_guid)); |
490 | 502 |
491 // If argument filter is enabled then only background mode dumps should be | 503 // If argument filter is enabled then only background mode dumps should be |
492 // allowed. In case the trace config passed for background tracing session | 504 // allowed. In case the trace config passed for background tracing session |
493 // missed the allowed modes argument, it crashes here instead of creating | 505 // missed the allowed modes argument, it crashes here instead of creating |
494 // unexpected dumps. | 506 // unexpected dumps. |
495 if (TraceLog::GetInstance() | 507 if (TraceLog::GetInstance() |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
968 if (iter == process_dumps.end()) { | 980 if (iter == process_dumps.end()) { |
969 std::unique_ptr<ProcessMemoryDump> new_pmd( | 981 std::unique_ptr<ProcessMemoryDump> new_pmd( |
970 new ProcessMemoryDump(session_state, dump_args)); | 982 new ProcessMemoryDump(session_state, dump_args)); |
971 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first; | 983 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first; |
972 } | 984 } |
973 return iter->second.get(); | 985 return iter->second.get(); |
974 } | 986 } |
975 | 987 |
976 } // namespace trace_event | 988 } // namespace trace_event |
977 } // namespace base | 989 } // namespace base |
OLD | NEW |