From d2c049e1dd5aaa61a541bfc4c547a59ee6945724 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Thu, 10 Oct 2024 13:47:44 -0700 Subject: [PATCH 1/2] [engine] remove merge thread setting and fix default value. --- common/settings.h | 4 ---- shell/common/switches.cc | 3 --- shell/platform/android/android_shell_holder.cc | 9 +-------- .../android/android_shell_holder_unittests.cc | 15 --------------- 4 files changed, 1 insertion(+), 30 deletions(-) diff --git a/common/settings.h b/common/settings.h index 345cf3d977f3f..6d973fa12060f 100644 --- a/common/settings.h +++ b/common/settings.h @@ -232,10 +232,6 @@ struct Settings { // Force disable the android surface control even where supported. bool disable_surface_control = false; - // If true, the UI thread is the platform thread on supported - // platforms. - bool merged_platform_ui_thread = true; - // Log a warning during shell initialization if Impeller is not enabled. bool warn_on_impeller_opt_out = false; diff --git a/shell/common/switches.cc b/shell/common/switches.cc index de131b00fd806..0fdb14827aac9 100644 --- a/shell/common/switches.cc +++ b/shell/common/switches.cc @@ -360,9 +360,6 @@ Settings SettingsFromCommandLine(const fml::CommandLine& command_line) { settings.verbose_logging = command_line.HasOption(FlagForSwitch(Switch::VerboseLogging)); - settings.merged_platform_ui_thread = command_line.HasOption( - FlagForSwitch(Switch::EnableMergedPlatformUIThread)); - command_line.GetOptionValue(FlagForSwitch(Switch::FlutterAssetsDir), &settings.assets_path); diff --git a/shell/platform/android/android_shell_holder.cc b/shell/platform/android/android_shell_holder.cc index e86effe09bd92..fee4d2cf3b5f6 100644 --- a/shell/platform/android/android_shell_holder.cc +++ b/shell/platform/android/android_shell_holder.cc @@ -90,9 +90,6 @@ AndroidShellHolder::AndroidShellHolder( auto thread_label = std::to_string(thread_host_count++); auto mask = ThreadHost::Type::kRaster | ThreadHost::Type::kIo; - if (!settings.merged_platform_ui_thread) { - mask |= ThreadHost::Type::kUi; - } flutter::ThreadHost::ThreadHostConfig host_config( thread_label, mask, AndroidPlatformThreadConfigSetter); @@ -139,11 +136,7 @@ AndroidShellHolder::AndroidShellHolder( fml::RefPtr platform_runner = fml::MessageLoop::GetCurrent().GetTaskRunner(); raster_runner = thread_host_->raster_thread->GetTaskRunner(); - if (settings.merged_platform_ui_thread) { - ui_runner = platform_runner; - } else { - ui_runner = thread_host_->ui_thread->GetTaskRunner(); - } + ui_runner = thread_host_->ui_thread->GetTaskRunner(); io_runner = thread_host_->io_thread->GetTaskRunner(); flutter::TaskRunners task_runners(thread_label, // label diff --git a/shell/platform/android/android_shell_holder_unittests.cc b/shell/platform/android/android_shell_holder_unittests.cc index 0a1f1ed3fcf5d..d65bfae3c392a 100644 --- a/shell/platform/android/android_shell_holder_unittests.cc +++ b/shell/platform/android/android_shell_holder_unittests.cc @@ -163,7 +163,6 @@ TEST(AndroidShellHolder, HandlePlatformMessage) { TEST(AndroidShellHolder, CreateWithMergedPlatformAndUIThread) { Settings settings; - settings.merged_platform_ui_thread = true; auto jni = std::make_shared(); auto holder = std::make_unique(settings, jni); auto window = fml::MakeRefCounted( @@ -175,19 +174,5 @@ TEST(AndroidShellHolder, CreateWithMergedPlatformAndUIThread) { holder->GetShellForTesting()->GetTaskRunners().GetPlatformTaskRunner()); } -TEST(AndroidShellHolder, CreateWithUnMergedPlatformAndUIThread) { - Settings settings; - settings.merged_platform_ui_thread = false; - auto jni = std::make_shared(); - auto holder = std::make_unique(settings, jni); - auto window = fml::MakeRefCounted( - nullptr, /*is_fake_window=*/true); - holder->GetPlatformView()->NotifyCreated(window); - - EXPECT_NE( - holder->GetShellForTesting()->GetTaskRunners().GetUITaskRunner(), - holder->GetShellForTesting()->GetTaskRunners().GetPlatformTaskRunner()); -} - } // namespace testing } // namespace flutter From b0d1be6b446fc04f288f907d78db1c7fc3d348f4 Mon Sep 17 00:00:00 2001 From: Jonah Williams Date: Thu, 10 Oct 2024 13:50:42 -0700 Subject: [PATCH 2/2] Update android_shell_holder.cc --- shell/platform/android/android_shell_holder.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shell/platform/android/android_shell_holder.cc b/shell/platform/android/android_shell_holder.cc index fee4d2cf3b5f6..6ff32d8c83298 100644 --- a/shell/platform/android/android_shell_holder.cc +++ b/shell/platform/android/android_shell_holder.cc @@ -136,7 +136,7 @@ AndroidShellHolder::AndroidShellHolder( fml::RefPtr platform_runner = fml::MessageLoop::GetCurrent().GetTaskRunner(); raster_runner = thread_host_->raster_thread->GetTaskRunner(); - ui_runner = thread_host_->ui_thread->GetTaskRunner(); + ui_runner = platform_runner; io_runner = thread_host_->io_thread->GetTaskRunner(); flutter::TaskRunners task_runners(thread_label, // label