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

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

Issue 2092463002: Move memory-infra check from background tracing and whitelist memory dump args (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@enabled_modes
Patch Set: Created 4 years, 6 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
« no previous file with comments | « no previous file | chrome/common/trace_event_args_whitelist.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 MemoryDumpType dump_type, 381 MemoryDumpType dump_type,
382 MemoryDumpLevelOfDetail level_of_detail) { 382 MemoryDumpLevelOfDetail level_of_detail) {
383 RequestGlobalDump(dump_type, level_of_detail, MemoryDumpCallback()); 383 RequestGlobalDump(dump_type, level_of_detail, MemoryDumpCallback());
384 } 384 }
385 385
386 void MemoryDumpManager::CreateProcessDump(const MemoryDumpRequestArgs& args, 386 void MemoryDumpManager::CreateProcessDump(const MemoryDumpRequestArgs& args,
387 const MemoryDumpCallback& callback) { 387 const MemoryDumpCallback& callback) {
388 TRACE_EVENT_NESTABLE_ASYNC_BEGIN0(kTraceCategory, "ProcessMemoryDump", 388 TRACE_EVENT_NESTABLE_ASYNC_BEGIN0(kTraceCategory, "ProcessMemoryDump",
389 TRACE_ID_MANGLE(args.dump_guid)); 389 TRACE_ID_MANGLE(args.dump_guid));
390 390
391 // If argument filter is enabled then only background mode dumps should be
392 // allowed. In case the trace config passed for background tracing session
393 // missed the allowed modes argument, it crashes here instead of creating
394 // unexpected dumps.
395 if (TraceLog::GetInstance()
396 ->GetCurrentTraceConfig()
397 .IsArgumentFilterEnabled()) {
398 CHECK_EQ(MemoryDumpLevelOfDetail::BACKGROUND, args.level_of_detail);
399 }
400
391 std::unique_ptr<ProcessMemoryDumpAsyncState> pmd_async_state; 401 std::unique_ptr<ProcessMemoryDumpAsyncState> pmd_async_state;
392 { 402 {
393 AutoLock lock(lock_); 403 AutoLock lock(lock_);
394 404
395 // |dump_thread_| can be nullptr is tracing was disabled before reaching 405 // |dump_thread_| can be nullptr is tracing was disabled before reaching
396 // here. SetupNextMemoryDump() is robust enough to tolerate it and will 406 // here. SetupNextMemoryDump() is robust enough to tolerate it and will
397 // NACK the dump. 407 // NACK the dump.
398 pmd_async_state.reset(new ProcessMemoryDumpAsyncState( 408 pmd_async_state.reset(new ProcessMemoryDumpAsyncState(
399 args, dump_providers_, session_state_, callback, 409 args, dump_providers_, session_state_, callback,
400 dump_thread_ ? dump_thread_->task_runner() : nullptr)); 410 dump_thread_ ? dump_thread_->task_runner() : nullptr));
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 if (heavy_dump_rate_ > 0 && periodic_dumps_count_ % heavy_dump_rate_ == 0) 874 if (heavy_dump_rate_ > 0 && periodic_dumps_count_ % heavy_dump_rate_ == 0)
865 level_of_detail = MemoryDumpLevelOfDetail::DETAILED; 875 level_of_detail = MemoryDumpLevelOfDetail::DETAILED;
866 ++periodic_dumps_count_; 876 ++periodic_dumps_count_;
867 877
868 MemoryDumpManager::GetInstance()->RequestGlobalDump( 878 MemoryDumpManager::GetInstance()->RequestGlobalDump(
869 MemoryDumpType::PERIODIC_INTERVAL, level_of_detail); 879 MemoryDumpType::PERIODIC_INTERVAL, level_of_detail);
870 } 880 }
871 881
872 } // namespace trace_event 882 } // namespace trace_event
873 } // namespace base 883 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | chrome/common/trace_event_args_whitelist.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698