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

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

Issue 1486333002: Kill ScopedPtrMap and friends (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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/atomic_sequence_num.h" 10 #include "base/atomic_sequence_num.h"
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 Passed(&pmd_async_state))); 449 Passed(&pmd_async_state)));
450 return; 450 return;
451 } 451 }
452 452
453 TRACE_EVENT_WITH_FLOW0(kTraceCategory, 453 TRACE_EVENT_WITH_FLOW0(kTraceCategory,
454 "MemoryDumpManager::FinalizeDumpAndAddToTrace", 454 "MemoryDumpManager::FinalizeDumpAndAddToTrace",
455 TRACE_ID_MANGLE(dump_guid), TRACE_EVENT_FLAG_FLOW_IN); 455 TRACE_ID_MANGLE(dump_guid), TRACE_EVENT_FLAG_FLOW_IN);
456 456
457 for (const auto& kv : pmd_async_state->process_dumps) { 457 for (const auto& kv : pmd_async_state->process_dumps) {
458 ProcessId pid = kv.first; // kNullProcessId for the current process. 458 ProcessId pid = kv.first; // kNullProcessId for the current process.
459 ProcessMemoryDump* process_memory_dump = kv.second; 459 ProcessMemoryDump* process_memory_dump = kv.second.get();
460 TracedValue* traced_value = new TracedValue(); 460 TracedValue* traced_value = new TracedValue();
461 scoped_refptr<ConvertableToTraceFormat> event_value(traced_value); 461 scoped_refptr<ConvertableToTraceFormat> event_value(traced_value);
462 process_memory_dump->AsValueInto(traced_value); 462 process_memory_dump->AsValueInto(traced_value);
463 traced_value->SetString("level_of_detail", 463 traced_value->SetString("level_of_detail",
464 MemoryDumpLevelOfDetailToString( 464 MemoryDumpLevelOfDetailToString(
465 pmd_async_state->req_args.level_of_detail)); 465 pmd_async_state->req_args.level_of_detail));
466 const char* const event_name = 466 const char* const event_name =
467 MemoryDumpTypeToString(pmd_async_state->req_args.dump_type); 467 MemoryDumpTypeToString(pmd_async_state->req_args.dump_type);
468 468
469 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_PROCESS_ID( 469 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_PROCESS_ID(
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 dump_thread_task_runner(dump_thread_task_runner) {} 644 dump_thread_task_runner(dump_thread_task_runner) {}
645 645
646 MemoryDumpManager::ProcessMemoryDumpAsyncState::~ProcessMemoryDumpAsyncState() { 646 MemoryDumpManager::ProcessMemoryDumpAsyncState::~ProcessMemoryDumpAsyncState() {
647 } 647 }
648 648
649 ProcessMemoryDump* MemoryDumpManager::ProcessMemoryDumpAsyncState:: 649 ProcessMemoryDump* MemoryDumpManager::ProcessMemoryDumpAsyncState::
650 GetOrCreateMemoryDumpContainerForProcess(ProcessId pid) { 650 GetOrCreateMemoryDumpContainerForProcess(ProcessId pid) {
651 auto iter = process_dumps.find(pid); 651 auto iter = process_dumps.find(pid);
652 if (iter == process_dumps.end()) { 652 if (iter == process_dumps.end()) {
653 scoped_ptr<ProcessMemoryDump> new_pmd(new ProcessMemoryDump(session_state)); 653 scoped_ptr<ProcessMemoryDump> new_pmd(new ProcessMemoryDump(session_state));
654 iter = process_dumps.insert(pid, std::move(new_pmd)).first; 654 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first;
655 } 655 }
656 return iter->second; 656 return iter->second.get();
657 } 657 }
658 658
659 } // namespace trace_event 659 } // namespace trace_event
660 } // namespace base 660 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698