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

Commit 5005e23

Browse files
authored
Prefix remaining OS defines with FML_ namespace (#31172)
1 parent f9e6267 commit 5005e23

26 files changed

+73
-73
lines changed

flow/frame_timings_recorder_unittests.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ TEST(FrameTimingsRecorderTest, RecordRasterTimesWithCache) {
122122
}
123123

124124
// Windows and Fuchsia don't allow testing with killed by signal.
125-
#if !defined(OS_FUCHSIA) && !defined(OS_WIN) && \
125+
#if !defined(OS_FUCHSIA) && !defined(FML_OS_WIN) && \
126126
(FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG)
127127

128128
TEST(FrameTimingsRecorderTest, ThrowWhenRecordBuildBeforeVsync) {

fml/backtrace.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#include <csignal>
1212
#include <sstream>
1313

14-
#if OS_WIN
14+
#if FML_OS_WIN
1515
#include <crtdbg.h>
1616
#include <debugapi.h>
1717
#endif
@@ -132,7 +132,7 @@ static void ToggleSignalHandlers(bool set) {
132132
}
133133

134134
void InstallCrashHandler() {
135-
#if OS_WIN
135+
#if FML_OS_WIN
136136
if (!IsDebuggerPresent()) {
137137
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
138138
_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);

fml/build_config.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
// This file adds defines about the platform we're currently building on.
66
// Operating System:
7-
// OS_WIN / FML_OS_MACOSX / FML_OS_LINUX / FML_OS_POSIX (MACOSX or LINUX) /
8-
// FML_OS_NACL (NACL_SFI or NACL_NONSFI) / FML_OS_NACL_SFI /
7+
// FML_OS_WIN / FML_OS_MACOSX / FML_OS_LINUX / FML_OS_POSIX (MACOSX or LINUX)
8+
// / FML_OS_NACL (NACL_SFI or NACL_NONSFI) / FML_OS_NACL_SFI /
99
// FML_OS_NACL_NONSFI
1010
// Compiler:
1111
// COMPILER_MSVC / COMPILER_GCC
@@ -27,7 +27,7 @@
2727
#include <TargetConditionals.h>
2828
#define FML_OS_MACOSX 1
2929
#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
30-
#define OS_IOS 1
30+
#define FML_OS_IOS 1
3131
#endif // defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
3232
#elif defined(__linux__)
3333
#define FML_OS_LINUX 1
@@ -38,7 +38,7 @@
3838
#define LIBC_GLIBC 1
3939
#endif
4040
#elif defined(_WIN32)
41-
#define OS_WIN 1
41+
#define FML_OS_WIN 1
4242
#elif defined(__FreeBSD__)
4343
#define FML_OS_FREEBSD 1
4444
#elif defined(__OpenBSD__)
@@ -51,10 +51,10 @@
5151
#error Please add support for your platform in flutter/fml/build_config.h
5252
#endif
5353

54-
// For access to standard BSD features, use OS_BSD instead of a
54+
// For access to standard BSD features, use FML_OS_BSD instead of a
5555
// more specific macro.
5656
#if defined(FML_OS_FREEBSD) || defined(FML_OS_OPENBSD)
57-
#define OS_BSD 1
57+
#define FML_OS_BSD 1
5858
#endif
5959

6060
// For access to standard POSIXish features, use FML_OS_POSIX instead of a

fml/eintr_wrapper.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#include "flutter/fml/build_config.h"
1111

12-
#if defined(OS_WIN)
12+
#if defined(FML_OS_WIN)
1313

1414
// Windows has no concept of EINTR.
1515
#define FML_HANDLE_EINTR(x) (x)
@@ -38,6 +38,6 @@
3838
eintr_wrapper_result; \
3939
})
4040

41-
#endif // defined(OS_WIN)
41+
#endif // defined(FML_OS_WIN)
4242

4343
#endif // FLUTTER_FML_EINTR_WRAPPER_H_

fml/file_unittest.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ TEST(FileTest, CanStopVisitEarly) {
228228
ASSERT_TRUE(fml::UnlinkDirectory(dir.fd(), "a"));
229229
}
230230

231-
#if OS_WIN
231+
#if FML_OS_WIN
232232
#define AtomicWriteTest DISABLED_AtomicWriteTest
233233
#else
234234
#define AtomicWriteTest AtomicWriteTest

fml/logging.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
#if defined(FML_OS_ANDROID)
1313
#include <android/log.h>
14-
#elif defined(OS_IOS)
14+
#elif defined(FML_OS_IOS)
1515
#include <syslog.h>
1616
#elif defined(OS_FUCHSIA)
1717
#include <lib/syslog/global.h>
@@ -94,7 +94,7 @@ LogMessage::~LogMessage() {
9494
break;
9595
}
9696
__android_log_write(priority, "flutter", stream_.str().c_str());
97-
#elif defined(OS_IOS)
97+
#elif defined(FML_OS_IOS)
9898
syslog(LOG_ALERT, "%s", stream_.str().c_str());
9999
#elif defined(OS_FUCHSIA)
100100
fx_log_severity_t fx_severity;

fml/mapping.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ class FileMapping final : public Mapping {
8282
uint8_t* mapping_ = nullptr;
8383
uint8_t* mutable_mapping_ = nullptr;
8484

85-
#if OS_WIN
85+
#if FML_OS_WIN
8686
fml::UniqueFD mapping_handle_;
8787
#endif
8888

fml/memory/thread_checker.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "flutter/fml/logging.h"
1313
#include "flutter/fml/macros.h"
1414

15-
#if defined(OS_WIN)
15+
#if defined(FML_OS_WIN)
1616
#include <windows.h>
1717
#else
1818
#include <pthread.h>
@@ -30,7 +30,7 @@ namespace fml {
3030
// there's a small space cost to having even an empty class. )
3131
class ThreadChecker final {
3232
public:
33-
#if defined(OS_WIN)
33+
#if defined(FML_OS_WIN)
3434
ThreadChecker() : self_(GetCurrentThreadId()) {}
3535
~ThreadChecker() {}
3636

fml/message_loop_impl.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include "flutter/fml/platform/fuchsia/message_loop_fuchsia.h"
2222
#elif FML_OS_LINUX
2323
#include "flutter/fml/platform/linux/message_loop_linux.h"
24-
#elif OS_WIN
24+
#elif FML_OS_WIN
2525
#include "flutter/fml/platform/win/message_loop_win.h"
2626
#endif
2727

@@ -36,7 +36,7 @@ fml::RefPtr<MessageLoopImpl> MessageLoopImpl::Create() {
3636
return fml::MakeRefCounted<MessageLoopFuchsia>();
3737
#elif FML_OS_LINUX
3838
return fml::MakeRefCounted<MessageLoopLinux>();
39-
#elif OS_WIN
39+
#elif FML_OS_WIN
4040
return fml::MakeRefCounted<MessageLoopWin>();
4141
#else
4242
return nullptr;

fml/message_loop_unittests.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include "gtest/gtest.h"
1919

2020
#define TIMESENSITIVE(x) TimeSensitiveTest_##x
21-
#if OS_WIN
21+
#if FML_OS_WIN
2222
#define PLATFORM_SPECIFIC_CAPTURE(...) [ __VA_ARGS__, count ]
2323
#else
2424
#define PLATFORM_SPECIFIC_CAPTURE(...) [__VA_ARGS__]

fml/native_library.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@
1212
#include "flutter/fml/memory/ref_counted.h"
1313
#include "flutter/fml/memory/ref_ptr.h"
1414

15-
#if defined(OS_WIN)
15+
#if defined(FML_OS_WIN)
1616
#include <windows.h>
17-
#endif // defined(OS_WIN)
17+
#endif // defined(FML_OS_WIN)
1818

1919
namespace fml {
2020
class NativeLibrary : public fml::RefCountedThreadSafe<NativeLibrary> {
2121
public:
22-
#if OS_WIN
22+
#if FML_OS_WIN
2323
using Handle = HMODULE;
2424
using SymbolHandle = FARPROC;
25-
#else // OS_WIN
25+
#else // FML_OS_WIN
2626
using Handle = void*;
2727
using SymbolHandle = void*;
28-
#endif // OS_WIN
28+
#endif // FML_OS_WIN
2929

3030
static fml::RefPtr<NativeLibrary> Create(const char* path);
3131

fml/paths.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ std::string JoinPaths(std::initializer_list<std::string> components) {
1919
i++;
2020
stream << component;
2121
if (i != size) {
22-
#if OS_WIN
22+
#if FML_OS_WIN
2323
stream << "\\";
24-
#else // OS_WIN
24+
#else // FML_OS_WIN
2525
stream << "/";
26-
#endif // OS_WIN
26+
#endif // FML_OS_WIN
2727
}
2828
}
2929
return stream.str();

fml/synchronization/semaphore.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class PlatformSemaphore {
5959

6060
} // namespace fml
6161

62-
#elif OS_WIN
62+
#elif FML_OS_WIN
6363
#include <windows.h>
6464

6565
namespace fml {

fml/thread.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include "flutter/fml/message_loop.h"
1414
#include "flutter/fml/synchronization/waitable_event.h"
1515

16-
#if defined(OS_WIN)
16+
#if defined(FML_OS_WIN)
1717
#include <windows.h>
1818
#elif defined(OS_FUCHSIA)
1919
#include <lib/zx/thread.h>
@@ -55,7 +55,7 @@ void Thread::Join() {
5555
thread_->join();
5656
}
5757

58-
#if defined(OS_WIN)
58+
#if defined(FML_OS_WIN)
5959
// The information on how to set the thread name comes from
6060
// a MSDN article: http://msdn2.microsoft.com/en-us/library/xcb2z8hs.aspx
6161
const DWORD kVCThreadNameException = 0x406D1388;
@@ -75,7 +75,7 @@ void Thread::SetCurrentThreadName(const std::string& name) {
7575
pthread_setname_np(name.c_str());
7676
#elif defined(FML_OS_LINUX) || defined(FML_OS_ANDROID)
7777
pthread_setname_np(pthread_self(), name.c_str());
78-
#elif defined(OS_WIN)
78+
#elif defined(FML_OS_WIN)
7979
THREADNAME_INFO info;
8080
info.dwType = 0x1000;
8181
info.szName = name.c_str();

fml/unique_fd.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
namespace fml {
1010
namespace internal {
1111

12-
#if OS_WIN
12+
#if FML_OS_WIN
1313

1414
namespace os_win {
1515

@@ -22,7 +22,7 @@ void UniqueFDTraits::Free_Handle(HANDLE fd) {
2222

2323
} // namespace os_win
2424

25-
#else // OS_WIN
25+
#else // FML_OS_WIN
2626

2727
namespace os_unix {
2828

@@ -36,7 +36,7 @@ void UniqueDirTraits::Free(DIR* dir) {
3636

3737
} // namespace os_unix
3838

39-
#endif // OS_WIN
39+
#endif // FML_OS_WIN
4040

4141
} // namespace internal
4242
} // namespace fml

fml/unique_fd.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@
88
#include "flutter/fml/build_config.h"
99
#include "flutter/fml/unique_object.h"
1010

11-
#if OS_WIN
11+
#if FML_OS_WIN
1212
#include <windows.h>
1313
#include <map>
1414
#include <mutex>
1515
#include <optional>
16-
#else // OS_WIN
16+
#else // FML_OS_WIN
1717
#include <dirent.h>
1818
#include <unistd.h>
19-
#endif // OS_WIN
19+
#endif // FML_OS_WIN
2020

2121
namespace fml {
2222
namespace internal {
2323

24-
#if OS_WIN
24+
#if FML_OS_WIN
2525

2626
namespace os_win {
2727

@@ -69,7 +69,7 @@ struct UniqueFDTraits {
6969

7070
} // namespace os_win
7171

72-
#else // OS_WIN
72+
#else // FML_OS_WIN
7373

7474
namespace os_unix {
7575

@@ -87,20 +87,20 @@ struct UniqueDirTraits {
8787

8888
} // namespace os_unix
8989

90-
#endif // OS_WIN
90+
#endif // FML_OS_WIN
9191

9292
} // namespace internal
9393

94-
#if OS_WIN
94+
#if FML_OS_WIN
9595

9696
using UniqueFD = UniqueObject<HANDLE, internal::os_win::UniqueFDTraits>;
9797

98-
#else // OS_WIN
98+
#else // FML_OS_WIN
9999

100100
using UniqueFD = UniqueObject<int, internal::os_unix::UniqueFDTraits>;
101101
using UniqueDir = UniqueObject<DIR*, internal::os_unix::UniqueDirTraits>;
102102

103-
#endif // OS_WIN
103+
#endif // FML_OS_WIN
104104

105105
} // namespace fml
106106

lib/ui/painting/image_generator_registry.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include "third_party/skia/src/codec/SkCodecImageGenerator.h"
1111
#ifdef FML_OS_MACOSX
1212
#include "third_party/skia/include/ports/SkImageGeneratorCG.h"
13-
#elif OS_WIN
13+
#elif FML_OS_WIN
1414
#include "third_party/skia/include/ports/SkImageGeneratorWIC.h"
1515
#endif
1616

@@ -32,7 +32,7 @@ ImageGeneratorRegistry::ImageGeneratorRegistry() : weak_factory_(this) {
3232
std::move(generator));
3333
},
3434
0);
35-
#elif OS_WIN
35+
#elif FML_OS_WIN
3636
AddFactory(
3737
[](sk_sp<SkData> buffer) {
3838
auto generator = SkImageGeneratorWIC::MakeFromEncodedWIC(buffer);

lib/ui/ui_dart_state.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
#if defined(FML_OS_ANDROID)
1515
#include <android/log.h>
16-
#elif defined(OS_IOS)
16+
#elif defined(FML_OS_IOS)
1717
extern "C" {
1818
// Cannot import the syslog.h header directly because of macro collision.
1919
extern void syslog(int, const char*, ...);
@@ -219,7 +219,7 @@ void UIDartState::LogMessage(const std::string& tag,
219219
#if defined(FML_OS_ANDROID)
220220
__android_log_print(ANDROID_LOG_INFO, tag.c_str(), "%.*s",
221221
(int)message.size(), message.c_str());
222-
#elif defined(OS_IOS)
222+
#elif defined(FML_OS_IOS)
223223
std::stringstream stream;
224224
if (tag.size() > 0) {
225225
stream << tag << ": ";

runtime/dart_snapshot.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const char* DartSnapshot::kIsolateInstructionsSymbol =
2525
// data through symbols that are statically linked into the executable.
2626
// On other platforms this data is obtained by a dynamic symbol lookup.
2727
#define DART_SNAPSHOT_STATIC_LINK \
28-
((OS_WIN || FML_OS_ANDROID) && FLUTTER_JIT_RUNTIME)
28+
((FML_OS_WIN || FML_OS_ANDROID) && FLUTTER_JIT_RUNTIME)
2929

3030
#if !DART_SNAPSHOT_STATIC_LINK
3131

0 commit comments

Comments
 (0)