[tracing] Fix MemoryDumpManager to support startup tracing
commitba4ca8421832350dd3335a8bd7abea9f0e1311b6
authorprimiano <primiano@chromium.org>
Thu, 10 Sep 2015 16:50:59 +0000 (10 09:50 -0700)
committerCommit bot <commit-bot@chromium.org>
Thu, 10 Sep 2015 16:51:43 +0000 (10 16:51 +0000)
treeb6eeafc3ccf55d80b649bad93525a3dbb586d95b
parent33dbe9fa98d0d0ec31e8b927a172e291b02bf893
[tracing] Fix MemoryDumpManager to support startup tracing

This CL simplifies a lot the design of the MemoryDumpManager (MDM)
initialization (\o/). Before this change the MDM had a two-stage
initialization: 1. Initialize() that was registering to the
TraceLog enabled stateobserver; 2. SetDelegate() that was setting
the inversion-of-control delegate.
This design was fragile as it required to think about the two possible
sequences of events (1 -> 2 or 2 -> 1) and not really necessary.
The simplification herein introduced consists in:
 - Drop the IsCoordinatorProcess() method from the delegate. That
   information is not supposed to change over time and is known
   at MDM initialization time.
 - Merge the SetDelegate() into the Initialize() call. There is no
   point allowing to initialize the MDM without a delegate, so
   why bother? Moved all the initialization to the point where the
   delegate (concretelly the TracingControllerImpl) is ready.

As a side effect, startup tracing now works properly (tests are
coming in a separate CL).

BUG=524057
TEST=--trace-startup=-*,disabled-by-default-memory-infra --trace-startup-file=/tmp/startup.json

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

Cr-Commit-Position: refs/heads/master@{#348168}
base/trace_event/memory_dump_manager.cc
base/trace_event/memory_dump_manager.h
base/trace_event/memory_dump_manager_unittest.cc
components/tracing/child_memory_dump_manager_delegate_impl.cc
components/tracing/child_memory_dump_manager_delegate_impl.h
content/browser/browser_main_loop.cc
content/browser/tracing/memory_tracing_browsertest.cc
content/browser/tracing/tracing_controller_impl.cc
content/browser/tracing/tracing_controller_impl.h
content/child/child_thread_impl.cc