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

Unified Diff: base/trace_event/memory_dump_manager_unittest.cc

Issue 1884573002: Fix race condition when dump providers invoked within destroyed state (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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_unittest.cc
diff --git a/base/trace_event/memory_dump_manager_unittest.cc b/base/trace_event/memory_dump_manager_unittest.cc
index 2461e616790476de6ab95ef14a8ddc2695b21d01..d6809366e3ea101becac22d5fcdc7cdc39051ae3 100644
--- a/base/trace_event/memory_dump_manager_unittest.cc
+++ b/base/trace_event/memory_dump_manager_unittest.cc
@@ -938,8 +938,11 @@ TEST_F(MemoryDumpManagerTest, DisableTracingRightBeforeStartOfDump) {
base::WaitableEvent tracing_disabled_event(false, false);
InitializeMemoryDumpManager(false /* is_coordinator */);
+ auto thread = WrapUnique(new Thread("test thread"));
Primiano Tucci (use gerrit) 2016/04/13 17:08:41 I think we don't allow yet auto with WrapUnique.
kraynov 2016/04/13 17:17:41 Acknowledged.
+ thread->Start();
+
MockMemoryDumpProvider mdp;
- RegisterDumpProvider(&mdp);
+ RegisterDumpProvider(&mdp, thread->task_runner(), kDefaultOptions);
Primiano Tucci (use gerrit) 2016/04/13 17:08:41 hmm here you are overriding the previous behavior.
kraynov 2016/04/13 17:17:41 Acknowledged.
EnableTracingWithLegacyCategories(MemoryDumpManager::kTraceCategory);
EXPECT_CALL(*delegate_, RequestGlobalMemoryDump(_, _))
@@ -949,6 +952,10 @@ TEST_F(MemoryDumpManagerTest, DisableTracingRightBeforeStartOfDump) {
delegate_->CreateProcessDump(args, callback);
}));
+ // If tracing is disabled for current session CreateProcessDump() should NOT
+ // request dumps from providers. Real-world regression: crbug.com/600570 .
+ EXPECT_CALL(mdp, OnMemoryDump(_, _)).Times(0);
+
last_callback_success_ = true;
RequestGlobalDumpAndWait(MemoryDumpType::EXPLICITLY_TRIGGERED,
MemoryDumpLevelOfDetail::DETAILED);
« base/trace_event/memory_dump_manager.cc ('K') | « base/trace_event/memory_dump_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698