Make {shell|lib/ui}/... compatible with .clang_tidy. (flutter/engine#48242)

This is mostly just rename `ThreadHost::Type::{IDENTIFIER}` to
`kIdentifier`.

I also ignored some enum violations that are in public APIs.
This commit is contained in:
Matan Lurey 2023-11-21 12:29:14 -08:00 committed by GitHub
parent 753e9e6ac7
commit edb665c82d
22 changed files with 167 additions and 146 deletions

View File

@ -21,8 +21,8 @@ class Fixture : public testing::FixtureTest {
static void BM_PlatformMessageResponseDartComplete(benchmark::State& state) {
ThreadHost thread_host(ThreadHost::ThreadHostConfig(
"test", ThreadHost::Type::Platform | ThreadHost::Type::RASTER |
ThreadHost::Type::IO | ThreadHost::Type::UI));
"test", ThreadHost::Type::kPlatform | ThreadHost::Type::kRaster |
ThreadHost::Type::kIo | ThreadHost::Type::kUi));
TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(),
thread_host.raster_thread->GetTaskRunner(),
thread_host.ui_thread->GetTaskRunner(),
@ -69,8 +69,8 @@ static void BM_PlatformMessageResponseDartComplete(benchmark::State& state) {
static void BM_PathVolatilityTracker(benchmark::State& state) {
ThreadHost thread_host(ThreadHost::ThreadHostConfig(
"test", ThreadHost::Type::Platform | ThreadHost::Type::RASTER |
ThreadHost::Type::IO | ThreadHost::Type::UI));
"test", ThreadHost::Type::kPlatform | ThreadHost::Type::kRaster |
ThreadHost::Type::kIo | ThreadHost::Type::kUi));
TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(),
thread_host.raster_thread->GetTaskRunner(),
thread_host.ui_thread->GetTaskRunner(),

View File

@ -44,8 +44,8 @@ BENCHMARK_F(DartNativeBenchmarks, TimeToFirstNativeMessageFromIsolateInNewVM)
DartVMRef vm_ref = DartVMRef::Create(settings);
ThreadHost thread_host("io.flutter.test.DartNativeBenchmarks.",
ThreadHost::Type::Platform | ThreadHost::Type::IO |
ThreadHost::Type::UI);
ThreadHost::Type::kPlatform | ThreadHost::Type::kIo |
ThreadHost::Type::kUi);
TaskRunners task_runners(
"test",
thread_host.platform_thread->GetTaskRunner(), // platform
@ -81,8 +81,8 @@ BENCHMARK_F(DartNativeBenchmarks, MultipleDartToNativeMessages)
DartVMRef vm_ref = DartVMRef::Create(settings);
ThreadHost thread_host("io.flutter.test.DartNativeBenchmarks.",
ThreadHost::Type::Platform | ThreadHost::Type::IO |
ThreadHost::Type::UI);
ThreadHost::Type::kPlatform | ThreadHost::Type::kIo |
ThreadHost::Type::kUi);
TaskRunners task_runners(
"test",
thread_host.platform_thread->GetTaskRunner(), // platform

View File

@ -207,8 +207,8 @@ class EngineTest : public testing::FixtureTest {
public:
EngineTest()
: thread_host_("EngineTest",
ThreadHost::Type::Platform | ThreadHost::Type::IO |
ThreadHost::Type::UI | ThreadHost::Type::RASTER),
ThreadHost::Type::kPlatform | ThreadHost::Type::kIo |
ThreadHost::Type::kUi | ThreadHost::Type::kRaster),
task_runners_({
"EngineTest",
thread_host_.platform_thread->GetTaskRunner(), // platform

View File

@ -149,8 +149,9 @@ TEST(RasterizerTest, drawEmptyPipeline) {
std::string test_name =
::testing::UnitTest::GetInstance()->current_test_info()->name();
ThreadHost thread_host("io.flutter.test." + test_name + ".",
ThreadHost::Type::Platform | ThreadHost::Type::RASTER |
ThreadHost::Type::IO | ThreadHost::Type::UI);
ThreadHost::Type::kPlatform |
ThreadHost::Type::kRaster | ThreadHost::Type::kIo |
ThreadHost::Type::kUi);
TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(),
thread_host.raster_thread->GetTaskRunner(),
thread_host.ui_thread->GetTaskRunner(),
@ -179,8 +180,9 @@ TEST(RasterizerTest,
std::string test_name =
::testing::UnitTest::GetInstance()->current_test_info()->name();
ThreadHost thread_host("io.flutter.test." + test_name + ".",
ThreadHost::Type::Platform | ThreadHost::Type::RASTER |
ThreadHost::Type::IO | ThreadHost::Type::UI);
ThreadHost::Type::kPlatform |
ThreadHost::Type::kRaster | ThreadHost::Type::kIo |
ThreadHost::Type::kUi);
TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(),
thread_host.raster_thread->GetTaskRunner(),
thread_host.ui_thread->GetTaskRunner(),
@ -253,8 +255,9 @@ TEST(
std::string test_name =
::testing::UnitTest::GetInstance()->current_test_info()->name();
ThreadHost thread_host("io.flutter.test." + test_name + ".",
ThreadHost::Type::Platform | ThreadHost::Type::RASTER |
ThreadHost::Type::IO | ThreadHost::Type::UI);
ThreadHost::Type::kPlatform |
ThreadHost::Type::kRaster | ThreadHost::Type::kIo |
ThreadHost::Type::kUi);
TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(),
thread_host.raster_thread->GetTaskRunner(),
thread_host.ui_thread->GetTaskRunner(),
@ -321,8 +324,9 @@ TEST(
std::string test_name =
::testing::UnitTest::GetInstance()->current_test_info()->name();
ThreadHost thread_host("io.flutter.test." + test_name + ".",
ThreadHost::Type::Platform | ThreadHost::Type::RASTER |
ThreadHost::Type::IO | ThreadHost::Type::UI);
ThreadHost::Type::kPlatform |
ThreadHost::Type::kRaster | ThreadHost::Type::kIo |
ThreadHost::Type::kUi);
fml::MessageLoop::EnsureInitializedForCurrentThread();
TaskRunners task_runners("test",
fml::MessageLoop::GetCurrent().GetTaskRunner(),
@ -391,8 +395,9 @@ TEST(RasterizerTest,
std::string test_name =
::testing::UnitTest::GetInstance()->current_test_info()->name();
ThreadHost thread_host("io.flutter.test." + test_name + ".",
ThreadHost::Type::Platform | ThreadHost::Type::RASTER |
ThreadHost::Type::IO | ThreadHost::Type::UI);
ThreadHost::Type::kPlatform |
ThreadHost::Type::kRaster | ThreadHost::Type::kIo |
ThreadHost::Type::kUi);
fml::MessageLoop::EnsureInitializedForCurrentThread();
TaskRunners task_runners("test",
fml::MessageLoop::GetCurrent().GetTaskRunner(),
@ -475,8 +480,9 @@ TEST(RasterizerTest, externalViewEmbedderDoesntEndFrameWhenNoSurfaceIsSet) {
std::string test_name =
::testing::UnitTest::GetInstance()->current_test_info()->name();
ThreadHost thread_host("io.flutter.test." + test_name + ".",
ThreadHost::Type::Platform | ThreadHost::Type::RASTER |
ThreadHost::Type::IO | ThreadHost::Type::UI);
ThreadHost::Type::kPlatform |
ThreadHost::Type::kRaster | ThreadHost::Type::kIo |
ThreadHost::Type::kUi);
TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(),
thread_host.raster_thread->GetTaskRunner(),
thread_host.ui_thread->GetTaskRunner(),
@ -522,8 +528,9 @@ TEST(RasterizerTest, externalViewEmbedderDoesntEndFrameWhenNotUsedThisFrame) {
std::string test_name =
::testing::UnitTest::GetInstance()->current_test_info()->name();
ThreadHost thread_host("io.flutter.test." + test_name + ".",
ThreadHost::Type::Platform | ThreadHost::Type::RASTER |
ThreadHost::Type::IO | ThreadHost::Type::UI);
ThreadHost::Type::kPlatform |
ThreadHost::Type::kRaster | ThreadHost::Type::kIo |
ThreadHost::Type::kUi);
TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(),
thread_host.raster_thread->GetTaskRunner(),
thread_host.ui_thread->GetTaskRunner(),
@ -587,8 +594,9 @@ TEST(RasterizerTest, externalViewEmbedderDoesntEndFrameWhenPipelineIsEmpty) {
std::string test_name =
::testing::UnitTest::GetInstance()->current_test_info()->name();
ThreadHost thread_host("io.flutter.test." + test_name + ".",
ThreadHost::Type::Platform | ThreadHost::Type::RASTER |
ThreadHost::Type::IO | ThreadHost::Type::UI);
ThreadHost::Type::kPlatform |
ThreadHost::Type::kRaster | ThreadHost::Type::kIo |
ThreadHost::Type::kUi);
TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(),
thread_host.raster_thread->GetTaskRunner(),
thread_host.ui_thread->GetTaskRunner(),
@ -632,8 +640,9 @@ TEST(RasterizerTest,
std::string test_name =
::testing::UnitTest::GetInstance()->current_test_info()->name();
ThreadHost thread_host("io.flutter.test." + test_name + ".",
ThreadHost::Type::Platform | ThreadHost::Type::RASTER |
ThreadHost::Type::IO | ThreadHost::Type::UI);
ThreadHost::Type::kPlatform |
ThreadHost::Type::kRaster | ThreadHost::Type::kIo |
ThreadHost::Type::kUi);
TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(),
thread_host.raster_thread->GetTaskRunner(),
thread_host.ui_thread->GetTaskRunner(),
@ -692,8 +701,9 @@ TEST(
std::string test_name =
::testing::UnitTest::GetInstance()->current_test_info()->name();
ThreadHost thread_host("io.flutter.test." + test_name + ".",
ThreadHost::Type::Platform | ThreadHost::Type::RASTER |
ThreadHost::Type::IO | ThreadHost::Type::UI);
ThreadHost::Type::kPlatform |
ThreadHost::Type::kRaster | ThreadHost::Type::kIo |
ThreadHost::Type::kUi);
TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(),
thread_host.raster_thread->GetTaskRunner(),
thread_host.ui_thread->GetTaskRunner(),
@ -753,8 +763,9 @@ TEST(
std::string test_name =
::testing::UnitTest::GetInstance()->current_test_info()->name();
ThreadHost thread_host("io.flutter.test." + test_name + ".",
ThreadHost::Type::Platform | ThreadHost::Type::RASTER |
ThreadHost::Type::IO | ThreadHost::Type::UI);
ThreadHost::Type::kPlatform |
ThreadHost::Type::kRaster | ThreadHost::Type::kIo |
ThreadHost::Type::kUi);
TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(),
thread_host.raster_thread->GetTaskRunner(),
thread_host.ui_thread->GetTaskRunner(),
@ -813,8 +824,9 @@ TEST(
std::string test_name =
::testing::UnitTest::GetInstance()->current_test_info()->name();
ThreadHost thread_host("io.flutter.test." + test_name + ".",
ThreadHost::Type::Platform | ThreadHost::Type::RASTER |
ThreadHost::Type::IO | ThreadHost::Type::UI);
ThreadHost::Type::kPlatform |
ThreadHost::Type::kRaster | ThreadHost::Type::kIo |
ThreadHost::Type::kUi);
TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(),
thread_host.raster_thread->GetTaskRunner(),
thread_host.ui_thread->GetTaskRunner(),
@ -872,8 +884,9 @@ TEST(
std::string test_name =
::testing::UnitTest::GetInstance()->current_test_info()->name();
ThreadHost thread_host("io.flutter.test." + test_name + ".",
ThreadHost::Type::Platform | ThreadHost::Type::RASTER |
ThreadHost::Type::IO | ThreadHost::Type::UI);
ThreadHost::Type::kPlatform |
ThreadHost::Type::kRaster | ThreadHost::Type::kIo |
ThreadHost::Type::kUi);
TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(),
thread_host.raster_thread->GetTaskRunner(),
thread_host.ui_thread->GetTaskRunner(),
@ -930,8 +943,9 @@ TEST(RasterizerTest,
std::string test_name =
::testing::UnitTest::GetInstance()->current_test_info()->name();
ThreadHost thread_host("io.flutter.test." + test_name + ".",
ThreadHost::Type::Platform | ThreadHost::Type::RASTER |
ThreadHost::Type::IO | ThreadHost::Type::UI);
ThreadHost::Type::kPlatform |
ThreadHost::Type::kRaster | ThreadHost::Type::kIo |
ThreadHost::Type::kUi);
TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(),
thread_host.raster_thread->GetTaskRunner(),
thread_host.ui_thread->GetTaskRunner(),
@ -1017,8 +1031,9 @@ TEST(RasterizerTest, TeardownFreesResourceCache) {
std::string test_name =
::testing::UnitTest::GetInstance()->current_test_info()->name();
ThreadHost thread_host("io.flutter.test." + test_name + ".",
ThreadHost::Type::Platform | ThreadHost::Type::RASTER |
ThreadHost::Type::IO | ThreadHost::Type::UI);
ThreadHost::Type::kPlatform |
ThreadHost::Type::kRaster | ThreadHost::Type::kIo |
ThreadHost::Type::kUi);
TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(),
thread_host.raster_thread->GetTaskRunner(),
thread_host.ui_thread->GetTaskRunner(),
@ -1079,8 +1094,9 @@ TEST(RasterizerTest, TeardownNoSurface) {
std::string test_name =
::testing::UnitTest::GetInstance()->current_test_info()->name();
ThreadHost thread_host("io.flutter.test." + test_name + ".",
ThreadHost::Type::Platform | ThreadHost::Type::RASTER |
ThreadHost::Type::IO | ThreadHost::Type::UI);
ThreadHost::Type::kPlatform |
ThreadHost::Type::kRaster | ThreadHost::Type::kIo |
ThreadHost::Type::kUi);
TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(),
thread_host.raster_thread->GetTaskRunner(),
thread_host.ui_thread->GetTaskRunner(),
@ -1105,8 +1121,8 @@ TEST(RasterizerTest, presentationTimeSetWhenVsyncTargetInFuture) {
std::string test_name =
::testing::UnitTest::GetInstance()->current_test_info()->name();
ThreadHost thread_host("io.flutter.test." + test_name + ".",
ThreadHost::Type::Platform | ThreadHost::Type::RASTER |
ThreadHost::Type::IO | ThreadHost::Type::UI);
ThreadHost::Type::kPlatform | ThreadHost::Type::kRaster |
ThreadHost::Type::kIo | ThreadHost::Type::kUi);
TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(),
thread_host.raster_thread->GetTaskRunner(),
thread_host.ui_thread->GetTaskRunner(),
@ -1194,8 +1210,8 @@ TEST(RasterizerTest, presentationTimeNotSetWhenVsyncTargetInPast) {
std::string test_name =
::testing::UnitTest::GetInstance()->current_test_info()->name();
ThreadHost thread_host("io.flutter.test." + test_name + ".",
ThreadHost::Type::Platform | ThreadHost::Type::RASTER |
ThreadHost::Type::IO | ThreadHost::Type::UI);
ThreadHost::Type::kPlatform | ThreadHost::Type::kRaster |
ThreadHost::Type::kIo | ThreadHost::Type::kUi);
TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(),
thread_host.raster_thread->GetTaskRunner(),
thread_host.ui_thread->GetTaskRunner(),

View File

@ -44,9 +44,9 @@ static void StartupAndShutdownShell(benchmark::State& state,
}
thread_host = std::make_unique<ThreadHost>(ThreadHost::ThreadHostConfig(
"io.flutter.bench.", ThreadHost::Type::Platform |
ThreadHost::Type::RASTER |
ThreadHost::Type::IO | ThreadHost::Type::UI));
"io.flutter.bench.",
ThreadHost::Type::kPlatform | ThreadHost::Type::kRaster |
ThreadHost::Type::kIo | ThreadHost::Type::kUi));
TaskRunners task_runners("test",
thread_host->platform_thread->GetTaskRunner(),

View File

@ -57,8 +57,8 @@ FrameContent ViewContent::ImplicitView(double width,
ShellTest::ShellTest()
: thread_host_("io.flutter.test." + GetCurrentTestName() + ".",
ThreadHost::Type::Platform | ThreadHost::Type::IO |
ThreadHost::Type::UI | ThreadHost::Type::RASTER) {}
ThreadHost::Type::kPlatform | ThreadHost::Type::kIo |
ThreadHost::Type::kUi | ThreadHost::Type::kRaster) {}
void ShellTest::SendPlatformMessage(Shell* shell,
std::unique_ptr<PlatformMessage> message) {

View File

@ -388,8 +388,8 @@ TEST_F(ShellTest, InitializeWithDifferentThreads) {
Settings settings = CreateSettingsForFixture();
std::string name_prefix = "io.flutter.test." + GetCurrentTestName() + ".";
ThreadHost thread_host(ThreadHost::ThreadHostConfig(
name_prefix, ThreadHost::Type::Platform | ThreadHost::Type::RASTER |
ThreadHost::Type::IO | ThreadHost::Type::UI));
name_prefix, ThreadHost::Type::kPlatform | ThreadHost::Type::kRaster |
ThreadHost::Type::kIo | ThreadHost::Type::kUi));
ASSERT_EQ(thread_host.name_prefix, name_prefix);
TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(),
@ -407,7 +407,7 @@ TEST_F(ShellTest, InitializeWithSingleThread) {
ASSERT_FALSE(DartVMRef::IsInstanceRunning());
Settings settings = CreateSettingsForFixture();
ThreadHost thread_host("io.flutter.test." + GetCurrentTestName() + ".",
ThreadHost::Type::Platform);
ThreadHost::Type::kPlatform);
auto task_runner = thread_host.platform_thread->GetTaskRunner();
TaskRunners task_runners("test", task_runner, task_runner, task_runner,
task_runner);
@ -436,9 +436,9 @@ TEST_F(ShellTest,
InitializeWithMultipleThreadButCallingThreadAsPlatformThread) {
ASSERT_FALSE(DartVMRef::IsInstanceRunning());
Settings settings = CreateSettingsForFixture();
ThreadHost thread_host(
"io.flutter.test." + GetCurrentTestName() + ".",
ThreadHost::Type::RASTER | ThreadHost::Type::IO | ThreadHost::Type::UI);
ThreadHost thread_host("io.flutter.test." + GetCurrentTestName() + ".",
ThreadHost::Type::kRaster | ThreadHost::Type::kIo |
ThreadHost::Type::kUi);
fml::MessageLoop::EnsureInitializedForCurrentThread();
TaskRunners task_runners("test",
fml::MessageLoop::GetCurrent().GetTaskRunner(),
@ -471,7 +471,7 @@ TEST_F(ShellTest, InitializeWithDisabledGpu) {
ASSERT_FALSE(DartVMRef::IsInstanceRunning());
Settings settings = CreateSettingsForFixture();
ThreadHost thread_host("io.flutter.test." + GetCurrentTestName() + ".",
ThreadHost::Type::Platform);
ThreadHost::Type::kPlatform);
auto task_runner = thread_host.platform_thread->GetTaskRunner();
TaskRunners task_runners("test", task_runner, task_runner, task_runner,
task_runner);
@ -495,9 +495,9 @@ TEST_F(ShellTest, InitializeWithDisabledGpu) {
TEST_F(ShellTest, InitializeWithGPUAndPlatformThreadsTheSame) {
ASSERT_FALSE(DartVMRef::IsInstanceRunning());
Settings settings = CreateSettingsForFixture();
ThreadHost thread_host(
"io.flutter.test." + GetCurrentTestName() + ".",
ThreadHost::Type::Platform | ThreadHost::Type::IO | ThreadHost::Type::UI);
ThreadHost thread_host("io.flutter.test." + GetCurrentTestName() + ".",
ThreadHost::Type::kPlatform | ThreadHost::Type::kIo |
ThreadHost::Type::kUi);
TaskRunners task_runners(
"test",
thread_host.platform_thread->GetTaskRunner(), // platform
@ -1337,9 +1337,9 @@ TEST_F(ShellTest, OnPlatformViewDestroyWithStaticThreadMerging) {
};
auto external_view_embedder = std::make_shared<ShellTestExternalViewEmbedder>(
end_frame_callback, PostPrerollResult::kSuccess, true);
ThreadHost thread_host(
"io.flutter.test." + GetCurrentTestName() + ".",
ThreadHost::Type::Platform | ThreadHost::Type::IO | ThreadHost::Type::UI);
ThreadHost thread_host("io.flutter.test." + GetCurrentTestName() + ".",
ThreadHost::Type::kPlatform | ThreadHost::Type::kIo |
ThreadHost::Type::kUi);
TaskRunners task_runners(
"test",
thread_host.platform_thread->GetTaskRunner(), // platform
@ -3699,7 +3699,7 @@ TEST_F(ShellTest, UpdateAssetResolverByTypeNull) {
Settings settings = CreateSettingsForFixture();
ThreadHost thread_host(ThreadHost::ThreadHostConfig(
"io.flutter.test." + GetCurrentTestName() + ".",
ThreadHost::Type::Platform));
ThreadHost::Type::kPlatform));
auto task_runner = thread_host.platform_thread->GetTaskRunner();
TaskRunners task_runners("test", task_runner, task_runner, task_runner,
task_runner);
@ -4221,7 +4221,7 @@ TEST_F(ShellTest, PictureToImageSyncWithTrampledContext) {
// make it easier to trample the GL context by running on a single task
// runner.
ThreadHost thread_host("io.flutter.test." + GetCurrentTestName() + ".",
ThreadHost::Type::Platform);
ThreadHost::Type::kPlatform);
auto task_runner = thread_host.platform_thread->GetTaskRunner();
TaskRunners task_runners("test", task_runner, task_runner, task_runner,
task_runner);
@ -4299,8 +4299,8 @@ TEST_F(ShellTest, NotifyIdleRejectsPastAndNearFuture) {
ASSERT_FALSE(DartVMRef::IsInstanceRunning());
Settings settings = CreateSettingsForFixture();
ThreadHost thread_host("io.flutter.test." + GetCurrentTestName() + ".",
ThreadHost::Type::Platform | ThreadHost::UI |
ThreadHost::IO | ThreadHost::RASTER);
ThreadHost::Type::kPlatform | ThreadHost::kUi |
ThreadHost::kIo | ThreadHost::kRaster);
auto platform_task_runner = thread_host.platform_thread->GetTaskRunner();
TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(),
thread_host.raster_thread->GetTaskRunner(),
@ -4344,8 +4344,8 @@ TEST_F(ShellTest, NotifyIdleNotCalledInLatencyMode) {
ASSERT_FALSE(DartVMRef::IsInstanceRunning());
Settings settings = CreateSettingsForFixture();
ThreadHost thread_host("io.flutter.test." + GetCurrentTestName() + ".",
ThreadHost::Type::Platform | ThreadHost::UI |
ThreadHost::IO | ThreadHost::RASTER);
ThreadHost::Type::kPlatform | ThreadHost::kUi |
ThreadHost::kIo | ThreadHost::kRaster);
auto platform_task_runner = thread_host.platform_thread->GetTaskRunner();
TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(),
thread_host.raster_thread->GetTaskRunner(),
@ -4387,8 +4387,8 @@ TEST_F(ShellTest, NotifyDestroyed) {
ASSERT_FALSE(DartVMRef::IsInstanceRunning());
Settings settings = CreateSettingsForFixture();
ThreadHost thread_host("io.flutter.test." + GetCurrentTestName() + ".",
ThreadHost::Type::Platform | ThreadHost::UI |
ThreadHost::IO | ThreadHost::RASTER);
ThreadHost::Type::kPlatform | ThreadHost::kUi |
ThreadHost::kIo | ThreadHost::kRaster);
auto platform_task_runner = thread_host.platform_thread->GetTaskRunner();
TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(),
thread_host.raster_thread->GetTaskRunner(),
@ -4423,7 +4423,7 @@ TEST_F(ShellTest, PrintsErrorWhenPlatformMessageSentFromWrongThread) {
#else
Settings settings = CreateSettingsForFixture();
ThreadHost thread_host("io.flutter.test." + GetCurrentTestName() + ".",
ThreadHost::Type::Platform);
ThreadHost::Type::kPlatform);
auto task_runner = thread_host.platform_thread->GetTaskRunner();
TaskRunners task_runners("test", task_runner, task_runner, task_runner,
task_runner);
@ -4475,7 +4475,7 @@ TEST_F(ShellTest, DiesIfSoftwareRenderingAndImpellerAreEnabledDeathTest) {
settings.enable_impeller = true;
settings.enable_software_rendering = true;
ThreadHost thread_host("io.flutter.test." + GetCurrentTestName() + ".",
ThreadHost::Type::Platform);
ThreadHost::Type::kPlatform);
auto task_runner = thread_host.platform_thread->GetTaskRunner();
TaskRunners task_runners("test", task_runner, task_runner, task_runner,
task_runner);
@ -4540,8 +4540,8 @@ TEST_F(ShellTest, ShellCanAddViewOrRemoveView) {
Settings settings = CreateSettingsForFixture();
ThreadHost thread_host(ThreadHost::ThreadHostConfig(
"io.flutter.test." + GetCurrentTestName() + ".",
ThreadHost::Type::Platform | ThreadHost::Type::RASTER |
ThreadHost::Type::IO | ThreadHost::Type::UI));
ThreadHost::Type::kPlatform | ThreadHost::Type::kRaster |
ThreadHost::Type::kIo | ThreadHost::Type::kUi));
TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(),
thread_host.raster_thread->GetTaskRunner(),
thread_host.ui_thread->GetTaskRunner(),
@ -4621,8 +4621,8 @@ TEST_F(ShellTest, ShellFlushesPlatformStatesByMain) {
Settings settings = CreateSettingsForFixture();
ThreadHost thread_host(ThreadHost::ThreadHostConfig(
"io.flutter.test." + GetCurrentTestName() + ".",
ThreadHost::Type::Platform | ThreadHost::Type::RASTER |
ThreadHost::Type::IO | ThreadHost::Type::UI));
ThreadHost::Type::kPlatform | ThreadHost::Type::kRaster |
ThreadHost::Type::kIo | ThreadHost::Type::kUi));
TaskRunners task_runners("test", thread_host.platform_thread->GetTaskRunner(),
thread_host.raster_thread->GetTaskRunner(),
thread_host.ui_thread->GetTaskRunner(),

View File

@ -16,43 +16,43 @@ std::string ThreadHost::ThreadHostConfig::MakeThreadName(
Type type,
const std::string& prefix) {
switch (type) {
case Type::Platform:
case Type::kPlatform:
return prefix + ".platform";
case Type::UI:
case Type::kUi:
return prefix + ".ui";
case Type::IO:
case Type::kIo:
return prefix + ".io";
case Type::RASTER:
case Type::kRaster:
return prefix + ".raster";
case Type::Profiler:
case Type::kProfiler:
return prefix + ".profiler";
}
}
void ThreadHost::ThreadHostConfig::SetIOConfig(const ThreadConfig& config) {
type_mask |= ThreadHost::Type::IO;
type_mask |= ThreadHost::Type::kIo;
io_config = config;
}
void ThreadHost::ThreadHostConfig::SetUIConfig(const ThreadConfig& config) {
type_mask |= ThreadHost::Type::UI;
type_mask |= ThreadHost::Type::kUi;
ui_config = config;
}
void ThreadHost::ThreadHostConfig::SetPlatformConfig(
const ThreadConfig& config) {
type_mask |= ThreadHost::Type::Platform;
type_mask |= ThreadHost::Type::kPlatform;
platform_config = config;
}
void ThreadHost::ThreadHostConfig::SetRasterConfig(const ThreadConfig& config) {
type_mask |= ThreadHost::Type::RASTER;
type_mask |= ThreadHost::Type::kRaster;
raster_config = config;
}
void ThreadHost::ThreadHostConfig::SetProfilerConfig(
const ThreadConfig& config) {
type_mask |= ThreadHost::Type::Profiler;
type_mask |= ThreadHost::Type::kProfiler;
profiler_config = config;
}
@ -78,27 +78,27 @@ ThreadHost::ThreadHost(const std::string& name_prefix, uint64_t mask)
ThreadHost::ThreadHost(const ThreadHostConfig& host_config)
: name_prefix(host_config.name_prefix) {
if (host_config.isThreadNeeded(ThreadHost::Type::Platform)) {
if (host_config.isThreadNeeded(ThreadHost::Type::kPlatform)) {
platform_thread =
CreateThread(Type::Platform, host_config.platform_config, host_config);
CreateThread(Type::kPlatform, host_config.platform_config, host_config);
}
if (host_config.isThreadNeeded(ThreadHost::Type::UI)) {
ui_thread = CreateThread(Type::UI, host_config.ui_config, host_config);
if (host_config.isThreadNeeded(ThreadHost::Type::kUi)) {
ui_thread = CreateThread(Type::kUi, host_config.ui_config, host_config);
}
if (host_config.isThreadNeeded(ThreadHost::Type::RASTER)) {
if (host_config.isThreadNeeded(ThreadHost::Type::kRaster)) {
raster_thread =
CreateThread(Type::RASTER, host_config.raster_config, host_config);
CreateThread(Type::kRaster, host_config.raster_config, host_config);
}
if (host_config.isThreadNeeded(ThreadHost::Type::IO)) {
io_thread = CreateThread(Type::IO, host_config.io_config, host_config);
if (host_config.isThreadNeeded(ThreadHost::Type::kIo)) {
io_thread = CreateThread(Type::kIo, host_config.io_config, host_config);
}
if (host_config.isThreadNeeded(ThreadHost::Type::Profiler)) {
if (host_config.isThreadNeeded(ThreadHost::Type::kProfiler)) {
profiler_thread =
CreateThread(Type::Profiler, host_config.profiler_config, host_config);
CreateThread(Type::kProfiler, host_config.profiler_config, host_config);
}
}

View File

@ -20,13 +20,11 @@ using ThreadConfigSetter = fml::Thread::ThreadConfigSetter;
/// The collection of all the threads used by the engine.
struct ThreadHost {
enum Type {
// NOLINTBEGIN(readability-identifier-naming)
Platform = 1 << 0,
UI = 1 << 1,
RASTER = 1 << 2,
IO = 1 << 3,
Profiler = 1 << 4,
// NOLINTEND(readability-identifier-naming)
kPlatform = 1 << 0,
kUi = 1 << 1,
kRaster = 1 << 2,
kIo = 1 << 3,
kProfiler = 1 << 4,
};
/// The collection of all the thread configures, and we create custom thread

View File

@ -36,8 +36,8 @@ TEST(AndroidContextGl, Create) {
::testing::UnitTest::GetInstance()->current_test_info()->name();
ThreadHost thread_host(ThreadHost::ThreadHostConfig(
thread_label,
ThreadHost::Type::UI | ThreadHost::Type::RASTER | ThreadHost::Type::IO));
thread_label, ThreadHost::Type::kUi | ThreadHost::Type::kRaster |
ThreadHost::Type::kIo));
TaskRunners task_runners = MakeTaskRunners(thread_label, thread_host);
auto context = std::make_unique<AndroidContextGLSkia>(
AndroidRenderingAPI::kOpenGLES, environment, task_runners, 0);
@ -76,8 +76,8 @@ TEST(AndroidSurfaceGL, CreateSnapshopSurfaceWhenOnscreenSurfaceIsNotNull) {
std::string thread_label =
::testing::UnitTest::GetInstance()->current_test_info()->name();
ThreadHost thread_host(ThreadHost::ThreadHostConfig(
thread_label,
ThreadHost::Type::UI | ThreadHost::Type::RASTER | ThreadHost::Type::IO));
thread_label, ThreadHost::Type::kUi | ThreadHost::Type::kRaster |
ThreadHost::Type::kIo));
TaskRunners task_runners = MakeTaskRunners(thread_label, thread_host);
auto android_context = std::make_shared<AndroidContextGLSkia>(
AndroidRenderingAPI::kOpenGLES, environment, task_runners, 0);
@ -101,7 +101,7 @@ TEST(AndroidSurfaceGL, CreateSnapshopSurfaceWhenOnscreenSurfaceIsNull) {
::testing::UnitTest::GetInstance()->current_test_info()->name();
auto mask =
ThreadHost::Type::UI | ThreadHost::Type::RASTER | ThreadHost::Type::IO;
ThreadHost::Type::kUi | ThreadHost::Type::kRaster | ThreadHost::Type::kIo;
flutter::ThreadHost::ThreadHostConfig host_config(mask);
ThreadHost thread_host(host_config);
@ -125,8 +125,8 @@ TEST(AndroidContextGl, DISABLED_MSAAx4) {
::testing::UnitTest::GetInstance()->current_test_info()->name();
ThreadHost thread_host(ThreadHost::ThreadHostConfig(
thread_label,
ThreadHost::Type::UI | ThreadHost::Type::RASTER | ThreadHost::Type::IO));
thread_label, ThreadHost::Type::kUi | ThreadHost::Type::kRaster |
ThreadHost::Type::kIo));
TaskRunners task_runners = MakeTaskRunners(thread_label, thread_host);
auto context = std::make_unique<AndroidContextGLSkia>(
AndroidRenderingAPI::kOpenGLES, environment, task_runners, 4);
@ -147,8 +147,8 @@ TEST(AndroidContextGl, EnsureMakeCurrentChecksCurrentContextStatus) {
::testing::UnitTest::GetInstance()->current_test_info()->name();
ThreadHost thread_host(ThreadHost::ThreadHostConfig(
thread_label,
ThreadHost::Type::UI | ThreadHost::Type::RASTER | ThreadHost::Type::IO));
thread_label, ThreadHost::Type::kUi | ThreadHost::Type::kRaster |
ThreadHost::Type::kIo));
TaskRunners task_runners = MakeTaskRunners(thread_label, thread_host);
auto context = std::make_unique<AndroidContextGLSkia>(
AndroidRenderingAPI::kOpenGLES, environment, task_runners, 0);

View File

@ -90,21 +90,21 @@ AndroidShellHolder::AndroidShellHolder(
auto thread_label = std::to_string(thread_host_count++);
auto mask =
ThreadHost::Type::UI | ThreadHost::Type::RASTER | ThreadHost::Type::IO;
ThreadHost::Type::kUi | ThreadHost::Type::kRaster | ThreadHost::Type::kIo;
flutter::ThreadHost::ThreadHostConfig host_config(
thread_label, mask, AndroidPlatformThreadConfigSetter);
host_config.ui_config = fml::Thread::ThreadConfig(
flutter::ThreadHost::ThreadHostConfig::MakeThreadName(
flutter::ThreadHost::Type::UI, thread_label),
flutter::ThreadHost::Type::kUi, thread_label),
fml::Thread::ThreadPriority::kDisplay);
host_config.raster_config = fml::Thread::ThreadConfig(
flutter::ThreadHost::ThreadHostConfig::MakeThreadName(
flutter::ThreadHost::Type::RASTER, thread_label),
flutter::ThreadHost::Type::kRaster, thread_label),
fml::Thread::ThreadPriority::kRaster);
host_config.io_config = fml::Thread::ThreadConfig(
flutter::ThreadHost::ThreadHostConfig::MakeThreadName(
flutter::ThreadHost::Type::IO, thread_label),
flutter::ThreadHost::Type::kIo, thread_label),
fml::Thread::ThreadPriority::kNormal);
thread_host_ = std::make_shared<ThreadHost>(host_config);

View File

@ -5,6 +5,8 @@
#ifndef FLUTTER_SHELL_PLATFORM_ANDROID_JNI_PLATFORM_VIEW_ANDROID_JNI_H_
#define FLUTTER_SHELL_PLATFORM_ANDROID_JNI_PLATFORM_VIEW_ANDROID_JNI_H_
#include <utility>
#include "flutter/fml/macros.h"
#include "flutter/fml/mapping.h"
@ -179,7 +181,7 @@ class PlatformViewAndroidJNI {
///
struct OverlayMetadata {
OverlayMetadata(int id, fml::RefPtr<AndroidNativeWindow> window)
: id(id), window(window){};
: id(id), window(std::move(window)){};
~OverlayMetadata() = default;

View File

@ -54,7 +54,7 @@ class GpuSurfaceTexture {
GpuSurfaceTexture(FlutterDesktopGpuSurfaceType surface_type,
ObtainDescriptorCallback obtain_descriptor_callback)
: surface_type_(surface_type),
obtain_descriptor_callback_(obtain_descriptor_callback) {}
obtain_descriptor_callback_(std::move(obtain_descriptor_callback)) {}
// Returns the callback-provided FlutterDesktopGpuSurfaceDescriptor that
// contains the surface handle. The intended surface size is specified by

View File

@ -793,11 +793,11 @@ static constexpr int kNumProfilerSamplesPerSec = 5;
// initialized.
fml::MessageLoop::EnsureInitializedForCurrentThread();
uint32_t threadHostType = flutter::ThreadHost::Type::UI | flutter::ThreadHost::Type::RASTER |
flutter::ThreadHost::Type::IO;
uint32_t threadHostType = flutter::ThreadHost::Type::kUi | flutter::ThreadHost::Type::kRaster |
flutter::ThreadHost::Type::kIo;
if ([FlutterEngine isProfilerEnabled]) {
threadHostType = threadHostType | flutter::ThreadHost::Type::Profiler;
threadHostType = threadHostType | flutter::ThreadHost::Type::kProfiler;
}
flutter::ThreadHost::ThreadHostConfig host_config(threadLabel.UTF8String, threadHostType,
@ -805,17 +805,17 @@ static constexpr int kNumProfilerSamplesPerSec = 5;
host_config.ui_config =
fml::Thread::ThreadConfig(flutter::ThreadHost::ThreadHostConfig::MakeThreadName(
flutter::ThreadHost::Type::UI, threadLabel.UTF8String),
flutter::ThreadHost::Type::kUi, threadLabel.UTF8String),
fml::Thread::ThreadPriority::kDisplay);
host_config.raster_config =
fml::Thread::ThreadConfig(flutter::ThreadHost::ThreadHostConfig::MakeThreadName(
flutter::ThreadHost::Type::RASTER, threadLabel.UTF8String),
flutter::ThreadHost::Type::kRaster, threadLabel.UTF8String),
fml::Thread::ThreadPriority::kRaster);
host_config.io_config =
fml::Thread::ThreadConfig(flutter::ThreadHost::ThreadHostConfig::MakeThreadName(
flutter::ThreadHost::Type::IO, threadLabel.UTF8String),
flutter::ThreadHost::Type::kIo, threadLabel.UTF8String),
fml::Thread::ThreadPriority::kNormal);
return (flutter::ThreadHost){host_config};

View File

@ -52,7 +52,7 @@ class MockPlatformMessageResponse : public PlatformMessageResponse {
- (void)testSetAndCallHandler {
ThreadHost thread_host("io.flutter.test." + std::string(self.name.UTF8String),
ThreadHost::Type::RASTER | ThreadHost::Type::IO | ThreadHost::Type::UI);
ThreadHost::Type::kRaster | ThreadHost::Type::kIo | ThreadHost::Type::kUi);
TaskRunners task_runners(
"test", GetCurrentTaskRunner(), thread_host.raster_thread->GetTaskRunner(),
thread_host.ui_thread->GetTaskRunner(), thread_host.io_thread->GetTaskRunner());
@ -78,7 +78,7 @@ class MockPlatformMessageResponse : public PlatformMessageResponse {
- (void)testSetClearAndCallHandler {
ThreadHost thread_host("io.flutter.test." + std::string(self.name.UTF8String),
ThreadHost::Type::RASTER | ThreadHost::Type::IO | ThreadHost::Type::UI);
ThreadHost::Type::kRaster | ThreadHost::Type::kIo | ThreadHost::Type::kUi);
TaskRunners task_runners(
"test", GetCurrentTaskRunner(), thread_host.raster_thread->GetTaskRunner(),
thread_host.ui_thread->GetTaskRunner(), thread_host.io_thread->GetTaskRunner());
@ -106,7 +106,7 @@ class MockPlatformMessageResponse : public PlatformMessageResponse {
- (void)testSetAndCallHandlerTaskQueue {
ThreadHost thread_host("io.flutter.test." + std::string(self.name.UTF8String),
ThreadHost::Type::RASTER | ThreadHost::Type::IO | ThreadHost::Type::UI);
ThreadHost::Type::kRaster | ThreadHost::Type::kIo | ThreadHost::Type::kUi);
TaskRunners task_runners(
"test", GetCurrentTaskRunner(), thread_host.raster_thread->GetTaskRunner(),
thread_host.ui_thread->GetTaskRunner(), thread_host.io_thread->GetTaskRunner());

View File

@ -137,9 +137,9 @@ EmbedderThreadHost::CreateEmbedderManagedThreadHost(
//
// If/when more task runners are exposed, this mask will need to be updated.
thread_host_config.SetUIConfig(MakeThreadConfig(
ThreadHost::Type::UI, fml::Thread::ThreadPriority::kDisplay));
ThreadHost::Type::kUi, fml::Thread::ThreadPriority::kDisplay));
thread_host_config.SetIOConfig(MakeThreadConfig(
ThreadHost::Type::IO, fml::Thread::ThreadPriority::kBackground));
ThreadHost::Type::kIo, fml::Thread::ThreadPriority::kBackground));
auto platform_task_runner_pair = CreateEmbedderTaskRunner(
SAFE_ACCESS(custom_task_runners, platform_task_runner, nullptr));
@ -157,7 +157,7 @@ EmbedderThreadHost::CreateEmbedderManagedThreadHost(
// created.
if (!render_task_runner_pair.second) {
thread_host_config.SetRasterConfig(MakeThreadConfig(
ThreadHost::Type::RASTER, fml::Thread::ThreadPriority::kRaster));
ThreadHost::Type::kRaster, fml::Thread::ThreadPriority::kRaster));
}
// If both the platform task runner and the raster task runner are specified
@ -227,11 +227,11 @@ EmbedderThreadHost::CreateEngineManagedThreadHost(
// Crate a thraed host config, and specified the thread name and priority.
auto thread_host_config = ThreadHost::ThreadHostConfig(config_setter);
thread_host_config.SetUIConfig(MakeThreadConfig(
flutter::ThreadHost::UI, fml::Thread::ThreadPriority::kDisplay));
flutter::ThreadHost::kUi, fml::Thread::ThreadPriority::kDisplay));
thread_host_config.SetRasterConfig(MakeThreadConfig(
flutter::ThreadHost::RASTER, fml::Thread::ThreadPriority::kRaster));
flutter::ThreadHost::kRaster, fml::Thread::ThreadPriority::kRaster));
thread_host_config.SetIOConfig(MakeThreadConfig(
flutter::ThreadHost::IO, fml::Thread::ThreadPriority::kBackground));
flutter::ThreadHost::kIo, fml::Thread::ThreadPriority::kBackground));
// Create a thread host with the current thread as the platform thread and all
// other threads managed.

View File

@ -94,7 +94,7 @@ class MockResponse : public PlatformMessageResponse {
TEST(PlatformViewEmbedderTest, HasPlatformMessageHandler) {
ThreadHost thread_host("io.flutter.test." + GetCurrentTestName() + ".",
ThreadHost::Type::Platform);
ThreadHost::Type::kPlatform);
flutter::TaskRunners task_runners = flutter::TaskRunners(
"HasPlatformMessageHandler", thread_host.platform_thread->GetTaskRunner(),
nullptr, nullptr, nullptr);
@ -116,7 +116,7 @@ TEST(PlatformViewEmbedderTest, HasPlatformMessageHandler) {
TEST(PlatformViewEmbedderTest, Dispatches) {
ThreadHost thread_host("io.flutter.test." + GetCurrentTestName() + ".",
ThreadHost::Type::Platform);
ThreadHost::Type::kPlatform);
flutter::TaskRunners task_runners = flutter::TaskRunners(
"HasPlatformMessageHandler", thread_host.platform_thread->GetTaskRunner(),
nullptr, nullptr, nullptr);
@ -161,7 +161,7 @@ TEST(PlatformViewEmbedderTest, Dispatches) {
TEST(PlatformViewEmbedderTest, DeletionDisabledDispatch) {
ThreadHost thread_host("io.flutter.test." + GetCurrentTestName() + ".",
ThreadHost::Type::Platform);
ThreadHost::Type::kPlatform);
flutter::TaskRunners task_runners = flutter::TaskRunners(
"HasPlatformMessageHandler", thread_host.platform_thread->GetTaskRunner(),
nullptr, nullptr, nullptr);

View File

@ -185,15 +185,15 @@ flutter::ThreadHost Engine::CreateThreadHost(
thread_host_config.SetRasterConfig(
{flutter::ThreadHost::ThreadHostConfig::MakeThreadName(
flutter::ThreadHost::Type::RASTER, name_prefix),
flutter::ThreadHost::Type::kRaster, name_prefix),
fml::Thread::ThreadPriority::kRaster});
thread_host_config.SetUIConfig(
{flutter::ThreadHost::ThreadHostConfig::MakeThreadName(
flutter::ThreadHost::Type::UI, name_prefix),
flutter::ThreadHost::Type::kUi, name_prefix),
fml::Thread::ThreadPriority::kDisplay});
thread_host_config.SetIOConfig(
{flutter::ThreadHost::ThreadHostConfig::MakeThreadName(
flutter::ThreadHost::Type::IO, name_prefix),
flutter::ThreadHost::Type::kIo, name_prefix),
fml::Thread::ThreadPriority::kNormal});
return flutter::ThreadHost(thread_host_config);

View File

@ -25,9 +25,9 @@ TEST(VSyncWaiterFuchsia, FrameScheduledForStartTime) {
auto platform_task_runner = fml::MessageLoop::GetCurrent().GetTaskRunner();
ThreadHost thread_host =
ThreadHost(prefix, flutter::ThreadHost::Type::RASTER |
flutter::ThreadHost::Type::UI |
flutter::ThreadHost::Type::IO);
ThreadHost(prefix, flutter::ThreadHost::Type::kRaster |
flutter::ThreadHost::Type::kUi |
flutter::ThreadHost::Type::kIo);
const flutter::TaskRunners task_runners(
prefix, // Dart thread labels
platform_task_runner, // platform

View File

@ -27,6 +27,8 @@ G_BEGIN_DECLS
#define FL_BINARY_MESSENGER_ERROR fl_binary_messenger_codec_error_quark()
typedef enum {
// Part of the public API, so fixing the name is a breaking change.
// NOLINTNEXTLINE(readability-identifier-naming)
FL_BINARY_MESSENGER_ERROR_ALREADY_RESPONDED,
} FlBinaryMessengerError;

View File

@ -57,6 +57,8 @@ typedef struct _FlValue FlValue;
* Types of #FlValue.
*/
typedef enum {
// Parts of the public API, so fixing the names is a breaking change.
// NOLINTBEGIN(readability-identifier-naming)
FL_VALUE_TYPE_NULL,
FL_VALUE_TYPE_BOOL,
FL_VALUE_TYPE_INT,
@ -69,6 +71,7 @@ typedef enum {
FL_VALUE_TYPE_LIST,
FL_VALUE_TYPE_MAP,
FL_VALUE_TYPE_FLOAT32_LIST,
// NOLINTEND(readability-identifier-naming)
} FlValueType;
/**

View File

@ -337,8 +337,8 @@ int RunTester(const flutter::Settings& settings,
if (multithreaded) {
threadhost = std::make_unique<ThreadHost>(
thread_label, ThreadHost::Type::Platform | ThreadHost::Type::IO |
ThreadHost::Type::UI | ThreadHost::Type::RASTER);
thread_label, ThreadHost::Type::kPlatform | ThreadHost::Type::kIo |
ThreadHost::Type::kUi | ThreadHost::Type::kRaster);
platform_task_runner = current_task_runner;
raster_task_runner = threadhost->raster_thread->GetTaskRunner();
ui_task_runner = threadhost->ui_thread->GetTaskRunner();