Fix --trace-shutdown with thread-local tracing.

With thread-local tracing (r221766), TraceLog::Flush() is async and
needs to be called from a thread having a message loop. It also requires
that tracing has been stopped.

BrowserShutdownProfileDumper is a special caller that TraceLog::Flush()
was originally called from a thread without message loop.

Now start another thread for flushing, and call TraceLog::SetDisabled()
before TraceLog::Flush().

The calling thread needs to wait for the completion of the flush,
otherwise the browser may shutdown before all trace events written.
Temporarily allow the thread to wait in ThreadRestrictions.

BUG=none
TEST=manual run chrome with --trace-shutdown. Should not assert. Should generate correct trace file.

Review URL: https://chromiumcodereview.appspot.com/24047007

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@223819 0039d316-1c4b-4281-b951-d872f2087c98


CrOS-Libchrome-Original-Commit: f9be1053de943283ec72f4dbf2e6fce78fd2fea1
2 files changed
tree: b12c1e4e56943a2ad1283acc7f6a572dc0eaaf4e
  1. base/
  2. build/
  3. components/
  4. dbus/
  5. ipc/
  6. mojo/
  7. testing/
  8. third_party/
  9. ui/