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

Unified Diff: base/trace_event/memory_dump_manager.cc

Issue 1186053006: [tracing] fix a data race in MemoryDumpManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/trace_event/memory_dump_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1e0a36a44e7b3f3f7758ac38bacdf2302d55e95a..4be09ce89e4b5f307c981a8332327ee16aff1563 100644
--- a/base/trace_event/memory_dump_manager.cc
+++ b/base/trace_event/memory_dump_manager.cc
@@ -283,6 +283,7 @@ void MemoryDumpManager::CreateProcessDump(const MemoryDumpRequestArgs& args,
new ProcessMemoryDumpHolder(args, session_state_, callback));
ProcessMemoryDump* pmd = &pmd_holder->process_memory_dump;
bool did_any_provider_dump = false;
+ bool did_post_any_async_task = false;
// Iterate over the active dump providers and invoke OnMemoryDump(pmd).
// The MDM guarantees linearity (at most one MDP is active within one
@@ -316,6 +317,7 @@ void MemoryDumpManager::CreateProcessDump(const MemoryDumpRequestArgs& args,
// The thread underlying the TaskRunner might have gone away.
if (did_post_async_task)
++pmd_holder->num_pending_async_requests;
+ did_post_any_async_task |= did_post_async_task;
petrcermak 2015/06/15 14:00:26 As Simon suggested, this could be "... = true;" in
} else {
// Invoke the dump provider synchronously.
did_any_provider_dump |= InvokeDumpProviderLocked(mdp, pmd);
@@ -326,7 +328,7 @@ void MemoryDumpManager::CreateProcessDump(const MemoryDumpRequestArgs& args,
// If at least one synchronous provider did dump and there are no pending
// asynchronous requests, add the dump to the trace and invoke the callback
// straight away (FinalizeDumpAndAddToTrace() takes care of the callback).
- if (did_any_provider_dump && pmd_holder->num_pending_async_requests == 0)
+ if (did_any_provider_dump && !did_post_any_async_task)
FinalizeDumpAndAddToTrace(pmd_holder);
}
« no previous file with comments | « no previous file | base/trace_event/memory_dump_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698