Fix initialization of ThreadHost name prefix (flutter/engine#31420)

This commit is contained in:
Jason Simmons
2022-02-11 18:35:09 -08:00
committed by GitHub
parent b3b951bcc7
commit 94ce103fb5
4 changed files with 10 additions and 6 deletions

View File

@@ -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(),

View File

@@ -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);

View File

@@ -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),

View File

@@ -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(