Avoid deadlock during trace_event flush
The deadlock occurs because we hold lock when posting flush tasks. If MessageLoop::PostTask() also calls TRACE_EVENT and the TRACE_EVENT has never been reached before, the TRACE_EVENT will try to get the category enabled flag which will also need a lock. Copy thread_message_loops into a temporary vector of scoped_refptr<SingleProcessTaskRunner> to avoid lock when calling PostTask(). BUG=397022 TEST=Existing tests and ThreadSanitizer Review URL: https://codereview.chromium.org/491393002 Cr-Commit-Position: refs/heads/master@{#293144}
Showing
Please register or sign in to comment