diff --git a/DEPS b/DEPS index 49f805a0ce3..d452b41600f 100644 --- a/DEPS +++ b/DEPS @@ -256,7 +256,7 @@ deps = { Var('chromium_git') + '/vulkan-deps' + '@' + '938de304bdcb33049ec39ce45f16223eb6a960b6', 'engine/src/flutter/third_party/flatbuffers': - Var('chromium_git') + '/external/github.com/google/flatbuffers' + '@' + '0a80646371179f8a7a5c1f42c31ee1d44dcf6709', + Var('chromium_git') + '/external/github.com/google/flatbuffers' + '@' + '067bfdbde9b10c1beb5d6b02d67ae9db8b96f736', 'engine/src/flutter/third_party/icu': Var('chromium_git') + '/chromium/deps/icu.git' + '@' + '1b2e3e8a421efae36141a7b932b41e315b089af8', diff --git a/engine/src/build/config/compiler/BUILD.gn b/engine/src/build/config/compiler/BUILD.gn index 800a6a66acf..cb987ddd86e 100644 --- a/engine/src/build/config/compiler/BUILD.gn +++ b/engine/src/build/config/compiler/BUILD.gn @@ -116,6 +116,7 @@ config("compiler") { } else if (!is_ios && !is_wasm && !is_qnx) { cflags += [ "-fstack-protector", + # 8 is the default, but make this explicit here so that we don't have to # go hunting for the flag name if we ever want a value that is # different from the default. @@ -300,7 +301,8 @@ config("compiler") { if (wasm_use_workers) { cflags += [ "-sWASM_WORKERS=1" ] ldflags += [ "-sWASM_WORKERS=1" ] - } if (wasm_shared_memory) { + } + if (wasm_shared_memory) { cflags += [ "-sSHARED_MEMORY=1" ] ldflags += [ "-sSHARED_MEMORY=1" ] } @@ -356,9 +358,7 @@ config("compiler") { # Linux/Android common flags setup. # --------------------------------- if (is_linux || is_android || is_qnx) { - cflags += [ - "-fPIC", - ] + cflags += [ "-fPIC" ] if (!is_qnx) { cflags += [ @@ -382,7 +382,7 @@ config("compiler") { if (target_cpu == "arm64") { qnx_arch_flags += [ "-V", - "gcc_ntoaarch64le" + "gcc_ntoaarch64le", ] } else { assert(false, "Unknown QNX architecture") @@ -474,20 +474,55 @@ config("compiler") { # Fuchsia-specific flags setup. # ----------------------------- if (is_fuchsia) { - configs = ["//flutter/tools/fuchsia/gn-sdk/src/config:compiler"] + configs = [ "//flutter/tools/fuchsia/gn-sdk/src/config:compiler" ] } asmflags = cflags } +# C++ modules (available and enabled by default in C++20 and above) are +# prohibited by the style guide. +config("cxx_disable_modules") { + disable_modules_flags = [ + "-fno-modules", + + # Some Clang versions do not disable ObjC modules (as tested by + # __has_feature(objc_modules)) when just -fno-modules is present. + "-Xclang", + "-fno-cxx-modules", + ] + cflags_c = disable_modules_flags + cflags_cc = disable_modules_flags + cflags_objc = disable_modules_flags + cflags_objcc = disable_modules_flags +} + config("cxx_version_default") { if (is_win) { - cc_std = [ "/std:c++17" ] + cc_std = [ "/std:c++20" ] } else { - cc_std = [ "-std=c++17" ] + cc_std = [ "-std=c++20" ] } + + configs = [ ":cxx_disable_modules" ] + cflags_cc = cc_std cflags_objcc = cc_std + + # The following corrections are only in place for targets that have opted into + # the default version. These targets have not had to opportunity to upgrade to + # a newer version. Targets that have explicitly opted into the newer version + # must fix the errors they run into. + + if (is_clang) { + extra_warning_flags_cc = [ + # TODO(174665): Third-party dependency (Angle) needs to patched to work + # around this. + "-Wno-deprecated-this-capture", + ] + cflags_cc += extra_warning_flags_cc + cflags_objcc += extra_warning_flags_cc + } } config("cxx_version_11") { @@ -528,6 +563,8 @@ config("cxx_version_20") { } cflags_cc = cc_std cflags_objcc = cc_std + + configs = [ ":cxx_disable_modules" ] } config("compiler_arm_fpu") { @@ -575,8 +612,10 @@ config("runtime_library") { # Add libcxx[abi]/include via cflags_cc, cflags_objcc to apply to # C++/Obj-C++ only. Adding them via include_dirs is problematic for Swift, # whose core libraries expect the Apple SDK C++ headers, module.modulemap. - _libcxx_include = rebase_path("//flutter/third_party/libcxx/include", root_build_dir) - _libcxxabi_include = rebase_path("//flutter/third_party/libcxxabi/include", root_build_dir) + _libcxx_include = + rebase_path("//flutter/third_party/libcxx/include", root_build_dir) + _libcxxabi_include = + rebase_path("//flutter/third_party/libcxxabi/include", root_build_dir) cflags_cc += [ "-nostdinc++", "-I" + _libcxx_include, @@ -604,9 +643,7 @@ config("runtime_library") { ldflags += [ "-nostdlib" ] - ldflags += [ - "-Wl,--warn-shared-textrel", - ] + ldflags += [ "-Wl,--warn-shared-textrel" ] libs += [ "c", @@ -639,7 +676,7 @@ config("runtime_library") { # Fuchsia standard library setup. if (is_fuchsia) { - configs = ["//flutter/tools/fuchsia/gn-sdk/src/config:runtime_library"] + configs = [ "//flutter/tools/fuchsia/gn-sdk/src/config:runtime_library" ] } } @@ -653,6 +690,7 @@ default_warning_flags_cc = [] if (is_qnx) { default_warning_flags_cc += [ "-fpermissive" ] } + if (is_win) { default_warning_flags += [ # Permanent. @@ -1013,9 +1051,7 @@ config("no_optimize") { # On WASM we don't want to fully deoptimize the debug build because the # compiled binary will have some functions with too many local variables # and Chrome will reject it. - cflags = [ - "-O1", - ] + cflags = [ "-O1" ] ldflags = common_optimize_on_ldflags } else { cflags = [ "-O0" ] @@ -1112,6 +1148,7 @@ config("prevent_unsafe_narrowing") { "-Wshorten-64-to-32", "-Wimplicit-int-conversion", "-Wsign-compare", + # Avoid bugs of the form `if (size_t i = size; i >= 0; --i)` while # fixing types to be sign-correct. "-Wtautological-unsigned-zero-compare", diff --git a/engine/src/flutter/build/secondary/flutter/third_party/flatbuffers/BUILD.gn b/engine/src/flutter/build/secondary/flutter/third_party/flatbuffers/BUILD.gn index a5aba290a33..a760addb04a 100644 --- a/engine/src/flutter/build/secondary/flutter/third_party/flatbuffers/BUILD.gn +++ b/engine/src/flutter/build/secondary/flutter/third_party/flatbuffers/BUILD.gn @@ -15,11 +15,12 @@ source_set("flatbuffers") { "$_src_root/include/flatbuffers/allocator.h", "$_src_root/include/flatbuffers/array.h", "$_src_root/include/flatbuffers/base.h", - "$_src_root/include/flatbuffers/bfbs_generator.h", "$_src_root/include/flatbuffers/buffer.h", "$_src_root/include/flatbuffers/buffer_ref.h", + "$_src_root/include/flatbuffers/code_generator.h", "$_src_root/include/flatbuffers/default_allocator.h", "$_src_root/include/flatbuffers/detached_buffer.h", + "$_src_root/include/flatbuffers/file_manager.h", "$_src_root/include/flatbuffers/flatbuffer_builder.h", "$_src_root/include/flatbuffers/flatbuffers.h", "$_src_root/include/flatbuffers/flex_flat_util.h", @@ -62,18 +63,28 @@ executable("flatc") { "$_src_root/grpc/src/compiler/swift_generator.h", "$_src_root/grpc/src/compiler/ts_generator.cc", "$_src_root/grpc/src/compiler/ts_generator.h", + "$_src_root/include/codegen/idl_namer.h", + "$_src_root/include/codegen/namer.h", + "$_src_root/include/codegen/python.cc", + "$_src_root/include/codegen/python.h", "$_src_root/include/flatbuffers/code_generators.h", "$_src_root/src/annotated_binary_text_gen.cpp", "$_src_root/src/annotated_binary_text_gen.h", "$_src_root/src/bfbs_gen.h", "$_src_root/src/bfbs_gen_lua.cpp", "$_src_root/src/bfbs_gen_lua.h", + "$_src_root/src/bfbs_gen_nim.cpp", + "$_src_root/src/bfbs_gen_nim.h", "$_src_root/src/bfbs_namer.h", "$_src_root/src/binary_annotator.cpp", "$_src_root/src/binary_annotator.h", "$_src_root/src/code_generators.cpp", + "$_src_root/src/file_binary_writer.cpp", + "$_src_root/src/file_name_saving_file_manager.cpp", + "$_src_root/src/file_writer.cpp", "$_src_root/src/flatc.cpp", "$_src_root/src/flatc_main.cpp", + "$_src_root/src/idl_gen_binary.cpp", "$_src_root/src/idl_gen_cpp.cpp", "$_src_root/src/idl_gen_csharp.cpp", "$_src_root/src/idl_gen_dart.cpp", @@ -83,8 +94,8 @@ executable("flatc") { "$_src_root/src/idl_gen_java.cpp", "$_src_root/src/idl_gen_json_schema.cpp", "$_src_root/src/idl_gen_kotlin.cpp", + "$_src_root/src/idl_gen_kotlin_kmp.cpp", "$_src_root/src/idl_gen_lobster.cpp", - "$_src_root/src/idl_gen_lua.cpp", "$_src_root/src/idl_gen_php.cpp", "$_src_root/src/idl_gen_python.cpp", "$_src_root/src/idl_gen_rust.cpp", diff --git a/engine/src/flutter/display_list/dl_paint.cc b/engine/src/flutter/display_list/dl_paint.cc index 76a682eab99..ccec201f869 100644 --- a/engine/src/flutter/display_list/dl_paint.cc +++ b/engine/src/flutter/display_list/dl_paint.cc @@ -13,8 +13,6 @@ DlPaint::DlPaint(DlColor color) draw_style_(static_cast(DlDrawStyle::kDefaultStyle)), stroke_cap_(static_cast(DlStrokeCap::kDefaultCap)), stroke_join_(static_cast(DlStrokeJoin::kDefaultJoin)), - is_anti_alias_(false), - is_invert_colors_(false), color_(color), stroke_width_(kDefaultWidth), stroke_miter_(kDefaultMiter) {} diff --git a/engine/src/flutter/display_list/dl_paint.h b/engine/src/flutter/display_list/dl_paint.h index 843900df2c3..adaa018c612 100644 --- a/engine/src/flutter/display_list/dl_paint.h +++ b/engine/src/flutter/display_list/dl_paint.h @@ -221,12 +221,12 @@ class DlPaint { union { struct { - unsigned blend_mode_ : kBlendModeBits; - unsigned draw_style_ : kDrawStyleBits; - unsigned stroke_cap_ : kStrokeCapBits; - unsigned stroke_join_ : kStrokeJoinBits; - unsigned is_anti_alias_ : 1; - unsigned is_invert_colors_ : 1; + unsigned blend_mode_ : kBlendModeBits = {}; + unsigned draw_style_ : kDrawStyleBits = {}; + unsigned stroke_cap_ : kStrokeCapBits = {}; + unsigned stroke_join_ : kStrokeJoinBits = {}; + unsigned is_anti_alias_ : 1 = {}; + unsigned is_invert_colors_ : 1 = {}; }; }; diff --git a/engine/src/flutter/fml/file_unittest.cc b/engine/src/flutter/fml/file_unittest.cc index 647f82b7f5a..6e55d1c9762 100644 --- a/engine/src/flutter/fml/file_unittest.cc +++ b/engine/src/flutter/fml/file_unittest.cc @@ -343,7 +343,7 @@ TEST(FileTest, FileTestsWork) { TEST(FileTest, FileTestsSupportsUnicode) { fml::ScopedTemporaryDirectory dir; ASSERT_TRUE(dir.fd().is_valid()); - const char* filename = u8"äëïöüテスト☃"; + const auto* filename = reinterpret_cast(u8"äëïöüテスト☃"); auto fd = fml::OpenFile(dir.fd(), filename, true, fml::FilePermission::kWrite); ASSERT_TRUE(fd.is_valid()); diff --git a/engine/src/flutter/impeller/golden_tests/vulkan_screenshotter.mm b/engine/src/flutter/impeller/golden_tests/vulkan_screenshotter.mm index 0315fdfd7b9..6f6702d1823 100644 --- a/engine/src/flutter/impeller/golden_tests/vulkan_screenshotter.mm +++ b/engine/src/flutter/impeller/golden_tests/vulkan_screenshotter.mm @@ -62,7 +62,8 @@ std::unique_ptr ReadTexture( &CGColorSpaceRelease); CGBitmapInfo bitmap_info = texture->GetTextureDescriptor().format == PixelFormat::kB8G8R8A8UNormInt - ? kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Little + ? static_cast(kCGImageAlphaPremultipliedFirst) | + static_cast(kCGBitmapByteOrder32Little) : kCGImageAlphaPremultipliedLast; CGContextPtr context( CGBitmapContextCreate( diff --git a/engine/src/flutter/impeller/renderer/backend/vulkan/vk.h b/engine/src/flutter/impeller/renderer/backend/vulkan/vk.h index f1c129d7fc7..a688985c60b 100644 --- a/engine/src/flutter/impeller/renderer/backend/vulkan/vk.h +++ b/engine/src/flutter/impeller/renderer/backend/vulkan/vk.h @@ -69,6 +69,9 @@ } #define VULKAN_HPP_NO_EXCEPTIONS +// The spaceship operator behaves differently on 32-bit platforms. +#define VULKAN_HPP_NO_SPACESHIP_OPERATOR + #include "vulkan/vulkan.hpp" // IWYU pragma: keep. static_assert(VK_HEADER_VERSION >= 215, "Vulkan headers must not be too old."); diff --git a/engine/src/flutter/shell/platform/common/client_wrapper/standard_message_codec_unittests.cc b/engine/src/flutter/shell/platform/common/client_wrapper/standard_message_codec_unittests.cc index afe7247025f..df4420af8b2 100644 --- a/engine/src/flutter/shell/platform/common/client_wrapper/standard_message_codec_unittests.cc +++ b/engine/src/flutter/shell/platform/common/client_wrapper/standard_message_codec_unittests.cc @@ -134,22 +134,22 @@ TEST(StandardMessageCodec, CanEncodeAndDecodeDouble) { TEST(StandardMessageCodec, CanEncodeAndDecodeString) { std::vector bytes = {0x07, 0x0b, 0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64}; - CheckEncodeDecode(EncodableValue(u8"hello world"), bytes); + CheckEncodeDecode(EncodableValue("hello world"), bytes); } TEST(StandardMessageCodec, CanEncodeAndDecodeStringWithNonAsciiCodePoint) { std::vector bytes = {0x07, 0x05, 0x68, 0xe2, 0x98, 0xba, 0x77}; - CheckEncodeDecode(EncodableValue(u8"h\u263Aw"), bytes); + CheckEncodeDecode(EncodableValue("h\u263Aw"), bytes); } TEST(StandardMessageCodec, CanEncodeAndDecodeStringWithNonBMPCodePoint) { std::vector bytes = {0x07, 0x06, 0x68, 0xf0, 0x9f, 0x98, 0x82, 0x77}; - CheckEncodeDecode(EncodableValue(u8"h\U0001F602w"), bytes); + CheckEncodeDecode(EncodableValue("h\U0001F602w"), bytes); } TEST(StandardMessageCodec, CanEncodeAndDecodeEmptyString) { std::vector bytes = {0x07, 0x00}; - CheckEncodeDecode(EncodableValue(u8""), bytes); + CheckEncodeDecode(EncodableValue(""), bytes); } TEST(StandardMessageCodec, CanEncodeAndDecodeList) { diff --git a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformViewsTest.mm b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformViewsTest.mm index 3340c358dc5..e65dc4af721 100644 --- a/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformViewsTest.mm +++ b/engine/src/flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformViewsTest.mm @@ -3812,8 +3812,10 @@ fml::RefPtr GetDefaultTaskRunner() { CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); // Draw the pixel on `point` in the context. - CGContextRef context = CGBitmapContextCreate( - pixel, 1, 1, 8, 4, colorSpace, kCGBitmapAlphaInfoMask & kCGImageAlphaPremultipliedLast); + CGContextRef context = + CGBitmapContextCreate(pixel, 1, 1, 8, 4, colorSpace, + static_cast(kCGBitmapAlphaInfoMask) & + static_cast(kCGImageAlphaPremultipliedLast)); CGContextTranslateCTM(context, -point.x, -point.y); [view.layer renderInContext:context]; diff --git a/engine/src/flutter/shell/platform/darwin/macos/framework/Source/FlutterViewControllerTest.mm b/engine/src/flutter/shell/platform/darwin/macos/framework/Source/FlutterViewControllerTest.mm index 8f3aae4acdb..c830c3554da 100644 --- a/engine/src/flutter/shell/platform/darwin/macos/framework/Source/FlutterViewControllerTest.mm +++ b/engine/src/flutter/shell/platform/darwin/macos/framework/Source/FlutterViewControllerTest.mm @@ -939,7 +939,8 @@ TEST_F(FlutterViewControllerTest, testViewControllerIsReleased) { CGEventRef cgEventDiscreteShift = CGEventCreateScrollWheelEvent(NULL, kCGScrollEventUnitPixel, 1, 0); CGEventSetType(cgEventDiscreteShift, kCGEventScrollWheel); - CGEventSetFlags(cgEventDiscreteShift, kCGEventFlagMaskShift | flutter::kModifierFlagShiftLeft); + CGEventSetFlags(cgEventDiscreteShift, static_cast(kCGEventFlagMaskShift) | + static_cast(flutter::kModifierFlagShiftLeft)); CGEventSetIntegerValueField(cgEventDiscreteShift, kCGScrollWheelEventIsContinuous, 0); CGEventSetIntegerValueField(cgEventDiscreteShift, kCGScrollWheelEventDeltaAxis2, 0); // scroll_delta_x diff --git a/engine/src/flutter/shell/platform/glfw/BUILD.gn b/engine/src/flutter/shell/platform/glfw/BUILD.gn index 59735b59763..19838543f21 100644 --- a/engine/src/flutter/shell/platform/glfw/BUILD.gn +++ b/engine/src/flutter/shell/platform/glfw/BUILD.gn @@ -73,6 +73,8 @@ source_set("flutter_glfw") { "IOKit.framework", ] } + + cflags_cc = [ "-Wno-deprecated-declarations" ] } test_fixtures("flutter_glfw_fixtures") { diff --git a/engine/src/flutter/shell/platform/linux/BUILD.gn b/engine/src/flutter/shell/platform/linux/BUILD.gn index 42da463b00c..b4b161cbfa4 100644 --- a/engine/src/flutter/shell/platform/linux/BUILD.gn +++ b/engine/src/flutter/shell/platform/linux/BUILD.gn @@ -75,6 +75,12 @@ config("relative_flutter_linux_headers") { include_dirs = [ "public" ] } +config("disable_warnings") { + warning_flags = [ "-Wno-deprecated-volatile" ] + cflags = warning_flags + cflags_cc = warning_flags +} + source_set("flutter_linux_sources") { public = _public_headers + [ "fl_binary_messenger_private.h", @@ -99,6 +105,8 @@ source_set("flutter_linux_sources") { configs += [ "//flutter/shell/platform/linux/config:gtk" ] + public_configs = [ ":disable_warnings" ] + sources = [ "fl_accessible_node.cc", "fl_accessible_text_field.cc", diff --git a/engine/src/flutter/shell/platform/windows/BUILD.gn b/engine/src/flutter/shell/platform/windows/BUILD.gn index 97c25996f16..4f49f5dc600 100644 --- a/engine/src/flutter/shell/platform/windows/BUILD.gn +++ b/engine/src/flutter/shell/platform/windows/BUILD.gn @@ -125,6 +125,8 @@ source_set("flutter_windows_source") { "text_input_manager.h", "text_input_plugin.cc", "text_input_plugin.h", + "wchar_util.cc", + "wchar_util.h", "window_binding_handler.h", "window_binding_handler_delegate.h", "window_manager.cc", diff --git a/engine/src/flutter/shell/platform/windows/direct_manipulation.cc b/engine/src/flutter/shell/platform/windows/direct_manipulation.cc index f65e0e1074f..19bc332477a 100644 --- a/engine/src/flutter/shell/platform/windows/direct_manipulation.cc +++ b/engine/src/flutter/shell/platform/windows/direct_manipulation.cc @@ -8,6 +8,7 @@ #include "flutter/shell/platform/windows/direct_manipulation.h" #include "flutter/shell/platform/windows/flutter_window.h" +#include "flutter/shell/platform/windows/wchar_util.h" #include "flutter/shell/platform/windows/window_binding_handler_delegate.h" #define RETURN_IF_FAILED(operation) \ @@ -259,7 +260,7 @@ void DirectManipulationOwner::Update() { FORMAT_MESSAGE_IGNORE_INSERTS, NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), reinterpret_cast(&message), 0, NULL); - FML_LOG(ERROR) << message; + FML_LOG(ERROR) << WCharBufferToString(message); } } } diff --git a/engine/src/flutter/shell/platform/windows/flutter_project_bundle.cc b/engine/src/flutter/shell/platform/windows/flutter_project_bundle.cc index 87cd0b4a329..b63dad588a5 100644 --- a/engine/src/flutter/shell/platform/windows/flutter_project_bundle.cc +++ b/engine/src/flutter/shell/platform/windows/flutter_project_bundle.cc @@ -69,11 +69,11 @@ UniqueAotDataPtr FlutterProjectBundle::LoadAotData( return UniqueAotDataPtr(nullptr, nullptr); } if (!std::filesystem::exists(aot_library_path_)) { - FML_LOG(ERROR) << "Can't load AOT data from " - << aot_library_path_.u8string() << "; no such file."; + FML_LOG(ERROR) << "Can't load AOT data from " << aot_library_path_ + << "; no such file."; return UniqueAotDataPtr(nullptr, nullptr); } - std::string path_string = aot_library_path_.u8string(); + std::string path_string = aot_library_path_.string(); FlutterEngineAOTDataSource source = {}; source.type = kFlutterEngineAOTDataSourceTypeElfPath; source.elf_path = path_string.c_str(); diff --git a/engine/src/flutter/shell/platform/windows/flutter_windows_engine.cc b/engine/src/flutter/shell/platform/windows/flutter_windows_engine.cc index bb7a7c76b42..8753eccb046 100644 --- a/engine/src/flutter/shell/platform/windows/flutter_windows_engine.cc +++ b/engine/src/flutter/shell/platform/windows/flutter_windows_engine.cc @@ -274,8 +274,8 @@ bool FlutterWindowsEngine::Run(std::string_view entrypoint) { FML_LOG(ERROR) << "Missing or unresolvable paths to assets."; return false; } - std::string assets_path_string = project_->assets_path().u8string(); - std::string icu_path_string = project_->icu_path().u8string(); + std::string assets_path_string = project_->assets_path().string(); + std::string icu_path_string = project_->icu_path().string(); if (embedder_api_.RunsAOTCompiledDartCode()) { aot_data_ = project_->LoadAotData(embedder_api_); if (!aot_data_) { diff --git a/engine/src/flutter/shell/platform/windows/host_window.cc b/engine/src/flutter/shell/platform/windows/host_window.cc index 41f8552bee9..c2bcfeaf831 100644 --- a/engine/src/flutter/shell/platform/windows/host_window.cc +++ b/engine/src/flutter/shell/platform/windows/host_window.cc @@ -11,6 +11,7 @@ #include "flutter/shell/platform/windows/flutter_window.h" #include "flutter/shell/platform/windows/flutter_windows_view_controller.h" #include "flutter/shell/platform/windows/rect_helper.h" +#include "flutter/shell/platform/windows/wchar_util.h" #include "flutter/shell/platform/windows/window_manager.h" namespace { @@ -317,8 +318,9 @@ std::unique_ptr HostWindow::CreateRegularWindow( window_class.lpszClassName = kWindowClassName; if (!RegisterClassEx(&window_class)) { - FML_LOG(ERROR) << "Cannot register window class " << kWindowClassName - << ": " << GetLastErrorAsString(); + FML_LOG(ERROR) << "Cannot register window class " + << WCharBufferToString(kWindowClassName) << ": " + << GetLastErrorAsString(); return nullptr; } } diff --git a/engine/src/flutter/shell/platform/windows/wchar_util.cc b/engine/src/flutter/shell/platform/windows/wchar_util.cc new file mode 100644 index 00000000000..d6c85b15d26 --- /dev/null +++ b/engine/src/flutter/shell/platform/windows/wchar_util.cc @@ -0,0 +1,42 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "flutter/shell/platform/windows/wchar_util.h" + +#include + +namespace flutter { + +std::string WCharBufferToString(const wchar_t* wstr) { + if (!wstr) { + return ""; + } + + int buffer_size = WideCharToMultiByte(CP_UTF8, // + 0, // + wstr, // + -1, // + nullptr, // + 0, // + nullptr, // + nullptr // + ); + if (buffer_size <= 0) { + return ""; + } + + std::string result(buffer_size - 1, 0); + WideCharToMultiByte(CP_UTF8, // + 0, // + wstr, // + -1, // + result.data(), // + buffer_size, // + nullptr, // + nullptr // + ); + return result; +} + +} // namespace flutter diff --git a/engine/src/flutter/shell/platform/windows/wchar_util.h b/engine/src/flutter/shell/platform/windows/wchar_util.h new file mode 100644 index 00000000000..ed527f444ef --- /dev/null +++ b/engine/src/flutter/shell/platform/windows/wchar_util.h @@ -0,0 +1,29 @@ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_SHELL_PLATFORM_WINDOWS_WCHAR_UTIL_H_ +#define FLUTTER_SHELL_PLATFORM_WINDOWS_WCHAR_UTIL_H_ + +#include + +namespace flutter { + +//------------------------------------------------------------------------------ +/// @brief Convert a null terminated wchar_t buffer to a std::string using +/// Windows utilities. +/// +/// The reliance on wchar_t buffers is problematic on C++20 since +/// their interop with standard library components has been +/// deprecated/removed. +/// +/// @param[in] wstr The null terminated buffer. +/// +/// @return The converted string if conversion is possible. Empty string +/// otherwise. +/// +std::string WCharBufferToString(const wchar_t* wstr); + +} // namespace flutter + +#endif // FLUTTER_SHELL_PLATFORM_WINDOWS_WCHAR_UTIL_H_ diff --git a/engine/src/flutter/sky/packages/sky_engine/LICENSE b/engine/src/flutter/sky/packages/sky_engine/LICENSE index 0b43ac32939..a7bd977c23c 100644 --- a/engine/src/flutter/sky/packages/sky_engine/LICENSE +++ b/engine/src/flutter/sky/packages/sky_engine/LICENSE @@ -34764,6 +34764,22 @@ Copyright 2023 Google Inc. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. -------------------------------------------------------------------------------- +flatbuffers + +Copyright 2023 Google Inc. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +-------------------------------------------------------------------------------- cpu_features Copyright 2023 Google LLC @@ -34972,6 +34988,22 @@ Copyright 2024 Google Inc. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. -------------------------------------------------------------------------------- +flatbuffers + +Copyright 2024 Google Inc. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +-------------------------------------------------------------------------------- skia Copyright 2024 Google LLC diff --git a/engine/src/flutter/third_party/accessibility/ax/ax_node_position_unittest.cc b/engine/src/flutter/third_party/accessibility/ax/ax_node_position_unittest.cc index 0d028c2270a..f3efb840b71 100644 --- a/engine/src/flutter/third_party/accessibility/ax/ax_node_position_unittest.cc +++ b/engine/src/flutter/third_party/accessibility/ax/ax_node_position_unittest.cc @@ -113,6 +113,16 @@ class AXPositionTest : public testing::Test, public TestAXTreeManager { struct ExpandToEnclosingTextBoundaryTestParam { ExpandToEnclosingTextBoundaryTestParam() = default; + ExpandToEnclosingTextBoundaryTestParam( + ax::mojom::TextBoundary p_boundary, + AXRangeExpandBehavior p_expand_behavior, + std::string p_expected_anchor_position, + std::string p_expected_focus_position) + : boundary(p_boundary), + expand_behavior(p_expand_behavior), + expected_anchor_position(std::move(p_expected_anchor_position)), + expected_focus_position(std::move(p_expected_focus_position)) {} + // Required by GTest framework. ExpandToEnclosingTextBoundaryTestParam( const ExpandToEnclosingTextBoundaryTestParam& other) = default; @@ -157,6 +167,15 @@ class AXPositionExpandToEnclosingTextBoundaryTestWithParam struct CreatePositionAtTextBoundaryTestParam { CreatePositionAtTextBoundaryTestParam() = default; + CreatePositionAtTextBoundaryTestParam(ax::mojom::TextBoundary p_boundary, + ax::mojom::MoveDirection p_direction, + AXBoundaryBehavior p_boundary_behavior, + std::string p_expected_text_position) + : boundary(p_boundary), + direction(p_direction), + boundary_behavior(p_boundary_behavior), + expected_text_position(std::move(p_expected_text_position)) {} + // Required by GTest framework. CreatePositionAtTextBoundaryTestParam( const CreatePositionAtTextBoundaryTestParam& other) = default; @@ -203,6 +222,16 @@ class AXPositionCreatePositionAtTextBoundaryTestWithParam struct TextNavigationTestParam { TextNavigationTestParam() = default; + TextNavigationTestParam( + std::function p_TestMethod, + AXNode::AXID p_start_node_id, + int p_start_offset, + std::vector p_expectations) + : TestMethod(std::move(p_TestMethod)), + start_node_id(p_start_node_id), + start_offset(p_start_offset), + expectations(std::move(p_expectations)) {} + // Required by GTest framework. TextNavigationTestParam(const TextNavigationTestParam& other) = default; TextNavigationTestParam& operator=(const TextNavigationTestParam& other) = diff --git a/engine/src/flutter/tools/templater/templater_main.cc b/engine/src/flutter/tools/templater/templater_main.cc index 4cd0f230d88..c803d7290b9 100644 --- a/engine/src/flutter/tools/templater/templater_main.cc +++ b/engine/src/flutter/tools/templater/templater_main.cc @@ -51,7 +51,7 @@ bool TemplaterMain(const fml::CommandLine& command_line) { rendered_template.size()}; auto current_dir = - fml::OpenDirectory(std::filesystem::current_path().u8string().c_str(), + fml::OpenDirectory(std::filesystem::current_path().string().c_str(), false, fml::FilePermission::kReadWrite); if (!current_dir.is_valid()) { FML_LOG(ERROR) << "Could not open current directory."; diff --git a/engine/src/flutter/txt/tests/paragraph_unittests.cc b/engine/src/flutter/txt/tests/paragraph_unittests.cc index aff36e49288..d3d64ee8697 100644 --- a/engine/src/flutter/txt/tests/paragraph_unittests.cc +++ b/engine/src/flutter/txt/tests/paragraph_unittests.cc @@ -19,6 +19,7 @@ namespace flutter { namespace testing { +[[maybe_unused]] static const std::string kEmojiFontFile = #if FML_OS_MACOSX "Apple Color Emoji.ttc"; @@ -26,6 +27,7 @@ static const std::string kEmojiFontFile = "NotoColorEmoji.ttf"; #endif +[[maybe_unused]] static const std::string kEmojiFontName = #if FML_OS_MACOSX "Apple Color Emoji";