[tracing] fix a data race in MemoryDumpManager
commit5dc4c114e510b6d6a9d0c5760a8fba17186d0966
authorprimiano <primiano@chromium.org>
Mon, 15 Jun 2015 17:06:43 +0000 (15 10:06 -0700)
committerCommit bot <commit-bot@chromium.org>
Mon, 15 Jun 2015 17:07:08 +0000 (15 17:07 +0000)
tree295195afe92d023e202d0444f6caedb734e7e87b
parent20140791d42e1f46a08308c1d15e562bc6e04e36
[tracing] fix a data race in MemoryDumpManager

Fix a data race spotted by the TSan bot [1] and re-enable the
MemoryDumpManagerTest.RespectTaskRunnerAffinity test.
The race consisted in mistakenly looking into the
pmd_holder->num_pending_async_requests to determine whether the dump
should be finalized inline at the end of the current stack frame
or on the last thread hop.
In theory it is possible that the chain of posted threads is done
before hitting the num_pending_async_requests check.

[1] http://build.chromium.org/p/chromium.memory.fyi/builders/Linux%20TSan%20Tests/builds/5757

BUG=499983

Review URL: https://codereview.chromium.org/1186053006

Cr-Commit-Position: refs/heads/master@{#334396}
base/trace_event/memory_dump_manager.cc
base/trace_event/memory_dump_manager_unittest.cc