Skip to content

Commit

Permalink
Prefix remaining OS defines with FML_ namespace (flutter#31172)
Browse files Browse the repository at this point in the history
  • Loading branch information
bdero authored Jan 31, 2022
1 parent f9e6267 commit 5005e23
Show file tree
Hide file tree
Showing 26 changed files with 73 additions and 73 deletions.
2 changes: 1 addition & 1 deletion flow/frame_timings_recorder_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ TEST(FrameTimingsRecorderTest, RecordRasterTimesWithCache) {
}

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

TEST(FrameTimingsRecorderTest, ThrowWhenRecordBuildBeforeVsync) {
Expand Down
4 changes: 2 additions & 2 deletions fml/backtrace.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <csignal>
#include <sstream>

#if OS_WIN
#if FML_OS_WIN
#include <crtdbg.h>
#include <debugapi.h>
#endif
Expand Down Expand Up @@ -132,7 +132,7 @@ static void ToggleSignalHandlers(bool set) {
}

void InstallCrashHandler() {
#if OS_WIN
#if FML_OS_WIN
if (!IsDebuggerPresent()) {
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
_CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
Expand Down
12 changes: 6 additions & 6 deletions fml/build_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

// This file adds defines about the platform we're currently building on.
// Operating System:
// OS_WIN / FML_OS_MACOSX / FML_OS_LINUX / FML_OS_POSIX (MACOSX or LINUX) /
// FML_OS_NACL (NACL_SFI or NACL_NONSFI) / FML_OS_NACL_SFI /
// FML_OS_WIN / FML_OS_MACOSX / FML_OS_LINUX / FML_OS_POSIX (MACOSX or LINUX)
// / FML_OS_NACL (NACL_SFI or NACL_NONSFI) / FML_OS_NACL_SFI /
// FML_OS_NACL_NONSFI
// Compiler:
// COMPILER_MSVC / COMPILER_GCC
Expand All @@ -27,7 +27,7 @@
#include <TargetConditionals.h>
#define FML_OS_MACOSX 1
#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
#define OS_IOS 1
#define FML_OS_IOS 1
#endif // defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
#elif defined(__linux__)
#define FML_OS_LINUX 1
Expand All @@ -38,7 +38,7 @@
#define LIBC_GLIBC 1
#endif
#elif defined(_WIN32)
#define OS_WIN 1
#define FML_OS_WIN 1
#elif defined(__FreeBSD__)
#define FML_OS_FREEBSD 1
#elif defined(__OpenBSD__)
Expand All @@ -51,10 +51,10 @@
#error Please add support for your platform in flutter/fml/build_config.h
#endif

// For access to standard BSD features, use OS_BSD instead of a
// For access to standard BSD features, use FML_OS_BSD instead of a
// more specific macro.
#if defined(FML_OS_FREEBSD) || defined(FML_OS_OPENBSD)
#define OS_BSD 1
#define FML_OS_BSD 1
#endif

// For access to standard POSIXish features, use FML_OS_POSIX instead of a
Expand Down
4 changes: 2 additions & 2 deletions fml/eintr_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include "flutter/fml/build_config.h"

#if defined(OS_WIN)
#if defined(FML_OS_WIN)

// Windows has no concept of EINTR.
#define FML_HANDLE_EINTR(x) (x)
Expand Down Expand Up @@ -38,6 +38,6 @@
eintr_wrapper_result; \
})

#endif // defined(OS_WIN)
#endif // defined(FML_OS_WIN)

#endif // FLUTTER_FML_EINTR_WRAPPER_H_
2 changes: 1 addition & 1 deletion fml/file_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ TEST(FileTest, CanStopVisitEarly) {
ASSERT_TRUE(fml::UnlinkDirectory(dir.fd(), "a"));
}

#if OS_WIN
#if FML_OS_WIN
#define AtomicWriteTest DISABLED_AtomicWriteTest
#else
#define AtomicWriteTest AtomicWriteTest
Expand Down
4 changes: 2 additions & 2 deletions fml/logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

#if defined(FML_OS_ANDROID)
#include <android/log.h>
#elif defined(OS_IOS)
#elif defined(FML_OS_IOS)
#include <syslog.h>
#elif defined(OS_FUCHSIA)
#include <lib/syslog/global.h>
Expand Down Expand Up @@ -94,7 +94,7 @@ LogMessage::~LogMessage() {
break;
}
__android_log_write(priority, "flutter", stream_.str().c_str());
#elif defined(OS_IOS)
#elif defined(FML_OS_IOS)
syslog(LOG_ALERT, "%s", stream_.str().c_str());
#elif defined(OS_FUCHSIA)
fx_log_severity_t fx_severity;
Expand Down
2 changes: 1 addition & 1 deletion fml/mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class FileMapping final : public Mapping {
uint8_t* mapping_ = nullptr;
uint8_t* mutable_mapping_ = nullptr;

#if OS_WIN
#if FML_OS_WIN
fml::UniqueFD mapping_handle_;
#endif

Expand Down
4 changes: 2 additions & 2 deletions fml/memory/thread_checker.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "flutter/fml/logging.h"
#include "flutter/fml/macros.h"

#if defined(OS_WIN)
#if defined(FML_OS_WIN)
#include <windows.h>
#else
#include <pthread.h>
Expand All @@ -30,7 +30,7 @@ namespace fml {
// there's a small space cost to having even an empty class. )
class ThreadChecker final {
public:
#if defined(OS_WIN)
#if defined(FML_OS_WIN)
ThreadChecker() : self_(GetCurrentThreadId()) {}
~ThreadChecker() {}

Expand Down
4 changes: 2 additions & 2 deletions fml/message_loop_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "flutter/fml/platform/fuchsia/message_loop_fuchsia.h"
#elif FML_OS_LINUX
#include "flutter/fml/platform/linux/message_loop_linux.h"
#elif OS_WIN
#elif FML_OS_WIN
#include "flutter/fml/platform/win/message_loop_win.h"
#endif

Expand All @@ -36,7 +36,7 @@ fml::RefPtr<MessageLoopImpl> MessageLoopImpl::Create() {
return fml::MakeRefCounted<MessageLoopFuchsia>();
#elif FML_OS_LINUX
return fml::MakeRefCounted<MessageLoopLinux>();
#elif OS_WIN
#elif FML_OS_WIN
return fml::MakeRefCounted<MessageLoopWin>();
#else
return nullptr;
Expand Down
2 changes: 1 addition & 1 deletion fml/message_loop_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "gtest/gtest.h"

#define TIMESENSITIVE(x) TimeSensitiveTest_##x
#if OS_WIN
#if FML_OS_WIN
#define PLATFORM_SPECIFIC_CAPTURE(...) [ __VA_ARGS__, count ]
#else
#define PLATFORM_SPECIFIC_CAPTURE(...) [__VA_ARGS__]
Expand Down
10 changes: 5 additions & 5 deletions fml/native_library.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@
#include "flutter/fml/memory/ref_counted.h"
#include "flutter/fml/memory/ref_ptr.h"

#if defined(OS_WIN)
#if defined(FML_OS_WIN)
#include <windows.h>
#endif // defined(OS_WIN)
#endif // defined(FML_OS_WIN)

namespace fml {
class NativeLibrary : public fml::RefCountedThreadSafe<NativeLibrary> {
public:
#if OS_WIN
#if FML_OS_WIN
using Handle = HMODULE;
using SymbolHandle = FARPROC;
#else // OS_WIN
#else // FML_OS_WIN
using Handle = void*;
using SymbolHandle = void*;
#endif // OS_WIN
#endif // FML_OS_WIN

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

Expand Down
6 changes: 3 additions & 3 deletions fml/paths.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ std::string JoinPaths(std::initializer_list<std::string> components) {
i++;
stream << component;
if (i != size) {
#if OS_WIN
#if FML_OS_WIN
stream << "\\";
#else // OS_WIN
#else // FML_OS_WIN
stream << "/";
#endif // OS_WIN
#endif // FML_OS_WIN
}
}
return stream.str();
Expand Down
2 changes: 1 addition & 1 deletion fml/synchronization/semaphore.cc
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class PlatformSemaphore {

} // namespace fml

#elif OS_WIN
#elif FML_OS_WIN
#include <windows.h>

namespace fml {
Expand Down
6 changes: 3 additions & 3 deletions fml/thread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "flutter/fml/message_loop.h"
#include "flutter/fml/synchronization/waitable_event.h"

#if defined(OS_WIN)
#if defined(FML_OS_WIN)
#include <windows.h>
#elif defined(OS_FUCHSIA)
#include <lib/zx/thread.h>
Expand Down Expand Up @@ -55,7 +55,7 @@ void Thread::Join() {
thread_->join();
}

#if defined(OS_WIN)
#if defined(FML_OS_WIN)
// The information on how to set the thread name comes from
// a MSDN article: http://msdn2.microsoft.com/en-us/library/xcb2z8hs.aspx
const DWORD kVCThreadNameException = 0x406D1388;
Expand All @@ -75,7 +75,7 @@ void Thread::SetCurrentThreadName(const std::string& name) {
pthread_setname_np(name.c_str());
#elif defined(FML_OS_LINUX) || defined(FML_OS_ANDROID)
pthread_setname_np(pthread_self(), name.c_str());
#elif defined(OS_WIN)
#elif defined(FML_OS_WIN)
THREADNAME_INFO info;
info.dwType = 0x1000;
info.szName = name.c_str();
Expand Down
6 changes: 3 additions & 3 deletions fml/unique_fd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace fml {
namespace internal {

#if OS_WIN
#if FML_OS_WIN

namespace os_win {

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

} // namespace os_win

#else // OS_WIN
#else // FML_OS_WIN

namespace os_unix {

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

} // namespace os_unix

#endif // OS_WIN
#endif // FML_OS_WIN

} // namespace internal
} // namespace fml
18 changes: 9 additions & 9 deletions fml/unique_fd.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@
#include "flutter/fml/build_config.h"
#include "flutter/fml/unique_object.h"

#if OS_WIN
#if FML_OS_WIN
#include <windows.h>
#include <map>
#include <mutex>
#include <optional>
#else // OS_WIN
#else // FML_OS_WIN
#include <dirent.h>
#include <unistd.h>
#endif // OS_WIN
#endif // FML_OS_WIN

namespace fml {
namespace internal {

#if OS_WIN
#if FML_OS_WIN

namespace os_win {

Expand Down Expand Up @@ -69,7 +69,7 @@ struct UniqueFDTraits {

} // namespace os_win

#else // OS_WIN
#else // FML_OS_WIN

namespace os_unix {

Expand All @@ -87,20 +87,20 @@ struct UniqueDirTraits {

} // namespace os_unix

#endif // OS_WIN
#endif // FML_OS_WIN

} // namespace internal

#if OS_WIN
#if FML_OS_WIN

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

#else // OS_WIN
#else // FML_OS_WIN

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

#endif // OS_WIN
#endif // FML_OS_WIN

} // namespace fml

Expand Down
4 changes: 2 additions & 2 deletions lib/ui/painting/image_generator_registry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "third_party/skia/src/codec/SkCodecImageGenerator.h"
#ifdef FML_OS_MACOSX
#include "third_party/skia/include/ports/SkImageGeneratorCG.h"
#elif OS_WIN
#elif FML_OS_WIN
#include "third_party/skia/include/ports/SkImageGeneratorWIC.h"
#endif

Expand All @@ -32,7 +32,7 @@ ImageGeneratorRegistry::ImageGeneratorRegistry() : weak_factory_(this) {
std::move(generator));
},
0);
#elif OS_WIN
#elif FML_OS_WIN
AddFactory(
[](sk_sp<SkData> buffer) {
auto generator = SkImageGeneratorWIC::MakeFromEncodedWIC(buffer);
Expand Down
4 changes: 2 additions & 2 deletions lib/ui/ui_dart_state.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#if defined(FML_OS_ANDROID)
#include <android/log.h>
#elif defined(OS_IOS)
#elif defined(FML_OS_IOS)
extern "C" {
// Cannot import the syslog.h header directly because of macro collision.
extern void syslog(int, const char*, ...);
Expand Down Expand Up @@ -219,7 +219,7 @@ void UIDartState::LogMessage(const std::string& tag,
#if defined(FML_OS_ANDROID)
__android_log_print(ANDROID_LOG_INFO, tag.c_str(), "%.*s",
(int)message.size(), message.c_str());
#elif defined(OS_IOS)
#elif defined(FML_OS_IOS)
std::stringstream stream;
if (tag.size() > 0) {
stream << tag << ": ";
Expand Down
2 changes: 1 addition & 1 deletion runtime/dart_snapshot.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const char* DartSnapshot::kIsolateInstructionsSymbol =
// data through symbols that are statically linked into the executable.
// On other platforms this data is obtained by a dynamic symbol lookup.
#define DART_SNAPSHOT_STATIC_LINK \
((OS_WIN || FML_OS_ANDROID) && FLUTTER_JIT_RUNTIME)
((FML_OS_WIN || FML_OS_ANDROID) && FLUTTER_JIT_RUNTIME)

#if !DART_SNAPSHOT_STATIC_LINK

Expand Down
Loading

0 comments on commit 5005e23

Please sign in to comment.