[tracing] Warmup the ThreadLocalEventBuffer when MemoryInfra is enabled
commitc525abe0b3a3fd9946e8a2db6f8fc251c40ab4d0
authorprimiano <primiano@chromium.org>
Tue, 16 Jun 2015 20:56:41 +0000 (16 13:56 -0700)
committerCommit bot <commit-bot@chromium.org>
Tue, 16 Jun 2015 20:57:08 +0000 (16 20:57 +0000)
treebe4c771f0943c5fce3f9714d754f1bbb65ea590f
parent027857bdba4dce9bea91ad4a49c9263e4c37c2f0
[tracing] Warmup the ThreadLocalEventBuffer when MemoryInfra is enabled

When memory tracing is enabled, the initialization of
ThreadLocalEventBuffer registers its own MemoryDumpProvider to account
for the memory overhead caused by tracing itself.
Before this CL, the ThreadLocalEventBuffer is lazily initialized the
first time a TRACE_EVENT* is called. Doing that w/ MemoryInfra enabled
though could lead to a deadlock if the first TRACE_EVENT happens in
the middle of a memory dump, in which case the ThreadLocalEventBuffer
would try to register a dump provider while dumping.
Races are broken by ensuring that, when a dump provider is being
registered, the ThreadLocalEventBuffer for its thread is being
initialized.

BUG=500569

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

Cr-Commit-Position: refs/heads/master@{#334689}
base/trace_event/memory_dump_manager.cc
base/trace_event/trace_event_impl.cc
base/trace_event/trace_event_impl.h