Commit b7ee29ad authored by Oystein Eftevaag's avatar Oystein Eftevaag Committed by Commit Bot

Perfetto: Avoid potential race condition

Fixes a theoretical race where tracing could be stopped and immediately
started again, and as we PostTask the destruction of the tracing session
in theory the new tracing session could be destroyed rather than
the old one.

R=eseckler@chromium.org

Bug: 900920
Change-Id: I2763100bb0915718cf1f1f0f685172d12fc24600
Reviewed-on: https://chromium-review.googlesource.com/c/1335953
Commit-Queue: Eric Seckler <eseckler@chromium.org>
Reviewed-by: default avatarEric Seckler <eseckler@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608129}
parent ea9e3961
...@@ -54,8 +54,8 @@ class PerfettoTracingCoordinator::TracingSession { ...@@ -54,8 +54,8 @@ class PerfettoTracingCoordinator::TracingSession {
base::ResetAndReturn(&stop_and_flush_callback_) base::ResetAndReturn(&stop_and_flush_callback_)
.Run(/*metadata=*/std::move(*metadata)); .Run(/*metadata=*/std::move(*metadata));
base::SequencedTaskRunnerHandle::Get()->PostTask( std::move(tracing_over_callback_).Run();
FROM_HERE, std::move(tracing_over_callback_)); // |this| is now destroyed.
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment