diff --git a/engine/src/flutter/shell/common/shell_unittests.cc b/engine/src/flutter/shell/common/shell_unittests.cc index 4070a79abd..45007218b5 100644 --- a/engine/src/flutter/shell/common/shell_unittests.cc +++ b/engine/src/flutter/shell/common/shell_unittests.cc @@ -267,10 +267,12 @@ TEST_F(ShellTest, InitializeWithInvalidThreads) { TEST_F(ShellTest, InitializeWithDifferentThreads) { ASSERT_FALSE(DartVMRef::IsInstanceRunning()); Settings settings = CreateSettingsForFixture(); + std::string name_prefix = "io.flutter.test." + GetCurrentTestName() + "."; ThreadHost thread_host(ThreadHost::ThreadHostConfig( - "io.flutter.test." + GetCurrentTestName() + ".", - ThreadHost::Type::Platform | ThreadHost::Type::RASTER | - ThreadHost::Type::IO | ThreadHost::Type::UI)); + name_prefix, ThreadHost::Type::Platform | ThreadHost::Type::RASTER | + ThreadHost::Type::IO | ThreadHost::Type::UI)); + ASSERT_EQ(thread_host.name_prefix, name_prefix); + TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(), thread_host.raster_thread->GetTaskRunner(), thread_host.ui_thread->GetTaskRunner(), diff --git a/engine/src/flutter/shell/common/thread_host.cc b/engine/src/flutter/shell/common/thread_host.cc index b79ed6c99a..debd472a39 100644 --- a/engine/src/flutter/shell/common/thread_host.cc +++ b/engine/src/flutter/shell/common/thread_host.cc @@ -49,7 +49,8 @@ ThreadHost::ThreadHost(ThreadHost&&) = default; ThreadHost::ThreadHost(const std::string name_prefix, uint64_t mask) : ThreadHost(ThreadHostConfig(name_prefix, mask)) {} -ThreadHost::ThreadHost(const ThreadHostConfig& host_config) { +ThreadHost::ThreadHost(const ThreadHostConfig& host_config) + : name_prefix(host_config.name_prefix) { if (host_config.isThreadNeeded(ThreadHost::Type::Platform)) { platform_thread = CreateThread(Type::Platform, host_config.platform_config, host_config); diff --git a/engine/src/flutter/shell/platform/android/android_shell_holder.cc b/engine/src/flutter/shell/platform/android/android_shell_holder.cc index 14e8555c40..a78a9b8e75 100644 --- a/engine/src/flutter/shell/platform/android/android_shell_holder.cc +++ b/engine/src/flutter/shell/platform/android/android_shell_holder.cc @@ -88,7 +88,7 @@ AndroidShellHolder::AndroidShellHolder( ThreadHost::Type::UI | ThreadHost::Type::RASTER | ThreadHost::Type::IO; flutter::ThreadHost::ThreadHostConfig host_config( - mask, AndroidPlatformThreadConfigSetter); + thread_label, mask, AndroidPlatformThreadConfigSetter); host_config.ui_config = fml::Thread::ThreadConfig( flutter::ThreadHost::ThreadHostConfig::MakeThreadName( flutter::ThreadHost::Type::UI, thread_label), diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm index 9c867eaaa9..889cb783da 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterEngine.mm @@ -649,7 +649,8 @@ static constexpr int kNumProfilerSamplesPerSec = 5; threadHostType = threadHostType | flutter::ThreadHost::Type::Profiler; } - flutter::ThreadHost::ThreadHostConfig host_config(threadHostType, IOSPlatformThreadConfigSetter); + flutter::ThreadHost::ThreadHostConfig host_config(threadLabel.UTF8String, threadHostType, + IOSPlatformThreadConfigSetter); host_config.ui_config = fml::Thread::ThreadConfig(flutter::ThreadHost::ThreadHostConfig::MakeThreadName(