Add FML_ prefix to fml/build_config.h macros (flutter/engine#31141)

This commit is contained in:
Brandon DeRosier
2022-01-31 11:53:51 -08:00
committed by GitHub
parent 5692b52b4f
commit 2d4f908b9d
31 changed files with 116 additions and 124 deletions

View File

@@ -86,9 +86,9 @@ static void TestPerformanceOverlayLayerGold(int refresh_rate) {
// TODO(https://github.com/flutter/flutter/issues/53784): enable this on all
// platforms.
#if !defined(OS_LINUX)
#if !defined(FML_OS_LINUX)
GTEST_SKIP() << "Skipping golden tests on non-Linux OSes";
#endif // OS_LINUX
#endif // FML_OS_LINUX
const bool golden_data_matches = golden_data->equals(snapshot_data.get());
if (!golden_data_matches) {
SkFILEWStream wstream(new_golden_file_path.c_str());

View File

@@ -4,13 +4,14 @@
// This file adds defines about the platform we're currently building on.
// Operating System:
// OS_WIN / OS_MACOSX / OS_LINUX / OS_POSIX (MACOSX or LINUX) /
// OS_NACL (NACL_SFI or NACL_NONSFI) / OS_NACL_SFI / OS_NACL_NONSFI
// 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
// Processor:
// ARCH_CPU_X86 / ARCH_CPU_X86_64 / ARCH_CPU_X86_FAMILY (X86 or X86_64)
// ARCH_CPU_32_BITS / ARCH_CPU_64_BITS
// FML_ARCH_CPU_X86 / FML_ARCH_CPU_X86_64 / FML_ARCH_CPU_X86_FAMILY (X86 or
// X86_64) FML_ARCH_CPU_32_BITS / FML_ARCH_CPU_64_BITS
#ifndef FLUTTER_FML_BUILD_CONFIG_H_
#define FLUTTER_FML_BUILD_CONFIG_H_
@@ -18,18 +19,18 @@
#if defined(__Fuchsia__)
#define OS_FUCHSIA 1
#elif defined(ANDROID)
#define OS_ANDROID 1
#define FML_OS_ANDROID 1
#elif defined(__APPLE__)
// only include TargetConditions after testing ANDROID as some android builds
// on mac don't have this header available and it's not needed unless the target
// is really mac/ios.
#include <TargetConditionals.h>
#define OS_MACOSX 1
#define FML_OS_MACOSX 1
#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
#define OS_IOS 1
#endif // defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
#elif defined(__linux__)
#define OS_LINUX 1
#define FML_OS_LINUX 1
// include a system header to pull in features.h for glibc/uclibc macros.
#include <unistd.h>
#if defined(__GLIBC__) && !defined(__UCLIBC__)
@@ -39,29 +40,30 @@
#elif defined(_WIN32)
#define OS_WIN 1
#elif defined(__FreeBSD__)
#define OS_FREEBSD 1
#define FML_OS_FREEBSD 1
#elif defined(__OpenBSD__)
#define OS_OPENBSD 1
#define FML_OS_OPENBSD 1
#elif defined(__sun)
#define OS_SOLARIS 1
#define FML_OS_SOLARIS 1
#elif defined(__QNXNTO__)
#define OS_QNX 1
#define FML_OS_QNX 1
#else
#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
// more specific macro.
#if defined(OS_FREEBSD) || defined(OS_OPENBSD)
#if defined(FML_OS_FREEBSD) || defined(FML_OS_OPENBSD)
#define OS_BSD 1
#endif
// For access to standard POSIXish features, use OS_POSIX instead of a
// For access to standard POSIXish features, use FML_OS_POSIX instead of a
// more specific macro.
#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_FREEBSD) || \
defined(OS_OPENBSD) || defined(OS_SOLARIS) || defined(OS_ANDROID) || \
defined(OS_NACL) || defined(OS_QNX)
#define OS_POSIX 1
#if defined(FML_OS_MACOSX) || defined(FML_OS_LINUX) || \
defined(FML_OS_FREEBSD) || defined(FML_OS_OPENBSD) || \
defined(FML_OS_SOLARIS) || defined(FML_OS_ANDROID) || \
defined(FML_OS_NACL) || defined(FML_OS_QNX)
#define FML_OS_POSIX 1
#endif
// Processor architecture detection. For more info on what's defined, see:
@@ -69,40 +71,28 @@
// http://www.agner.org/optimize/calling_conventions.pdf
// or with gcc, run: "echo | gcc -E -dM -"
#if defined(_M_X64) || defined(__x86_64__)
#define ARCH_CPU_X86_FAMILY 1
#define ARCH_CPU_X86_64 1
#define ARCH_CPU_64_BITS 1
#define ARCH_CPU_LITTLE_ENDIAN 1
#define FML_ARCH_CPU_X86_FAMILY 1
#define FML_ARCH_CPU_X86_64 1
#define FML_ARCH_CPU_64_BITS 1
#define FML_ARCH_CPU_LITTLE_ENDIAN 1
#elif defined(_M_IX86) || defined(__i386__)
#define ARCH_CPU_X86_FAMILY 1
#define ARCH_CPU_X86 1
#define ARCH_CPU_32_BITS 1
#define ARCH_CPU_LITTLE_ENDIAN 1
#define FML_ARCH_CPU_X86_FAMILY 1
#define FML_ARCH_CPU_X86 1
#define FML_ARCH_CPU_32_BITS 1
#define FML_ARCH_CPU_LITTLE_ENDIAN 1
#elif defined(__ARMEL__)
#define ARCH_CPU_ARM_FAMILY 1
#define ARCH_CPU_ARMEL 1
#define ARCH_CPU_32_BITS 1
#define ARCH_CPU_LITTLE_ENDIAN 1
#define FML_ARCH_CPU_ARM_FAMILY 1
#define FML_ARCH_CPU_ARMEL 1
#define FML_ARCH_CPU_32_BITS 1
#define FML_ARCH_CPU_LITTLE_ENDIAN 1
#elif defined(__aarch64__)
#define ARCH_CPU_ARM_FAMILY 1
#define ARCH_CPU_ARM64 1
#define ARCH_CPU_64_BITS 1
#define ARCH_CPU_LITTLE_ENDIAN 1
#define FML_ARCH_CPU_ARM_FAMILY 1
#define FML_ARCH_CPU_ARM64 1
#define FML_ARCH_CPU_64_BITS 1
#define FML_ARCH_CPU_LITTLE_ENDIAN 1
#elif defined(__pnacl__)
#define ARCH_CPU_32_BITS 1
#define ARCH_CPU_LITTLE_ENDIAN 1
#elif defined(__MIPSEL__)
#if defined(__LP64__)
#define ARCH_CPU_MIPS64_FAMILY 1
#define ARCH_CPU_MIPS64EL 1
#define ARCH_CPU_64_BITS 1
#define ARCH_CPU_LITTLE_ENDIAN 1
#else
#define ARCH_CPU_MIPS_FAMILY 1
#define ARCH_CPU_MIPSEL 1
#define ARCH_CPU_32_BITS 1
#define ARCH_CPU_LITTLE_ENDIAN 1
#endif
#define FML_ARCH_CPU_32_BITS 1
#define FML_ARCH_CPU_LITTLE_ENDIAN 1
#else
#error Please add support for your architecture in flutter/fml/build_config.h
#endif

View File

@@ -49,7 +49,7 @@ constexpr T ByteSwap(T n) {
/// The given value must be an integral type of size 1, 2, 4, or 8.
template <typename T, class = std::enable_if_t<std::is_integral_v<T>>>
constexpr T BigEndianToArch(T n) {
#if ARCH_CPU_LITTLE_ENDIAN
#if FML_ARCH_CPU_LITTLE_ENDIAN
return ByteSwap<T>(n);
#else
return n;
@@ -61,7 +61,7 @@ constexpr T BigEndianToArch(T n) {
/// The given value must be an integral type of size 1, 2, 4, or 8.
template <typename T, class = std::enable_if_t<std::is_integral_v<T>>>
constexpr T LittleEndianToArch(T n) {
#if !ARCH_CPU_LITTLE_ENDIAN
#if !FML_ARCH_CPU_LITTLE_ENDIAN
return ByteSwap<T>(n);
#else
return n;

View File

@@ -16,7 +16,7 @@ TEST(EndiannessTest, ByteSwap) {
}
TEST(EndiannessTest, BigEndianToArch) {
#if ARCH_CPU_LITTLE_ENDIAN
#if FML_ARCH_CPU_LITTLE_ENDIAN
uint32_t expected = 0x44332211;
#else
uint32_t expected = 0x11223344;
@@ -25,7 +25,7 @@ TEST(EndiannessTest, BigEndianToArch) {
}
TEST(EndiannessTest, LittleEndianToArch) {
#if ARCH_CPU_LITTLE_ENDIAN
#if FML_ARCH_CPU_LITTLE_ENDIAN
uint32_t expected = 0x11223344;
#else
uint32_t expected = 0x44332211;

View File

@@ -9,7 +9,7 @@
#include "flutter/fml/log_settings.h"
#include "flutter/fml/logging.h"
#if defined(OS_ANDROID)
#if defined(FML_OS_ANDROID)
#include <android/log.h>
#elif defined(OS_IOS)
#include <syslog.h>
@@ -76,7 +76,7 @@ LogMessage::~LogMessage() {
stream_ << std::endl;
#endif
#if defined(OS_ANDROID)
#if defined(FML_OS_ANDROID)
android_LogPriority priority =
(severity_ < 0) ? ANDROID_LOG_VERBOSE : ANDROID_LOG_UNKNOWN;
switch (severity_) {

View File

@@ -13,13 +13,13 @@
#include "flutter/fml/logging.h"
#include "flutter/fml/trace_event.h"
#if OS_MACOSX
#if FML_OS_MACOSX
#include "flutter/fml/platform/darwin/message_loop_darwin.h"
#elif OS_ANDROID
#elif FML_OS_ANDROID
#include "flutter/fml/platform/android/message_loop_android.h"
#elif OS_FUCHSIA
#include "flutter/fml/platform/fuchsia/message_loop_fuchsia.h"
#elif OS_LINUX
#elif FML_OS_LINUX
#include "flutter/fml/platform/linux/message_loop_linux.h"
#elif OS_WIN
#include "flutter/fml/platform/win/message_loop_win.h"
@@ -28,13 +28,13 @@
namespace fml {
fml::RefPtr<MessageLoopImpl> MessageLoopImpl::Create() {
#if OS_MACOSX
#if FML_OS_MACOSX
return fml::MakeRefCounted<MessageLoopDarwin>();
#elif OS_ANDROID
#elif FML_OS_ANDROID
return fml::MakeRefCounted<MessageLoopAndroid>();
#elif OS_FUCHSIA
return fml::MakeRefCounted<MessageLoopFuchsia>();
#elif OS_LINUX
#elif FML_OS_LINUX
return fml::MakeRefCounted<MessageLoopLinux>();
#elif OS_WIN
return fml::MakeRefCounted<MessageLoopWin>();

View File

@@ -7,7 +7,7 @@
#include "flutter/fml/build_config.h"
#include "flutter/fml/logging.h"
#if OS_MACOSX
#if FML_OS_MACOSX
#include <dispatch/dispatch.h>
namespace fml {

View File

@@ -71,9 +71,9 @@ void Thread::SetCurrentThreadName(const std::string& name) {
if (name == "") {
return;
}
#if defined(OS_MACOSX)
#if defined(FML_OS_MACOSX)
pthread_setname_np(name.c_str());
#elif defined(OS_LINUX) || defined(OS_ANDROID)
#elif defined(FML_OS_LINUX) || defined(FML_OS_ANDROID)
pthread_setname_np(pthread_self(), name.c_str());
#elif defined(OS_WIN)
THREADNAME_INFO info;

View File

@@ -10,7 +10,8 @@
#include "flutter/fml/build_config.h"
#include "flutter/fml/macros.h"
#define FML_THREAD_LOCAL_PTHREADS OS_MACOSX || OS_LINUX || OS_ANDROID
#define FML_THREAD_LOCAL_PTHREADS \
FML_OS_MACOSX || FML_OS_LINUX || FML_OS_ANDROID
#if FML_THREAD_LOCAL_PTHREADS
#include <pthread.h>

View File

@@ -47,7 +47,7 @@
#include "flutter/fml/time/time_point.h"
#include "third_party/dart/runtime/include/dart_tools_api.h"
#if (FLUTTER_RELEASE && !defined(OS_FUCHSIA) && !defined(OS_ANDROID))
#if (FLUTTER_RELEASE && !defined(OS_FUCHSIA) && !defined(FML_OS_ANDROID))
#define FLUTTER_TIMELINE_ENABLED 0
#else
#define FLUTTER_TIMELINE_ENABLED 1

View File

@@ -8,7 +8,7 @@
#include "third_party/skia/include/codec/SkCodec.h"
#include "third_party/skia/include/core/SkImageGenerator.h"
#include "third_party/skia/src/codec/SkCodecImageGenerator.h"
#ifdef OS_MACOSX
#ifdef FML_OS_MACOSX
#include "third_party/skia/include/ports/SkImageGeneratorCG.h"
#elif OS_WIN
#include "third_party/skia/include/ports/SkImageGeneratorWIC.h"
@@ -24,7 +24,7 @@ ImageGeneratorRegistry::ImageGeneratorRegistry() : weak_factory_(this) {
0);
// todo(bdero): https://github.com/flutter/flutter/issues/82603
#ifdef OS_MACOSX
#ifdef FML_OS_MACOSX
AddFactory(
[](sk_sp<SkData> buffer) {
auto generator = SkImageGeneratorCG::MakeFromEncodedCG(buffer);

View File

@@ -11,7 +11,7 @@
#include "third_party/tonic/dart_args.h"
#include "third_party/tonic/dart_binding_macros.h"
#if OS_ANDROID
#if FML_OS_ANDROID
#include <sys/mman.h>
#endif
@@ -53,7 +53,7 @@ size_t ImmutableBuffer::GetAllocationSize() const {
return sizeof(ImmutableBuffer) + data_->size();
}
#if OS_ANDROID
#if FML_OS_ANDROID
// Compressed image buffers are allocated on the UI thread but are deleted on a
// decoder worker thread. Android's implementation of malloc appears to
@@ -96,6 +96,6 @@ sk_sp<SkData> ImmutableBuffer::MakeSkDataWithCopy(const void* data,
return SkData::MakeWithCopy(data, length);
}
#endif // OS_ANDROID
#endif // FML_OS_ANDROID
} // namespace flutter

View File

@@ -11,7 +11,7 @@
#include "third_party/tonic/converter/dart_converter.h"
#include "third_party/tonic/dart_message_handler.h"
#if defined(OS_ANDROID)
#if defined(FML_OS_ANDROID)
#include <android/log.h>
#elif defined(OS_IOS)
extern "C" {
@@ -216,7 +216,7 @@ void UIDartState::LogMessage(const std::string& tag,
log_message_callback_(tag, message);
} else {
// Fall back to previous behavior if unspecified.
#if defined(OS_ANDROID)
#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)

View File

@@ -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 || OS_ANDROID) && FLUTTER_JIT_RUNTIME)
((OS_WIN || FML_OS_ANDROID) && FLUTTER_JIT_RUNTIME)
#if !DART_SNAPSHOT_STATIC_LINK

View File

@@ -221,7 +221,7 @@ static std::vector<const char*> ProfilingFlags(bool enable_profiling) {
// This instructs the profiler to walk C++ frames, and to include
// them in the profile.
"--profile-vm",
#if OS_IOS && ARCH_CPU_ARM_FAMILY && ARCH_CPU_ARMEL
#if OS_IOS && FML_ARCH_CPU_ARM_FAMILY && FML_ARCH_CPU_ARMEL
// Set the profiler interrupt period to 500Hz instead of the
// default 1000Hz on 32-bit iOS devices to reduce average and worst
// case frame build times.
@@ -232,7 +232,7 @@ static std::vector<const char*> ProfilingFlags(bool enable_profiling) {
"--profile_period=2000",
#else
"--profile_period=1000",
#endif // OS_IOS && ARCH_CPU_ARM_FAMILY && ARCH_CPU_ARMEL
#endif // OS_IOS && FML_ARCH_CPU_ARM_FAMILY && FML_ARCH_CPU_ARMEL
};
} else {
return {"--no-profiler"};
@@ -341,7 +341,7 @@ DartVM::DartVM(std::shared_ptr<const DartVMData> vm_data,
#endif // !OS_FUCHSIA
#if (FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG)
#if !OS_IOS && !OS_MACOSX
#if !OS_IOS && !FML_OS_MACOSX
// Debug mode uses the JIT, disable code page write protection to avoid
// memory page protection changes before and after every compilation.
PushBackAll(&args, kDartWriteProtectCodeArgs,
@@ -361,7 +361,7 @@ DartVM::DartVM(std::shared_ptr<const DartVMData> vm_data,
PushBackAll(&args, kDartDisableIntegerDivisionArgs,
fml::size(kDartDisableIntegerDivisionArgs));
#endif // TARGET_CPU_ARM
#endif // !OS_IOS && !OS_MACOSX
#endif // !OS_IOS && !FML_OS_MACOSX
#endif // (FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG)
if (enable_asserts) {

View File

@@ -79,7 +79,7 @@ static const std::string gAllowedDartFlags[] = {
// Define symbols for the ICU data that is linked into the Flutter library on
// Android. This is a workaround for crashes seen when doing dynamic lookups
// of the engine's own symbols on some older versions of Android.
#if OS_ANDROID
#if FML_OS_ANDROID
extern uint8_t _binary_icudtl_dat_start[];
extern uint8_t _binary_icudtl_dat_end[];
@@ -401,7 +401,7 @@ Settings SettingsFromCommandLine(const fml::CommandLine& command_line) {
command_line.GetOptionValue(FlagForSwitch(Switch::ICUNativeLibPath),
&native_lib_path);
#if OS_ANDROID
#if FML_OS_ANDROID
settings.icu_mapper = GetICUStaticMapping;
#else
settings.icu_mapper = [icu_symbol_prefix, native_lib_path] {

View File

@@ -13,13 +13,13 @@
#include "flutter/shell/platform/android/surface/android_native_window.h"
#include "third_party/skia/include/core/SkMatrix.h"
#if OS_ANDROID
#if FML_OS_ANDROID
#include "flutter/fml/platform/android/scoped_java_ref.h"
#endif
namespace flutter {
#if OS_ANDROID
#if FML_OS_ANDROID
using JavaLocalRef = fml::jni::ScopedJavaLocalRef<jobject>;
#else
using JavaLocalRef = std::nullptr_t;

View File

@@ -14,9 +14,9 @@ AndroidNativeWindow::AndroidNativeWindow(Handle window)
AndroidNativeWindow::~AndroidNativeWindow() {
if (window_ != nullptr) {
#if OS_ANDROID
#if FML_OS_ANDROID
ANativeWindow_release(window_);
#endif // OS_ANDROID
#endif // FML_OS_ANDROID
window_ = nullptr;
}
}
@@ -30,13 +30,13 @@ AndroidNativeWindow::Handle AndroidNativeWindow::handle() const {
}
SkISize AndroidNativeWindow::GetSize() const {
#if OS_ANDROID
#if FML_OS_ANDROID
return window_ == nullptr ? SkISize::Make(0, 0)
: SkISize::Make(ANativeWindow_getWidth(window_),
ANativeWindow_getHeight(window_));
#else // OS_ANDROID
#else // FML_OS_ANDROID
return SkISize::Make(0, 0);
#endif // OS_ANDROID
#endif // FML_OS_ANDROID
}
} // namespace flutter

View File

@@ -11,20 +11,20 @@
#include "flutter/fml/memory/ref_counted.h"
#include "third_party/skia/include/core/SkSize.h"
#if OS_ANDROID
#if FML_OS_ANDROID
#include <android/native_window.h>
#endif // OS_ANDROID
#endif // FML_OS_ANDROID
namespace flutter {
class AndroidNativeWindow
: public fml::RefCountedThreadSafe<AndroidNativeWindow> {
public:
#if OS_ANDROID
#if FML_OS_ANDROID
using Handle = ANativeWindow*;
#else // OS_ANDROID
#else // FML_OS_ANDROID
using Handle = std::nullptr_t;
#endif // OS_ANDROID
#endif // FML_OS_ANDROID
bool IsValid() const;

View File

@@ -183,18 +183,18 @@ static bool IsRendererValid(const FlutterRendererConfig* config) {
return false;
}
#if OS_LINUX || OS_WIN
#if FML_OS_LINUX || OS_WIN
static void* DefaultGLProcResolver(const char* name) {
static fml::RefPtr<fml::NativeLibrary> proc_library =
#if OS_LINUX
#if FML_OS_LINUX
fml::NativeLibrary::CreateForCurrentProcess();
#elif OS_WIN // OS_LINUX
#elif OS_WIN // FML_OS_LINUX
fml::NativeLibrary::Create("opengl32.dll");
#endif // OS_WIN
return static_cast<void*>(
const_cast<uint8_t*>(proc_library->ResolveSymbol(name)));
}
#endif // OS_LINUX || OS_WIN
#endif // FML_OS_LINUX || OS_WIN
static flutter::Shell::CreateCallback<flutter::PlatformView>
InferOpenGLPlatformViewCreationCallback(
@@ -284,7 +284,7 @@ InferOpenGLPlatformViewCreationCallback(
return ptr(user_data, gl_proc_name);
};
} else {
#if OS_LINUX || OS_WIN
#if FML_OS_LINUX || OS_WIN
gl_proc_resolver = DefaultGLProcResolver;
#endif
}
@@ -887,7 +887,8 @@ void PopulateSnapshotMappingCallbacks(
#if !OS_FUCHSIA && (FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG)
settings.dart_library_sources_kernel =
make_mapping_callback(kPlatformStrongDill, kPlatformStrongDillSize);
#endif // !OS_FUCHSIA && (FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG)
#endif // !OS_FUCHSIA && (FLUTTER_RUNTIME_MODE ==
// FLUTTER_RUNTIME_MODE_DEBUG)
}
FlutterEngineResult FlutterEngineRun(size_t version,

View File

@@ -1028,9 +1028,9 @@ TEST_F(EmbedderTest, VerifyB143464703WithSoftwareBackend) {
// TODO(https://github.com/flutter/flutter/issues/53784): enable this on all
// platforms.
#if !defined(OS_LINUX)
#if !defined(FML_OS_LINUX)
GTEST_SKIP() << "Skipping golden tests on non-Linux OSes";
#endif // OS_LINUX
#endif // FML_OS_LINUX
ASSERT_TRUE(
ImageMatchesFixture("verifyb143464703_soft_noxform.png", rendered_scene));
}

View File

@@ -27,9 +27,9 @@
#include "third_party/dart/runtime/include/bin/dart_io_api.h"
#include "third_party/dart/runtime/include/dart_api.h"
#if defined(OS_POSIX)
#if defined(FML_OS_POSIX)
#include <signal.h>
#endif // defined(OS_POSIX)
#endif // defined(FML_OS_POSIX)
namespace flutter {
@@ -169,12 +169,12 @@ class ScriptCompletionTaskObserver {
// mutator thread in the main isolate in this process (threads spawned by the VM
// know about this limitation and automatically have this signal unblocked).
static void UnblockSIGPROF() {
#if defined(OS_POSIX)
#if defined(FML_OS_POSIX)
sigset_t set;
sigemptyset(&set);
sigaddset(&set, SIGPROF);
pthread_sigmask(SIG_UNBLOCK, &set, NULL);
#endif // defined(OS_POSIX)
#endif // defined(FML_OS_POSIX)
}
int RunTester(const flutter::Settings& settings,

View File

@@ -49,10 +49,10 @@ void DartFixture::SetSnapshotsAndAssets(Settings& settings) {
// snapshots will be present in the application AOT dylib.
if (DartVM::IsRunningPrecompiledCode()) {
FML_CHECK(PrepareSettingsForAOTWithSymbols(settings, aot_symbols_));
#if OS_LINUX
#if FML_OS_LINUX
settings.vmservice_snapshot_library_path.emplace_back(fml::paths::JoinPaths(
{GetTestingAssetsPath(), "libvmservice_snapshot.so"}));
#endif // OS_LINUX
#endif // FML_OS_LINUX
} else {
settings.application_kernels = [this]() -> Mappings {
std::vector<std::unique_ptr<const fml::Mapping>> kernel_mappings;

View File

@@ -7,13 +7,13 @@
#include "flutter/fml/build_config.h"
#include "flutter/fml/logging.h"
#if OS_MACOSX
#if FML_OS_MACOSX
#include <assert.h>
#include <stdbool.h>
#include <sys/sysctl.h>
#include <sys/types.h>
#include <unistd.h>
#endif // OS_MACOSX
#endif // FML_OS_MACOSX
#if OS_WIN
#include <windows.h>
@@ -23,7 +23,7 @@ namespace flutter {
namespace testing {
DebuggerStatus GetDebuggerStatus() {
#if OS_MACOSX
#if FML_OS_MACOSX
// From Technical Q&A QA1361 Detecting the Debugger
// https://developer.apple.com/library/archive/qa/qa1361/_index.html
int management_info_base[4];

View File

@@ -298,7 +298,7 @@ sk_sp<SkSurface> TestGLSurface::GetOnscreenSurface() {
const uint32_t width = surface_size_.width();
const uint32_t height = surface_size_.height();
framebuffer_info.fFBOID = GetFramebuffer(width, height);
#if OS_MACOSX
#if FML_OS_MACOSX
framebuffer_info.fFormat = GR_GL_RGBA8;
#else
framebuffer_info.fFormat = GR_GL_BGRA8;

View File

@@ -6,7 +6,7 @@
#include "flutter/vulkan/vulkan_proc_table.h"
#ifdef OS_MACOSX
#ifdef FML_OS_MACOSX
#define VULKAN_SO_PATH "libvk_swiftshader.dylib"
#elif OS_WIN
#define VULKAN_SO_PATH "vk_swiftshader.dll"

View File

@@ -60,7 +60,7 @@ VulkanDevice::VulkanDevice(VulkanProcTable& p_vk,
};
const char* extensions[] = {
#if OS_ANDROID
#if FML_OS_ANDROID
VK_KHR_SWAPCHAIN_EXTENSION_NAME,
#endif
#if OS_FUCHSIA
@@ -185,7 +185,7 @@ uint32_t VulkanDevice::GetGraphicsQueueIndex() const {
bool VulkanDevice::GetSurfaceCapabilities(
const VulkanSurface& surface,
VkSurfaceCapabilitiesKHR* capabilities) const {
#if OS_ANDROID
#if FML_OS_ANDROID
if (!surface.IsValid() || capabilities == nullptr) {
return false;
}
@@ -274,7 +274,7 @@ std::vector<VkQueueFamilyProperties> VulkanDevice::GetQueueFamilyProperties()
int VulkanDevice::ChooseSurfaceFormat(const VulkanSurface& surface,
std::vector<VkFormat> desired_formats,
VkSurfaceFormatKHR* format) const {
#if OS_ANDROID
#if FML_OS_ANDROID
if (!surface.IsValid() || format == nullptr) {
return -1;
}

View File

@@ -10,11 +10,11 @@
#include "flutter/fml/build_config.h"
#include "flutter/fml/logging.h"
#if OS_ANDROID
#if FML_OS_ANDROID
#ifndef VK_USE_PLATFORM_ANDROID_KHR
#define VK_USE_PLATFORM_ANDROID_KHR 1
#endif // VK_USE_PLATFORM_ANDROID_KHR
#endif // OS_ANDROID
#endif // FML_OS_ANDROID
#if OS_FUCHSIA
#ifndef VK_USE_PLATFORM_MAGMA_KHR

View File

@@ -79,14 +79,14 @@ bool VulkanProcTable::SetupInstanceProcAddresses(
ACQUIRE_PROC(GetDeviceProcAddr, handle);
ACQUIRE_PROC(GetPhysicalDeviceFeatures, handle);
ACQUIRE_PROC(GetPhysicalDeviceQueueFamilyProperties, handle);
#if OS_ANDROID
#if FML_OS_ANDROID
ACQUIRE_PROC(GetPhysicalDeviceSurfaceCapabilitiesKHR, handle);
ACQUIRE_PROC(GetPhysicalDeviceSurfaceFormatsKHR, handle);
ACQUIRE_PROC(GetPhysicalDeviceSurfacePresentModesKHR, handle);
ACQUIRE_PROC(GetPhysicalDeviceSurfaceSupportKHR, handle);
ACQUIRE_PROC(DestroySurfaceKHR, handle);
ACQUIRE_PROC(CreateAndroidSurfaceKHR, handle);
#endif // OS_ANDROID
#endif // FML_OS_ANDROID
// The debug report functions are optional. We don't want proc acquisition to
// fail here because the optional methods were not present (since ACQUIRE_PROC
@@ -130,13 +130,13 @@ bool VulkanProcTable::SetupDeviceProcAddresses(
ACQUIRE_PROC(ResetFences, handle);
ACQUIRE_PROC(WaitForFences, handle);
#ifndef TEST_VULKAN_PROCS
#if OS_ANDROID
#if FML_OS_ANDROID
ACQUIRE_PROC(AcquireNextImageKHR, handle);
ACQUIRE_PROC(CreateSwapchainKHR, handle);
ACQUIRE_PROC(DestroySwapchainKHR, handle);
ACQUIRE_PROC(GetSwapchainImagesKHR, handle);
ACQUIRE_PROC(QueuePresentKHR, handle);
#endif // OS_ANDROID
#endif // FML_OS_ANDROID
#if OS_FUCHSIA
ACQUIRE_PROC(ImportSemaphoreZirconHandleFUCHSIA, handle);
ACQUIRE_PROC(GetSemaphoreZirconHandleFUCHSIA, handle);

View File

@@ -107,7 +107,7 @@ class VulkanProcTable : public fml::RefCountedThreadSafe<VulkanProcTable> {
DEFINE_PROC(ResetFences);
DEFINE_PROC(WaitForFences);
#ifndef TEST_VULKAN_PROCS
#if OS_ANDROID
#if FML_OS_ANDROID
DEFINE_PROC(GetPhysicalDeviceSurfaceCapabilitiesKHR);
DEFINE_PROC(GetPhysicalDeviceSurfaceFormatsKHR);
DEFINE_PROC(GetPhysicalDeviceSurfacePresentModesKHR);
@@ -115,7 +115,7 @@ class VulkanProcTable : public fml::RefCountedThreadSafe<VulkanProcTable> {
DEFINE_PROC(GetSwapchainImagesKHR);
DEFINE_PROC(QueuePresentKHR);
DEFINE_PROC(CreateAndroidSurfaceKHR);
#endif // OS_ANDROID
#endif // FML_OS_ANDROID
#if OS_FUCHSIA
DEFINE_PROC(ImportSemaphoreZirconHandleFUCHSIA);
DEFINE_PROC(GetSemaphoreZirconHandleFUCHSIA);

View File

@@ -60,7 +60,7 @@ class VulkanSwapchain {
SkISize GetSize() const;
#if OS_ANDROID
#if FML_OS_ANDROID
private:
const VulkanProcTable& vk;
const VulkanDevice& device_;
@@ -90,7 +90,7 @@ class VulkanSwapchain {
sk_sp<SkColorSpace> color_space) const;
VulkanBackbuffer* GetNextBackbuffer();
#endif // OS_ANDROID
#endif // FML_OS_ANDROID
FML_DISALLOW_COPY_AND_ASSIGN(VulkanSwapchain);
};