From 8aa14bf642157dc28857152cff27aa6f3cb9bea2 Mon Sep 17 00:00:00 2001 From: Brandon DeRosier Date: Fri, 28 Jan 2022 11:28:44 -0800 Subject: [PATCH 1/4] Add FML prefix to CPU architecture macros --- fml/build_config.h | 52 ++++++++++++++++++---------------------------- runtime/dart_vm.cc | 4 ++-- 2 files changed, 22 insertions(+), 34 deletions(-) diff --git a/fml/build_config.h b/fml/build_config.h index 2714f46d1cebf..05c5658c85cff 100644 --- a/fml/build_config.h +++ b/fml/build_config.h @@ -9,8 +9,8 @@ // 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_ @@ -69,40 +69,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 diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc index ad3612b14305e..67749f5843bc6 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -221,7 +221,7 @@ static std::vector 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 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"}; From f91da6d313f9b682689ff4f78afab6d6453edf9e Mon Sep 17 00:00:00 2001 From: Brandon DeRosier Date: Fri, 28 Jan 2022 11:37:34 -0800 Subject: [PATCH 2/4] Add FML prefix to OS macros --- display_list/display_list_canvas_unittests.cc | 4 +- flow/flow_run_all_unittests.cc | 2 +- flow/frame_timings_recorder_unittests.cc | 2 +- .../performance_overlay_layer_unittests.cc | 8 ++-- fml/build_config.h | 38 ++++++++++--------- fml/log_settings.cc | 4 +- fml/logging.cc | 14 +++---- fml/logging_unittests.cc | 4 +- fml/message_loop_impl.cc | 16 ++++---- fml/synchronization/semaphore.cc | 2 +- fml/thread.cc | 8 ++-- fml/thread_local.h | 3 +- fml/time/time_point.cc | 4 +- fml/trace_event.h | 10 ++--- lib/ui/painting/image_generator_registry.cc | 4 +- lib/ui/painting/immutable_buffer.cc | 6 +-- lib/ui/ui_dart_state.cc | 4 +- runtime/dart_isolate.cc | 2 +- runtime/dart_snapshot.cc | 2 +- runtime/dart_vm.cc | 18 ++++----- shell/common/rasterizer.cc | 4 +- shell/common/shell_io_manager.cc | 6 +-- shell/common/shell_test.cc | 2 +- shell/common/shell_unittests.cc | 20 +++++----- shell/common/skia_event_tracer_impl.cc | 20 +++++----- shell/common/skp_shader_warmup_unittests.cc | 4 +- shell/common/switches.cc | 4 +- shell/common/vsync_waiter.cc | 2 +- .../android/jni/platform_view_android_jni.h | 4 +- .../android/surface/android_native_window.cc | 10 ++--- .../android/surface/android_native_window.h | 10 ++--- shell/platform/embedder/embedder.cc | 17 +++++---- .../embedder/tests/embedder_unittests.cc | 4 +- shell/testing/tester_main.cc | 8 ++-- testing/dart_fixture.cc | 4 +- testing/debugger_detection.cc | 6 +-- testing/elf_loader.cc | 4 +- testing/test_gl_surface.cc | 2 +- testing/test_vulkan_context.cc | 2 +- vulkan/vulkan_application.cc | 2 +- vulkan/vulkan_device.cc | 8 ++-- vulkan/vulkan_interface.h | 8 ++-- vulkan/vulkan_proc_table.cc | 12 +++--- vulkan/vulkan_proc_table.h | 8 ++-- vulkan/vulkan_swapchain.h | 4 +- vulkan/vulkan_utilities.cc | 4 +- 46 files changed, 169 insertions(+), 165 deletions(-) diff --git a/display_list/display_list_canvas_unittests.cc b/display_list/display_list_canvas_unittests.cc index f64a471ed30f3..310c23cf5cc38 100644 --- a/display_list/display_list_canvas_unittests.cc +++ b/display_list/display_list_canvas_unittests.cc @@ -2970,9 +2970,9 @@ TEST_F(DisplayListCanvas, DrawTextBlob) { // TODO(https://github.com/flutter/flutter/issues/82202): Remove once the // performance overlay can use Fuchsia's font manager instead of the empty // default. -#if defined(OS_FUCHSIA) +#if defined(FML_OS_FUCHSIA) GTEST_SKIP() << "Rendering comparisons require a valid default font manager"; -#endif // OS_FUCHSIA +#endif // FML_OS_FUCHSIA sk_sp blob = CanvasCompareTester::MakeTextBlob("Testing", RenderHeight * 0.33f); SkScalar RenderY1_3 = RenderTop + RenderHeight * 0.3; diff --git a/flow/flow_run_all_unittests.cc b/flow/flow_run_all_unittests.cc index e2106829a83c4..40d2ac2497725 100644 --- a/flow/flow_run_all_unittests.cc +++ b/flow/flow_run_all_unittests.cc @@ -15,7 +15,7 @@ int main(int argc, char** argv) { testing::InitGoogleTest(&argc, argv); fml::CommandLine cmd = fml::CommandLineFromArgcArgv(argc, argv); -#if defined(OS_FUCHSIA) +#if defined(FML_OS_FUCHSIA) flutter::SetGoldenDir(cmd.GetOptionValueWithDefault( "golden-dir", "/pkg/data/flutter/testing/resources")); #else diff --git a/flow/frame_timings_recorder_unittests.cc b/flow/frame_timings_recorder_unittests.cc index 434f06b802e6f..a976f67dd4542 100644 --- a/flow/frame_timings_recorder_unittests.cc +++ b/flow/frame_timings_recorder_unittests.cc @@ -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(FML_OS_FUCHSIA) && !defined(OS_WIN) && \ (FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG) TEST(FrameTimingsRecorderTest, ThrowWhenRecordBuildBeforeVsync) { diff --git a/flow/layers/performance_overlay_layer_unittests.cc b/flow/layers/performance_overlay_layer_unittests.cc index ecc400c26af74..0d130ef484cb7 100644 --- a/flow/layers/performance_overlay_layer_unittests.cc +++ b/flow/layers/performance_overlay_layer_unittests.cc @@ -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()); @@ -170,9 +170,9 @@ TEST_F(PerformanceOverlayLayerTest, SimpleRasterizerStatistics) { // TODO(https://github.com/flutter/flutter/issues/82202): Remove once the // performance overlay can use Fuchsia's font manager instead of the empty // default. -#if defined(OS_FUCHSIA) +#if defined(FML_OS_FUCHSIA) GTEST_SKIP() << "Expectation requires a valid default font manager"; -#endif // OS_FUCHSIA +#endif // FML_OS_FUCHSIA EXPECT_EQ(mock_canvas().draw_calls(), std::vector({MockCanvas::DrawCall{ 0, MockCanvas::DrawTextData{overlay_text_data, text_paint, diff --git a/fml/build_config.h b/fml/build_config.h index 05c5658c85cff..ed202fb460060 100644 --- a/fml/build_config.h +++ b/fml/build_config.h @@ -4,32 +4,33 @@ // 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: -// 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 +// 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_ #if defined(__Fuchsia__) -#define OS_FUCHSIA 1 +#define FML_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 -#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 #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: diff --git a/fml/log_settings.cc b/fml/log_settings.cc index 4388a1a277f5c..78067d4a1999c 100644 --- a/fml/log_settings.cc +++ b/fml/log_settings.cc @@ -13,7 +13,7 @@ #include "flutter/fml/build_config.h" #include "flutter/fml/logging.h" -#if defined(OS_FUCHSIA) +#if defined(FML_OS_FUCHSIA) #include #endif @@ -29,7 +29,7 @@ void SetLogSettings(const LogSettings& settings) { // Validate the new settings as we set them. state::g_log_settings.min_log_level = std::min(LOG_FATAL, settings.min_log_level); -#if defined(OS_FUCHSIA) +#if defined(FML_OS_FUCHSIA) // Syslog should accept all logs, since filtering by severity is done by fml. FX_LOG_SET_SEVERITY(ALL); #endif diff --git a/fml/logging.cc b/fml/logging.cc index e3a57df4bbccc..a36a93472ed55 100644 --- a/fml/logging.cc +++ b/fml/logging.cc @@ -9,11 +9,11 @@ #include "flutter/fml/log_settings.h" #include "flutter/fml/logging.h" -#if defined(OS_ANDROID) +#if defined(FML_OS_ANDROID) #include #elif defined(OS_IOS) #include -#elif defined(OS_FUCHSIA) +#elif defined(FML_OS_FUCHSIA) #include #endif @@ -21,7 +21,7 @@ namespace fml { namespace { -#if !defined(OS_FUCHSIA) +#if !defined(FML_OS_FUCHSIA) const char* const kLogSeverityNames[LOG_NUM_SEVERITIES] = {"INFO", "WARNING", "ERROR", "FATAL"}; @@ -55,7 +55,7 @@ LogMessage::LogMessage(LogSeverity severity, int line, const char* condition) : severity_(severity), file_(file), line_(line) { -#if !defined(OS_FUCHSIA) +#if !defined(FML_OS_FUCHSIA) stream_ << "["; if (severity >= LOG_INFO) { stream_ << GetNameForLogSeverity(severity); @@ -72,11 +72,11 @@ LogMessage::LogMessage(LogSeverity severity, } LogMessage::~LogMessage() { -#if !defined(OS_FUCHSIA) +#if !defined(FML_OS_FUCHSIA) 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_) { @@ -96,7 +96,7 @@ LogMessage::~LogMessage() { __android_log_write(priority, "flutter", stream_.str().c_str()); #elif defined(OS_IOS) syslog(LOG_ALERT, "%s", stream_.str().c_str()); -#elif defined(OS_FUCHSIA) +#elif defined(FML_OS_FUCHSIA) fx_log_severity_t fx_severity; switch (severity_) { case LOG_INFO: diff --git a/fml/logging_unittests.cc b/fml/logging_unittests.cc index 18ac1ad8fa8c6..1b9e0262bc7f6 100644 --- a/fml/logging_unittests.cc +++ b/fml/logging_unittests.cc @@ -7,7 +7,7 @@ #include "flutter/fml/logging.h" #include "gtest/gtest.h" -#if defined(OS_FUCHSIA) +#if defined(FML_OS_FUCHSIA) #include #include #include @@ -39,7 +39,7 @@ TEST(LoggingTest, UnreachableKillProcessWithMacro) { ASSERT_DEATH({ FML_UNREACHABLE(); }, ""); } -#if defined(OS_FUCHSIA) +#if defined(FML_OS_FUCHSIA) struct LogPacket { fx_log_metadata_t metadata; diff --git a/fml/message_loop_impl.cc b/fml/message_loop_impl.cc index a206b11a74f22..6c85bda2a0d23 100644 --- a/fml/message_loop_impl.cc +++ b/fml/message_loop_impl.cc @@ -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 +#elif FML_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::Create() { -#if OS_MACOSX +#if FML_OS_MACOSX return fml::MakeRefCounted(); -#elif OS_ANDROID +#elif FML_OS_ANDROID return fml::MakeRefCounted(); -#elif OS_FUCHSIA +#elif FML_OS_FUCHSIA return fml::MakeRefCounted(); -#elif OS_LINUX +#elif FML_OS_LINUX return fml::MakeRefCounted(); #elif OS_WIN return fml::MakeRefCounted(); diff --git a/fml/synchronization/semaphore.cc b/fml/synchronization/semaphore.cc index 7156e2ec88171..c28a57d632c3a 100644 --- a/fml/synchronization/semaphore.cc +++ b/fml/synchronization/semaphore.cc @@ -7,7 +7,7 @@ #include "flutter/fml/build_config.h" #include "flutter/fml/logging.h" -#if OS_MACOSX +#if FML_OS_MACOSX #include namespace fml { diff --git a/fml/thread.cc b/fml/thread.cc index 5eb05deaf978a..3f4c42f3f7ae0 100644 --- a/fml/thread.cc +++ b/fml/thread.cc @@ -15,7 +15,7 @@ #if defined(OS_WIN) #include -#elif defined(OS_FUCHSIA) +#elif defined(FML_OS_FUCHSIA) #include #else #include @@ -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; @@ -86,7 +86,7 @@ void Thread::SetCurrentThreadName(const std::string& name) { reinterpret_cast(&info)); } __except (EXCEPTION_CONTINUE_EXECUTION) { } -#elif defined(OS_FUCHSIA) +#elif defined(FML_OS_FUCHSIA) zx::thread::self()->set_property(ZX_PROP_NAME, name.c_str(), name.size()); #else FML_DLOG(INFO) << "Could not set the thread name to '" << name diff --git a/fml/thread_local.h b/fml/thread_local.h index ed6336c961554..010c0ff643dd3 100644 --- a/fml/thread_local.h +++ b/fml/thread_local.h @@ -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 diff --git a/fml/time/time_point.cc b/fml/time/time_point.cc index e3bd652ce013a..38b6b9bc996b9 100644 --- a/fml/time/time_point.cc +++ b/fml/time/time_point.cc @@ -8,7 +8,7 @@ #include "flutter/fml/logging.h" #include "flutter/fml/time/dart_timestamp_provider.h" -#if defined(OS_FUCHSIA) +#if defined(FML_OS_FUCHSIA) #include #else #include @@ -16,7 +16,7 @@ namespace fml { -#if defined(OS_FUCHSIA) +#if defined(FML_OS_FUCHSIA) // static TimePoint TimePoint::Now() { diff --git a/fml/trace_event.h b/fml/trace_event.h index 38a3ea2a9b225..c24308057ba6d 100644 --- a/fml/trace_event.h +++ b/fml/trace_event.h @@ -9,7 +9,7 @@ #include "flutter/fml/build_config.h" -#if defined(OS_FUCHSIA) +#if defined(FML_OS_FUCHSIA) // Forward to the system tracing mechanism on Fuchsia. @@ -35,7 +35,7 @@ #define TRACE_EVENT_INSTANT2(a, b, k1, v1, k2, v2) \ TRACE_INSTANT(a, b, TRACE_SCOPE_THREAD, k1, v1, k2, v2) -#endif // defined(OS_FUCHSIA) +#endif // defined(FML_OS_FUCHSIA) #include #include @@ -47,13 +47,13 @@ #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(FML_OS_FUCHSIA) && !defined(FML_OS_ANDROID)) #define FLUTTER_TIMELINE_ENABLED 0 #else #define FLUTTER_TIMELINE_ENABLED 1 #endif -#if !defined(OS_FUCHSIA) +#if !defined(FML_OS_FUCHSIA) #ifndef TRACE_EVENT_HIDE_MACROS #define __FML__TOKEN_CAT__(x, y) x##y @@ -137,7 +137,7 @@ ::fml::tracing::TraceEventFlowEnd0(category, name, id); #endif // TRACE_EVENT_HIDE_MACROS -#endif // !defined(OS_FUCHSIA) +#endif // !defined(FML_OS_FUCHSIA) namespace fml { namespace tracing { diff --git a/lib/ui/painting/image_generator_registry.cc b/lib/ui/painting/image_generator_registry.cc index 3d5d4cf5ecb98..0fc40010f2f6b 100644 --- a/lib/ui/painting/image_generator_registry.cc +++ b/lib/ui/painting/image_generator_registry.cc @@ -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 buffer) { auto generator = SkImageGeneratorCG::MakeFromEncodedCG(buffer); diff --git a/lib/ui/painting/immutable_buffer.cc b/lib/ui/painting/immutable_buffer.cc index 6491785f6eae0..e4d3f630de72f 100644 --- a/lib/ui/painting/immutable_buffer.cc +++ b/lib/ui/painting/immutable_buffer.cc @@ -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 #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 ImmutableBuffer::MakeSkDataWithCopy(const void* data, return SkData::MakeWithCopy(data, length); } -#endif // OS_ANDROID +#endif // FML_OS_ANDROID } // namespace flutter diff --git a/lib/ui/ui_dart_state.cc b/lib/ui/ui_dart_state.cc index 06411c4d3ce98..0aac768d61167 100644 --- a/lib/ui/ui_dart_state.cc +++ b/lib/ui/ui_dart_state.cc @@ -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 #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) diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc index e2221057d2b90..973f79a76bcfa 100644 --- a/runtime/dart_isolate.cc +++ b/runtime/dart_isolate.cc @@ -404,7 +404,7 @@ void DartIsolate::SetMessageHandlingTaskRunner( message_handling_task_runner_ = runner; message_handler().Initialize([runner](std::function task) { -#ifdef OS_FUCHSIA +#ifdef FML_OS_FUCHSIA runner->PostTask([task = std::move(task)]() { TRACE_EVENT0("flutter", "DartIsolate::HandleMessage"); task(); diff --git a/runtime/dart_snapshot.cc b/runtime/dart_snapshot.cc index e567dd58d41bc..b875cbc48d2b7 100644 --- a/runtime/dart_snapshot.cc +++ b/runtime/dart_snapshot.cc @@ -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 diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc index 67749f5843bc6..c360fff76b4f6 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -32,7 +32,7 @@ namespace dart { namespace observatory { -#if !OS_FUCHSIA && !FLUTTER_RELEASE +#if !FML_OS_FUCHSIA && !FLUTTER_RELEASE // These two symbols are defined in |observatory_archive.cc| which is generated // by the |//third_party/dart/runtime/observatory:archive_observatory| rule. @@ -41,7 +41,7 @@ namespace observatory { extern unsigned int observatory_assets_archive_len; extern const uint8_t* observatory_assets_archive; -#endif // !OS_FUCHSIA && !FLUTTER_RELEASE +#endif // !FML_OS_FUCHSIA && !FLUTTER_RELEASE } // namespace observatory } // namespace dart @@ -160,7 +160,7 @@ void ThreadExitCallback() {} Dart_Handle GetVMServiceAssetsArchiveCallback() { #if FLUTTER_RELEASE return nullptr; -#elif OS_FUCHSIA +#elif FML_OS_FUCHSIA fml::UniqueFD fd = fml::OpenFile("pkg/data/observatory.tar", false, fml::FilePermission::kRead); fml::FileMapping mapping(fd, {fml::FileMapping::Protection::kRead}); @@ -334,14 +334,14 @@ DartVM::DartVM(std::shared_ptr vm_data, // precompiled code only in the debug product mode. bool enable_asserts = !settings_.disable_dart_asserts; -#if !OS_FUCHSIA +#if !FML_OS_FUCHSIA if (IsRunningPrecompiledCode()) { enable_asserts = false; } -#endif // !OS_FUCHSIA +#endif // !FML_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 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) { @@ -403,7 +403,7 @@ DartVM::DartVM(std::shared_ptr vm_data, fml::size(kDartStartupTraceStreamsArgs)); } -#if defined(OS_FUCHSIA) +#if defined(FML_OS_FUCHSIA) PushBackAll(&args, kDartSystraceTraceBufferArgs, fml::size(kDartSystraceTraceBufferArgs)); PushBackAll(&args, kDartSystraceTraceStreamsArgs, @@ -413,7 +413,7 @@ DartVM::DartVM(std::shared_ptr vm_data, PushBackAll(&args, kDartDefaultTraceStreamsArgs, fml::size(kDartDefaultTraceStreamsArgs)); } -#endif // defined(OS_FUCHSIA) +#endif // defined(FML_OS_FUCHSIA) std::string old_gen_heap_size_args; if (settings_.old_gen_heap_size >= 0) { diff --git a/shell/common/rasterizer.cc b/shell/common/rasterizer.cc index ef12ceaf7b8af..23f4d6112768f 100644 --- a/shell/common/rasterizer.cc +++ b/shell/common/rasterizer.cc @@ -422,7 +422,7 @@ RasterStatus Rasterizer::DoDraw( // SceneDisplayLag events are disabled on Fuchsia. // see: https://github.com/flutter/flutter/issues/56598 -#if !defined(OS_FUCHSIA) +#if !defined(FML_OS_FUCHSIA) const fml::TimePoint raster_finish_time = frame_timings_recorder->GetRasterEndTime(); fml::TimePoint frame_target_time = @@ -629,7 +629,7 @@ static sk_sp ScreenshotLayerTreeAsPicture( root_surface_transformation, false, true, nullptr); frame->Raster(*tree, true, nullptr); -#if defined(OS_FUCHSIA) +#if defined(FML_OS_FUCHSIA) SkSerialProcs procs = {0}; procs.fImageProc = SerializeImageWithoutData; procs.fTypefaceProc = SerializeTypefaceWithoutData; diff --git a/shell/common/shell_io_manager.cc b/shell/common/shell_io_manager.cc index c8b626900116c..fd031ece0915b 100644 --- a/shell/common/shell_io_manager.cc +++ b/shell/common/shell_io_manager.cc @@ -19,7 +19,7 @@ sk_sp ShellIOManager::CreateCompatibleResourceLoadingContext( const auto options = MakeDefaultContextOptions(ContextType::kResource); -#if !OS_FUCHSIA +#if !FML_OS_FUCHSIA if (auto context = GrDirectContext::MakeGL(gl_interface, options)) { // Do not cache textures created by the image decoder. These textures // should be deleted when they are no longer referenced by an SkImage. @@ -48,11 +48,11 @@ ShellIOManager::ShellIOManager( is_gpu_disabled_sync_switch_(is_gpu_disabled_sync_switch), weak_factory_(this) { if (!resource_context_) { -#ifndef OS_FUCHSIA +#ifndef FML_OS_FUCHSIA FML_DLOG(WARNING) << "The IO manager was initialized without a resource " "context. Async texture uploads will be disabled. " "Expect performance degradation."; -#endif // OS_FUCHSIA +#endif // FML_OS_FUCHSIA } } diff --git a/shell/common/shell_test.cc b/shell/common/shell_test.cc index 4a01c96da7e7a..1a7f853c61a23 100644 --- a/shell/common/shell_test.cc +++ b/shell/common/shell_test.cc @@ -294,7 +294,7 @@ Settings ShellTest::CreateSettingsForFixture() { settings.isolate_create_callback = [this]() { native_resolver_->SetNativeResolverForIsolate(); }; -#if OS_FUCHSIA +#if FML_OS_FUCHSIA settings.verbose_logging = true; #endif SetSnapshotsAndAssets(settings); diff --git a/shell/common/shell_unittests.cc b/shell/common/shell_unittests.cc index 843b3c0a699da..71658bd2e40c0 100644 --- a/shell/common/shell_unittests.cc +++ b/shell/common/shell_unittests.cc @@ -761,7 +761,7 @@ TEST_F(ShellTest, ExternalEmbedderNoThreadMerger) { // TODO(https://github.com/flutter/flutter/issues/59816): Enable on fuchsia. TEST_F(ShellTest, -#if defined(OS_FUCHSIA) +#if defined(FML_OS_FUCHSIA) DISABLED_ExternalEmbedderEndFrameIsCalledWhenPostPrerollResultIsResubmit #else ExternalEmbedderEndFrameIsCalledWhenPostPrerollResultIsResubmit @@ -815,7 +815,7 @@ TEST_F(ShellTest, } TEST_F(ShellTest, -#if defined(OS_FUCHSIA) || defined(WINUWP) +#if defined(FML_OS_FUCHSIA) || defined(WINUWP) // TODO(dworsham): https://github.com/flutter/flutter/issues/59816 // TODO(cbracken): https://github.com/flutter/flutter/issues/90481 DISABLED_OnPlatformViewDestroyDisablesThreadMerger @@ -878,7 +878,7 @@ TEST_F(ShellTest, // TODO(https://github.com/flutter/flutter/issues/59816): Enable on fuchsia. TEST_F(ShellTest, -#if defined(OS_FUCHSIA) +#if defined(FML_OS_FUCHSIA) DISABLED_OnPlatformViewDestroyAfterMergingThreads #else OnPlatformViewDestroyAfterMergingThreads @@ -958,7 +958,7 @@ TEST_F(ShellTest, // TODO(https://github.com/flutter/flutter/issues/59816): Enable on fuchsia. TEST_F(ShellTest, -#if defined(OS_FUCHSIA) +#if defined(FML_OS_FUCHSIA) DISABLED_OnPlatformViewDestroyWhenThreadsAreMerging #else OnPlatformViewDestroyWhenThreadsAreMerging @@ -1039,7 +1039,7 @@ TEST_F(ShellTest, // TODO(https://github.com/flutter/flutter/issues/59816): Enable on fuchsia. TEST_F(ShellTest, -#if defined(OS_FUCHSIA) +#if defined(FML_OS_FUCHSIA) DISABLED_OnPlatformViewDestroyWithThreadMergerWhileThreadsAreUnmerged #else OnPlatformViewDestroyWithThreadMergerWhileThreadsAreUnmerged @@ -1148,7 +1148,7 @@ TEST_F(ShellTest, OnPlatformViewDestroyWithoutRasterThreadMerger) { // TODO(https://github.com/flutter/flutter/issues/59816): Enable on fuchsia. TEST_F(ShellTest, -#if defined(OS_FUCHSIA) +#if defined(FML_OS_FUCHSIA) DISABLED_OnPlatformViewDestroyWithStaticThreadMerging #else OnPlatformViewDestroyWithStaticThreadMerging @@ -1213,7 +1213,7 @@ TEST_F(ShellTest, // TODO(https://github.com/flutter/flutter/issues/66056): Deflake on all other // platforms TEST_F(ShellTest, -#if defined(OS_FUCHSIA) +#if defined(FML_OS_FUCHSIA) DISABLED_SkipAndSubmitFrame #else DISABLED_SkipAndSubmitFrame @@ -1265,7 +1265,7 @@ TEST_F(ShellTest, // TODO(https://github.com/flutter/flutter/issues/59816): Enable on fuchsia. TEST_F(ShellTest, -#if defined(OS_FUCHSIA) +#if defined(FML_OS_FUCHSIA) DISABLED_ResubmitFrame #else ResubmitFrame @@ -2671,7 +2671,7 @@ TEST_F(ShellTest, } } -#if defined(OS_FUCHSIA) +#if defined(FML_OS_FUCHSIA) TEST_F(ShellTest, AssetManagerMultiSubdir) { std::string subdir_path = "subdir"; @@ -2732,7 +2732,7 @@ TEST_F(ShellTest, AssetManagerMultiSubdir) { expected_results.end()); } } -#endif // OS_FUCHSIA +#endif // FML_OS_FUCHSIA TEST_F(ShellTest, Spawn) { auto settings = CreateSettingsForFixture(); diff --git a/shell/common/skia_event_tracer_impl.cc b/shell/common/skia_event_tracer_impl.cc index e3120db25a0d3..0adffe202de39 100644 --- a/shell/common/skia_event_tracer_impl.cc +++ b/shell/common/skia_event_tracer_impl.cc @@ -16,7 +16,7 @@ #include "third_party/skia/include/utils/SkEventTracer.h" #include "third_party/skia/include/utils/SkTraceEventPhase.h" -#if defined(OS_FUCHSIA) +#if defined(FML_OS_FUCHSIA) #include #include @@ -38,7 +38,7 @@ #define TRACE_VALUE_TYPE_COPY_STRING (static_cast(7)) #define TRACE_VALUE_TYPE_CONVERTABLE (static_cast(8)) -#endif // defined(OS_FUCHSIA) +#endif // defined(FML_OS_FUCHSIA) namespace flutter { @@ -52,15 +52,15 @@ constexpr std::string_view kTraceCategoryPrefix = "disabled-by-default-"; constexpr std::string_view kShaderCategoryName = "disabled-by-default-skia.shaders"; -#if !defined(OS_FUCHSIA) +#if !defined(FML_OS_FUCHSIA) // Argument name of the tag used by DevTools. constexpr char kDevtoolsTagArg[] = "devtoolsTag"; // DevtoolsTag value for shader events. constexpr char kShadersDevtoolsTag[] = "shaders"; -#endif // !defined(OS_FUCHSIA) +#endif // !defined(FML_OS_FUCHSIA) -#if defined(OS_FUCHSIA) +#if defined(FML_OS_FUCHSIA) template inline T BitCast(const U& u) { static_assert(sizeof(T) == sizeof(U)); @@ -69,7 +69,7 @@ inline T BitCast(const U& u) { memcpy(&t, &u, sizeof(t)); return t; } -#endif // defined(OS_FUCHSIA) +#endif // defined(FML_OS_FUCHSIA) } // namespace @@ -99,7 +99,7 @@ class FlutterEventTracer : public SkEventTracer { const uint8_t* p_arg_types, const uint64_t* p_arg_values, uint8_t flags) override { -#if defined(OS_FUCHSIA) +#if defined(FML_OS_FUCHSIA) static trace_site_t trace_site; trace_string_ref_t category_ref; trace_context_t* trace_context = trace_acquire_context_for_category_cached( @@ -210,7 +210,7 @@ class FlutterEventTracer : public SkEventTracer { trace_release_context(trace_context); -#else // defined(OS_FUCHSIA) +#else // defined(FML_OS_FUCHSIA) const char* devtoolsTag = nullptr; if (shaders_category_flag_ && category_enabled_flag == shaders_category_flag_) { @@ -256,7 +256,7 @@ class FlutterEventTracer : public SkEventTracer { default: break; } -#endif // defined(OS_FUCHSIA) +#endif // defined(FML_OS_FUCHSIA) return 0; } @@ -265,7 +265,7 @@ class FlutterEventTracer : public SkEventTracer { SkEventTracer::Handle handle) override { // This is only ever called from a scoped trace event so we will just end // the section. -#if defined(OS_FUCHSIA) +#if defined(FML_OS_FUCHSIA) TRACE_DURATION_END(kSkiaTag, name); #else fml::tracing::TraceEventEnd(name); diff --git a/shell/common/skp_shader_warmup_unittests.cc b/shell/common/skp_shader_warmup_unittests.cc index 7790e66667fdc..4a21ed16d9da2 100644 --- a/shell/common/skp_shader_warmup_unittests.cc +++ b/shell/common/skp_shader_warmup_unittests.cc @@ -25,7 +25,7 @@ #include "include/core/SkSerialProcs.h" #include "include/core/SkTextBlob.h" -#if defined(OS_FUCHSIA) +#if defined(FML_OS_FUCHSIA) #include "lib/sys/cpp/component_context.h" #include "third_party/skia/include/ports/SkFontMgr_fuchsia.h" @@ -298,4 +298,4 @@ TEST_F(SkpWarmupTest, DISABLED_Text) { } // namespace testing } // namespace flutter -#endif // defined(OS_FUCHSIA) +#endif // defined(FML_OS_FUCHSIA) diff --git a/shell/common/switches.cc b/shell/common/switches.cc index 29bc3d5e9e269..7f507b0786b75 100644 --- a/shell/common/switches.cc +++ b/shell/common/switches.cc @@ -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] { diff --git a/shell/common/vsync_waiter.cc b/shell/common/vsync_waiter.cc index 1755755182e87..555ba20a9f18b 100644 --- a/shell/common/vsync_waiter.cc +++ b/shell/common/vsync_waiter.cc @@ -16,7 +16,7 @@ namespace flutter { static constexpr const char* kVsyncFlowName = "VsyncFlow"; -#if defined(OS_FUCHSIA) +#if defined(FML_OS_FUCHSIA) // ________ _________ ________ ________ // |\ ____\|\___ ___\\ __ \|\ __ \ // \ \ \___|\|___ \ \_\ \ \|\ \ \ \|\ \ diff --git a/shell/platform/android/jni/platform_view_android_jni.h b/shell/platform/android/jni/platform_view_android_jni.h index cb838b2c200df..8e38a385fe771 100644 --- a/shell/platform/android/jni/platform_view_android_jni.h +++ b/shell/platform/android/jni/platform_view_android_jni.h @@ -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; #else using JavaLocalRef = std::nullptr_t; diff --git a/shell/platform/android/surface/android_native_window.cc b/shell/platform/android/surface/android_native_window.cc index 5e4ebef7840b5..20e75f57aaf58 100644 --- a/shell/platform/android/surface/android_native_window.cc +++ b/shell/platform/android/surface/android_native_window.cc @@ -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 diff --git a/shell/platform/android/surface/android_native_window.h b/shell/platform/android/surface/android_native_window.h index ac684b955eb4b..633ee02fadc13 100644 --- a/shell/platform/android/surface/android_native_window.h +++ b/shell/platform/android/surface/android_native_window.h @@ -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 -#endif // OS_ANDROID +#endif // FML_OS_ANDROID namespace flutter { class AndroidNativeWindow : public fml::RefCountedThreadSafe { 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; diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index c08651e6f3973..abe98716ea9cf 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -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 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( const_cast(proc_library->ResolveSymbol(name))); } -#endif // OS_LINUX || OS_WIN +#endif // FML_OS_LINUX || OS_WIN static flutter::Shell::CreateCallback 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 } @@ -791,7 +791,7 @@ FlutterEngineResult FlutterEngineCreateAOTData( auto aot_data = std::make_unique<_FlutterEngineAOTData>(); const char* error = nullptr; -#if OS_FUCHSIA +#if FML_OS_FUCHSIA // TODO(gw280): https://github.com/flutter/flutter/issues/50285 // Dart doesn't implement Dart_LoadELF on Fuchsia Dart_LoadedElf* loaded_elf = nullptr; @@ -884,10 +884,11 @@ void PopulateSnapshotMappingCallbacks( } } -#if !OS_FUCHSIA && (FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG) +#if !FML_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 // !FML_OS_FUCHSIA && (FLUTTER_RUNTIME_MODE == + // FLUTTER_RUNTIME_MODE_DEBUG) } FlutterEngineResult FlutterEngineRun(size_t version, diff --git a/shell/platform/embedder/tests/embedder_unittests.cc b/shell/platform/embedder/tests/embedder_unittests.cc index 3108cff91e200..5dccfab382910 100644 --- a/shell/platform/embedder/tests/embedder_unittests.cc +++ b/shell/platform/embedder/tests/embedder_unittests.cc @@ -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)); } diff --git a/shell/testing/tester_main.cc b/shell/testing/tester_main.cc index b96166c5faee6..b059908416b78 100644 --- a/shell/testing/tester_main.cc +++ b/shell/testing/tester_main.cc @@ -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 -#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, diff --git a/testing/dart_fixture.cc b/testing/dart_fixture.cc index 2852f4165fb54..0f92085406098 100644 --- a/testing/dart_fixture.cc +++ b/testing/dart_fixture.cc @@ -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> kernel_mappings; diff --git a/testing/debugger_detection.cc b/testing/debugger_detection.cc index 91a51ee3e8e0d..8ce2321763eac 100644 --- a/testing/debugger_detection.cc +++ b/testing/debugger_detection.cc @@ -7,13 +7,13 @@ #include "flutter/fml/build_config.h" #include "flutter/fml/logging.h" -#if OS_MACOSX +#if FML_OS_MACOSX #include #include #include #include #include -#endif // OS_MACOSX +#endif // FML_OS_MACOSX #if OS_WIN #include @@ -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]; diff --git a/testing/elf_loader.cc b/testing/elf_loader.cc index 50b6e43960bec..087ff70c999ed 100644 --- a/testing/elf_loader.cc +++ b/testing/elf_loader.cc @@ -31,7 +31,7 @@ ELFAOTSymbols LoadELFSymbolFromFixturesIfNeccessary(std::string elf_filename) { // Must not be freed. const char* error = nullptr; -#if OS_FUCHSIA +#if FML_OS_FUCHSIA // TODO(gw280): https://github.com/flutter/flutter/issues/50285 // Dart doesn't implement Dart_LoadELF on Fuchsia auto loaded_elf = nullptr; @@ -80,7 +80,7 @@ ELFAOTSymbols LoadELFSplitSymbolFromFixturesIfNeccessary( // Must not be freed. const char* error = nullptr; -#if OS_FUCHSIA +#if FML_OS_FUCHSIA // TODO(gw280): https://github.com/flutter/flutter/issues/50285 // Dart doesn't implement Dart_LoadELF on Fuchsia auto loaded_elf = nullptr; diff --git a/testing/test_gl_surface.cc b/testing/test_gl_surface.cc index 36ffe6831a336..8ee71caa26b65 100644 --- a/testing/test_gl_surface.cc +++ b/testing/test_gl_surface.cc @@ -298,7 +298,7 @@ sk_sp 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; diff --git a/testing/test_vulkan_context.cc b/testing/test_vulkan_context.cc index ab83100982055..73df59d813104 100644 --- a/testing/test_vulkan_context.cc +++ b/testing/test_vulkan_context.cc @@ -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" diff --git a/vulkan/vulkan_application.cc b/vulkan/vulkan_application.cc index 31dd54aaa1bf1..a5c8ecd43bfb5 100644 --- a/vulkan/vulkan_application.cc +++ b/vulkan/vulkan_application.cc @@ -37,7 +37,7 @@ VulkanApplication::VulkanApplication( if (enable_instance_debugging) { enabled_extensions.emplace_back(VulkanDebugReport::DebugExtensionName()); } -#if OS_FUCHSIA +#if FML_OS_FUCHSIA if (ExtensionSupported(supported_extensions, VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME)) { // VK_KHR_get_physical_device_properties2 is a dependency of the memory diff --git a/vulkan/vulkan_device.cc b/vulkan/vulkan_device.cc index c4a8d334b9102..80e4055466b7d 100644 --- a/vulkan/vulkan_device.cc +++ b/vulkan/vulkan_device.cc @@ -60,10 +60,10 @@ VulkanDevice::VulkanDevice(VulkanProcTable& p_vk, }; const char* extensions[] = { -#if OS_ANDROID +#if FML_OS_ANDROID VK_KHR_SWAPCHAIN_EXTENSION_NAME, #endif -#if OS_FUCHSIA +#if FML_OS_FUCHSIA VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME, VK_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME, VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME, @@ -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 VulkanDevice::GetQueueFamilyProperties() int VulkanDevice::ChooseSurfaceFormat(const VulkanSurface& surface, std::vector desired_formats, VkSurfaceFormatKHR* format) const { -#if OS_ANDROID +#if FML_OS_ANDROID if (!surface.IsValid() || format == nullptr) { return -1; } diff --git a/vulkan/vulkan_interface.h b/vulkan/vulkan_interface.h index e973b5ffafeb6..190f629c1ce64 100644 --- a/vulkan/vulkan_interface.h +++ b/vulkan/vulkan_interface.h @@ -10,20 +10,20 @@ #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 +#if FML_OS_FUCHSIA #ifndef VK_USE_PLATFORM_MAGMA_KHR #define VK_USE_PLATFORM_MAGMA_KHR 1 #endif // VK_USE_PLATFORM_MAGMA_KHR #ifndef VK_USE_PLATFORM_FUCHSIA #define VK_USE_PLATFORM_FUCHSIA 1 #endif // VK_USE_PLATFORM_FUCHSIA -#endif // OS_FUCHSIA +#endif // FML_OS_FUCHSIA #if !VULKAN_LINK_STATICALLY #define VK_NO_PROTOTYPES 1 diff --git a/vulkan/vulkan_proc_table.cc b/vulkan/vulkan_proc_table.cc index d5017e313a382..117d2fe9b00d3 100644 --- a/vulkan/vulkan_proc_table.cc +++ b/vulkan/vulkan_proc_table.cc @@ -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,14 +130,14 @@ 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 -#if OS_FUCHSIA +#endif // FML_OS_ANDROID +#if FML_OS_FUCHSIA ACQUIRE_PROC(ImportSemaphoreZirconHandleFUCHSIA, handle); ACQUIRE_PROC(GetSemaphoreZirconHandleFUCHSIA, handle); ACQUIRE_PROC(GetMemoryZirconHandleFUCHSIA, handle); @@ -145,7 +145,7 @@ bool VulkanProcTable::SetupDeviceProcAddresses( ACQUIRE_PROC(DestroyBufferCollectionFUCHSIA, handle); ACQUIRE_PROC(SetBufferCollectionImageConstraintsFUCHSIA, handle); ACQUIRE_PROC(GetBufferCollectionPropertiesFUCHSIA, handle); -#endif // OS_FUCHSIA +#endif // FML_OS_FUCHSIA #endif // TEST_VULKAN_PROCS device_ = VulkanHandle{handle, nullptr}; return true; diff --git a/vulkan/vulkan_proc_table.h b/vulkan/vulkan_proc_table.h index fddb8cfda96d8..5b5a8c9f85748 100644 --- a/vulkan/vulkan_proc_table.h +++ b/vulkan/vulkan_proc_table.h @@ -107,7 +107,7 @@ class VulkanProcTable : public fml::RefCountedThreadSafe { 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,8 +115,8 @@ class VulkanProcTable : public fml::RefCountedThreadSafe { DEFINE_PROC(GetSwapchainImagesKHR); DEFINE_PROC(QueuePresentKHR); DEFINE_PROC(CreateAndroidSurfaceKHR); -#endif // OS_ANDROID -#if OS_FUCHSIA +#endif // FML_OS_ANDROID +#if FML_OS_FUCHSIA DEFINE_PROC(ImportSemaphoreZirconHandleFUCHSIA); DEFINE_PROC(GetSemaphoreZirconHandleFUCHSIA); DEFINE_PROC(GetMemoryZirconHandleFUCHSIA); @@ -124,7 +124,7 @@ class VulkanProcTable : public fml::RefCountedThreadSafe { DEFINE_PROC(DestroyBufferCollectionFUCHSIA); DEFINE_PROC(SetBufferCollectionImageConstraintsFUCHSIA); DEFINE_PROC(GetBufferCollectionPropertiesFUCHSIA); -#endif // OS_FUCHSIA +#endif // FML_OS_FUCHSIA #endif // TEST_VULKAN_PROCS #undef DEFINE_PROC diff --git a/vulkan/vulkan_swapchain.h b/vulkan/vulkan_swapchain.h index 9c8fc6717e9d8..b617b659d04fb 100644 --- a/vulkan/vulkan_swapchain.h +++ b/vulkan/vulkan_swapchain.h @@ -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 color_space) const; VulkanBackbuffer* GetNextBackbuffer(); -#endif // OS_ANDROID +#endif // FML_OS_ANDROID FML_DISALLOW_COPY_AND_ASSIGN(VulkanSwapchain); }; diff --git a/vulkan/vulkan_utilities.cc b/vulkan/vulkan_utilities.cc index 8077a1e4fde61..e005d3286b22a 100644 --- a/vulkan/vulkan_utilities.cc +++ b/vulkan/vulkan_utilities.cc @@ -18,7 +18,7 @@ bool ValidationLayerInfoMessagesEnabled() { } bool ValidationErrorsFatal() { -#if OS_FUCHSIA +#if FML_OS_FUCHSIA return false; #endif return true; @@ -34,7 +34,7 @@ static std::vector InstanceOrDeviceLayersToEnable( // NOTE: The loader is sensitive to the ordering here. Please do not rearrange // this list. -#if OS_FUCHSIA +#if FML_OS_FUCHSIA // The other layers in the Fuchsia SDK seem to have a bug right now causing // crashes, so it is only recommended that we use VK_LAYER_KHRONOS_validation // until we have a confirmation that they are fixed. From f40a4ee46367b399c0cd4b34c45a7ef29c2396a0 Mon Sep 17 00:00:00 2001 From: Brandon DeRosier Date: Fri, 28 Jan 2022 14:21:28 -0800 Subject: [PATCH 3/4] Remove OS_FUCHSIA change because FEMU is sad --- display_list/display_list_canvas_unittests.cc | 4 ++-- flow/flow_run_all_unittests.cc | 2 +- flow/frame_timings_recorder_unittests.cc | 2 +- .../performance_overlay_layer_unittests.cc | 4 ++-- fml/build_config.h | 2 +- fml/log_settings.cc | 4 ++-- fml/logging.cc | 10 +++++----- fml/logging_unittests.cc | 4 ++-- fml/message_loop_impl.cc | 4 ++-- fml/thread.cc | 4 ++-- fml/time/time_point.cc | 4 ++-- fml/trace_event.h | 10 +++++----- runtime/dart_isolate.cc | 2 +- runtime/dart_vm.cc | 14 ++++++------- shell/common/rasterizer.cc | 4 ++-- shell/common/shell_io_manager.cc | 6 +++--- shell/common/shell_test.cc | 2 +- shell/common/shell_unittests.cc | 20 +++++++++---------- shell/common/skia_event_tracer_impl.cc | 20 +++++++++---------- shell/common/skp_shader_warmup_unittests.cc | 4 ++-- shell/common/vsync_waiter.cc | 2 +- shell/platform/embedder/embedder.cc | 6 +++--- testing/elf_loader.cc | 4 ++-- vulkan/vulkan_application.cc | 2 +- vulkan/vulkan_device.cc | 2 +- vulkan/vulkan_interface.h | 4 ++-- vulkan/vulkan_proc_table.cc | 4 ++-- vulkan/vulkan_proc_table.h | 4 ++-- vulkan/vulkan_utilities.cc | 4 ++-- 29 files changed, 79 insertions(+), 79 deletions(-) diff --git a/display_list/display_list_canvas_unittests.cc b/display_list/display_list_canvas_unittests.cc index 310c23cf5cc38..f64a471ed30f3 100644 --- a/display_list/display_list_canvas_unittests.cc +++ b/display_list/display_list_canvas_unittests.cc @@ -2970,9 +2970,9 @@ TEST_F(DisplayListCanvas, DrawTextBlob) { // TODO(https://github.com/flutter/flutter/issues/82202): Remove once the // performance overlay can use Fuchsia's font manager instead of the empty // default. -#if defined(FML_OS_FUCHSIA) +#if defined(OS_FUCHSIA) GTEST_SKIP() << "Rendering comparisons require a valid default font manager"; -#endif // FML_OS_FUCHSIA +#endif // OS_FUCHSIA sk_sp blob = CanvasCompareTester::MakeTextBlob("Testing", RenderHeight * 0.33f); SkScalar RenderY1_3 = RenderTop + RenderHeight * 0.3; diff --git a/flow/flow_run_all_unittests.cc b/flow/flow_run_all_unittests.cc index 40d2ac2497725..e2106829a83c4 100644 --- a/flow/flow_run_all_unittests.cc +++ b/flow/flow_run_all_unittests.cc @@ -15,7 +15,7 @@ int main(int argc, char** argv) { testing::InitGoogleTest(&argc, argv); fml::CommandLine cmd = fml::CommandLineFromArgcArgv(argc, argv); -#if defined(FML_OS_FUCHSIA) +#if defined(OS_FUCHSIA) flutter::SetGoldenDir(cmd.GetOptionValueWithDefault( "golden-dir", "/pkg/data/flutter/testing/resources")); #else diff --git a/flow/frame_timings_recorder_unittests.cc b/flow/frame_timings_recorder_unittests.cc index a976f67dd4542..434f06b802e6f 100644 --- a/flow/frame_timings_recorder_unittests.cc +++ b/flow/frame_timings_recorder_unittests.cc @@ -122,7 +122,7 @@ TEST(FrameTimingsRecorderTest, RecordRasterTimesWithCache) { } // Windows and Fuchsia don't allow testing with killed by signal. -#if !defined(FML_OS_FUCHSIA) && !defined(OS_WIN) && \ +#if !defined(OS_FUCHSIA) && !defined(OS_WIN) && \ (FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG) TEST(FrameTimingsRecorderTest, ThrowWhenRecordBuildBeforeVsync) { diff --git a/flow/layers/performance_overlay_layer_unittests.cc b/flow/layers/performance_overlay_layer_unittests.cc index 0d130ef484cb7..be49685a99496 100644 --- a/flow/layers/performance_overlay_layer_unittests.cc +++ b/flow/layers/performance_overlay_layer_unittests.cc @@ -170,9 +170,9 @@ TEST_F(PerformanceOverlayLayerTest, SimpleRasterizerStatistics) { // TODO(https://github.com/flutter/flutter/issues/82202): Remove once the // performance overlay can use Fuchsia's font manager instead of the empty // default. -#if defined(FML_OS_FUCHSIA) +#if defined(OS_FUCHSIA) GTEST_SKIP() << "Expectation requires a valid default font manager"; -#endif // FML_OS_FUCHSIA +#endif // OS_FUCHSIA EXPECT_EQ(mock_canvas().draw_calls(), std::vector({MockCanvas::DrawCall{ 0, MockCanvas::DrawTextData{overlay_text_data, text_paint, diff --git a/fml/build_config.h b/fml/build_config.h index ed202fb460060..256201614d467 100644 --- a/fml/build_config.h +++ b/fml/build_config.h @@ -17,7 +17,7 @@ #define FLUTTER_FML_BUILD_CONFIG_H_ #if defined(__Fuchsia__) -#define FML_OS_FUCHSIA 1 +#define OS_FUCHSIA 1 #elif defined(ANDROID) #define FML_OS_ANDROID 1 #elif defined(__APPLE__) diff --git a/fml/log_settings.cc b/fml/log_settings.cc index 78067d4a1999c..4388a1a277f5c 100644 --- a/fml/log_settings.cc +++ b/fml/log_settings.cc @@ -13,7 +13,7 @@ #include "flutter/fml/build_config.h" #include "flutter/fml/logging.h" -#if defined(FML_OS_FUCHSIA) +#if defined(OS_FUCHSIA) #include #endif @@ -29,7 +29,7 @@ void SetLogSettings(const LogSettings& settings) { // Validate the new settings as we set them. state::g_log_settings.min_log_level = std::min(LOG_FATAL, settings.min_log_level); -#if defined(FML_OS_FUCHSIA) +#if defined(OS_FUCHSIA) // Syslog should accept all logs, since filtering by severity is done by fml. FX_LOG_SET_SEVERITY(ALL); #endif diff --git a/fml/logging.cc b/fml/logging.cc index a36a93472ed55..5830cb79c2624 100644 --- a/fml/logging.cc +++ b/fml/logging.cc @@ -13,7 +13,7 @@ #include #elif defined(OS_IOS) #include -#elif defined(FML_OS_FUCHSIA) +#elif defined(OS_FUCHSIA) #include #endif @@ -21,7 +21,7 @@ namespace fml { namespace { -#if !defined(FML_OS_FUCHSIA) +#if !defined(OS_FUCHSIA) const char* const kLogSeverityNames[LOG_NUM_SEVERITIES] = {"INFO", "WARNING", "ERROR", "FATAL"}; @@ -55,7 +55,7 @@ LogMessage::LogMessage(LogSeverity severity, int line, const char* condition) : severity_(severity), file_(file), line_(line) { -#if !defined(FML_OS_FUCHSIA) +#if !defined(OS_FUCHSIA) stream_ << "["; if (severity >= LOG_INFO) { stream_ << GetNameForLogSeverity(severity); @@ -72,7 +72,7 @@ LogMessage::LogMessage(LogSeverity severity, } LogMessage::~LogMessage() { -#if !defined(FML_OS_FUCHSIA) +#if !defined(OS_FUCHSIA) stream_ << std::endl; #endif @@ -96,7 +96,7 @@ LogMessage::~LogMessage() { __android_log_write(priority, "flutter", stream_.str().c_str()); #elif defined(OS_IOS) syslog(LOG_ALERT, "%s", stream_.str().c_str()); -#elif defined(FML_OS_FUCHSIA) +#elif defined(OS_FUCHSIA) fx_log_severity_t fx_severity; switch (severity_) { case LOG_INFO: diff --git a/fml/logging_unittests.cc b/fml/logging_unittests.cc index 1b9e0262bc7f6..18ac1ad8fa8c6 100644 --- a/fml/logging_unittests.cc +++ b/fml/logging_unittests.cc @@ -7,7 +7,7 @@ #include "flutter/fml/logging.h" #include "gtest/gtest.h" -#if defined(FML_OS_FUCHSIA) +#if defined(OS_FUCHSIA) #include #include #include @@ -39,7 +39,7 @@ TEST(LoggingTest, UnreachableKillProcessWithMacro) { ASSERT_DEATH({ FML_UNREACHABLE(); }, ""); } -#if defined(FML_OS_FUCHSIA) +#if defined(OS_FUCHSIA) struct LogPacket { fx_log_metadata_t metadata; diff --git a/fml/message_loop_impl.cc b/fml/message_loop_impl.cc index 6c85bda2a0d23..ca47c0964e896 100644 --- a/fml/message_loop_impl.cc +++ b/fml/message_loop_impl.cc @@ -17,7 +17,7 @@ #include "flutter/fml/platform/darwin/message_loop_darwin.h" #elif FML_OS_ANDROID #include "flutter/fml/platform/android/message_loop_android.h" -#elif FML_OS_FUCHSIA +#elif OS_FUCHSIA #include "flutter/fml/platform/fuchsia/message_loop_fuchsia.h" #elif FML_OS_LINUX #include "flutter/fml/platform/linux/message_loop_linux.h" @@ -32,7 +32,7 @@ fml::RefPtr MessageLoopImpl::Create() { return fml::MakeRefCounted(); #elif FML_OS_ANDROID return fml::MakeRefCounted(); -#elif FML_OS_FUCHSIA +#elif OS_FUCHSIA return fml::MakeRefCounted(); #elif FML_OS_LINUX return fml::MakeRefCounted(); diff --git a/fml/thread.cc b/fml/thread.cc index 3f4c42f3f7ae0..7a5e951da1621 100644 --- a/fml/thread.cc +++ b/fml/thread.cc @@ -15,7 +15,7 @@ #if defined(OS_WIN) #include -#elif defined(FML_OS_FUCHSIA) +#elif defined(OS_FUCHSIA) #include #else #include @@ -86,7 +86,7 @@ void Thread::SetCurrentThreadName(const std::string& name) { reinterpret_cast(&info)); } __except (EXCEPTION_CONTINUE_EXECUTION) { } -#elif defined(FML_OS_FUCHSIA) +#elif defined(OS_FUCHSIA) zx::thread::self()->set_property(ZX_PROP_NAME, name.c_str(), name.size()); #else FML_DLOG(INFO) << "Could not set the thread name to '" << name diff --git a/fml/time/time_point.cc b/fml/time/time_point.cc index 38b6b9bc996b9..e3bd652ce013a 100644 --- a/fml/time/time_point.cc +++ b/fml/time/time_point.cc @@ -8,7 +8,7 @@ #include "flutter/fml/logging.h" #include "flutter/fml/time/dart_timestamp_provider.h" -#if defined(FML_OS_FUCHSIA) +#if defined(OS_FUCHSIA) #include #else #include @@ -16,7 +16,7 @@ namespace fml { -#if defined(FML_OS_FUCHSIA) +#if defined(OS_FUCHSIA) // static TimePoint TimePoint::Now() { diff --git a/fml/trace_event.h b/fml/trace_event.h index c24308057ba6d..d89e421a7bec6 100644 --- a/fml/trace_event.h +++ b/fml/trace_event.h @@ -9,7 +9,7 @@ #include "flutter/fml/build_config.h" -#if defined(FML_OS_FUCHSIA) +#if defined(OS_FUCHSIA) // Forward to the system tracing mechanism on Fuchsia. @@ -35,7 +35,7 @@ #define TRACE_EVENT_INSTANT2(a, b, k1, v1, k2, v2) \ TRACE_INSTANT(a, b, TRACE_SCOPE_THREAD, k1, v1, k2, v2) -#endif // defined(FML_OS_FUCHSIA) +#endif // defined(OS_FUCHSIA) #include #include @@ -47,13 +47,13 @@ #include "flutter/fml/time/time_point.h" #include "third_party/dart/runtime/include/dart_tools_api.h" -#if (FLUTTER_RELEASE && !defined(FML_OS_FUCHSIA) && !defined(FML_OS_ANDROID)) +#if (FLUTTER_RELEASE && !defined(OS_FUCHSIA) && !defined(FML_OS_ANDROID)) #define FLUTTER_TIMELINE_ENABLED 0 #else #define FLUTTER_TIMELINE_ENABLED 1 #endif -#if !defined(FML_OS_FUCHSIA) +#if !defined(OS_FUCHSIA) #ifndef TRACE_EVENT_HIDE_MACROS #define __FML__TOKEN_CAT__(x, y) x##y @@ -137,7 +137,7 @@ ::fml::tracing::TraceEventFlowEnd0(category, name, id); #endif // TRACE_EVENT_HIDE_MACROS -#endif // !defined(FML_OS_FUCHSIA) +#endif // !defined(OS_FUCHSIA) namespace fml { namespace tracing { diff --git a/runtime/dart_isolate.cc b/runtime/dart_isolate.cc index 973f79a76bcfa..e2221057d2b90 100644 --- a/runtime/dart_isolate.cc +++ b/runtime/dart_isolate.cc @@ -404,7 +404,7 @@ void DartIsolate::SetMessageHandlingTaskRunner( message_handling_task_runner_ = runner; message_handler().Initialize([runner](std::function task) { -#ifdef FML_OS_FUCHSIA +#ifdef OS_FUCHSIA runner->PostTask([task = std::move(task)]() { TRACE_EVENT0("flutter", "DartIsolate::HandleMessage"); task(); diff --git a/runtime/dart_vm.cc b/runtime/dart_vm.cc index c360fff76b4f6..77bf094e960a3 100644 --- a/runtime/dart_vm.cc +++ b/runtime/dart_vm.cc @@ -32,7 +32,7 @@ namespace dart { namespace observatory { -#if !FML_OS_FUCHSIA && !FLUTTER_RELEASE +#if !OS_FUCHSIA && !FLUTTER_RELEASE // These two symbols are defined in |observatory_archive.cc| which is generated // by the |//third_party/dart/runtime/observatory:archive_observatory| rule. @@ -41,7 +41,7 @@ namespace observatory { extern unsigned int observatory_assets_archive_len; extern const uint8_t* observatory_assets_archive; -#endif // !FML_OS_FUCHSIA && !FLUTTER_RELEASE +#endif // !OS_FUCHSIA && !FLUTTER_RELEASE } // namespace observatory } // namespace dart @@ -160,7 +160,7 @@ void ThreadExitCallback() {} Dart_Handle GetVMServiceAssetsArchiveCallback() { #if FLUTTER_RELEASE return nullptr; -#elif FML_OS_FUCHSIA +#elif OS_FUCHSIA fml::UniqueFD fd = fml::OpenFile("pkg/data/observatory.tar", false, fml::FilePermission::kRead); fml::FileMapping mapping(fd, {fml::FileMapping::Protection::kRead}); @@ -334,11 +334,11 @@ DartVM::DartVM(std::shared_ptr vm_data, // precompiled code only in the debug product mode. bool enable_asserts = !settings_.disable_dart_asserts; -#if !FML_OS_FUCHSIA +#if !OS_FUCHSIA if (IsRunningPrecompiledCode()) { enable_asserts = false; } -#endif // !FML_OS_FUCHSIA +#endif // !OS_FUCHSIA #if (FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG) #if !OS_IOS && !FML_OS_MACOSX @@ -403,7 +403,7 @@ DartVM::DartVM(std::shared_ptr vm_data, fml::size(kDartStartupTraceStreamsArgs)); } -#if defined(FML_OS_FUCHSIA) +#if defined(OS_FUCHSIA) PushBackAll(&args, kDartSystraceTraceBufferArgs, fml::size(kDartSystraceTraceBufferArgs)); PushBackAll(&args, kDartSystraceTraceStreamsArgs, @@ -413,7 +413,7 @@ DartVM::DartVM(std::shared_ptr vm_data, PushBackAll(&args, kDartDefaultTraceStreamsArgs, fml::size(kDartDefaultTraceStreamsArgs)); } -#endif // defined(FML_OS_FUCHSIA) +#endif // defined(OS_FUCHSIA) std::string old_gen_heap_size_args; if (settings_.old_gen_heap_size >= 0) { diff --git a/shell/common/rasterizer.cc b/shell/common/rasterizer.cc index 23f4d6112768f..ef12ceaf7b8af 100644 --- a/shell/common/rasterizer.cc +++ b/shell/common/rasterizer.cc @@ -422,7 +422,7 @@ RasterStatus Rasterizer::DoDraw( // SceneDisplayLag events are disabled on Fuchsia. // see: https://github.com/flutter/flutter/issues/56598 -#if !defined(FML_OS_FUCHSIA) +#if !defined(OS_FUCHSIA) const fml::TimePoint raster_finish_time = frame_timings_recorder->GetRasterEndTime(); fml::TimePoint frame_target_time = @@ -629,7 +629,7 @@ static sk_sp ScreenshotLayerTreeAsPicture( root_surface_transformation, false, true, nullptr); frame->Raster(*tree, true, nullptr); -#if defined(FML_OS_FUCHSIA) +#if defined(OS_FUCHSIA) SkSerialProcs procs = {0}; procs.fImageProc = SerializeImageWithoutData; procs.fTypefaceProc = SerializeTypefaceWithoutData; diff --git a/shell/common/shell_io_manager.cc b/shell/common/shell_io_manager.cc index fd031ece0915b..c8b626900116c 100644 --- a/shell/common/shell_io_manager.cc +++ b/shell/common/shell_io_manager.cc @@ -19,7 +19,7 @@ sk_sp ShellIOManager::CreateCompatibleResourceLoadingContext( const auto options = MakeDefaultContextOptions(ContextType::kResource); -#if !FML_OS_FUCHSIA +#if !OS_FUCHSIA if (auto context = GrDirectContext::MakeGL(gl_interface, options)) { // Do not cache textures created by the image decoder. These textures // should be deleted when they are no longer referenced by an SkImage. @@ -48,11 +48,11 @@ ShellIOManager::ShellIOManager( is_gpu_disabled_sync_switch_(is_gpu_disabled_sync_switch), weak_factory_(this) { if (!resource_context_) { -#ifndef FML_OS_FUCHSIA +#ifndef OS_FUCHSIA FML_DLOG(WARNING) << "The IO manager was initialized without a resource " "context. Async texture uploads will be disabled. " "Expect performance degradation."; -#endif // FML_OS_FUCHSIA +#endif // OS_FUCHSIA } } diff --git a/shell/common/shell_test.cc b/shell/common/shell_test.cc index 1a7f853c61a23..4a01c96da7e7a 100644 --- a/shell/common/shell_test.cc +++ b/shell/common/shell_test.cc @@ -294,7 +294,7 @@ Settings ShellTest::CreateSettingsForFixture() { settings.isolate_create_callback = [this]() { native_resolver_->SetNativeResolverForIsolate(); }; -#if FML_OS_FUCHSIA +#if OS_FUCHSIA settings.verbose_logging = true; #endif SetSnapshotsAndAssets(settings); diff --git a/shell/common/shell_unittests.cc b/shell/common/shell_unittests.cc index 71658bd2e40c0..843b3c0a699da 100644 --- a/shell/common/shell_unittests.cc +++ b/shell/common/shell_unittests.cc @@ -761,7 +761,7 @@ TEST_F(ShellTest, ExternalEmbedderNoThreadMerger) { // TODO(https://github.com/flutter/flutter/issues/59816): Enable on fuchsia. TEST_F(ShellTest, -#if defined(FML_OS_FUCHSIA) +#if defined(OS_FUCHSIA) DISABLED_ExternalEmbedderEndFrameIsCalledWhenPostPrerollResultIsResubmit #else ExternalEmbedderEndFrameIsCalledWhenPostPrerollResultIsResubmit @@ -815,7 +815,7 @@ TEST_F(ShellTest, } TEST_F(ShellTest, -#if defined(FML_OS_FUCHSIA) || defined(WINUWP) +#if defined(OS_FUCHSIA) || defined(WINUWP) // TODO(dworsham): https://github.com/flutter/flutter/issues/59816 // TODO(cbracken): https://github.com/flutter/flutter/issues/90481 DISABLED_OnPlatformViewDestroyDisablesThreadMerger @@ -878,7 +878,7 @@ TEST_F(ShellTest, // TODO(https://github.com/flutter/flutter/issues/59816): Enable on fuchsia. TEST_F(ShellTest, -#if defined(FML_OS_FUCHSIA) +#if defined(OS_FUCHSIA) DISABLED_OnPlatformViewDestroyAfterMergingThreads #else OnPlatformViewDestroyAfterMergingThreads @@ -958,7 +958,7 @@ TEST_F(ShellTest, // TODO(https://github.com/flutter/flutter/issues/59816): Enable on fuchsia. TEST_F(ShellTest, -#if defined(FML_OS_FUCHSIA) +#if defined(OS_FUCHSIA) DISABLED_OnPlatformViewDestroyWhenThreadsAreMerging #else OnPlatformViewDestroyWhenThreadsAreMerging @@ -1039,7 +1039,7 @@ TEST_F(ShellTest, // TODO(https://github.com/flutter/flutter/issues/59816): Enable on fuchsia. TEST_F(ShellTest, -#if defined(FML_OS_FUCHSIA) +#if defined(OS_FUCHSIA) DISABLED_OnPlatformViewDestroyWithThreadMergerWhileThreadsAreUnmerged #else OnPlatformViewDestroyWithThreadMergerWhileThreadsAreUnmerged @@ -1148,7 +1148,7 @@ TEST_F(ShellTest, OnPlatformViewDestroyWithoutRasterThreadMerger) { // TODO(https://github.com/flutter/flutter/issues/59816): Enable on fuchsia. TEST_F(ShellTest, -#if defined(FML_OS_FUCHSIA) +#if defined(OS_FUCHSIA) DISABLED_OnPlatformViewDestroyWithStaticThreadMerging #else OnPlatformViewDestroyWithStaticThreadMerging @@ -1213,7 +1213,7 @@ TEST_F(ShellTest, // TODO(https://github.com/flutter/flutter/issues/66056): Deflake on all other // platforms TEST_F(ShellTest, -#if defined(FML_OS_FUCHSIA) +#if defined(OS_FUCHSIA) DISABLED_SkipAndSubmitFrame #else DISABLED_SkipAndSubmitFrame @@ -1265,7 +1265,7 @@ TEST_F(ShellTest, // TODO(https://github.com/flutter/flutter/issues/59816): Enable on fuchsia. TEST_F(ShellTest, -#if defined(FML_OS_FUCHSIA) +#if defined(OS_FUCHSIA) DISABLED_ResubmitFrame #else ResubmitFrame @@ -2671,7 +2671,7 @@ TEST_F(ShellTest, } } -#if defined(FML_OS_FUCHSIA) +#if defined(OS_FUCHSIA) TEST_F(ShellTest, AssetManagerMultiSubdir) { std::string subdir_path = "subdir"; @@ -2732,7 +2732,7 @@ TEST_F(ShellTest, AssetManagerMultiSubdir) { expected_results.end()); } } -#endif // FML_OS_FUCHSIA +#endif // OS_FUCHSIA TEST_F(ShellTest, Spawn) { auto settings = CreateSettingsForFixture(); diff --git a/shell/common/skia_event_tracer_impl.cc b/shell/common/skia_event_tracer_impl.cc index 0adffe202de39..e3120db25a0d3 100644 --- a/shell/common/skia_event_tracer_impl.cc +++ b/shell/common/skia_event_tracer_impl.cc @@ -16,7 +16,7 @@ #include "third_party/skia/include/utils/SkEventTracer.h" #include "third_party/skia/include/utils/SkTraceEventPhase.h" -#if defined(FML_OS_FUCHSIA) +#if defined(OS_FUCHSIA) #include #include @@ -38,7 +38,7 @@ #define TRACE_VALUE_TYPE_COPY_STRING (static_cast(7)) #define TRACE_VALUE_TYPE_CONVERTABLE (static_cast(8)) -#endif // defined(FML_OS_FUCHSIA) +#endif // defined(OS_FUCHSIA) namespace flutter { @@ -52,15 +52,15 @@ constexpr std::string_view kTraceCategoryPrefix = "disabled-by-default-"; constexpr std::string_view kShaderCategoryName = "disabled-by-default-skia.shaders"; -#if !defined(FML_OS_FUCHSIA) +#if !defined(OS_FUCHSIA) // Argument name of the tag used by DevTools. constexpr char kDevtoolsTagArg[] = "devtoolsTag"; // DevtoolsTag value for shader events. constexpr char kShadersDevtoolsTag[] = "shaders"; -#endif // !defined(FML_OS_FUCHSIA) +#endif // !defined(OS_FUCHSIA) -#if defined(FML_OS_FUCHSIA) +#if defined(OS_FUCHSIA) template inline T BitCast(const U& u) { static_assert(sizeof(T) == sizeof(U)); @@ -69,7 +69,7 @@ inline T BitCast(const U& u) { memcpy(&t, &u, sizeof(t)); return t; } -#endif // defined(FML_OS_FUCHSIA) +#endif // defined(OS_FUCHSIA) } // namespace @@ -99,7 +99,7 @@ class FlutterEventTracer : public SkEventTracer { const uint8_t* p_arg_types, const uint64_t* p_arg_values, uint8_t flags) override { -#if defined(FML_OS_FUCHSIA) +#if defined(OS_FUCHSIA) static trace_site_t trace_site; trace_string_ref_t category_ref; trace_context_t* trace_context = trace_acquire_context_for_category_cached( @@ -210,7 +210,7 @@ class FlutterEventTracer : public SkEventTracer { trace_release_context(trace_context); -#else // defined(FML_OS_FUCHSIA) +#else // defined(OS_FUCHSIA) const char* devtoolsTag = nullptr; if (shaders_category_flag_ && category_enabled_flag == shaders_category_flag_) { @@ -256,7 +256,7 @@ class FlutterEventTracer : public SkEventTracer { default: break; } -#endif // defined(FML_OS_FUCHSIA) +#endif // defined(OS_FUCHSIA) return 0; } @@ -265,7 +265,7 @@ class FlutterEventTracer : public SkEventTracer { SkEventTracer::Handle handle) override { // This is only ever called from a scoped trace event so we will just end // the section. -#if defined(FML_OS_FUCHSIA) +#if defined(OS_FUCHSIA) TRACE_DURATION_END(kSkiaTag, name); #else fml::tracing::TraceEventEnd(name); diff --git a/shell/common/skp_shader_warmup_unittests.cc b/shell/common/skp_shader_warmup_unittests.cc index 4a21ed16d9da2..7790e66667fdc 100644 --- a/shell/common/skp_shader_warmup_unittests.cc +++ b/shell/common/skp_shader_warmup_unittests.cc @@ -25,7 +25,7 @@ #include "include/core/SkSerialProcs.h" #include "include/core/SkTextBlob.h" -#if defined(FML_OS_FUCHSIA) +#if defined(OS_FUCHSIA) #include "lib/sys/cpp/component_context.h" #include "third_party/skia/include/ports/SkFontMgr_fuchsia.h" @@ -298,4 +298,4 @@ TEST_F(SkpWarmupTest, DISABLED_Text) { } // namespace testing } // namespace flutter -#endif // defined(FML_OS_FUCHSIA) +#endif // defined(OS_FUCHSIA) diff --git a/shell/common/vsync_waiter.cc b/shell/common/vsync_waiter.cc index 555ba20a9f18b..1755755182e87 100644 --- a/shell/common/vsync_waiter.cc +++ b/shell/common/vsync_waiter.cc @@ -16,7 +16,7 @@ namespace flutter { static constexpr const char* kVsyncFlowName = "VsyncFlow"; -#if defined(FML_OS_FUCHSIA) +#if defined(OS_FUCHSIA) // ________ _________ ________ ________ // |\ ____\|\___ ___\\ __ \|\ __ \ // \ \ \___|\|___ \ \_\ \ \|\ \ \ \|\ \ diff --git a/shell/platform/embedder/embedder.cc b/shell/platform/embedder/embedder.cc index abe98716ea9cf..a4850e3f64909 100644 --- a/shell/platform/embedder/embedder.cc +++ b/shell/platform/embedder/embedder.cc @@ -791,7 +791,7 @@ FlutterEngineResult FlutterEngineCreateAOTData( auto aot_data = std::make_unique<_FlutterEngineAOTData>(); const char* error = nullptr; -#if FML_OS_FUCHSIA +#if OS_FUCHSIA // TODO(gw280): https://github.com/flutter/flutter/issues/50285 // Dart doesn't implement Dart_LoadELF on Fuchsia Dart_LoadedElf* loaded_elf = nullptr; @@ -884,10 +884,10 @@ void PopulateSnapshotMappingCallbacks( } } -#if !FML_OS_FUCHSIA && (FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG) +#if !OS_FUCHSIA && (FLUTTER_RUNTIME_MODE == FLUTTER_RUNTIME_MODE_DEBUG) settings.dart_library_sources_kernel = make_mapping_callback(kPlatformStrongDill, kPlatformStrongDillSize); -#endif // !FML_OS_FUCHSIA && (FLUTTER_RUNTIME_MODE == +#endif // !OS_FUCHSIA && (FLUTTER_RUNTIME_MODE == // FLUTTER_RUNTIME_MODE_DEBUG) } diff --git a/testing/elf_loader.cc b/testing/elf_loader.cc index 087ff70c999ed..50b6e43960bec 100644 --- a/testing/elf_loader.cc +++ b/testing/elf_loader.cc @@ -31,7 +31,7 @@ ELFAOTSymbols LoadELFSymbolFromFixturesIfNeccessary(std::string elf_filename) { // Must not be freed. const char* error = nullptr; -#if FML_OS_FUCHSIA +#if OS_FUCHSIA // TODO(gw280): https://github.com/flutter/flutter/issues/50285 // Dart doesn't implement Dart_LoadELF on Fuchsia auto loaded_elf = nullptr; @@ -80,7 +80,7 @@ ELFAOTSymbols LoadELFSplitSymbolFromFixturesIfNeccessary( // Must not be freed. const char* error = nullptr; -#if FML_OS_FUCHSIA +#if OS_FUCHSIA // TODO(gw280): https://github.com/flutter/flutter/issues/50285 // Dart doesn't implement Dart_LoadELF on Fuchsia auto loaded_elf = nullptr; diff --git a/vulkan/vulkan_application.cc b/vulkan/vulkan_application.cc index a5c8ecd43bfb5..31dd54aaa1bf1 100644 --- a/vulkan/vulkan_application.cc +++ b/vulkan/vulkan_application.cc @@ -37,7 +37,7 @@ VulkanApplication::VulkanApplication( if (enable_instance_debugging) { enabled_extensions.emplace_back(VulkanDebugReport::DebugExtensionName()); } -#if FML_OS_FUCHSIA +#if OS_FUCHSIA if (ExtensionSupported(supported_extensions, VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME)) { // VK_KHR_get_physical_device_properties2 is a dependency of the memory diff --git a/vulkan/vulkan_device.cc b/vulkan/vulkan_device.cc index 80e4055466b7d..e981329d2174b 100644 --- a/vulkan/vulkan_device.cc +++ b/vulkan/vulkan_device.cc @@ -63,7 +63,7 @@ VulkanDevice::VulkanDevice(VulkanProcTable& p_vk, #if FML_OS_ANDROID VK_KHR_SWAPCHAIN_EXTENSION_NAME, #endif -#if FML_OS_FUCHSIA +#if OS_FUCHSIA VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME, VK_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME, VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME, diff --git a/vulkan/vulkan_interface.h b/vulkan/vulkan_interface.h index 190f629c1ce64..03218c9621b2a 100644 --- a/vulkan/vulkan_interface.h +++ b/vulkan/vulkan_interface.h @@ -16,14 +16,14 @@ #endif // VK_USE_PLATFORM_ANDROID_KHR #endif // FML_OS_ANDROID -#if FML_OS_FUCHSIA +#if OS_FUCHSIA #ifndef VK_USE_PLATFORM_MAGMA_KHR #define VK_USE_PLATFORM_MAGMA_KHR 1 #endif // VK_USE_PLATFORM_MAGMA_KHR #ifndef VK_USE_PLATFORM_FUCHSIA #define VK_USE_PLATFORM_FUCHSIA 1 #endif // VK_USE_PLATFORM_FUCHSIA -#endif // FML_OS_FUCHSIA +#endif // OS_FUCHSIA #if !VULKAN_LINK_STATICALLY #define VK_NO_PROTOTYPES 1 diff --git a/vulkan/vulkan_proc_table.cc b/vulkan/vulkan_proc_table.cc index 117d2fe9b00d3..f5ba8f97bcb3c 100644 --- a/vulkan/vulkan_proc_table.cc +++ b/vulkan/vulkan_proc_table.cc @@ -137,7 +137,7 @@ bool VulkanProcTable::SetupDeviceProcAddresses( ACQUIRE_PROC(GetSwapchainImagesKHR, handle); ACQUIRE_PROC(QueuePresentKHR, handle); #endif // FML_OS_ANDROID -#if FML_OS_FUCHSIA +#if OS_FUCHSIA ACQUIRE_PROC(ImportSemaphoreZirconHandleFUCHSIA, handle); ACQUIRE_PROC(GetSemaphoreZirconHandleFUCHSIA, handle); ACQUIRE_PROC(GetMemoryZirconHandleFUCHSIA, handle); @@ -145,7 +145,7 @@ bool VulkanProcTable::SetupDeviceProcAddresses( ACQUIRE_PROC(DestroyBufferCollectionFUCHSIA, handle); ACQUIRE_PROC(SetBufferCollectionImageConstraintsFUCHSIA, handle); ACQUIRE_PROC(GetBufferCollectionPropertiesFUCHSIA, handle); -#endif // FML_OS_FUCHSIA +#endif // OS_FUCHSIA #endif // TEST_VULKAN_PROCS device_ = VulkanHandle{handle, nullptr}; return true; diff --git a/vulkan/vulkan_proc_table.h b/vulkan/vulkan_proc_table.h index 5b5a8c9f85748..a7f2a3d5f35b8 100644 --- a/vulkan/vulkan_proc_table.h +++ b/vulkan/vulkan_proc_table.h @@ -116,7 +116,7 @@ class VulkanProcTable : public fml::RefCountedThreadSafe { DEFINE_PROC(QueuePresentKHR); DEFINE_PROC(CreateAndroidSurfaceKHR); #endif // FML_OS_ANDROID -#if FML_OS_FUCHSIA +#if OS_FUCHSIA DEFINE_PROC(ImportSemaphoreZirconHandleFUCHSIA); DEFINE_PROC(GetSemaphoreZirconHandleFUCHSIA); DEFINE_PROC(GetMemoryZirconHandleFUCHSIA); @@ -124,7 +124,7 @@ class VulkanProcTable : public fml::RefCountedThreadSafe { DEFINE_PROC(DestroyBufferCollectionFUCHSIA); DEFINE_PROC(SetBufferCollectionImageConstraintsFUCHSIA); DEFINE_PROC(GetBufferCollectionPropertiesFUCHSIA); -#endif // FML_OS_FUCHSIA +#endif // OS_FUCHSIA #endif // TEST_VULKAN_PROCS #undef DEFINE_PROC diff --git a/vulkan/vulkan_utilities.cc b/vulkan/vulkan_utilities.cc index e005d3286b22a..8077a1e4fde61 100644 --- a/vulkan/vulkan_utilities.cc +++ b/vulkan/vulkan_utilities.cc @@ -18,7 +18,7 @@ bool ValidationLayerInfoMessagesEnabled() { } bool ValidationErrorsFatal() { -#if FML_OS_FUCHSIA +#if OS_FUCHSIA return false; #endif return true; @@ -34,7 +34,7 @@ static std::vector InstanceOrDeviceLayersToEnable( // NOTE: The loader is sensitive to the ordering here. Please do not rearrange // this list. -#if FML_OS_FUCHSIA +#if OS_FUCHSIA // The other layers in the Fuchsia SDK seem to have a bug right now causing // crashes, so it is only recommended that we use VK_LAYER_KHRONOS_validation // until we have a confirmation that they are fixed. From b60a4a8ae66d3630b869db1599296e02eaed0afa Mon Sep 17 00:00:00 2001 From: Brandon DeRosier Date: Fri, 28 Jan 2022 15:03:40 -0800 Subject: [PATCH 4/4] Use updated FML defines --- fml/endianness.h | 4 ++-- fml/endianness_unittests.cc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/fml/endianness.h b/fml/endianness.h index 4951f7c2edeaf..b4bd9a9b2d42d 100644 --- a/fml/endianness.h +++ b/fml/endianness.h @@ -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 >> constexpr T BigEndianToArch(T n) { -#if ARCH_CPU_LITTLE_ENDIAN +#if FML_ARCH_CPU_LITTLE_ENDIAN return ByteSwap(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 >> constexpr T LittleEndianToArch(T n) { -#if !ARCH_CPU_LITTLE_ENDIAN +#if !FML_ARCH_CPU_LITTLE_ENDIAN return ByteSwap(n); #else return n; diff --git a/fml/endianness_unittests.cc b/fml/endianness_unittests.cc index 24b35464e82bd..1523661174304 100644 --- a/fml/endianness_unittests.cc +++ b/fml/endianness_unittests.cc @@ -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;