5#include "flutter/shell/common/thread_host.h"
17 const std::string&
prefix) {
20 return prefix +
".platform";
28 return prefix +
".profiler";
33 type_mask |= ThreadHost::Type::kIo;
38 type_mask |= ThreadHost::Type::kUi;
44 type_mask |= ThreadHost::Type::kPlatform;
45 platform_config = config;
50 raster_config = config;
55 type_mask |= ThreadHost::Type::kProfiler;
56 profiler_config = config;
59std::unique_ptr<fml::Thread> ThreadHost::CreateThread(
61 std::optional<ThreadConfig> thread_config,
64 if (!thread_config.has_value()) {
68 return std::make_unique<fml::Thread>(host_config.
config_setter,
69 thread_config.value());
80 : name_prefix(host_config.name_prefix) {
83 CreateThread(Type::kPlatform, host_config.
platform_config, host_config);
101 CreateThread(Type::kProfiler, host_config.
profiler_config, host_config);
@ kRaster
Suitable for thread which raster data.
fml::Thread::ThreadConfig ThreadConfig
std::optional< ThreadConfig > platform_config
std::optional< ThreadConfig > io_config
void SetUIConfig(const ThreadConfig &)
Specified the UI Thread Config, meanwhile set the mask.
const ThreadConfigSetter config_setter
void SetProfilerConfig(const ThreadConfig &)
Specified the ProfilerThread Config, meanwhile set the mask.
std::optional< ThreadConfig > ui_config
std::optional< ThreadConfig > raster_config
static std::string MakeThreadName(Type type, const std::string &prefix)
Use the prefix and thread type to generator a thread name.
void SetIOConfig(const ThreadConfig &)
Specified the IO Thread Config, meanwhile set the mask.
void SetRasterConfig(const ThreadConfig &)
Specified the IO Thread Config, meanwhile set the mask.
bool isThreadNeeded(Type type) const
Check if need to create thread.
std::optional< ThreadConfig > profiler_config
void SetPlatformConfig(const ThreadConfig &)
Specified the Platform Thread Config, meanwhile set the mask.
The collection of all the threads used by the engine.
std::unique_ptr< fml::Thread > io_thread
std::unique_ptr< fml::Thread > platform_thread
std::unique_ptr< fml::Thread > profiler_thread
std::unique_ptr< fml::Thread > raster_thread
std::unique_ptr< fml::Thread > ui_thread
The ThreadConfig is the thread info include thread name, thread priority.