Commit 7c3c1ebd authored by Stephen Nusko's avatar Stephen Nusko Committed by Commit Bot

Construct PerfettoTracedProcess before we access the SystemProducer.

This fixes the cast_linux and cast_audio_linux CI builders since on cast
DETACH_FROM_SEQUENCE compiles to a no-op, and thus the PostTask which
accesses the SystemProducer would execute before we had constructed
PerfettoTracedProcess (which posts a task to  set the SystemProducer).

TBR=eseckler@chromium.org

Bug: 1007299
Change-Id: I64da7192406bb067559a26c44a617a772849fe52
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1826789Reviewed-by: default avatarStephen Nusko <nuskos@chromium.org>
Commit-Queue: Stephen Nusko <nuskos@chromium.org>
Auto-Submit: Stephen Nusko <nuskos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#700492}
parent 5ea745a6
...@@ -149,11 +149,17 @@ void PerfettoTracedProcess::ResetTaskRunnerForTesting( ...@@ -149,11 +149,17 @@ void PerfettoTracedProcess::ResetTaskRunnerForTesting(
// call to Get()) which would then PostTask which would create races if we // call to Get()) which would then PostTask which would create races if we
// reset the task runner right afterwards. // reset the task runner right afterwards.
DETACH_FROM_SEQUENCE(PerfettoTracedProcess::Get()->sequence_checker_); DETACH_FROM_SEQUENCE(PerfettoTracedProcess::Get()->sequence_checker_);
// Call Get() explicitly. This ensures that we constructed the
// PerfettoTracedProcess. On some tests (like cast linux) the DETACH macro is
// compiled to nothing, which woud cause this PostTask to access a nullptr the
// producer requires a PostTask from inside the constructor.
PerfettoTracedProcess::Get();
PerfettoTracedProcess::GetTaskRunner()->GetOrCreateTaskRunner()->PostTask( PerfettoTracedProcess::GetTaskRunner()->GetOrCreateTaskRunner()->PostTask(
FROM_HERE, base::BindOnce([]() { FROM_HERE, base::BindOnce([]() {
PerfettoTracedProcess::Get() auto* producer =
->SystemProducerForTesting() PerfettoTracedProcess::Get()->SystemProducerForTesting();
->ResetSequenceForTesting(); CHECK(producer);
producer->ResetSequenceForTesting();
})); }));
} }
......
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