From b66daf88a6d0a4bd822ed0f2532299c3a5a09269 Mon Sep 17 00:00:00 2001 From: Chinmay Garde Date: Tue, 10 Oct 2023 13:11:51 -0700 Subject: [PATCH] Remove workaround for older versions of MSVC. (flutter/engine#46689) We don't use the MSVC frontend now anyway. And haven't for a while. --- .../src/flutter/fml/message_loop_unittests.cc | 46 ++++++++----------- 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/engine/src/flutter/fml/message_loop_unittests.cc b/engine/src/flutter/fml/message_loop_unittests.cc index 5e64e407f8..df762f4249 100644 --- a/engine/src/flutter/fml/message_loop_unittests.cc +++ b/engine/src/flutter/fml/message_loop_unittests.cc @@ -17,12 +17,6 @@ #include "flutter/fml/time/chrono_timestamp_provider.h" #include "gtest/gtest.h" -#if FML_OS_WIN -#define PLATFORM_SPECIFIC_CAPTURE(...) [ __VA_ARGS__, count ] -#else -#define PLATFORM_SPECIFIC_CAPTURE(...) [__VA_ARGS__] -#endif - TEST(MessageLoop, GetCurrent) { std::thread thread([]() { fml::MessageLoop::EnsureInitializedForCurrentThread(); @@ -88,15 +82,14 @@ TEST(MessageLoop, NonDelayedTasksAreRunInOrder) { auto& loop = fml::MessageLoop::GetCurrent(); size_t current = 0; for (size_t i = 0; i < count; i++) { - loop.GetTaskRunner()->PostTask( - PLATFORM_SPECIFIC_CAPTURE(&terminated, i, ¤t)() { - ASSERT_EQ(current, i); - current++; - if (count == i + 1) { - fml::MessageLoop::GetCurrent().Terminate(); - terminated = true; - } - }); + loop.GetTaskRunner()->PostTask([&terminated, i, ¤t]() { + ASSERT_EQ(current, i); + current++; + if (count == i + 1) { + fml::MessageLoop::GetCurrent().Terminate(); + terminated = true; + } + }); } loop.Run(); ASSERT_EQ(current, count); @@ -119,7 +112,7 @@ TEST(MessageLoop, DelayedTasksAtSameTimeAreRunInOrder) { fml::ChronoTicksSinceEpoch() + fml::TimeDelta::FromMilliseconds(2); for (size_t i = 0; i < count; i++) { loop.GetTaskRunner()->PostTaskForTime( - PLATFORM_SPECIFIC_CAPTURE(&terminated, i, ¤t)() { + [&terminated, i, ¤t]() { ASSERT_EQ(current, i); current++; if (count == i + 1) { @@ -163,19 +156,16 @@ TEST(MessageLoop, TaskObserverFire) { auto& loop = fml::MessageLoop::GetCurrent(); size_t task_count = 0; size_t obs_count = 0; - auto obs = PLATFORM_SPECIFIC_CAPTURE(&obs_count)() { - obs_count++; - }; + auto obs = [&obs_count]() { obs_count++; }; for (size_t i = 0; i < count; i++) { - loop.GetTaskRunner()->PostTask( - PLATFORM_SPECIFIC_CAPTURE(&terminated, i, &task_count)() { - ASSERT_EQ(task_count, i); - task_count++; - if (count == i + 1) { - fml::MessageLoop::GetCurrent().Terminate(); - terminated = true; - } - }); + loop.GetTaskRunner()->PostTask([&terminated, i, &task_count]() { + ASSERT_EQ(task_count, i); + task_count++; + if (count == i + 1) { + fml::MessageLoop::GetCurrent().Terminate(); + terminated = true; + } + }); } loop.AddTaskObserver(0, obs); loop.Run();