From b3590cd6dbb4ac399a257097afdfad665775a942 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Mon, 4 Dec 2017 15:57:05 -0800 Subject: [PATCH 1/6] Updated fml to build on Windows. --- fml/BUILD.gn | 6 +- fml/icu_util.cc | 10 ++- fml/mapping.h | 14 ++++ fml/message_loop_unittests.cc | 16 ++-- .../posix/mapping_posix.cc} | 7 +- fml/platform/win/mapping_win.cc | 83 +++++++++++++++++++ fml/trace_event.h | 6 +- shell/common/shell.cc | 8 ++ 8 files changed, 133 insertions(+), 17 deletions(-) rename fml/{mapping.cc => platform/posix/mapping_posix.cc} (99%) create mode 100644 fml/platform/win/mapping_win.cc diff --git a/fml/BUILD.gn b/fml/BUILD.gn index e81ed4f1683a3..6dabcb446c912 100644 --- a/fml/BUILD.gn +++ b/fml/BUILD.gn @@ -6,7 +6,6 @@ source_set("fml") { sources = [ "icu_util.cc", "icu_util.h", - "mapping.cc", "mapping.h", "memory/weak_ptr.h", "memory/weak_ptr_internal.cc", @@ -98,10 +97,15 @@ source_set("fml") { if (is_win) { sources += [ + "platform/win/mapping_win.cc", "platform/win/message_loop_win.cc", "platform/win/message_loop_win.h", "platform/win/paths_win.cc", ] + } else { + sources += [ + "platform/posix/mapping_posix.cc", + ] } } diff --git a/fml/icu_util.cc b/fml/icu_util.cc index a214c4f2593aa..b0988baf93525 100644 --- a/fml/icu_util.cc +++ b/fml/icu_util.cc @@ -16,6 +16,12 @@ namespace fml { namespace icu { +#if OS_WIN +static constexpr char kPathSeparator = '\\'; +#else +static constexpr char kPathSeparator = '/'; +#endif + static constexpr char kIcuDataFileName[] = "icudtl.dat"; class ICUContext { @@ -53,8 +59,8 @@ class ICUContext { // FIXME(chinmaygarde): There is no Path::Join in FXL. So a non-portable // version is used here. Patch FXL and update. - auto file = std::make_unique(directory.second + "/" + - kIcuDataFileName); + auto file = std::make_unique(directory.second + + kPathSeparator + kIcuDataFileName); if (file->GetSize() != 0) { mapping_ = std::move(file); return true; diff --git a/fml/mapping.h b/fml/mapping.h index eba438b4f6ff0..8963b22a9c1f6 100644 --- a/fml/mapping.h +++ b/fml/mapping.h @@ -5,8 +5,15 @@ #ifndef FLUTTER_FML_MAPPING_H_ #define FLUTTER_FML_MAPPING_H_ +#include #include +#include "lib/fxl/build_config.h" + +#if OS_WIN +#include +#endif + #include "lib/fxl/files/unique_fd.h" #include "lib/fxl/macros.h" @@ -34,7 +41,10 @@ class FileMapping : public Mapping { public: FileMapping(const std::string& path); +// fxl::UniqueFD isn't supported for Windows handles. +#if !OS_WIN FileMapping(const fxl::UniqueFD& fd); +#endif ~FileMapping() override; @@ -46,6 +56,10 @@ class FileMapping : public Mapping { size_t size_; uint8_t* mapping_; +#if OS_WIN + HANDLE mapping_handle_; +#endif + FXL_DISALLOW_COPY_AND_ASSIGN(FileMapping); }; diff --git a/fml/message_loop_unittests.cc b/fml/message_loop_unittests.cc index f2a74a5f4a11c..f298f839fbe33 100644 --- a/fml/message_loop_unittests.cc +++ b/fml/message_loop_unittests.cc @@ -75,7 +75,7 @@ TEST(MessageLoop, NonDelayedTasksAreRunInOrder) { auto& loop = fml::MessageLoop::GetCurrent(); size_t current = 0; for (size_t i = 0; i < count; i++) { - loop.GetTaskRunner()->PostTask([&terminated, i, ¤t]() { + loop.GetTaskRunner()->PostTask([&terminated, i, ¤t, count]() { ASSERT_EQ(current, i); current++; if (count == i + 1) { @@ -105,7 +105,7 @@ TEST(MessageLoop, DelayedTasksAtSameTimeAreRunInOrder) { fxl::TimePoint::Now() + fxl::TimeDelta::FromMilliseconds(2); for (size_t i = 0; i < count; i++) { loop.GetTaskRunner()->PostTaskForTime( - [&terminated, i, ¤t]() { + [&terminated, i, ¤t, count]() { ASSERT_EQ(current, i); current++; if (count == i + 1) { @@ -187,13 +187,13 @@ TEST(MessageLoop, TIME_SENSITIVE(SingleDelayedTaskForTime)) { TEST(MessageLoop, TIME_SENSITIVE(MultipleDelayedTasksWithIncreasingDeltas)) { const auto count = 10; int checked = false; - std::thread thread([&checked]() { + std::thread thread([&checked, count]() { fml::MessageLoop::EnsureInitializedForCurrentThread(); auto& loop = fml::MessageLoop::GetCurrent(); for (int target_ms = 0 + 2; target_ms < count + 2; target_ms++) { auto begin = fxl::TimePoint::Now(); loop.GetTaskRunner()->PostDelayedTask( - [begin, target_ms, &checked]() { + [begin, target_ms, &checked, count]() { auto delta = fxl::TimePoint::Now() - begin; auto ms = delta.ToMillisecondsF(); ASSERT_GE(ms, target_ms - 2); @@ -214,13 +214,13 @@ TEST(MessageLoop, TIME_SENSITIVE(MultipleDelayedTasksWithIncreasingDeltas)) { TEST(MessageLoop, TIME_SENSITIVE(MultipleDelayedTasksWithDecreasingDeltas)) { const auto count = 10; int checked = false; - std::thread thread([&checked]() { + std::thread thread([&checked, count]() { fml::MessageLoop::EnsureInitializedForCurrentThread(); auto& loop = fml::MessageLoop::GetCurrent(); for (int target_ms = count + 2; target_ms > 0 + 2; target_ms--) { auto begin = fxl::TimePoint::Now(); loop.GetTaskRunner()->PostDelayedTask( - [begin, target_ms, &checked]() { + [begin, target_ms, &checked, count]() { auto delta = fxl::TimePoint::Now() - begin; auto ms = delta.ToMillisecondsF(); ASSERT_GE(ms, target_ms - 2); @@ -263,9 +263,9 @@ TEST(MessageLoop, TaskObserverFire) { auto& loop = fml::MessageLoop::GetCurrent(); size_t task_count = 0; size_t obs_count = 0; - CustomTaskObserver obs([&obs_count]() { obs_count++; }); + CustomTaskObserver obs([&obs_count, count]() { obs_count++; }); for (size_t i = 0; i < count; i++) { - loop.GetTaskRunner()->PostTask([&terminated, i, &task_count]() { + loop.GetTaskRunner()->PostTask([&terminated, i, &task_count, count]() { ASSERT_EQ(task_count, i); task_count++; if (count == i + 1) { diff --git a/fml/mapping.cc b/fml/platform/posix/mapping_posix.cc similarity index 99% rename from fml/mapping.cc rename to fml/platform/posix/mapping_posix.cc index 07f7edb074ab9..a2c1c4ae417d5 100644 --- a/fml/mapping.cc +++ b/fml/platform/posix/mapping_posix.cc @@ -5,15 +5,16 @@ #include "flutter/fml/mapping.h" #include -#include #include -#include #include #include "lib/fxl/build_config.h" #include "lib/fxl/files/eintr_wrapper.h" +#include +#include + #if OS_MACOSX #include "flutter/fml/platform/darwin/resource_mapping_darwin.h" @@ -41,7 +42,7 @@ std::unique_ptr GetResourceMapping(const std::string& resource_name) { FileMapping::FileMapping(const std::string& path) : FileMapping(fxl::UniqueFD{HANDLE_EINTR(::open(path.c_str(), O_RDONLY))}) { -} + } FileMapping::FileMapping(const fxl::UniqueFD& handle) : size_(0), mapping_(nullptr) { diff --git a/fml/platform/win/mapping_win.cc b/fml/platform/win/mapping_win.cc new file mode 100644 index 0000000000000..ef17c914e995e --- /dev/null +++ b/fml/platform/win/mapping_win.cc @@ -0,0 +1,83 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "flutter/fml/mapping.h" + +#include + +#include + +#include "lib/fxl/build_config.h" + +#include +#include + +using PlatformResourceMapping = fml::FileMapping; + +namespace fml { + +Mapping::Mapping() = default; + +Mapping::~Mapping() = default; + +bool PlatformHasResourcesBundle() { + return !std::is_same::value; +} + +std::unique_ptr GetResourceMapping(const std::string& resource_name) { + return std::make_unique(resource_name); +} + +FileMapping::FileMapping(const std::string& path) + : size_(0), mapping_(nullptr) { + HANDLE file_handle_ = CreateFileA(reinterpret_cast(path.c_str()), + GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL|FILE_FLAG_RANDOM_ACCESS,nullptr); + + if (file_handle_ == INVALID_HANDLE_VALUE) { + return; + } + + size_ = GetFileSize(file_handle_, nullptr); + if (size_ == INVALID_FILE_SIZE) { + size_ = 0; + return; + } + + mapping_handle_ = CreateFileMapping(file_handle_, nullptr, PAGE_READONLY, 0, + size_, nullptr); + + CloseHandle(file_handle_); + + if (mapping_handle_ == INVALID_HANDLE_VALUE) { + return; + } + + auto mapping = MapViewOfFile(mapping_handle_, FILE_MAP_READ, 0, 0, size_); + + if (mapping == INVALID_HANDLE_VALUE) { + CloseHandle(mapping_handle_); + mapping_handle_ = INVALID_HANDLE_VALUE; + return; + } + + mapping_ = static_cast(mapping); +} + +FileMapping::~FileMapping() { + if (mapping_ != nullptr) { + UnmapViewOfFile(mapping_); + CloseHandle(mapping_handle_); + } +} + +size_t FileMapping::GetSize() const { + return size_; +} + +const uint8_t* FileMapping::GetMapping() const { + return mapping_; +} + +} // namespace fml diff --git a/fml/trace_event.h b/fml/trace_event.h index a8a56c02a82d5..832d099ce38b0 100644 --- a/fml/trace_event.h +++ b/fml/trace_event.h @@ -45,13 +45,13 @@ #define TRACE_EVENT_INSTANT0(category_group, name) \ ::fml::tracing::TraceEventInstant0(category_group, name); -#define TRACE_FLOW_BEGIN(category, name, id, args...) \ +#define TRACE_FLOW_BEGIN(category, name, id) \ ::fml::tracing::TraceEventFlowBegin0(category, name, id); -#define TRACE_FLOW_STEP(category, name, id, args...) \ +#define TRACE_FLOW_STEP(category, name, id) \ ::fml::tracing::TraceEventFlowStep0(category, name, id); -#define TRACE_FLOW_END(category, name, id, args...) \ +#define TRACE_FLOW_END(category, name, id) \ ::fml::tracing::TraceEventFlowEnd0(category, name, id); #endif // TRACE_EVENT_HIDE_MACROS diff --git a/shell/common/shell.cc b/shell/common/shell.cc index 506861c430067..7540471363d4e 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -267,9 +267,17 @@ void Shell::RunInPlatformViewUIThread(uintptr_t view_id, IteratePlatformViews( [ view_id, // argument +#if !defined(OS_WIN) + // Using std::move on const references inside lambda capture is not + // supported on Windows for some reason. assets_directory = std::move(assets_directory), // argument main = std::move(main), // argument packages = std::move(packages), // argument +#else + assets_directory, // argument + main, // argument + packages, // argument +#endif &view_existed, // out &dart_isolate_id, // out &isolate_name // out From 382f1d0af6683364f84b9d509011b8cdac929f36 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Fri, 8 Dec 2017 09:56:20 -0800 Subject: [PATCH 2/6] Fixed formatting. --- fml/icu_util.cc | 4 +-- fml/platform/posix/mapping_posix.cc | 7 ++-- fml/platform/win/mapping_win.cc | 11 ++++--- shell/common/shell.cc | 50 ++++++++++++++--------------- 4 files changed, 35 insertions(+), 37 deletions(-) diff --git a/fml/icu_util.cc b/fml/icu_util.cc index b0988baf93525..093dc3d02b1bc 100644 --- a/fml/icu_util.cc +++ b/fml/icu_util.cc @@ -59,8 +59,8 @@ class ICUContext { // FIXME(chinmaygarde): There is no Path::Join in FXL. So a non-portable // version is used here. Patch FXL and update. - auto file = std::make_unique(directory.second + - kPathSeparator + kIcuDataFileName); + auto file = std::make_unique( + directory.second + kPathSeparator + kIcuDataFileName); if (file->GetSize() != 0) { mapping_ = std::move(file); return true; diff --git a/fml/platform/posix/mapping_posix.cc b/fml/platform/posix/mapping_posix.cc index a2c1c4ae417d5..07f7edb074ab9 100644 --- a/fml/platform/posix/mapping_posix.cc +++ b/fml/platform/posix/mapping_posix.cc @@ -5,16 +5,15 @@ #include "flutter/fml/mapping.h" #include +#include #include +#include #include #include "lib/fxl/build_config.h" #include "lib/fxl/files/eintr_wrapper.h" -#include -#include - #if OS_MACOSX #include "flutter/fml/platform/darwin/resource_mapping_darwin.h" @@ -42,7 +41,7 @@ std::unique_ptr GetResourceMapping(const std::string& resource_name) { FileMapping::FileMapping(const std::string& path) : FileMapping(fxl::UniqueFD{HANDLE_EINTR(::open(path.c_str(), O_RDONLY))}) { - } +} FileMapping::FileMapping(const fxl::UniqueFD& handle) : size_(0), mapping_(nullptr) { diff --git a/fml/platform/win/mapping_win.cc b/fml/platform/win/mapping_win.cc index ef17c914e995e..fd404a14f37dc 100644 --- a/fml/platform/win/mapping_win.cc +++ b/fml/platform/win/mapping_win.cc @@ -10,8 +10,8 @@ #include "lib/fxl/build_config.h" -#include #include +#include using PlatformResourceMapping = fml::FileMapping; @@ -31,9 +31,10 @@ std::unique_ptr GetResourceMapping(const std::string& resource_name) { FileMapping::FileMapping(const std::string& path) : size_(0), mapping_(nullptr) { - HANDLE file_handle_ = CreateFileA(reinterpret_cast(path.c_str()), - GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL|FILE_FLAG_RANDOM_ACCESS,nullptr); + HANDLE file_handle_ = + CreateFileA(reinterpret_cast(path.c_str()), GENERIC_READ, + FILE_SHARE_READ, nullptr, OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL | FILE_FLAG_RANDOM_ACCESS, nullptr); if (file_handle_ == INVALID_HANDLE_VALUE) { return; @@ -46,7 +47,7 @@ FileMapping::FileMapping(const std::string& path) } mapping_handle_ = CreateFileMapping(file_handle_, nullptr, PAGE_READONLY, 0, - size_, nullptr); + size_, nullptr); CloseHandle(file_handle_); diff --git a/shell/common/shell.cc b/shell/common/shell.cc index 7540471363d4e..c20d8991c282f 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -265,35 +265,33 @@ void Shell::RunInPlatformViewUIThread(uintptr_t view_id, *view_existed = false; IteratePlatformViews( - [ - view_id, // argument + [view_id, // argument #if !defined(OS_WIN) - // Using std::move on const references inside lambda capture is not - // supported on Windows for some reason. - assets_directory = std::move(assets_directory), // argument - main = std::move(main), // argument - packages = std::move(packages), // argument + // Using std::move on const references inside lambda capture is not + // supported on Windows for some reason. + assets_directory = std::move(assets_directory), // argument + main = std::move(main), // argument + packages = std::move(packages), // argument #else - assets_directory, // argument - main, // argument - packages, // argument + assets_directory, // argument + main, // argument + packages, // argument #endif - &view_existed, // out - &dart_isolate_id, // out - &isolate_name // out - ](PlatformView * view) - ->bool { - if (reinterpret_cast(view) != view_id) { - // Keep looking. - return true; - } - *view_existed = true; - view->RunFromSource(assets_directory, main, packages); - *dart_isolate_id = view->engine().GetUIIsolateMainPort(); - *isolate_name = view->engine().GetUIIsolateName(); - // We found the requested view. Stop iterating over platform views. - return false; - }); + &view_existed, // out + &dart_isolate_id, // out + &isolate_name // out + ](PlatformView* view) -> bool { + if (reinterpret_cast(view) != view_id) { + // Keep looking. + return true; + } + *view_existed = true; + view->RunFromSource(assets_directory, main, packages); + *dart_isolate_id = view->engine().GetUIIsolateMainPort(); + *isolate_name = view->engine().GetUIIsolateName(); + // We found the requested view. Stop iterating over platform views. + return false; + }); latch->Signal(); } From 6e7ff2b86ab1420a0dbced4eef2ed34cd6f93ec2 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Fri, 8 Dec 2017 10:07:19 -0800 Subject: [PATCH 3/6] Updated licenses. --- travis/licenses_golden/licenses_flutter | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/travis/licenses_golden/licenses_flutter b/travis/licenses_golden/licenses_flutter index 4ce918d74b61d..7574ded2c1023 100644 --- a/travis/licenses_golden/licenses_flutter +++ b/travis/licenses_golden/licenses_flutter @@ -1088,7 +1088,6 @@ FILE: ../../../flutter/flow/texture.cc FILE: ../../../flutter/flow/texture.h FILE: ../../../flutter/fml/icu_util.cc FILE: ../../../flutter/fml/icu_util.h -FILE: ../../../flutter/fml/mapping.cc FILE: ../../../flutter/fml/mapping.h FILE: ../../../flutter/fml/message_loop.cc FILE: ../../../flutter/fml/message_loop.h @@ -1122,6 +1121,8 @@ FILE: ../../../flutter/fml/platform/linux/message_loop_linux.h FILE: ../../../flutter/fml/platform/linux/paths_linux.cc FILE: ../../../flutter/fml/platform/linux/timerfd.cc FILE: ../../../flutter/fml/platform/linux/timerfd.h +FILE: ../../../flutter/fml/platform/posix/mapping_posix.cc +FILE: ../../../flutter/fml/platform/win/mapping_win.cc FILE: ../../../flutter/fml/platform/win/message_loop_win.cc FILE: ../../../flutter/fml/platform/win/message_loop_win.h FILE: ../../../flutter/fml/platform/win/paths_win.cc From 7adfe3fb3cc6f54080a1b69426c39a72e78829fd Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Fri, 8 Dec 2017 10:30:15 -0800 Subject: [PATCH 4/6] Formatting. --- shell/common/shell.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shell/common/shell.cc b/shell/common/shell.cc index c20d8991c282f..d839820594df8 100644 --- a/shell/common/shell.cc +++ b/shell/common/shell.cc @@ -267,8 +267,8 @@ void Shell::RunInPlatformViewUIThread(uintptr_t view_id, IteratePlatformViews( [view_id, // argument #if !defined(OS_WIN) - // Using std::move on const references inside lambda capture is not - // supported on Windows for some reason. + // Using std::move on const references inside lambda capture is + // not supported on Windows for some reason. assets_directory = std::move(assets_directory), // argument main = std::move(main), // argument packages = std::move(packages), // argument From 9f8624f83c6629cd6b5d5473eeba97ff71aeabf8 Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Fri, 8 Dec 2017 10:59:09 -0800 Subject: [PATCH 5/6] Fixed errors on Linux caused by introduction of non-required capture which was needed to satisfy MSVC. --- fml/message_loop_unittests.cc | 42 ++++++++++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/fml/message_loop_unittests.cc b/fml/message_loop_unittests.cc index f298f839fbe33..63d288d52d11e 100644 --- a/fml/message_loop_unittests.cc +++ b/fml/message_loop_unittests.cc @@ -75,7 +75,12 @@ TEST(MessageLoop, NonDelayedTasksAreRunInOrder) { auto& loop = fml::MessageLoop::GetCurrent(); size_t current = 0; for (size_t i = 0; i < count; i++) { - loop.GetTaskRunner()->PostTask([&terminated, i, ¤t, count]() { + loop.GetTaskRunner()->PostTask([&terminated, i, ¤t +#if OS_WIN + , + count +#endif + ]() { ASSERT_EQ(current, i); current++; if (count == i + 1) { @@ -105,7 +110,12 @@ TEST(MessageLoop, DelayedTasksAtSameTimeAreRunInOrder) { fxl::TimePoint::Now() + fxl::TimeDelta::FromMilliseconds(2); for (size_t i = 0; i < count; i++) { loop.GetTaskRunner()->PostTaskForTime( - [&terminated, i, ¤t, count]() { + [&terminated, i, ¤t +#if OS_WIN + , + count +#endif + ]() { ASSERT_EQ(current, i); current++; if (count == i + 1) { @@ -193,7 +203,12 @@ TEST(MessageLoop, TIME_SENSITIVE(MultipleDelayedTasksWithIncreasingDeltas)) { for (int target_ms = 0 + 2; target_ms < count + 2; target_ms++) { auto begin = fxl::TimePoint::Now(); loop.GetTaskRunner()->PostDelayedTask( - [begin, target_ms, &checked, count]() { + [begin, target_ms, &checked +#if OS_WIN + , + count +#endif + ]() { auto delta = fxl::TimePoint::Now() - begin; auto ms = delta.ToMillisecondsF(); ASSERT_GE(ms, target_ms - 2); @@ -220,7 +235,12 @@ TEST(MessageLoop, TIME_SENSITIVE(MultipleDelayedTasksWithDecreasingDeltas)) { for (int target_ms = count + 2; target_ms > 0 + 2; target_ms--) { auto begin = fxl::TimePoint::Now(); loop.GetTaskRunner()->PostDelayedTask( - [begin, target_ms, &checked, count]() { + [begin, target_ms, &checked +#if OS_WIN + , + count +#endif + ]() { auto delta = fxl::TimePoint::Now() - begin; auto ms = delta.ToMillisecondsF(); ASSERT_GE(ms, target_ms - 2); @@ -263,9 +283,19 @@ TEST(MessageLoop, TaskObserverFire) { auto& loop = fml::MessageLoop::GetCurrent(); size_t task_count = 0; size_t obs_count = 0; - CustomTaskObserver obs([&obs_count, count]() { obs_count++; }); + CustomTaskObserver obs([&obs_count +#if OS_WIN + , + count +#endif + ]() { obs_count++; }); for (size_t i = 0; i < count; i++) { - loop.GetTaskRunner()->PostTask([&terminated, i, &task_count, count]() { + loop.GetTaskRunner()->PostTask([&terminated, i, &task_count +#if OS_WIN + , + count +#endif + ]() { ASSERT_EQ(task_count, i); task_count++; if (count == i + 1) { From c5715acdc8de12504ddf0890da58f6704f38aeae Mon Sep 17 00:00:00 2001 From: Ben Konyi Date: Fri, 8 Dec 2017 11:08:22 -0800 Subject: [PATCH 6/6] Fixed additional errors causing linux build failures. --- fml/message_loop_unittests.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/fml/message_loop_unittests.cc b/fml/message_loop_unittests.cc index 63d288d52d11e..f29d8adce3bd3 100644 --- a/fml/message_loop_unittests.cc +++ b/fml/message_loop_unittests.cc @@ -197,7 +197,12 @@ TEST(MessageLoop, TIME_SENSITIVE(SingleDelayedTaskForTime)) { TEST(MessageLoop, TIME_SENSITIVE(MultipleDelayedTasksWithIncreasingDeltas)) { const auto count = 10; int checked = false; - std::thread thread([&checked, count]() { + std::thread thread([&checked +#if OS_WIN + , + count +#endif + ]() { fml::MessageLoop::EnsureInitializedForCurrentThread(); auto& loop = fml::MessageLoop::GetCurrent(); for (int target_ms = 0 + 2; target_ms < count + 2; target_ms++) { @@ -229,7 +234,12 @@ TEST(MessageLoop, TIME_SENSITIVE(MultipleDelayedTasksWithIncreasingDeltas)) { TEST(MessageLoop, TIME_SENSITIVE(MultipleDelayedTasksWithDecreasingDeltas)) { const auto count = 10; int checked = false; - std::thread thread([&checked, count]() { + std::thread thread([&checked +#if OS_WIN + , + count +#endif + ]() { fml::MessageLoop::EnsureInitializedForCurrentThread(); auto& loop = fml::MessageLoop::GetCurrent(); for (int target_ms = count + 2; target_ms > 0 + 2; target_ms--) {