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

Unified Diff: base/trace_event/memory_dump_manager.cc

Issue 1308403002: [Tracing] Disable registration of regular dump providers during tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@reland-content-browsertest
Patch Set: Address review issues Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: base/trace_event/memory_dump_manager.cc
diff --git a/base/trace_event/memory_dump_manager.cc b/base/trace_event/memory_dump_manager.cc
index 1c3c581d8ebece634081ce613e1057a0d0d70111..854f839faf349701ddf78c2c3d7de1d75240432a 100644
--- a/base/trace_event/memory_dump_manager.cc
+++ b/base/trace_event/memory_dump_manager.cc
@@ -87,8 +87,6 @@ MemoryDumpManager* MemoryDumpManager::GetInstance() {
// static
void MemoryDumpManager::SetInstanceForTesting(MemoryDumpManager* instance) {
- if (instance)
- instance->skip_core_dumpers_auto_registration_for_testing_ = true;
g_instance_for_testing = instance;
}
@@ -97,7 +95,7 @@ MemoryDumpManager::MemoryDumpManager()
memory_tracing_enabled_(0),
tracing_process_id_(kInvalidTracingProcessId),
system_allocator_pool_name_(nullptr),
- skip_core_dumpers_auto_registration_for_testing_(false),
+ ignore_dumper_registrations_for_testing_(false),
disable_periodic_dumps_for_testing_(false) {
g_next_guid.GetNext(); // Make sure that first guid is not zero.
}
@@ -110,9 +108,6 @@ void MemoryDumpManager::Initialize() {
TRACE_EVENT0(kTraceCategory, "init"); // Add to trace-viewer category list.
trace_event::TraceLog::GetInstance()->AddEnabledStateObserver(this);
- if (skip_core_dumpers_auto_registration_for_testing_)
- return;
-
// Enable the core dump providers.
#if !defined(OS_NACL)
RegisterDumpProvider(ProcessMemoryTotalsDumpProvider::GetInstance());
@@ -150,8 +145,12 @@ void MemoryDumpManager::SetDelegate(MemoryDumpManagerDelegate* delegate) {
void MemoryDumpManager::RegisterDumpProvider(
MemoryDumpProvider* mdp,
const scoped_refptr<SingleThreadTaskRunner>& task_runner) {
+ AutoLock lock(lock_);
+
+ if (ignore_dumper_registrations_for_testing_)
+ return;
+
MemoryDumpProviderInfo mdp_info(mdp, task_runner);
Primiano Tucci (use gerrit) 2015/09/22 08:07:02 Keep this before the lock. No need to call this ct
Ruud van Asseldonk 2015/09/29 09:12:27 Done.
- AutoLock lock(lock_);
auto iter_new = dump_providers_.insert(mdp_info);
// If there was a previous entry, replace it with the new one. This is to deal

Powered by Google App Engine
This is Rietveld 408576698