Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: base/trace_event/memory_dump_manager.cc

Issue 2753723003: Fix crash in InvokeOnMemoryDump when tracing (Closed)
Patch Set: dont run test on mac or windows Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
968 if (iter == process_dumps.end()) { 979 if (iter == process_dumps.end()) {
969 std::unique_ptr<ProcessMemoryDump> new_pmd( 980 std::unique_ptr<ProcessMemoryDump> new_pmd(
970 new ProcessMemoryDump(session_state, dump_args)); 981 new ProcessMemoryDump(session_state, dump_args));
971 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first; 982 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first;
972 } 983 }
973 return iter->second.get(); 984 return iter->second.get();
974 } 985 }
975 986
976 } // namespace trace_event 987 } // namespace trace_event
977 } // namespace base 988 } // namespace base
OLDNEW
« no previous file with comments | « base/trace_event/memory_dump_manager.h ('k') | components/tracing/common/process_metrics_memory_dump_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698