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

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

Issue 2006943003: [tracing] Sanitize process memory dumps for background mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@whitelist_mdp
Patch Set: Created 4 years, 7 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/atomic_sequence_num.h" 10 #include "base/atomic_sequence_num.h"
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 } 772 }
773 773
774 MemoryDumpManager::ProcessMemoryDumpAsyncState::~ProcessMemoryDumpAsyncState() { 774 MemoryDumpManager::ProcessMemoryDumpAsyncState::~ProcessMemoryDumpAsyncState() {
775 } 775 }
776 776
777 ProcessMemoryDump* MemoryDumpManager::ProcessMemoryDumpAsyncState:: 777 ProcessMemoryDump* MemoryDumpManager::ProcessMemoryDumpAsyncState::
778 GetOrCreateMemoryDumpContainerForProcess(ProcessId pid) { 778 GetOrCreateMemoryDumpContainerForProcess(ProcessId pid) {
779 auto iter = process_dumps.find(pid); 779 auto iter = process_dumps.find(pid);
780 if (iter == process_dumps.end()) { 780 if (iter == process_dumps.end()) {
781 std::unique_ptr<ProcessMemoryDump> new_pmd( 781 std::unique_ptr<ProcessMemoryDump> new_pmd(
782 new ProcessMemoryDump(session_state)); 782 new ProcessMemoryDump(session_state, req_args.level_of_detail));
783 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first; 783 iter = process_dumps.insert(std::make_pair(pid, std::move(new_pmd))).first;
784 } 784 }
785 return iter->second.get(); 785 return iter->second.get();
786 } 786 }
787 787
788 MemoryDumpManager::PeriodicGlobalDumpTimer::PeriodicGlobalDumpTimer() 788 MemoryDumpManager::PeriodicGlobalDumpTimer::PeriodicGlobalDumpTimer()
789 : periodic_dumps_count_(0) {} 789 : periodic_dumps_count_(0) {}
790 790
791 MemoryDumpManager::PeriodicGlobalDumpTimer::~PeriodicGlobalDumpTimer() { 791 MemoryDumpManager::PeriodicGlobalDumpTimer::~PeriodicGlobalDumpTimer() {
792 Stop(); 792 Stop();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 if (heavy_dump_rate_ > 0 && periodic_dumps_count_ % heavy_dump_rate_ == 0) 843 if (heavy_dump_rate_ > 0 && periodic_dumps_count_ % heavy_dump_rate_ == 0)
844 level_of_detail = MemoryDumpLevelOfDetail::DETAILED; 844 level_of_detail = MemoryDumpLevelOfDetail::DETAILED;
845 ++periodic_dumps_count_; 845 ++periodic_dumps_count_;
846 846
847 MemoryDumpManager::GetInstance()->RequestGlobalDump( 847 MemoryDumpManager::GetInstance()->RequestGlobalDump(
848 MemoryDumpType::PERIODIC_INTERVAL, level_of_detail); 848 MemoryDumpType::PERIODIC_INTERVAL, level_of_detail);
849 } 849 }
850 850
851 } // namespace trace_event 851 } // namespace trace_event
852 } // namespace base 852 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698