From f3c121ecb50994f942951b26ec126d80d1451291 Mon Sep 17 00:00:00 2001 From: "auto-submit[bot]" <98614782+auto-submit[bot]@users.noreply.github.com> Date: Fri, 6 Sep 2024 15:54:46 +0000 Subject: [PATCH] Reverts "[engine] always force platform channel responses to schedule a task. (#54975)" (flutter/engine#55000) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reverts: flutter/engine#54975 Initiated by: jtmcdole Reason for reverting: I believe this change caused flutter/flutter to break in an engine roll. It was one of two changes - the other being a webui change. Tests broken: module_test_ios: testDualCold router test: ``` [2024-09-05 17:43:20.837343] [STDOUT] stderr: [ +135 ms] VMServiceFlutterDriver: Connected to Flutter application. [2024-09-05 17:43:20.841927] [STDOUT] stdout: [ +4 ms] 00:00 +0: Original PR Author: jonahwilliams Reviewed By: {jason-simmons, johnmccutchan} This change reverts the following previous change: 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. --- engine/src/flutter/shell/common/shell.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engine/src/flutter/shell/common/shell.cc b/engine/src/flutter/shell/common/shell.cc index a23bc5498e..79c532640a 100644 --- a/engine/src/flutter/shell/common/shell.cc +++ b/engine/src/flutter/shell/common/shell.cc @@ -1076,10 +1076,10 @@ void Shell::OnPlatformViewDispatchPlatformMessage( // The static leak checker gets confused by the use of fml::MakeCopyable. // NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDeleteLeaks) - // This logic must always explicitly post a task so that we are guaranteed - // to wake up the UI message loop to flush tasks. - task_runners_.GetUITaskRunner()->PostTask(fml::MakeCopyable( - [engine = engine_->GetWeakPtr(), message = std::move(message)]() mutable { + fml::TaskRunner::RunNowOrPostTask( + task_runners_.GetUITaskRunner(), + fml::MakeCopyable([engine = engine_->GetWeakPtr(), + message = std::move(message)]() mutable { if (engine) { engine->DispatchPlatformMessage(std::move(message)); }