Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 015f3b1

Browse files
[engine] always force platform channel responses to schedule a task. (#54975)
If we use runNowOrPostTask on platform channel responses, then we may not wake up the dart message loop. If nothing else wakes it up, then the embedder may hang on platform channel responses. This fixes several google3 integration tests when run in merged thread mode.
1 parent 0462d19 commit 015f3b1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

shell/common/shell.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,10 +1076,10 @@ void Shell::OnPlatformViewDispatchPlatformMessage(
10761076

10771077
// The static leak checker gets confused by the use of fml::MakeCopyable.
10781078
// NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks)
1079-
fml::TaskRunner::RunNowOrPostTask(
1080-
task_runners_.GetUITaskRunner(),
1081-
fml::MakeCopyable([engine = engine_->GetWeakPtr(),
1082-
message = std::move(message)]() mutable {
1079+
// This logic must always explicitly post a task so that we are guaranteed
1080+
// to wake up the UI message loop to flush tasks.
1081+
task_runners_.GetUITaskRunner()->PostTask(fml::MakeCopyable(
1082+
[engine = engine_->GetWeakPtr(), message = std::move(message)]() mutable {
10831083
if (engine) {
10841084
engine->DispatchPlatformMessage(std::move(message));
10851085
}

0 commit comments

Comments
 (0)