[engine] make Platform thread the UI thread for iOS Impeller. (flutter/engine#54655)

Does it blend?
This commit is contained in:
Jonah Williams
2024-08-23 10:06:14 -07:00
committed by GitHub
parent ff452d94a3
commit c8fc2ff531
2 changed files with 7 additions and 6 deletions

View File

@@ -802,7 +802,7 @@ static flutter::ThreadHost MakeThreadHost(NSString* thread_label,
flutter::ThreadHost::ThreadHostConfig host_config(thread_label.UTF8String, threadHostType,
IOSPlatformThreadConfigSetter);
if (!settings.merged_platform_ui_thread) {
if (!settings.enable_impeller) {
host_config.ui_config =
fml::Thread::ThreadConfig(flutter::ThreadHost::ThreadHostConfig::MakeThreadName(
flutter::ThreadHost::Type::kUi, thread_label.UTF8String),
@@ -879,8 +879,7 @@ static void SetEntryPoint(flutter::Settings* settings, NSString* entrypoint, NSS
[](flutter::Shell& shell) { return std::make_unique<flutter::Rasterizer>(shell); };
fml::RefPtr<fml::TaskRunner> ui_runner;
if (settings.merged_platform_ui_thread) {
FML_LOG(IMPORTANT) << "Warning: Using highly experimental merged thread mode.";
if (settings.enable_impeller) {
ui_runner = fml::MessageLoop::GetCurrent().GetTaskRunner();
} else {
ui_runner = _threadHost->ui_thread->GetTaskRunner();

View File

@@ -473,6 +473,7 @@ FLUTTER_ASSERT_ARC
- (void)testCanMergePlatformAndUIThread {
auto settings = FLTDefaultSettingsForBundle();
settings.merged_platform_ui_thread = true;
settings.enable_impeller = true;
FlutterDartProject* project = [[FlutterDartProject alloc] initWithSettings:settings];
FlutterEngine* engine = [[FlutterEngine alloc] initWithName:@"foobar" project:project];
[engine run];
@@ -481,15 +482,16 @@ FLUTTER_ASSERT_ARC
engine.shell.GetTaskRunners().GetPlatformTaskRunner());
}
- (void)testCanUnMergePlatformAndUIThread {
- (void)testCanNotUnMergePlatformAndUIThread {
auto settings = FLTDefaultSettingsForBundle();
settings.merged_platform_ui_thread = false;
settings.enable_impeller = true;
FlutterDartProject* project = [[FlutterDartProject alloc] initWithSettings:settings];
FlutterEngine* engine = [[FlutterEngine alloc] initWithName:@"foobar" project:project];
[engine run];
XCTAssertNotEqual(engine.shell.GetTaskRunners().GetUITaskRunner(),
engine.shell.GetTaskRunners().GetPlatformTaskRunner());
XCTAssertEqual(engine.shell.GetTaskRunners().GetUITaskRunner(),
engine.shell.GetTaskRunners().GetPlatformTaskRunner());
}
@end