Reland "memory-infra: Move TracingObserver to service/"

This reverts commit 7e3d0c0351183f0eab2384f2801db9ab755fe139.

Reason for revert:
The race was on second dump and shutdown.
1. The main thread starts a dump. Posts task on WP2 first for MPD1.
2. WP2-thread posts task to itself for MDP2.
3. WP2-thread posts task to WP1 for MDP1. At this point, WP2-thread
is waiting on WP1 to create a new thread.
4. The test finishes with WP1-thread finalizing the dump, main
thread returns.
5. The MDM destructor decides to delete it's reference to the task
runner (MDPInfo). This clears the WP1 first.

Step 5 calls WP1 destructor which calls thread destructor.
The thread in Step 3 comes back to life and tries to check if the
new thread has been created in WP1.
MDM should not destroy the task runner when PostTask is not done.
So, hold a reference in SetupNextMemoryDump().


Original change's description:
> Revert "memory-infra: Move TracingObserver to service/"
> 
> This reverts commit 15617f0ba9ba58672ce22b2269017c7b12ec124f.
> 
> Reason for revert:
> https://uberchromegw.corp.google.com/i/chromium.memory/builders/Linux%20TSan%20Tests/builds/8765
> 
> base_unittest MemoryDumpManagerTest.PostTaskForSequencedTaskRunner is crashing due to the data race.
> 
> Original change's description:
> > memory-infra: Move TracingObserver to service/
> > 
> > The memory tracing observer along with peak detector and periodic
> > scheduler should live in service/resource_coordinator since the peak
> > detector needs to know about the OS dump providers.
> > The tests were moved in previous CL.
> > 
> > BUG=728199
> > 
> > Change-Id: Ib4934421d1d057fd7d062258179f17d3ca8209f7
> > Reviewed-on: https://chromium-review.googlesource.com/554280
> > Commit-Queue: Primiano Tucci <primiano@chromium.org>
> > Reviewed-by: Helen Li <xunjieli@chromium.org>
> > Reviewed-by: Daniel Cheng <dcheng@chromium.org>
> > Reviewed-by: Primiano Tucci <primiano@chromium.org>
> > Reviewed-by: Dirk Pranke <dpranke@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#485968}
> 
> TBR=dcheng@chromium.org,primiano@chromium.org,dpranke@chromium.org,hjd@chromium.org,xunjieli@chromium.org,ssid@chromium.org
> 
> Change-Id: Iea202e6099216cb8ccad38d6f0d5354ea82643fe
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: 728199
> Reviewed-on: https://chromium-review.googlesource.com/568401
> Reviewed-by: Hongchan Choi <hongchan@chromium.org>
> Reviewed-by: Dirk Pranke <dpranke@chromium.org>
> Commit-Queue: Hongchan Choi <hongchan@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#486014}

TBR=dcheng@chromium.org,primiano@chromium.org,dpranke@chromium.org,hjd@chromium.org,xunjieli@chromium.org,ssid@chromium.org,hongchan@chromium.org

Change-Id: Ic58718b4d4497f9cb28cb2962deb653b45f2f6da
Bug: 728199
Reviewed-on: https://chromium-review.googlesource.com/568402
Commit-Queue: Siddhartha S <ssid@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Helen Li <xunjieli@chromium.org>
Reviewed-by: Siddhartha S <ssid@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#486487}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 43929085bfb1df7bc1ad3231a3a71736a72dea38
1 file changed
tree: 464052fae7db9b7314797d6e8f9263481eadcd35
  1. tools/