Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 897db94

Browse files
chinmaygardeharryterkelsen
authored andcommitted
Remove workaround for older versions of MSVC. (#46689)
We don't use the MSVC frontend now anyway. And haven't for a while.
1 parent ad1bf8c commit 897db94

File tree

1 file changed

+18
-28
lines changed

1 file changed

+18
-28
lines changed

fml/message_loop_unittests.cc

Lines changed: 18 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@
1717
#include "flutter/fml/time/chrono_timestamp_provider.h"
1818
#include "gtest/gtest.h"
1919

20-
#if FML_OS_WIN
21-
#define PLATFORM_SPECIFIC_CAPTURE(...) [ __VA_ARGS__, count ]
22-
#else
23-
#define PLATFORM_SPECIFIC_CAPTURE(...) [__VA_ARGS__]
24-
#endif
25-
2620
TEST(MessageLoop, GetCurrent) {
2721
std::thread thread([]() {
2822
fml::MessageLoop::EnsureInitializedForCurrentThread();
@@ -88,15 +82,14 @@ TEST(MessageLoop, NonDelayedTasksAreRunInOrder) {
8882
auto& loop = fml::MessageLoop::GetCurrent();
8983
size_t current = 0;
9084
for (size_t i = 0; i < count; i++) {
91-
loop.GetTaskRunner()->PostTask(
92-
PLATFORM_SPECIFIC_CAPTURE(&terminated, i, &current)() {
93-
ASSERT_EQ(current, i);
94-
current++;
95-
if (count == i + 1) {
96-
fml::MessageLoop::GetCurrent().Terminate();
97-
terminated = true;
98-
}
99-
});
85+
loop.GetTaskRunner()->PostTask([&terminated, i, &current]() {
86+
ASSERT_EQ(current, i);
87+
current++;
88+
if (count == i + 1) {
89+
fml::MessageLoop::GetCurrent().Terminate();
90+
terminated = true;
91+
}
92+
});
10093
}
10194
loop.Run();
10295
ASSERT_EQ(current, count);
@@ -119,7 +112,7 @@ TEST(MessageLoop, DelayedTasksAtSameTimeAreRunInOrder) {
119112
fml::ChronoTicksSinceEpoch() + fml::TimeDelta::FromMilliseconds(2);
120113
for (size_t i = 0; i < count; i++) {
121114
loop.GetTaskRunner()->PostTaskForTime(
122-
PLATFORM_SPECIFIC_CAPTURE(&terminated, i, &current)() {
115+
[&terminated, i, &current]() {
123116
ASSERT_EQ(current, i);
124117
current++;
125118
if (count == i + 1) {
@@ -163,19 +156,16 @@ TEST(MessageLoop, TaskObserverFire) {
163156
auto& loop = fml::MessageLoop::GetCurrent();
164157
size_t task_count = 0;
165158
size_t obs_count = 0;
166-
auto obs = PLATFORM_SPECIFIC_CAPTURE(&obs_count)() {
167-
obs_count++;
168-
};
159+
auto obs = [&obs_count]() { obs_count++; };
169160
for (size_t i = 0; i < count; i++) {
170-
loop.GetTaskRunner()->PostTask(
171-
PLATFORM_SPECIFIC_CAPTURE(&terminated, i, &task_count)() {
172-
ASSERT_EQ(task_count, i);
173-
task_count++;
174-
if (count == i + 1) {
175-
fml::MessageLoop::GetCurrent().Terminate();
176-
terminated = true;
177-
}
178-
});
161+
loop.GetTaskRunner()->PostTask([&terminated, i, &task_count]() {
162+
ASSERT_EQ(task_count, i);
163+
task_count++;
164+
if (count == i + 1) {
165+
fml::MessageLoop::GetCurrent().Terminate();
166+
terminated = true;
167+
}
168+
});
179169
}
180170
loop.AddTaskObserver(0, obs);
181171
loop.Run();

0 commit comments

Comments
 (0)