Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions runtime/dart_isolate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -633,10 +633,16 @@ bool DartIsolate::UpdateThreadPoolNames() const {
}

if (auto task_runner = task_runners.GetPlatformTaskRunner()) {
bool is_merged_platform_ui_thread =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should have a static method that returns if current thread is the platform main thread (with platform specific implementations for checks).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what sort of platform specific checks would we perform?

task_runner == task_runners.GetUITaskRunner();
std::string label;
if (is_merged_platform_ui_thread) {
label = task_runners.GetLabel() + std::string{".ui"};
} else {
label = task_runners.GetLabel() + std::string{".platform"};
}
task_runner->PostTask(
[label = task_runners.GetLabel() + std::string{".platform"}]() {
Dart_SetThreadName(label.c_str());
});
[label = std::move(label)]() { Dart_SetThreadName(label.c_str()); });
}

return true;
Expand Down
16 changes: 8 additions & 8 deletions shell/platform/android/android_shell_holder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,17 +89,17 @@ AndroidShellHolder::AndroidShellHolder(
static size_t thread_host_count = 1;
auto thread_label = std::to_string(thread_host_count++);

auto mask =
ThreadHost::Type::kUi | ThreadHost::Type::kRaster | ThreadHost::Type::kIo;
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);
if (!settings.merged_platform_ui_thread) {
host_config.ui_config = fml::Thread::ThreadConfig(
flutter::ThreadHost::ThreadHostConfig::MakeThreadName(
flutter::ThreadHost::Type::kUi, thread_label),
fml::Thread::ThreadPriority::kDisplay);
}
host_config.ui_config = fml::Thread::ThreadConfig(
flutter::ThreadHost::ThreadHostConfig::MakeThreadName(
flutter::ThreadHost::Type::kUi, thread_label),
fml::Thread::ThreadPriority::kDisplay);
host_config.raster_config = fml::Thread::ThreadConfig(
flutter::ThreadHost::ThreadHostConfig::MakeThreadName(
flutter::ThreadHost::Type::kRaster, thread_label),
Expand Down
17 changes: 8 additions & 9 deletions shell/platform/darwin/ios/framework/Source/FlutterEngine.mm
Original file line number Diff line number Diff line change
Expand Up @@ -792,8 +792,10 @@ + (NSString*)generateThreadLabel:(NSString*)labelPrefix {
// initialized.
fml::MessageLoop::EnsureInitializedForCurrentThread();

uint32_t threadHostType = flutter::ThreadHost::Type::kUi | flutter::ThreadHost::Type::kRaster |
flutter::ThreadHost::Type::kIo;
uint32_t threadHostType = flutter::ThreadHost::Type::kRaster | flutter::ThreadHost::Type::kIo;
if (!settings.enable_impeller) {
threadHostType |= flutter::ThreadHost::Type::kUi;
}

if ([FlutterEngine isProfilerEnabled]) {
threadHostType = threadHostType | flutter::ThreadHost::Type::kProfiler;
Expand All @@ -802,13 +804,10 @@ + (NSString*)generateThreadLabel:(NSString*)labelPrefix {
flutter::ThreadHost::ThreadHostConfig host_config(thread_label.UTF8String, threadHostType,
IOSPlatformThreadConfigSetter);

if (!settings.enable_impeller) {
host_config.ui_config =
fml::Thread::ThreadConfig(flutter::ThreadHost::ThreadHostConfig::MakeThreadName(
flutter::ThreadHost::Type::kUi, thread_label.UTF8String),
fml::Thread::ThreadPriority::kDisplay);
}

host_config.ui_config =
fml::Thread::ThreadConfig(flutter::ThreadHost::ThreadHostConfig::MakeThreadName(
flutter::ThreadHost::Type::kUi, thread_label.UTF8String),
fml::Thread::ThreadPriority::kDisplay);
host_config.raster_config =
fml::Thread::ThreadConfig(flutter::ThreadHost::ThreadHostConfig::MakeThreadName(
flutter::ThreadHost::Type::kRaster, thread_label.UTF8String),
Expand Down