Fix BM_ShellShutdown regression (flutter/engine#18676)

This commit is contained in:
chenjianguang
2020-06-02 07:13:02 +08:00
committed by GitHub
parent 65afbec58a
commit 5a78bd2f4d

View File

@@ -66,6 +66,17 @@ static void StartupAndShutdownShell(benchmark::State& state,
FML_CHECK(shell);
{
// The ui thread could be busy processing tasks after shell created, e.g.,
// default font manager setup. The measurement of shell shutdown should be
// considered after those ui tasks have been done.
benchmarking::ScopedPauseTiming pause(state, true);
fml::AutoResetWaitableEvent latch;
fml::TaskRunner::RunNowOrPostTask(thread_host->ui_thread->GetTaskRunner(),
[&latch]() { latch.Signal(); });
latch.Wait();
}
{
benchmarking::ScopedPauseTiming pause(state, !measure_shutdown);
// Shutdown must occur synchronously on the platform thread.