diff --git a/common-files/chromium-patches/autofill-unique_ids-no-constexpr-operator-equal/6261.patch b/common-files/chromium-patches/autofill-unique_ids-no-constexpr-operator-equal/6261.patch new file mode 100644 index 000000000..030f0449f --- /dev/null +++ b/common-files/chromium-patches/autofill-unique_ids-no-constexpr-operator-equal/6261.patch @@ -0,0 +1,13 @@ +error: defaulted definition of equality comparison operator cannot be declared constexpr because it invokes a non-constexpr comparison function + +--- a/components/autofill/core/common/unique_ids.h ++++ b/components/autofill/core/common/unique_ids.h +@@ -137,7 +137,7 @@ + + friend constexpr auto operator<=>(const GlobalId& lhs, + const GlobalId& rhs) = default; +- friend constexpr bool operator==(const GlobalId& lhs, ++ friend bool operator==(const GlobalId& lhs, + const GlobalId& rhs) = default; + }; + diff --git a/common-files/chromium-patches/blink-font-constructor/6261.patch b/common-files/chromium-patches/blink-font-constructor/6261.patch new file mode 100644 index 000000000..020e795ff --- /dev/null +++ b/common-files/chromium-patches/blink-font-constructor/6261.patch @@ -0,0 +1,11 @@ +--- a/third_party/blink/renderer/platform/fonts/palette_interpolation.cc ++++ b/third_party/blink/renderer/platform/fonts/palette_interpolation.cc +@@ -31,7 +31,7 @@ + color_interpolation_space, hue_interpolation_method, start_color, + end_color, percentage, alpha_multiplier); + +- FontPalette::FontPaletteOverride result_color_record(i, result_color); ++ FontPalette::FontPaletteOverride result_color_record{static_cast(i), result_color}; + result_color_records.push_back(result_color_record); + } + return result_color_records; diff --git a/common-files/chromium-patches/chromium-strong_alias-no-constexpr-operator-equal/6261.patch b/common-files/chromium-patches/chromium-strong_alias-no-constexpr-operator-equal/6261.patch new file mode 100644 index 000000000..a547bb7c2 --- /dev/null +++ b/common-files/chromium-patches/chromium-strong_alias-no-constexpr-operator-equal/6261.patch @@ -0,0 +1,16 @@ +error: defaulted definition of equality comparison operator cannot be declared constexpr because it invokes a non-constexpr comparison function + +--- a/base/types/strong_alias.h ++++ b/base/types/strong_alias.h +@@ -108,9 +108,9 @@ + // because it is from an external library), then a work-around is to create a + // thin wrapper `W` around it, define `operator<=>` for the wrapper and create + // a `StrongAlias`. +- friend constexpr auto operator<=>(const StrongAlias& lhs, ++ friend auto operator<=>(const StrongAlias& lhs, + const StrongAlias& rhs) = default; +- friend constexpr bool operator==(const StrongAlias& lhs, ++ friend bool operator==(const StrongAlias& lhs, + const StrongAlias& rhs) = default; + + // Hasher to use in std::unordered_map, std::unordered_set, etc. diff --git a/common-files/chromium-patches/compiler-remove-unsupported-flags/6261.patch b/common-files/chromium-patches/compiler-remove-unsupported-flags/6261.patch new file mode 100644 index 000000000..6f46bd265 --- /dev/null +++ b/common-files/chromium-patches/compiler-remove-unsupported-flags/6261.patch @@ -0,0 +1,16 @@ +--- a/build/config/compiler/BUILD.gn ++++ b/build/config/compiler/BUILD.gn +@@ -1878,13 +1878,6 @@ + # TODO(https://crbug.com/1490607): Fix and re-enable. + "-Wno-thread-safety-reference-return", + ] +- +- if (!is_nacl) { +- cflags_cc += [ +- # TODO(https://crbug.com/1513724): Fix and re-enable. +- "-Wno-c++11-narrowing-const-reference", +- ] +- } + } + + # Some builders, such as Cronet, use a different version of Clang than diff --git a/common-files/chromium-patches/cpuinfo-android-arm/6261.patch b/common-files/chromium-patches/cpuinfo-android-arm/6261.patch new file mode 100644 index 000000000..0755a9025 --- /dev/null +++ b/common-files/chromium-patches/cpuinfo-android-arm/6261.patch @@ -0,0 +1,13 @@ +--- a/third_party/cpuinfo/src/src/arm/linux/init.c ++++ b/third_party/cpuinfo/src/src/arm/linux/init.c +@@ -14,6 +14,10 @@ + #include + #include + ++#ifdef __TERMUX__ ++#include ++#endif ++ + struct cpuinfo_arm_isa cpuinfo_isa = {0}; + + static struct cpuinfo_package package = {{0}}; diff --git a/common-files/chromium-patches/metadata.json b/common-files/chromium-patches/metadata.json index 7ddeeba1f..ed95aad66 100644 --- a/common-files/chromium-patches/metadata.json +++ b/common-files/chromium-patches/metadata.json @@ -4,32 +4,48 @@ "end": 5789 }, "add-missing-typename/5790.patch": { - "start": 5790 + "start": 5790, + "end": 6260, + "comment": "Disable since host clang-16" }, "add-missing-typename-2/5735.patch": { "start": 5735, "end": 5767 }, "add-missing-typename-3/5790.patch": { - "start": 5790 + "start": 5790, + "end": 6260, + "comment": "Disable since host clang-16" }, "add-missing-typename-4/5790.patch": { - "start": 5790 + "start": 5790, + "end": 6260, + "comment": "Disable since host clang-16" }, "add-missing-typename-5/5845.patch": { - "start": 5845 + "start": 5845, + "end": 6260, + "comment": "Disable since host clang-16" }, "add-missing-typename-6/6099.patch": { - "start": 6099 + "start": 6099, + "end": 6260, + "comment": "Disable since host clang-16" }, "add-missing-typename-7/6099.patch": { - "start": 6099 + "start": 6099, + "end": 6260, + "comment": "Disable since host clang-16" }, "add-missing-typename-8/6167.patch": { - "start": 6167 + "start": 6167, + "end": 6260, + "comment": "Disable since host clang-16" }, "add-missing-typename-9/6167.patch": { - "start": 6167 + "start": 6167, + "end": 6260, + "comment": "Disable since host clang-16" }, "angle-fix-atomic/5615.patch": { "start": 5615 @@ -47,12 +63,17 @@ "autofill_i18n_api-no-constexpr-string/6099.patch": { "start": 6099 }, + "autofill-unique_ids-no-constexpr-operator-equal/6261.patch": { + "start": 6261 + }, "avoid-constexpr-std-string/5672.patch": { "start": 5672, "end": 5775 }, "avoid-emplace_back-struct/5938.patch": { - "start": 5938 + "start": 5938, + "end": 6260, + "comment": "Disable since host clang-16" }, "blink-fix-narrowing/5511.patch": { "start": 5481, @@ -79,13 +100,20 @@ "end": 6166 }, "blink-fix-structured-binding-declaration/6167.patch": { - "start": 6167 + "start": 6167, + "end": 6167 }, "blink-font-constructor/5845.patch": { - "start": 5845 + "start": 5845, + "end": 6260 + }, + "blink-font-constructor/6261.patch": { + "start": 6261 }, "blink-font-constructor-2/5938.patch": { - "start": 5938 + "start": 5938, + "end": 6260, + "comment": "Disable since host clang-16" }, "blink-impl-wtf-stacksize/4389.patch": { "start": 4389, @@ -106,7 +134,9 @@ "end": 5685 }, "chromedriver-vector-emplace_back/5790.patch": { - "start": 5790 + "start": 5790, + "end": 6260, + "comment": "Disable since host clang-16" }, "chromium-disable-sandbox/5359.patch": { "start": 5359, @@ -219,7 +249,9 @@ "end": 5358 }, "chromium-no-atomic_flag/5359.patch": { - "start": 5359 + "start": 5359, + "end": 6260, + "comment": "Disable since NDK r26" }, "chromium-no-execinfo/4389.patch": { "start": 4389, @@ -275,6 +307,9 @@ "start": 5414, "end": 5562 }, + "chromium-strong_alias-no-constexpr-operator-equal/6261.patch": { + "start": 6261 + }, "chromium-struct-contructor/5790.patch": { "start": 5790, "end": 5844 @@ -331,7 +366,11 @@ "end": 6166 }, "compiler-remove-unsupported-flags/6167.patch": { - "start": 6167 + "start": 6167, + "end": 6260 + }, + "compiler-remove-unsupported-flags/6261.patch": { + "start": 6261 }, "compiler-use-android-target/4389.patch": { "start": 4389, @@ -349,7 +388,11 @@ "start": 5414 }, "cpuinfo-android-arm/5249.patch": { - "start": 5249 + "start": 5249, + "end": 6260 + }, + "cpuinfo-android-arm/6261.patch": { + "start": 6261 }, "crashpad-no-getdtablesize/4389.patch": { "start": 4389, @@ -486,14 +529,32 @@ "start": 6159, "end": 6225 }, + "remove-xorg-from-build-deps-2/6255.patch": { + "start": 6255 + }, "resource_attribution-query_params-no-constexpr-operator-equal/6167.patch": { - "start": 6167 + "start": 6167, + "end": 6260 + }, + "resource_attribution-query_params-no-constexpr-operator-equal/6261.patch": { + "start": 6261 }, "revert-blink-v8-cxx20/6167.patch": { - "start": 6167 + "start": 6167, + "end": 6260 + }, + "revert-blink-v8-cxx20/6261.patch": { + "start": 6261 + }, + "revert-blink-v8-cxx20-2/6261.patch": { + "start": 6261 }, "revert-rust-qr-scanner/6167.patch": { - "start": 6167 + "start": 6167, + "end": 6260 + }, + "revert-rust-qr-scanner/6261.patch": { + "start": 6261 }, "revert-split-out-ios-shared-feed-protos/5615.patch": { "start": 5615, @@ -535,7 +596,11 @@ "end": 6044 }, "swiftshader-no-android/6045.patch": { - "start": 6045 + "start": 6045, + "end": 6260 + }, + "swiftshader-no-android/6261.patch": { + "start": 6261 }, "swiftshader-no-spawn/5359.patch": { "start": 5359 @@ -547,6 +612,9 @@ "start": 5359, "end": 5413 }, + "undo-internal-alloc/6261.patch": { + "start": 6261 + }, "unity-fix-dynamic-loaded-libraries/4389.patch": { "start": 4389 }, @@ -554,10 +622,16 @@ "start": 4389 }, "use-std_to_address-from-libcxx/6167.patch": { - "start": 6167 + "start": 6167, + "end": 6260 + }, + "use-std_to_address-from-libcxx/6261.patch": { + "start": 6261 }, "v8-do-not-use-builtin-mul/5481.patch": { - "start": 5481 + "start": 5481, + "end": 6260, + "comment": "Disable since host clang-16" }, "v8-fix-compile-on-android-ndk/5993.patch": { "start": 5993 @@ -566,7 +640,8 @@ "start": 5546 }, "v8-fix-non-ptr-compr-compilation-on-old-compilers/5938.patch": { - "start": 5938 + "start": 5938, + "end": 6260 }, "v8-fix-trap-handler/5249.patch": { "start": 4961, @@ -615,7 +690,11 @@ "end": 6044 }, "x11-fix-dynamic-loaded-libraries/6045.patch": { - "start": 6045 + "start": 6045, + "end": 6260 + }, + "x11-fix-dynamic-loaded-libraries/6261.patch": { + "start": 6261 }, "y-exclusive_sync_wait_info-constructor/6099.patch": { "start": 6099 @@ -630,7 +709,11 @@ "start": 6099 }, "y-loss_based_bwe_v2_config-constructor/6099.patch": { - "start": 6099 + "start": 6099, + "end": 6260 + }, + "y-loss_based_bwe_v2_config-constructor/6261.patch": { + "start": 6261 }, "y-mime_util_xdg-file_info-consturctor/6167.patch": { "start": 6167 @@ -648,12 +731,16 @@ "start": 5615, "end": 5734 }, + "z-iwyu-blink-include-bitset-2/6261.patch": { + "start": 6261 + }, "z-iwyu-blink-include-cstring/4961.patch": { "start": 4961, "end": 5005 }, "z-iwyu-blink-include-mutex/6167.patch": { - "start": 6167 + "start": 6167, + "end": 6260 }, "z-iwyu-blink-include-variant/5845.patch": { "start": 5845, @@ -672,10 +759,12 @@ "end": 6044 }, "z-iwyu-chromium-include-cmath/5249.patch": { - "start": 4961 + "start": 4961, + "end": 6260 }, "z-iwyu-chromium-include-compare/5735.patch": { - "start": 5735 + "start": 5735, + "end": 6260 }, "z-iwyu-chromium-include-ctime/4389.patch": { "start": 4389, @@ -686,10 +775,15 @@ "end": 5844 }, "z-iwyu-crypto-hkdf-include-vector/6167.patch": { - "start": 6167 + "start": 6167, + "end": 6260 }, "z-iwyu-display_color_management-include-string/6167.patch": { - "start": 6167 + "start": 6167, + "end": 6260 + }, + "z-iwyu-display_color_management-include-string/6261.patch": { + "start": 6261 }, "z-iwyu-gfx-include-bitset/6167.patch": { "start": 6167 diff --git a/common-files/chromium-patches/remove-xorg-from-build-deps-2/6255.patch b/common-files/chromium-patches/remove-xorg-from-build-deps-2/6255.patch new file mode 100644 index 000000000..0a82a4db9 --- /dev/null +++ b/common-files/chromium-patches/remove-xorg-from-build-deps-2/6255.patch @@ -0,0 +1,13 @@ +This reverts https://github.com/chromium/chromium/commit/97c864b32a7f4d64f541e2b7bf9006d2f582082f + +--- a/build/install-build-deps.py ++++ b/build/install-build-deps.py +@@ -374,8 +374,6 @@ def lib_list(): + "libxrender1", + "libxtst6", + "x11-utils", +- "xserver-xorg-core", # TODO(crbug.com/1417069): Experimental. +- "xserver-xorg-video-dummy", # TODO(crbug.com/1417069): Experimental. + "xvfb", + "zlib1g", + ] diff --git a/common-files/chromium-patches/resource_attribution-query_params-no-constexpr-operator-equal/6261.patch b/common-files/chromium-patches/resource_attribution-query_params-no-constexpr-operator-equal/6261.patch new file mode 100644 index 000000000..01622b6d3 --- /dev/null +++ b/common-files/chromium-patches/resource_attribution-query_params-no-constexpr-operator-equal/6261.patch @@ -0,0 +1,22 @@ +error: defaulted definition of equality comparison operator cannot be declared constexpr because it invokes a non-constexpr comparison function + +--- a/components/performance_manager/resource_attribution/query_params.h ++++ b/components/performance_manager/resource_attribution/query_params.h +@@ -29,7 +29,7 @@ + ContextCollection(const ContextCollection& other); + ContextCollection& operator=(const ContextCollection& other); + +- friend constexpr bool operator==(const ContextCollection&, ++ friend bool operator==(const ContextCollection&, + const ContextCollection&) = default; + + // Adds `context` to the collection. +@@ -67,7 +67,7 @@ + QueryParams(const QueryParams& other); + QueryParams& operator=(const QueryParams& other); + +- friend constexpr bool operator==(const QueryParams&, ++ friend bool operator==(const QueryParams&, + const QueryParams&) = default; + + // Resource types to measure. diff --git a/common-files/chromium-patches/revert-blink-v8-cxx20-2/6261.patch b/common-files/chromium-patches/revert-blink-v8-cxx20-2/6261.patch new file mode 100644 index 000000000..b36611017 --- /dev/null +++ b/common-files/chromium-patches/revert-blink-v8-cxx20-2/6261.patch @@ -0,0 +1,146 @@ +This reverts https://github.com/chromium/chromium/commit/ce71348a09f6689dd01a68db64b172191d0182d8 + +--- a/third_party/blink/renderer/bindings/core/v8/native_value_traits.h ++++ b/third_party/blink/renderer/bindings/core/v8/native_value_traits.h +@@ -110,12 +110,6 @@ struct NativeValueTraitsBase< + static constexpr bool has_null_value = + bindings::NativeValueTraitsHasNullValue::value; + +- // This should only be true for certain subclasses of ScriptWrappable +- // that satisfy the assumptions of CreateIDLSequenceFromV8ArraySlow() with +- // regards to how NativeValue() is implemented for the underlying type. +- static constexpr bool supports_scriptwrappable_specific_fast_array_iteration = +- false; +- + template + static decltype(auto) ArgumentValue(v8::Isolate* isolate, + int argument_index, +--- a/third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h ++++ b/third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h +@@ -1067,86 +1067,10 @@ CreateIDLSequenceFromV8ArraySlow(v8::Iso + return {}; + } + +- using ResultType = typename NativeValueTraits>::ImplType; +- ResultType result; ++ typename NativeValueTraits>::ImplType result; + result.ReserveInitialCapacity(length); + v8::Local current_context = isolate->GetCurrentContext(); + v8::TryCatch try_block(isolate); +- +- // Fast path -- we're creating a sequence of script wrappables, which can be +- // done by directly getting underlying object as long as array types are +- // homogeneous. With ScriptWrappables, we don't expect to enter JS during +- // iteration, so we can rely on v8::Array::Iterate() which is much faster than +- // iterating an array on the client side of the v8. Additionally, for most +- // subsptyes of ScriptWrappables, we can speed up type checks (see more on +- // that below next to supports_scriptwrappable_specific_fast_array_iteration +- // check. +- if constexpr (std::is_base_of_v) { +- struct CallbackData { +- STACK_ALLOCATED(); +- +- public: +- v8::Isolate* isolate; +- v8::TypecheckWitness witness; +- ResultType& result; +- ExceptionState& exception_state; +- CallbackData(v8::Isolate* isolate, +- ResultType& result, +- ExceptionState& exception_state) +- : isolate(isolate), +- witness(isolate), +- result(result), +- exception_state(exception_state) {} +- }; +- +- CallbackData callback_data(isolate, result, exception_state); +- v8::Array::IterationCallback callback = [](uint32_t index, +- v8::Local v8_element, +- void* data) { +- CallbackData* callback_data = reinterpret_cast(data); +- // 3.4. Initialize Si to the result of converting nextItem to an IDL value +- // of type T. +- v8::TypecheckWitness& witness = callback_data->witness; +- // We can speed up type check by taking advantage of V8's type witness, +- // provided traits' NativeValue implementation doesn't have additional +- // logic beyond checking the type and calling ToScriptWrappable(). +- if constexpr ( +- NativeValueTraits< +- T>::supports_scriptwrappable_specific_fast_array_iteration) { +- if (witness.Matches(v8_element)) { +- auto&& value = ToScriptWrappable(v8_element.As()) +- ->template ToImpl(); +- callback_data->result.push_back(std::move(value)); +- return v8::Array::CallbackResult::kContinue; +- } +- } +- auto&& element = NativeValueTraits::NativeValue( +- callback_data->isolate, v8_element, callback_data->exception_state); +- if (callback_data->exception_state.HadException()) { +- // It doesn't matter whether we return `kException` or `kBreak` here, +- // as that only affects the return value of `v8_array->Iterate()`, +- // which we are ignoring. +- return v8::Array::CallbackResult::kException; +- } +- if constexpr ( +- NativeValueTraits< +- T>::supports_scriptwrappable_specific_fast_array_iteration) { +- witness.Update(v8_element); +- } +- callback_data->result.push_back(std::move(element)); +- return v8::Array::CallbackResult::kContinue; +- }; +- if (!v8_array->Iterate(current_context, callback, &callback_data) +- .IsJust()) { +- if (try_block.HasCaught()) { +- exception_state.RethrowV8Exception(try_block.Exception()); +- } +- DCHECK(exception_state.HadException()); +- return {}; +- } +- return result; +- } +- + // Array length may change if array is mutated during iteration. + for (uint32_t i = 0; i < v8_array->Length(); ++i) { + v8::Local v8_element; +@@ -1162,7 +1086,6 @@ CreateIDLSequenceFromV8ArraySlow(v8::Iso + return {}; + result.push_back(std::move(element)); + } +- + // 3.2. If next is false, then return an IDL sequence value of type + // sequence of length i, where the value of the element at index j is Sj. + return result; +@@ -1521,7 +1444,6 @@ struct NativeValueTraits< + } + }; + +-// Interface types + template + struct NativeValueTraits< + IDLNullable, +@@ -1606,21 +1528,13 @@ struct NativeValueTraits< + T, + typename std::enable_if_t::value>> + : public NativeValueTraitsBase { +- // This signifies that CreateIDLSequenceFromV8ArraySlow() may apply +- // certain optimization based on assumptions about `NativeValue()` +- // implementation below. For subclasses of ScriptWrappable that have +- // different implementation of NativeValue(), this should remain false. +- static constexpr bool supports_scriptwrappable_specific_fast_array_iteration = +- true; + + static inline T* NativeValue(v8::Isolate* isolate, + v8::Local value, + ExceptionState& exception_state) { + const WrapperTypeInfo* wrapper_type_info = T::GetStaticWrapperTypeInfo(); +- if (V8PerIsolateData::From(isolate)->HasInstance(wrapper_type_info, +- value)) { ++ if (V8PerIsolateData::From(isolate)->HasInstance(wrapper_type_info, value)) + return ToScriptWrappable(value.As())->template ToImpl(); +- } + + bindings::NativeValueTraitsInterfaceNotOfType(wrapper_type_info, + exception_state); diff --git a/common-files/chromium-patches/revert-blink-v8-cxx20/6261.patch b/common-files/chromium-patches/revert-blink-v8-cxx20/6261.patch new file mode 100644 index 000000000..2bc42538a --- /dev/null +++ b/common-files/chromium-patches/revert-blink-v8-cxx20/6261.patch @@ -0,0 +1,725 @@ +This reverts https://github.com/chromium/chromium/commit/940af9f2c87b436559b97c53763aa9eaaf1254eb + +--- a/third_party/blink/renderer/bindings/core/v8/native_value_traits.h ++++ b/third_party/blink/renderer/bindings/core/v8/native_value_traits.h +@@ -5,7 +5,6 @@ + #ifndef THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_NATIVE_VALUE_TRAITS_H_ + #define THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_NATIVE_VALUE_TRAITS_H_ + +-#include + #include + + #include "third_party/blink/renderer/bindings/core/v8/idl_types_base.h" +@@ -31,7 +30,7 @@ + // return toInt32(isolate, value, exceptionState, NormalConversion); + // } + // } +-template ++template + struct NativeValueTraits; + + // This declaration serves only as a blueprint for specializations: the +@@ -46,15 +45,22 @@ + + namespace bindings { + ++template ++struct NativeValueTraitsHasIsNull : std::false_type {}; ++ + template +-struct ImplTypeFor { +- using type = T; +-}; ++struct NativeValueTraitsHasIsNull< ++ T, ++ std::void_t().IsNull())>> : std::true_type {}; + + template +- requires std::derived_from +-struct ImplTypeFor { +- using type = typename T::ImplType; ++struct NativeValueTraitsHasNullValue { ++ // true if |T| supports IDL null value. ++ static constexpr bool value = ++ // ScriptValue, String, and union types have IsNull member function. ++ bindings::NativeValueTraitsHasIsNull::value || ++ // Pointer types have nullptr as IDL null value. ++ std::is_pointer::value; + }; + + } // namespace bindings +@@ -72,17 +78,37 @@ + // If present, |NullValue()| will be used when converting from the nullable type + // T?, and should be used if the impl type has an existing "null" state. If not + // present, WTF::Optional will be used to wrap the type. +-template ++template + struct NativeValueTraitsBase { + STATIC_ONLY(NativeValueTraitsBase); + +- using ImplType = bindings::ImplTypeFor::type; ++ using ImplType = T; ++ ++ static constexpr bool has_null_value = ++ bindings::NativeValueTraitsHasNullValue::value; ++ ++ template ++ static decltype(auto) ArgumentValue(v8::Isolate* isolate, ++ int argument_index, ++ v8::Local value, ++ ExceptionState& exception_state, ++ ExtraArgs... extra_args) { ++ return NativeValueTraits>::NativeValue( ++ isolate, value, exception_state, ++ std::forward(extra_args)...); ++ } ++}; ++ ++template ++struct NativeValueTraitsBase< ++ T, ++ std::enable_if_t::value>> { ++ STATIC_ONLY(NativeValueTraitsBase); ++ ++ using ImplType = typename T::ImplType; + +- // Pointer types have nullptr as IDL null value. +- // ScriptValue, String, and union types have IsNull member function. + static constexpr bool has_null_value = +- std::is_pointer_v || +- requires(ImplType value) { value.IsNull(); }; ++ bindings::NativeValueTraitsHasNullValue::value; + + // This should only be true for certain subclasses of ScriptWrappable + // that satisfy the assumptions of CreateIDLSequenceFromV8ArraySlow() with +--- a/third_party/blink/renderer/bindings/core/v8/native_value_traits_buffer_sources.cc ++++ b/third_party/blink/renderer/bindings/core/v8/native_value_traits_buffer_sources.cc +@@ -7,7 +7,6 @@ + #include "third_party/blink/renderer/core/core_export.h" + #include "third_party/blink/renderer/core/execution_context/execution_context.h" + #include "third_party/blink/renderer/core/frame/web_feature.h" +-#include "third_party/blink/renderer/core/typed_arrays/flexible_array_buffer_view.h" + #include "third_party/blink/renderer/core/typed_arrays/typed_flexible_array_buffer_view.h" + + namespace blink { +@@ -699,11 +698,12 @@ + // ArrayBufferView + + template +- requires std::derived_from +-NotShared NativeValueTraits>::NativeValue( +- v8::Isolate* isolate, +- v8::Local value, +- ExceptionState& exception_state) { ++NotShared NativeValueTraits< ++ NotShared, ++ typename std::enable_if_t::value>>:: ++ NativeValue(v8::Isolate* isolate, ++ v8::Local value, ++ ExceptionState& exception_state) { + return NativeValueImpl< + RecipeTrait>, ToDOMViewType, + Nullablity::kIsNotNullable, BufferSizeCheck::kCheck, +@@ -712,12 +712,13 @@ + } + + template +- requires std::derived_from +-NotShared NativeValueTraits>::ArgumentValue( +- v8::Isolate* isolate, +- int argument_index, +- v8::Local value, +- ExceptionState& exception_state) { ++NotShared NativeValueTraits< ++ NotShared, ++ typename std::enable_if_t::value>>:: ++ ArgumentValue(v8::Isolate* isolate, ++ int argument_index, ++ v8::Local value, ++ ExceptionState& exception_state) { + return ArgumentValueImpl< + RecipeTrait>, ToDOMViewType, + Nullablity::kIsNotNullable, BufferSizeCheck::kCheck, +@@ -728,11 +729,12 @@ + // [AllowShared] ArrayBufferView + + template +- requires std::derived_from +-MaybeShared NativeValueTraits>::NativeValue( +- v8::Isolate* isolate, +- v8::Local value, +- ExceptionState& exception_state) { ++MaybeShared NativeValueTraits< ++ MaybeShared, ++ typename std::enable_if_t::value>>:: ++ NativeValue(v8::Isolate* isolate, ++ v8::Local value, ++ ExceptionState& exception_state) { + return NativeValueImpl>, + ToDOMViewType, + Nullablity::kIsNotNullable, BufferSizeCheck::kCheck, +@@ -741,12 +743,13 @@ + } + + template +- requires std::derived_from +-MaybeShared NativeValueTraits>::ArgumentValue( +- v8::Isolate* isolate, +- int argument_index, +- v8::Local value, +- ExceptionState& exception_state) { ++MaybeShared NativeValueTraits< ++ MaybeShared, ++ typename std::enable_if_t::value>>:: ++ ArgumentValue(v8::Isolate* isolate, ++ int argument_index, ++ v8::Local value, ++ ExceptionState& exception_state) { + return ArgumentValueImpl>, + ToDOMViewType, + Nullablity::kIsNotNullable, BufferSizeCheck::kCheck, +@@ -757,12 +760,12 @@ + // [AllowShared, BufferSourceTypeNoSizeLimit] ArrayBufferView + + template +- requires std::derived_from +-MaybeShared +-NativeValueTraits>>::NativeValue( +- v8::Isolate* isolate, +- v8::Local value, +- ExceptionState& exception_state) { ++MaybeShared NativeValueTraits< ++ IDLBufferSourceTypeNoSizeLimit>, ++ typename std::enable_if_t::value>>:: ++ NativeValue(v8::Isolate* isolate, ++ v8::Local value, ++ ExceptionState& exception_state) { + return NativeValueImpl< + RecipeTrait>, ToDOMViewType, + Nullablity::kIsNotNullable, BufferSizeCheck::kDoNotCheck, +@@ -771,12 +774,13 @@ + } + + template +- requires std::derived_from +-MaybeShared NativeValueTraits>>::ArgumentValue(v8::Isolate* isolate, +- int argument_index, +- v8::Local value, +- ExceptionState& exception_state) { ++MaybeShared NativeValueTraits< ++ IDLBufferSourceTypeNoSizeLimit>, ++ typename std::enable_if_t::value>>:: ++ ArgumentValue(v8::Isolate* isolate, ++ int argument_index, ++ v8::Local value, ++ ExceptionState& exception_state) { + return ArgumentValueImpl< + RecipeTrait>, ToDOMViewType, + Nullablity::kIsNotNullable, BufferSizeCheck::kDoNotCheck, +@@ -787,11 +791,12 @@ + // Nullable ArrayBufferView + + template +- requires std::derived_from +-NotShared NativeValueTraits>>::NativeValue( +- v8::Isolate* isolate, +- v8::Local value, +- ExceptionState& exception_state) { ++NotShared NativeValueTraits< ++ IDLNullable>, ++ typename std::enable_if_t::value>>:: ++ NativeValue(v8::Isolate* isolate, ++ v8::Local value, ++ ExceptionState& exception_state) { + return NativeValueImpl< + RecipeTrait>, ToDOMViewType, + Nullablity::kIsNullable, BufferSizeCheck::kCheck, +@@ -800,12 +805,13 @@ + } + + template +- requires std::derived_from +-NotShared NativeValueTraits>>::ArgumentValue( +- v8::Isolate* isolate, +- int argument_index, +- v8::Local value, +- ExceptionState& exception_state) { ++NotShared NativeValueTraits< ++ IDLNullable>, ++ typename std::enable_if_t::value>>:: ++ ArgumentValue(v8::Isolate* isolate, ++ int argument_index, ++ v8::Local value, ++ ExceptionState& exception_state) { + return ArgumentValueImpl< + RecipeTrait>, ToDOMViewType, + Nullablity::kIsNullable, BufferSizeCheck::kCheck, +@@ -816,11 +822,12 @@ NotShared NativeValueTraits +- requires std::derived_from +-MaybeShared NativeValueTraits>>::NativeValue( +- v8::Isolate* isolate, +- v8::Local value, +- ExceptionState& exception_state) { ++MaybeShared NativeValueTraits< ++ IDLNullable>, ++ typename std::enable_if_t::value>>:: ++ NativeValue(v8::Isolate* isolate, ++ v8::Local value, ++ ExceptionState& exception_state) { + return NativeValueImpl>, + ToDOMViewType, + Nullablity::kIsNullable, BufferSizeCheck::kCheck, +@@ -829,12 +836,13 @@ + } + + template +- requires std::derived_from +-MaybeShared NativeValueTraits>>::ArgumentValue( +- v8::Isolate* isolate, +- int argument_index, +- v8::Local value, +- ExceptionState& exception_state) { ++MaybeShared NativeValueTraits< ++ IDLNullable>, ++ typename std::enable_if_t::value>>:: ++ ArgumentValue(v8::Isolate* isolate, ++ int argument_index, ++ v8::Local value, ++ ExceptionState& exception_state) { + return ArgumentValueImpl>, + ToDOMViewType, + Nullablity::kIsNullable, BufferSizeCheck::kCheck, +@@ -845,9 +853,9 @@ + // Nullable [AllowShared, BufferSourceTypeNoSizeLimit] ArrayBufferView + + template +- requires std::derived_from +-MaybeShared +-NativeValueTraits>>>:: ++MaybeShared NativeValueTraits< ++ IDLNullable>>, ++ typename std::enable_if_t::value>>:: + ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local value, +@@ -862,11 +870,13 @@ + // [AllowShared, FlexibleArrayBufferView] ArrayBufferView + + template +- requires std::derived_from +-T NativeValueTraits::ArgumentValue(v8::Isolate* isolate, +- int argument_index, +- v8::Local value, +- ExceptionState& exception_state) { ++T NativeValueTraits::value>>:: ++ ArgumentValue(v8::Isolate* isolate, ++ int argument_index, ++ v8::Local value, ++ ExceptionState& exception_state) { + return ArgumentValueImpl, ToFlexibleArrayBufferView, + Nullablity::kIsNotNullable, BufferSizeCheck::kCheck, + ResizableAllowance::kDisallowResizable, +@@ -878,12 +888,13 @@ + // ArrayBufferView + + template +- requires std::derived_from +-T NativeValueTraits>::ArgumentValue( +- v8::Isolate* isolate, +- int argument_index, +- v8::Local value, +- ExceptionState& exception_state) { ++T NativeValueTraits, ++ typename std::enable_if_t< ++ std::is_base_of::value>>:: ++ ArgumentValue(v8::Isolate* isolate, ++ int argument_index, ++ v8::Local value, ++ ExceptionState& exception_state) { + return ArgumentValueImpl< + RecipeTrait, ToFlexibleArrayBufferView, Nullablity::kIsNotNullable, + BufferSizeCheck::kDoNotCheck, ResizableAllowance::kDisallowResizable, +@@ -894,12 +905,13 @@ + // Nullable [AllowShared, FlexibleArrayBufferView] ArrayBufferView + + template +- requires std::derived_from +-T NativeValueTraits>::ArgumentValue( +- v8::Isolate* isolate, +- int argument_index, +- v8::Local value, +- ExceptionState& exception_state) { ++T NativeValueTraits, ++ typename std::enable_if_t< ++ std::is_base_of::value>>:: ++ ArgumentValue(v8::Isolate* isolate, ++ int argument_index, ++ v8::Local value, ++ ExceptionState& exception_state) { + return ArgumentValueImpl, ToFlexibleArrayBufferView, + Nullablity::kIsNullable, BufferSizeCheck::kCheck, + ResizableAllowance::kDisallowResizable, +--- a/third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h ++++ b/third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h +@@ -5,9 +5,6 @@ + #ifndef THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_NATIVE_VALUE_TRAITS_IMPL_H_ + #define THIRD_PARTY_BLINK_RENDERER_BINDINGS_CORE_V8_NATIVE_VALUE_TRAITS_IMPL_H_ + +-#include +-#include +- + #include "third_party/abseil-cpp/absl/types/optional.h" + #include "third_party/blink/renderer/bindings/core/v8/idl_types.h" + #include "third_party/blink/renderer/bindings/core/v8/native_value_traits.h" +@@ -736,8 +733,9 @@ + }; + + template +- requires std::derived_from +-struct NativeValueTraits { ++struct NativeValueTraits< ++ T, ++ typename std::enable_if_t::value>> { + // NotShared or MaybeShared should be used instead. + static T* NativeValue(v8::Isolate* isolate, + v8::Local value, +@@ -749,8 +747,9 @@ + }; + + template +- requires std::derived_from +-struct NativeValueTraits> { ++struct NativeValueTraits< ++ IDLNullable, ++ typename std::enable_if_t::value>> { + // NotShared or MaybeShared should be used instead. + static T* NativeValue(v8::Isolate* isolate, + v8::Local value, +@@ -762,8 +761,9 @@ + }; + + template +- requires std::derived_from +-struct NativeValueTraits> ++struct NativeValueTraits< ++ NotShared, ++ typename std::enable_if_t::value>> + : public NativeValueTraitsBase> { + static NotShared NativeValue(v8::Isolate* isolate, + v8::Local value, +@@ -776,8 +776,9 @@ + }; + + template +- requires std::derived_from +-struct NativeValueTraits>> ++struct NativeValueTraits< ++ IDLNullable>, ++ typename std::enable_if_t::value>> + : public NativeValueTraitsBase> { + static NotShared NativeValue(v8::Isolate* isolate, + v8::Local value, +@@ -790,8 +791,9 @@ + }; + + template +- requires std::derived_from +-struct NativeValueTraits> ++struct NativeValueTraits< ++ MaybeShared, ++ typename std::enable_if_t::value>> + : public NativeValueTraitsBase> { + static MaybeShared NativeValue(v8::Isolate* isolate, + v8::Local value, +@@ -804,8 +806,9 @@ + }; + + template +- requires std::derived_from +-struct NativeValueTraits>> ++struct NativeValueTraits< ++ IDLBufferSourceTypeNoSizeLimit>, ++ typename std::enable_if_t::value>> + : public NativeValueTraitsBase> { + // FlexibleArrayBufferView uses this in its implementation, so we cannot + // delete it. +@@ -820,8 +823,9 @@ + }; + + template +- requires std::derived_from +-struct NativeValueTraits>> ++struct NativeValueTraits< ++ IDLNullable>, ++ typename std::enable_if_t::value>> + : public NativeValueTraitsBase> { + static MaybeShared NativeValue(v8::Isolate* isolate, + v8::Local value, +@@ -834,9 +838,9 @@ + }; + + template +- requires std::derived_from + struct NativeValueTraits< +- IDLNullable>>> ++ IDLNullable>>, ++ typename std::enable_if_t::value>> + : public NativeValueTraitsBase> { + // BufferSourceTypeNoSizeLimit must be used only as arguments. + static MaybeShared NativeValue(v8::Isolate* isolate, +@@ -850,8 +854,11 @@ + }; + + template +- requires std::derived_from +-struct NativeValueTraits : public NativeValueTraitsBase { ++struct NativeValueTraits< ++ T, ++ typename std::enable_if_t< ++ std::is_base_of::value>> ++ : public NativeValueTraitsBase { + // FlexibleArrayBufferView must be used only as arguments. + static T NativeValue(v8::Isolate* isolate, + v8::Local value, +@@ -864,8 +871,10 @@ + }; + + template +- requires std::derived_from +-struct NativeValueTraits> ++struct NativeValueTraits< ++ IDLBufferSourceTypeNoSizeLimit, ++ typename std::enable_if_t< ++ std::is_base_of::value>> + : public NativeValueTraitsBase { + // BufferSourceTypeNoSizeLimit and FlexibleArrayBufferView must be used only + // as arguments. +@@ -880,8 +889,11 @@ + }; + + template +- requires std::derived_from +-struct NativeValueTraits> : public NativeValueTraitsBase { ++struct NativeValueTraits< ++ IDLNullable, ++ typename std::enable_if_t< ++ std::is_base_of::value>> ++ : public NativeValueTraitsBase { + // FlexibleArrayBufferView must be used only as arguments. + static T NativeValue(v8::Isolate* isolate, + v8::Local value, +@@ -1217,8 +1229,9 @@ + } + + template +- requires NativeValueTraits>::has_null_value +-struct NativeValueTraits>> ++struct NativeValueTraits>, ++ typename std::enable_if_t< ++ NativeValueTraits>::has_null_value>> + : public NativeValueTraitsBase>*> { + using ImplType = typename NativeValueTraits>::ImplType*; + +@@ -1294,8 +1307,9 @@ + : public NativeValueTraits> {}; + + template +- requires NativeValueTraits>::has_null_value +-struct NativeValueTraits>> ++struct NativeValueTraits>, ++ typename std::enable_if_t< ++ NativeValueTraits>::has_null_value>> + : public NativeValueTraits>> {}; + + // Record types +@@ -1425,8 +1439,10 @@ + + // Callback function types + template +- requires std::derived_from +-struct NativeValueTraits : public NativeValueTraitsBase { ++struct NativeValueTraits< ++ T, ++ typename std::enable_if_t::value>> ++ : public NativeValueTraitsBase { + static T* NativeValue(v8::Isolate* isolate, + v8::Local value, + ExceptionState& exception_state) { +@@ -1449,8 +1465,9 @@ + }; + + template +- requires std::derived_from +-struct NativeValueTraits> ++struct NativeValueTraits< ++ IDLNullable, ++ typename std::enable_if_t::value>> + : public NativeValueTraitsBase> { + static T* NativeValue(v8::Isolate* isolate, + v8::Local value, +@@ -1479,8 +1496,10 @@ + + // Callback interface types + template +- requires std::derived_from +-struct NativeValueTraits : public NativeValueTraitsBase { ++struct NativeValueTraits< ++ T, ++ typename std::enable_if_t::value>> ++ : public NativeValueTraitsBase { + static T* NativeValue(v8::Isolate* isolate, + v8::Local value, + ExceptionState& exception_state) { +@@ -1504,8 +1523,9 @@ + + // Interface types + template +- requires std::derived_from +-struct NativeValueTraits> ++struct NativeValueTraits< ++ IDLNullable, ++ typename std::enable_if_t::value>> + : public NativeValueTraitsBase> { + static T* NativeValue(v8::Isolate* isolate, + v8::Local value, +@@ -1534,8 +1554,11 @@ + + // Dictionary types + template +- requires std::derived_from +-struct NativeValueTraits : public NativeValueTraitsBase { ++struct NativeValueTraits< ++ T, ++ typename std::enable_if_t< ++ std::is_base_of::value>> ++ : public NativeValueTraitsBase { + static T* NativeValue(v8::Isolate* isolate, + v8::Local value, + ExceptionState& exception_state) { +@@ -1546,11 +1569,14 @@ + // We don't support nullable dictionary types in general since it's quite + // confusing and often misused. + template +- requires std::derived_from && +- (std::same_as || +- std::same_as || +- std::same_as) +-struct NativeValueTraits> : public NativeValueTraitsBase { ++struct NativeValueTraits< ++ IDLNullable, ++ typename std::enable_if_t< ++ std::is_base_of::value && ++ (std::is_same::value || ++ std::is_same::value || ++ std::is_same::value)>> ++ : public NativeValueTraitsBase { + static T* NativeValue(v8::Isolate* isolate, + v8::Local value, + ExceptionState& exception_state) { +@@ -1562,8 +1588,11 @@ + + // Enumeration types + template +- requires std::derived_from +-struct NativeValueTraits : public NativeValueTraitsBase { ++struct NativeValueTraits< ++ T, ++ typename std::enable_if_t< ++ std::is_base_of::value>> ++ : public NativeValueTraitsBase { + static T NativeValue(v8::Isolate* isolate, + v8::Local value, + ExceptionState& exception_state) { +@@ -1573,8 +1602,10 @@ + + // Interface types + template +- requires std::derived_from +-struct NativeValueTraits : public NativeValueTraitsBase { ++struct NativeValueTraits< ++ T, ++ typename std::enable_if_t::value>> ++ : public NativeValueTraitsBase { + // This signifies that CreateIDLSequenceFromV8ArraySlow() may apply + // certain optimization based on assumptions about `NativeValue()` + // implementation below. For subclasses of ScriptWrappable that have +@@ -1611,8 +1642,9 @@ + }; + + template +- requires std::derived_from +-struct NativeValueTraits> ++struct NativeValueTraits< ++ IDLNullable, ++ typename std::enable_if_t::value>> + : public NativeValueTraitsBase> { + static inline T* NativeValue(v8::Isolate* isolate, + v8::Local value, +@@ -1647,8 +1679,10 @@ + }; + + template +- requires std::derived_from +-struct NativeValueTraits : public NativeValueTraitsBase { ++struct NativeValueTraits< ++ T, ++ typename std::enable_if_t::value>> ++ : public NativeValueTraitsBase { + static T* NativeValue(v8::Isolate* isolate, + v8::Local value, + ExceptionState& exception_state) { +@@ -1664,8 +1698,10 @@ + }; + + template +- requires std::derived_from +-struct NativeValueTraits> : public NativeValueTraitsBase { ++struct NativeValueTraits< ++ IDLNullable, ++ typename std::enable_if_t::value>> ++ : public NativeValueTraitsBase { + static T* NativeValue(v8::Isolate* isolate, + v8::Local value, + ExceptionState& exception_state) { +@@ -1686,8 +1722,9 @@ + + // Nullable types + template +- requires(!NativeValueTraits::has_null_value) +-struct NativeValueTraits> ++struct NativeValueTraits< ++ IDLNullable, ++ typename std::enable_if_t::has_null_value>> + : public NativeValueTraitsBase> { + // https://webidl.spec.whatwg.org/#es-nullable-type + using ImplType = +@@ -1719,8 +1756,9 @@ + + // Optional types + template +- requires std::is_arithmetic_v::ImplType> +-struct NativeValueTraits> ++struct NativeValueTraits, ++ typename std::enable_if_t::ImplType>::value>> + : public NativeValueTraitsBase::ImplType> { + using ImplType = typename NativeValueTraits::ImplType; + +@@ -1742,8 +1780,9 @@ + }; + + template +- requires std::is_pointer_v::ImplType> +-struct NativeValueTraits> ++struct NativeValueTraits, ++ typename std::enable_if_t::ImplType>::value>> + : public NativeValueTraitsBase::ImplType> { + using ImplType = typename NativeValueTraits::ImplType; + diff --git a/common-files/chromium-patches/revert-rust-qr-scanner/6261.patch b/common-files/chromium-patches/revert-rust-qr-scanner/6261.patch new file mode 100644 index 000000000..a992588f9 --- /dev/null +++ b/common-files/chromium-patches/revert-rust-qr-scanner/6261.patch @@ -0,0 +1,169 @@ +This reverts https://github.com/chromium/chromium/commit/bcf739b95713071687ff25010683248de0092f6a + +--- a/components/qr_code_generator/BUILD.gn ++++ b/components/qr_code_generator/BUILD.gn +@@ -11,6 +11,11 @@ + enable_qr_print = false + } + ++buildflag_header("rust_buildflags") { ++ header = "rust_buildflags.h" ++ flags = [ "ENABLE_RUST=$enable_rust" ] ++} ++ + # Separate target to: + # - Limit `visibility` (stricter than dir-level `DEPS` would allow) + # - Allow `//chrome/services/qr_code_generator_service/public/cpp` to check the +@@ -23,7 +28,10 @@ + "features.cc", + "features.h", + ] +- deps = [ "//base" ] ++ deps = [ ++ ":rust_buildflags", ++ "//base", ++ ] + visibility = [ + ":qr_code_generator", + ":unit_tests", +@@ -39,19 +47,27 @@ + ] + deps = [ + ":qr_code_generator_features", +- ":qr_code_generator_ffi_glue", ++ ":rust_buildflags", + "//base", + ] ++ if (enable_rust) { ++ deps += [ ++ ":qr_code_generator_ffi_glue", ++ "//build/rust:cxx_cppdeps", ++ ] ++ } + public_deps = [ "//base" ] + } + +-rust_static_library("qr_code_generator_ffi_glue") { +- allow_unsafe = true # Needed for FFI that underpins the `cxx` crate. +- crate_root = "qr_code_generator_ffi_glue.rs" +- sources = [ "qr_code_generator_ffi_glue.rs" ] +- cxx_bindings = [ "qr_code_generator_ffi_glue.rs" ] +- visibility = [ ":qr_code_generator" ] +- deps = [ "//third_party/rust/qr_code/v2:lib" ] ++if (enable_rust) { ++ rust_static_library("qr_code_generator_ffi_glue") { ++ allow_unsafe = true # Needed for FFI that underpins the `cxx` crate. ++ crate_root = "qr_code_generator_ffi_glue.rs" ++ sources = [ "qr_code_generator_ffi_glue.rs" ] ++ cxx_bindings = [ "qr_code_generator_ffi_glue.rs" ] ++ visibility = [ ":qr_code_generator" ] ++ deps = [ "//third_party/rust/qr_code/v2:lib" ] ++ } + } + + source_set("unit_tests") { +@@ -60,6 +76,7 @@ + deps = [ + ":qr_code_generator", + ":qr_code_generator_features", ++ ":rust_buildflags", + "//base", + "//base/test:test_support", + "//testing/gtest", +--- a/components/qr_code_generator/features.h ++++ b/components/qr_code_generator/features.h +@@ -6,6 +6,7 @@ + #define COMPONENTS_QR_CODE_GENERATOR_FEATURES_H_ + + #include "base/feature_list.h" ++#include "components/qr_code_generator/rust_buildflags.h" + + namespace qr_code_generator { + +@@ -13,8 +14,10 @@ + // but product code should instead use `IsRustyQrCodeGeneratorFeatureEnabled`. + BASE_DECLARE_FEATURE(kRustyQrCodeGeneratorFeature); + +-// Returns true if Rust should be used for QR code generation - i.e. if +-// the `"RustyQrCodeGenerator"` base::Feature has been enabled. ++// Returns true if Rust should be used for QR code generation: ++// 1) the GN-level `enable_rust` is true. ++// *and* ++// 2) the `"RustyQrCodeGenerator"` base::Feature has been enabled. + // + // If Rust is used for QR code generation then: + // 1) //components/qr_code_generator becomes a thin wrapper around a 3rd-party +@@ -26,7 +29,11 @@ + // See https://crbug.com/1431991 for more details about the feature and the + // Rust QR Code Generator project. + inline bool IsRustyQrCodeGeneratorFeatureEnabled() { ++#if BUILDFLAG(ENABLE_RUST) + return base::FeatureList::IsEnabled(kRustyQrCodeGeneratorFeature); ++#else ++ return false; ++#endif + } + + } // namespace qr_code_generator +--- a/components/qr_code_generator/qr_code_generator.cc ++++ b/components/qr_code_generator/qr_code_generator.cc +@@ -11,12 +11,15 @@ + #include + + #include "base/check_op.h" +-#include "base/containers/span_rust.h" + #include "base/memory/raw_ptr.h" + #include "base/notreached.h" + #include "base/numerics/safe_conversions.h" + #include "components/qr_code_generator/features.h" ++ ++#if BUILDFLAG(ENABLE_RUST) ++#include "base/containers/span_rust.h" + #include "components/qr_code_generator/qr_code_generator_ffi_glue.rs.h" ++#endif + + namespace qr_code_generator { + +@@ -572,6 +575,7 @@ + return sum; + } + ++#if BUILDFLAG(ENABLE_RUST) + absl::optional GenerateQrCodeUsingRust( + base::span in, + absl::optional min_version) { +@@ -596,6 +600,7 @@ + CHECK_EQ(code.data.size(), static_cast(code.qr_size * code.qr_size)); + return code; + } ++#endif + + } // namespace + +@@ -618,9 +613,11 @@ + absl::optional QRCodeGenerator::Generate( + base::span in, + absl::optional min_version) { ++#if BUILDFLAG(ENABLE_RUST) + if (IsRustyQrCodeGeneratorFeatureEnabled()) { + return GenerateQrCodeUsingRust(in, min_version); + } ++#endif + + if (in.size() > kMaxInputSize) { + return absl::nullopt; +--- a/components/qr_code_generator/qr_code_generator_unittest.cc ++++ b/components/qr_code_generator/qr_code_generator_unittest.cc +@@ -298,9 +298,12 @@ + ASSERT_FALSE(qr.Generate(huge_input, std::make_optional(-1))); + } + ++#if BUILDFLAG(ENABLE_RUST) + INSTANTIATE_TEST_SUITE_P(RustEnabled, + QRCodeGeneratorTest, + ::testing::Values(RustFeatureState::kRustEnabled)); ++#endif ++ + INSTANTIATE_TEST_SUITE_P(RustDisabled, + QRCodeGeneratorTest, + ::testing::Values(RustFeatureState::kRustDisabled)); diff --git a/common-files/chromium-patches/swiftshader-no-android/6261.patch b/common-files/chromium-patches/swiftshader-no-android/6261.patch new file mode 100644 index 000000000..ad36188d7 --- /dev/null +++ b/common-files/chromium-patches/swiftshader-no-android/6261.patch @@ -0,0 +1,406 @@ +diff -uNr a/third_party/swiftshader/src/Vulkan/VkGetProcAddress.cpp b/third_party/swiftshader/src/Vulkan/VkGetProcAddress.cpp +--- a/third_party/swiftshader/src/Vulkan/VkGetProcAddress.cpp ++++ b/third_party/swiftshader/src/Vulkan/VkGetProcAddress.cpp +@@ -19,7 +19,7 @@ + #include + #include + +-#ifdef __ANDROID__ ++#if (defined(__ANDROID__) && !defined(__TERMUX__)) + # include + # include + # include +@@ -105,7 +105,7 @@ + MAKE_VULKAN_INSTANCE_ENTRY(vkSubmitDebugUtilsMessageEXT), + // VK_EXT_tooling_info + MAKE_VULKAN_INSTANCE_ENTRY(vkGetPhysicalDeviceToolProperties), +-#ifndef __ANDROID__ ++#if !(defined(__ANDROID__) && !defined(__TERMUX__)) + // VK_KHR_surface + MAKE_VULKAN_INSTANCE_ENTRY(vkDestroySurfaceKHR), + MAKE_VULKAN_INSTANCE_ENTRY(vkGetPhysicalDeviceSurfaceSupportKHR), +@@ -310,7 +310,7 @@ + MAKE_VULKAN_DEVICE_ENTRY(vkQueueInsertDebugUtilsLabelEXT), + MAKE_VULKAN_DEVICE_ENTRY(vkSetDebugUtilsObjectNameEXT), + MAKE_VULKAN_DEVICE_ENTRY(vkSetDebugUtilsObjectTagEXT), +-#ifdef __ANDROID__ ++#if defined(__ANDROID__) && !defined(__TERMUX__) + MAKE_VULKAN_DEVICE_ENTRY(vkGetSwapchainGrallocUsageANDROID), + MAKE_VULKAN_DEVICE_ENTRY(vkGetSwapchainGrallocUsage2ANDROID), + MAKE_VULKAN_DEVICE_ENTRY(vkAcquireImageANDROID), +@@ -535,7 +535,7 @@ + MAKE_VULKAN_DEVICE_ENTRY(vkCmdWriteTimestamp2KHR), + MAKE_VULKAN_DEVICE_ENTRY(vkQueueSubmit2KHR), + } }, +-#ifndef __ANDROID__ ++#if !(defined(__ANDROID__) && !defined(__TERMUX__)) + // VK_KHR_swapchain + { + VK_KHR_SWAPCHAIN_EXTENSION_NAME, +@@ -680,7 +680,7 @@ + + } // namespace vk + +-#ifdef __ANDROID__ ++#if defined(__ANDROID__) && !defined(__TERMUX__) + + extern "C" hwvulkan_module_t HAL_MODULE_INFO_SYM; + +diff -uNr a/third_party/swiftshader/src/Vulkan/VkImage.cpp b/third_party/swiftshader/src/Vulkan/VkImage.cpp +--- a/third_party/swiftshader/src/Vulkan/VkImage.cpp ++++ b/third_party/swiftshader/src/Vulkan/VkImage.cpp +@@ -25,7 +25,7 @@ + #include "Device/Blitter.hpp" + #include "Device/ETC_Decoder.hpp" + +-#ifdef __ANDROID__ ++#if defined(__ANDROID__) && !defined(__TERMUX__) + # include + + # include "VkDeviceMemoryExternalAndroid.hpp" +@@ -135,7 +135,7 @@ + // VK_STRUCTURE_TYPE_SWAPCHAIN_IMAGE_CREATE_INFO_ANDROID, are not enumerated in the official Vulkan headers. + switch((int)(nextInfo->sType)) + { +-#ifdef __ANDROID__ ++#if defined(__ANDROID__) && !defined(__TERMUX__) + case VK_STRUCTURE_TYPE_EXTERNAL_FORMAT_ANDROID: + { + const VkExternalFormatANDROID *externalFormatAndroid = reinterpret_cast(nextInfo); +@@ -317,7 +317,7 @@ + } + } + +-#ifdef __ANDROID__ ++#if defined(__ANDROID__) && !defined(__TERMUX__) + VkResult Image::prepareForExternalUseANDROID() const + { + VkExtent3D extent = getMipLevelExtent(VK_IMAGE_ASPECT_COLOR_BIT, 0); +diff -uNr a/third_party/swiftshader/src/Vulkan/VkImage.hpp b/third_party/swiftshader/src/Vulkan/VkImage.hpp +--- a/third_party/swiftshader/src/Vulkan/VkImage.hpp ++++ b/third_party/swiftshader/src/Vulkan/VkImage.hpp +@@ -20,7 +20,7 @@ + + #include "marl/mutex.h" + +-#ifdef __ANDROID__ ++#if defined(__ANDROID__) && !defined(__TERMUX__) + # include // For VkSwapchainImageUsageFlagsANDROID and buffer_handle_t + #endif + +@@ -33,7 +33,7 @@ + class DeviceMemory; + class ImageView; + +-#ifdef __ANDROID__ ++#if defined(__ANDROID__) && !defined(__TERMUX__) + struct BackingMemory + { + bool externalMemory = false; +@@ -48,7 +48,7 @@ + Image(const VkImageCreateInfo *pCreateInfo, void *mem, Device *device); + void destroy(const VkAllocationCallbacks *pAllocator); + +-#ifdef __ANDROID__ ++#if defined(__ANDROID__) && !defined(__TERMUX__) + VkResult prepareForExternalUseANDROID() const; + #endif + +@@ -110,7 +110,7 @@ + void contentsChanged(const VkImageSubresourceRange &subresourceRange, ContentsChangedContext contentsChangedContext = DIRECT_MEMORY_ACCESS); + const Image *getSampledImage(const vk::Format &imageViewFormat) const; + +-#ifdef __ANDROID__ ++#if defined(__ANDROID__) && !defined(__TERMUX__) + void setBackingMemory(BackingMemory &bm) + { + backingMemory = bm; +@@ -162,7 +162,7 @@ + VkImageTiling tiling = VK_IMAGE_TILING_OPTIMAL; + VkImageUsageFlags usage = (VkImageUsageFlags)0; + Image *decompressedImage = nullptr; +-#ifdef __ANDROID__ ++#if defined(__ANDROID__) && !defined(__TERMUX__) + BackingMemory backingMemory = {}; + #endif + +diff -uNr a/third_party/swiftshader/src/Vulkan/VkPhysicalDevice.cpp b/third_party/swiftshader/src/Vulkan/VkPhysicalDevice.cpp +--- a/third_party/swiftshader/src/Vulkan/VkPhysicalDevice.cpp ++++ b/third_party/swiftshader/src/Vulkan/VkPhysicalDevice.cpp +@@ -22,7 +22,7 @@ + #include + #include + +-#ifdef __ANDROID__ ++#if defined(__ANDROID__) && !defined(__TERMUX__) + # include + #endif + +@@ -971,7 +971,7 @@ + properties->combinedImageSamplerDescriptorCount = 1; // Need only one descriptor for YCbCr sampling. + } + +-#ifdef __ANDROID__ ++#if defined(__ANDROID__) && !defined(__TERMUX__) + void PhysicalDevice::getProperties(VkPhysicalDevicePresentationPropertiesANDROID *properties) const + { + properties->sharedImage = VK_FALSE; +diff -uNr a/third_party/swiftshader/src/Vulkan/VkPhysicalDevice.hpp b/third_party/swiftshader/src/Vulkan/VkPhysicalDevice.hpp +--- a/third_party/swiftshader/src/Vulkan/VkPhysicalDevice.hpp ++++ b/third_party/swiftshader/src/Vulkan/VkPhysicalDevice.hpp +@@ -69,7 +69,7 @@ + void getProperties(const VkExternalMemoryHandleTypeFlagBits *handleType, VkExternalImageFormatProperties *properties) const; + void getProperties(const VkExternalMemoryHandleTypeFlagBits *handleType, VkExternalBufferProperties *properties) const; + void getProperties(VkSamplerYcbcrConversionImageFormatProperties *properties) const; +-#ifdef __ANDROID__ ++#if defined(__ANDROID__) && !defined(__TERMUX__) + void getProperties(VkPhysicalDevicePresentationPropertiesANDROID *properties) const; + void getProperties(const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkAndroidHardwareBufferUsageANDROID *properties) const; + #endif +diff -uNr a/third_party/swiftshader/src/Vulkan/VkQueue.cpp b/third_party/swiftshader/src/Vulkan/VkQueue.cpp +--- a/third_party/swiftshader/src/Vulkan/VkQueue.cpp ++++ b/third_party/swiftshader/src/Vulkan/VkQueue.cpp +@@ -189,7 +189,7 @@ + } + } + +-#ifndef __ANDROID__ ++#if !(defined(__ANDROID__) && !defined(__TERMUX__)) + VkResult Queue::present(const VkPresentInfoKHR *presentInfo) + { + // This is a hack to deal with screen tearing for now. +diff -uNr a/third_party/swiftshader/src/Vulkan/VkQueue.hpp b/third_party/swiftshader/src/Vulkan/VkQueue.hpp +--- a/third_party/swiftshader/src/Vulkan/VkQueue.hpp ++++ b/third_party/swiftshader/src/Vulkan/VkQueue.hpp +@@ -53,7 +53,7 @@ + + VkResult submit(uint32_t submitCount, SubmitInfo *pSubmits, Fence *fence); + VkResult waitIdle(); +-#ifndef __ANDROID__ ++#if !(defined(__ANDROID__) && !defined(__TERMUX__)) + VkResult present(const VkPresentInfoKHR *presentInfo); + #endif + +diff -uNr a/third_party/swiftshader/src/Vulkan/libVulkan.cpp b/third_party/swiftshader/src/Vulkan/libVulkan.cpp +--- a/third_party/swiftshader/src/Vulkan/libVulkan.cpp ++++ b/third_party/swiftshader/src/Vulkan/libVulkan.cpp +@@ -81,7 +81,7 @@ + #include "marl/thread.h" + #include "marl/tsa.h" + +-#ifdef __ANDROID__ ++#if defined(__ANDROID__) && !defined(__TERMUX__) + # include + + # include "commit.h" +@@ -104,7 +104,7 @@ + namespace { + + // Enable commit_id.py and #include commit.h for other platforms. +-#if defined(__ANDROID__) && defined(ENABLE_BUILD_VERSION_OUTPUT) ++#if defined(__ANDROID__) && !defined(__TERMUX__) && defined(ENABLE_BUILD_VERSION_OUTPUT) + void logBuildVersionInformation() + { + // TODO(b/144093703): Don't call __android_log_print() directly +@@ -139,7 +139,7 @@ + void initializeLibrary() + { + static bool doOnce = [] { +-#if defined(__ANDROID__) && defined(ENABLE_BUILD_VERSION_OUTPUT) ++#if defined(__ANDROID__) && !defined(__TERMUX__) && defined(ENABLE_BUILD_VERSION_OUTPUT) + logBuildVersionInformation(); + #endif // __ANDROID__ && ENABLE_BUILD_VERSION_OUTPUT + return true; +@@ -286,7 +286,7 @@ + { { VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME, VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_SPEC_VERSION } }, + { { VK_EXT_DEBUG_UTILS_EXTENSION_NAME, VK_EXT_DEBUG_UTILS_SPEC_VERSION } }, + { { VK_EXT_HEADLESS_SURFACE_EXTENSION_NAME, VK_EXT_HEADLESS_SURFACE_SPEC_VERSION } }, +-#ifndef __ANDROID__ ++#if !(defined(__ANDROID__) && !defined(__TERMUX__)) + { { VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_SURFACE_SPEC_VERSION } }, + { { VK_EXT_SURFACE_MAINTENANCE_1_EXTENSION_NAME, VK_EXT_SURFACE_MAINTENANCE_1_SPEC_VERSION } }, + { { VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME, VK_KHR_GET_SURFACE_CAPABILITIES_2_SPEC_VERSION } }, +@@ -340,7 +340,7 @@ + // Only 1.1 core version of this is supported. The extension has additional requirements + //{{ VK_KHR_VARIABLE_POINTERS_EXTENSION_NAME, VK_KHR_VARIABLE_POINTERS_SPEC_VERSION }}, + { { VK_EXT_QUEUE_FAMILY_FOREIGN_EXTENSION_NAME, VK_EXT_QUEUE_FAMILY_FOREIGN_SPEC_VERSION } }, +-#ifndef __ANDROID__ ++#if !(defined(__ANDROID__) && !defined(__TERMUX__)) + // We fully support the KHR_swapchain v70 additions, so just track the spec version. + { { VK_KHR_SWAPCHAIN_EXTENSION_NAME, VK_KHR_SWAPCHAIN_SPEC_VERSION } }, + #else +@@ -416,7 +416,7 @@ + { { VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_EXTENSION_NAME, VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_SPEC_VERSION } }, + { { VK_KHR_SWAPCHAIN_MUTABLE_FORMAT_EXTENSION_NAME, VK_KHR_SWAPCHAIN_MUTABLE_FORMAT_SPEC_VERSION } }, + { { VK_KHR_PIPELINE_LIBRARY_EXTENSION_NAME, VK_KHR_PIPELINE_LIBRARY_SPEC_VERSION } }, +-#ifndef __ANDROID__ ++#if !(defined(__ANDROID__) && !defined(__TERMUX__)) + { { VK_EXT_SWAPCHAIN_MAINTENANCE_1_EXTENSION_NAME, VK_EXT_SWAPCHAIN_MAINTENANCE_1_SPEC_VERSION } }, + #endif + { { VK_EXT_GRAPHICS_PIPELINE_LIBRARY_EXTENSION_NAME, VK_EXT_GRAPHICS_PIPELINE_LIBRARY_SPEC_VERSION } }, +@@ -1952,7 +1952,7 @@ + + const VkBaseInStructure *extensionCreateInfo = reinterpret_cast(pCreateInfo->pNext); + +-#ifdef __ANDROID__ ++#if (defined(__ANDROID__) && !defined(__TERMUX__)) + vk::BackingMemory backmem; + bool swapchainImage = false; + #endif +@@ -1963,7 +1963,7 @@ + // VK_STRUCTURE_TYPE_NATIVE_BUFFER_ANDROID, are not enumerated in the official Vulkan headers. + switch((int)(extensionCreateInfo->sType)) + { +-#ifdef __ANDROID__ ++#if (defined(__ANDROID__) && !defined(__TERMUX__)) + case VK_STRUCTURE_TYPE_SWAPCHAIN_IMAGE_CREATE_INFO_ANDROID: + { + const VkSwapchainImageCreateInfoANDROID *swapImageCreateInfo = reinterpret_cast(extensionCreateInfo); +@@ -2023,7 +2023,7 @@ + + VkResult result = vk::Image::Create(pAllocator, pCreateInfo, pImage, vk::Cast(device)); + +-#ifdef __ANDROID__ ++#if (defined(__ANDROID__) && !defined(__TERMUX__)) + if(swapchainImage) + { + if(result != VK_SUCCESS) +@@ -2061,7 +2061,7 @@ + TRACE("(VkDevice device = %p, VkImage image = %p, const VkAllocationCallbacks* pAllocator = %p)", + device, static_cast(image), pAllocator); + +-#ifdef __ANDROID__ ++#if (defined(__ANDROID__) && !defined(__TERMUX__)) + vk::Image *img = vk::Cast(image); + if(img && img->hasExternalMemory()) + { +@@ -3473,7 +3473,7 @@ + /* Do nothing */ + break; + +-#ifndef __ANDROID__ ++#if !(defined(__ANDROID__) && !defined(__TERMUX__)) + case VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHR: + { + const auto *swapchainInfo = reinterpret_cast(extInfo); +@@ -3683,7 +3683,7 @@ + vk::Cast(physicalDevice)->getProperties(properties); + } + break; +-#ifdef __ANDROID__ ++#if (defined(__ANDROID__) && !defined(__TERMUX__)) + case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRESENTATION_PROPERTIES_ANDROID: + { + auto *properties = reinterpret_cast(extensionProperties); +@@ -3902,7 +3902,7 @@ + + VkBaseOutStructure *extensionProperties = reinterpret_cast(pImageFormatProperties->pNext); + +-#ifdef __ANDROID__ ++#if !(defined(__ANDROID__) && !defined(__TERMUX__)) + bool hasAHBUsage = false; + #endif + +@@ -3936,7 +3936,7 @@ + properties->identicalMemoryLayout = VK_TRUE; + } + break; +-#ifdef __ANDROID__ ++#if defined(__ANDROID__) && !defined(__TERMUX__) + case VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_USAGE_ANDROID: + { + auto *properties = reinterpret_cast(extensionProperties); +@@ -3966,7 +3966,7 @@ + + vk::Cast(physicalDevice)->getImageFormatProperties(format, type, tiling, usage, flags, &pImageFormatProperties->imageFormatProperties); + +-#ifdef __ANDROID__ ++#if defined(__ANDROID__) && !defined(__TERMUX__) + if(hasAHBUsage) + { + // AHardwareBuffer_lock may only be called with a single layer. +@@ -4089,7 +4089,7 @@ + { + switch(extInfo->sType) + { +-#ifdef __ANDROID__ ++#if defined(__ANDROID__) && !defined(__TERMUX__) + case VK_STRUCTURE_TYPE_EXTERNAL_FORMAT_ANDROID: + break; + #endif +@@ -4603,7 +4603,7 @@ + return vk::HeadlessSurfaceKHR::Create(pAllocator, pCreateInfo, pSurface); + } + +-#ifndef __ANDROID__ ++#if !(defined(__ANDROID__) && !defined(__TERMUX__)) + VKAPI_ATTR void VKAPI_CALL vkDestroySurfaceKHR(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks *pAllocator) + { + TRACE("(VkInstance instance = %p, VkSurfaceKHR surface = %p, const VkAllocationCallbacks* pAllocator = %p)", +@@ -4821,7 +4821,7 @@ + + #endif // ! __ANDROID__ + +-#ifdef __ANDROID__ ++#if defined(__ANDROID__) && !defined(__TERMUX__) + + VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainGrallocUsage2ANDROID(VkDevice device, VkFormat format, VkImageUsageFlags imageUsage, VkSwapchainImageUsageFlagsANDROID swapchainUsage, uint64_t *grallocConsumerUsage, uint64_t *grallocProducerUsage) + { +--- a/third_party/swiftshader/src/System/Debug.cpp ++++ b/third_party/swiftshader/src/System/Debug.cpp +@@ -14,7 +14,7 @@ + + #include "Debug.hpp" + +-#if __ANDROID__ ++#if defined(__ANDROID__) && !defined(__TERMUX__) + # include + #endif + +@@ -55,7 +55,7 @@ + Disabled, + }; + +-#ifdef __ANDROID__ ++#if defined(__ANDROID__) && !defined(__TERMUX__) + void logv_android(Level level, const char *msg) + { + switch(level) +@@ -107,7 +107,7 @@ + char buffer[2048]; + vsnprintf(buffer, sizeof(buffer), format, args); + +-# if defined(__ANDROID__) ++# if defined(__ANDROID__) && !defined(__TERMUX__) + logv_android(level, buffer); + # elif defined(_WIN32) + logv_std(level, buffer); +--- a/third_party/swiftshader/src/Reactor/Debug.cpp ++++ b/third_party/swiftshader/src/Reactor/Debug.cpp +@@ -19,7 +19,7 @@ + #include + #include + +-#if __ANDROID__ ++#if defined(__ANDROID__) && !defined(__TERMUX__) + # include + #endif + +@@ -105,7 +105,7 @@ + Fatal, + }; + +-#ifdef __ANDROID__ ++#if defined(__ANDROID__) && !defined(__TERMUX__) + void logv_android(Level level, const char *msg) + { + switch(level) +@@ -156,7 +156,7 @@ + char buffer[2048]; + vsnprintf(buffer, sizeof(buffer), format, args); + +-# if defined(__ANDROID__) ++# if defined(__ANDROID__) && !defined(__TERMUX__) + logv_android(level, buffer); + # elif defined(_WIN32) + logv_std(level, buffer); diff --git a/common-files/chromium-patches/sysroot-patches/libcxx-17-impl-three-way comparison-operator-for-vector.diff b/common-files/chromium-patches/sysroot-patches/libcxx-17-impl-three-way comparison-operator-for-vector.diff deleted file mode 100644 index 86d4c180a..000000000 --- a/common-files/chromium-patches/sysroot-patches/libcxx-17-impl-three-way comparison-operator-for-vector.diff +++ /dev/null @@ -1,108 +0,0 @@ -https://github.com/llvm/llvm-project/commit/55ec808a889726e0547b7e2f0aa12bc197f6d163 - ---- a/usr/include/c++/v1/vector -+++ b/usr/include/c++/v1/vector -@@ -269,12 +269,15 @@ template struct hash>; - --template bool operator==(const vector& x, const vector& y); --template bool operator< (const vector& x, const vector& y); --template bool operator!=(const vector& x, const vector& y); --template bool operator> (const vector& x, const vector& y); --template bool operator>=(const vector& x, const vector& y); --template bool operator<=(const vector& x, const vector& y); -+template bool operator==(const vector& x, const vector& y); // constexpr since C++20 -+template bool operator!=(const vector& x, const vector& y); // removed in C++20 -+template bool operator< (const vector& x, const vector& y); // removed in C++20 -+template bool operator> (const vector& x, const vector& y); // removed in C++20 -+template bool operator>=(const vector& x, const vector& y); // removed in C++20 -+template bool operator<=(const vector& x, const vector& y); // removed in C++20 -+template constexpr -+ constexpr synth-three-way-result operator<=>(const vector& x, -+ const vector& y); // since C++20 - - template - void swap(vector& x, vector& y) -@@ -282,10 +285,10 @@ void swap(vector& x, vector& y) - - template - typename vector::size_type --erase(vector& c, const U& value); // C++20 -+erase(vector& c, const U& value); // since C++20 - template - typename vector::size_type --erase_if(vector& c, Predicate pred); // C++20 -+erase_if(vector& c, Predicate pred); // since C++20 - - - template -@@ -303,6 +306,7 @@ template requires is-vector-bool-reference // Since C++ - #include <__algorithm/fill_n.h> - #include <__algorithm/iterator_operations.h> - #include <__algorithm/lexicographical_compare.h> -+#include <__algorithm/lexicographical_compare_three_way.h> - #include <__algorithm/remove.h> - #include <__algorithm/remove_if.h> - #include <__algorithm/rotate.h> -@@ -3441,8 +3445,9 @@ operator==(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __ - return __sz == __y.size() && std::equal(__x.begin(), __x.end(), __y.begin()); - } - -+#if _LIBCPP_STD_VER <= 17 -+ - template --_LIBCPP_CONSTEXPR_SINCE_CXX20 - inline _LIBCPP_HIDE_FROM_ABI - bool - operator!=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) -@@ -3451,7 +3456,6 @@ operator!=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __ - } - - template --_LIBCPP_CONSTEXPR_SINCE_CXX20 - inline _LIBCPP_HIDE_FROM_ABI - bool - operator< (const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) -@@ -3460,7 +3464,6 @@ operator< (const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __ - } - - template --_LIBCPP_CONSTEXPR_SINCE_CXX20 - inline _LIBCPP_HIDE_FROM_ABI - bool - operator> (const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) -@@ -3469,7 +3472,6 @@ operator> (const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __ - } - - template --_LIBCPP_CONSTEXPR_SINCE_CXX20 - inline _LIBCPP_HIDE_FROM_ABI - bool - operator>=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) -@@ -3478,7 +3480,6 @@ operator>=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __ - } - - template --_LIBCPP_CONSTEXPR_SINCE_CXX20 - inline _LIBCPP_HIDE_FROM_ABI - bool - operator<=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) -@@ -3486,6 +3487,17 @@ operator<=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __ - return !(__y < __x); - } - -+#else // _LIBCPP_STD_VER <= 17 -+ -+template -+_LIBCPP_HIDE_FROM_ABI constexpr __synth_three_way_result<_Tp> -+operator<=>(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y) { -+ return std::lexicographical_compare_three_way( -+ __x.begin(), __x.end(), __y.begin(), __y.end(), std::__synth_three_way<_Tp, _Tp>); -+} -+ -+#endif // _LIBCPP_STD_VER <= 17 -+ - template - _LIBCPP_CONSTEXPR_SINCE_CXX20 - inline _LIBCPP_HIDE_FROM_ABI diff --git a/common-files/chromium-patches/undo-internal-alloc/6261.patch b/common-files/chromium-patches/undo-internal-alloc/6261.patch new file mode 100644 index 000000000..e122a5fa3 --- /dev/null +++ b/common-files/chromium-patches/undo-internal-alloc/6261.patch @@ -0,0 +1,582 @@ +https://sources.debian.org/data/main/c/chromium/122.0.6261.57-1/debian/patches/bookworm/undo-internal-alloc.patch + +Revert commit b4d62daa178298eaa6fc8b9bc7ec6835c95ad86e to work around error + +/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../include/c++/13/bits/hashtable_policy.h:2058:28: error: excess elements in struct initializer + __buckets_alloc_type __alloc(_M_node_allocator()); + ^ ~~~~~~~~~~~~~~~~~~~ + +--- a/base/allocator/partition_allocator/src/partition_alloc/BUILD.gn ++++ b/base/allocator/partition_allocator/src/partition_alloc/BUILD.gn +@@ -388,7 +388,6 @@ if (is_clang_or_gcc) { + "gwp_asan_support.h", + "internal_allocator.cc", + "internal_allocator.h", +- "internal_allocator_forward.h", + "lightweight_quarantine.cc", + "lightweight_quarantine.h", + "memory_reclaimer.cc", +@@ -457,6 +456,8 @@ if (is_clang_or_gcc) { + if (use_starscan) { + sources += [ + "starscan/logging.h", ++ "starscan/metadata_allocator.cc", ++ "starscan/metadata_allocator.h", + "starscan/pcscan.cc", + "starscan/pcscan.h", + "starscan/pcscan_internal.cc", +--- a/base/allocator/partition_allocator/src/partition_alloc/internal_allocator.cc ++++ b/base/allocator/partition_allocator/src/partition_alloc/internal_allocator.cc +@@ -17,28 +17,4 @@ PartitionRoot& InternalAllocatorRoot() { + + return *allocator; + } +- +-// static +-void* InternalPartitionAllocated::operator new(size_t count) { +- return InternalAllocatorRoot().Alloc(count); +-} +-// static +-void* InternalPartitionAllocated::operator new(size_t count, +- std::align_val_t alignment) { +- return InternalAllocatorRoot().AlignedAlloc( +- static_cast(alignment), count); +-} +-// static +-void InternalPartitionAllocated::operator delete(void* ptr) { +- InternalAllocatorRoot().Free(ptr); +-} +-// static +-void InternalPartitionAllocated::operator delete(void* ptr, std::align_val_t) { +- InternalAllocatorRoot().Free(ptr); +-} +- +-// A deleter for `std::unique_ptr`. +-void InternalPartitionDeleter::operator()(void* ptr) const { +- InternalAllocatorRoot().Free(ptr); +-} + } // namespace partition_alloc::internal +--- a/base/allocator/partition_allocator/src/partition_alloc/internal_allocator.h ++++ b/base/allocator/partition_allocator/src/partition_alloc/internal_allocator.h +@@ -8,7 +8,6 @@ + #include + #include + +-#include "partition_alloc/internal_allocator_forward.h" + #include "partition_alloc/partition_alloc_base/component_export.h" + #include "partition_alloc/partition_root.h" + +@@ -24,38 +23,6 @@ namespace partition_alloc::internal { + PA_COMPONENT_EXPORT(PARTITION_ALLOC) + PartitionRoot& InternalAllocatorRoot(); + +-// A class that meets C++ named requirements, Allocator. +-template +-InternalAllocator::value_type* InternalAllocator::allocate( +- std::size_t count) { +- PA_CHECK(count <= +- std::numeric_limits::max() / sizeof(value_type)); +- return static_cast( +- InternalAllocatorRoot().Alloc(count * +- sizeof(value_type))); +-} +-template +-void InternalAllocator::deallocate(value_type* ptr, std::size_t) { +- InternalAllocatorRoot().Free(ptr); +-} +- +-// Create an object on heap in the internal partition. +-template +-T* ConstructAtInternalPartition(Args&&... args) { +- auto* memory = static_cast( +- InternalAllocatorRoot().Alloc(sizeof(T))); +- return new (memory) T(std::forward(args)...); +-} +- +-// Destroy an object on heap in the internal partition. +-template +-void DestroyAtInternalPartition(T* ptr) { +- // Destroying an array is not supported. +- static_assert(!std::is_array_v); +- ptr->~T(); +- InternalAllocatorRoot().Free(ptr); +-} +- + } // namespace partition_alloc::internal + + #endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_SRC_PARTITION_ALLOC_INTERNAL_ALLOCATOR_H_ +--- a/base/allocator/partition_allocator/src/partition_alloc/internal_allocator_forward.h ++++ /dev/null +@@ -1,67 +0,0 @@ +-// Copyright 2024 The Chromium Authors +-// Use of this source code is governed by a BSD-style license that can be +-// found in the LICENSE file. +- +-#ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_SRC_PARTITION_ALLOC_INTERNAL_ALLOCATOR_FORWARD_H_ +-#define BASE_ALLOCATOR_PARTITION_ALLOCATOR_SRC_PARTITION_ALLOC_INTERNAL_ALLOCATOR_FORWARD_H_ +- +-#include +-#include +- +-#include "partition_alloc/partition_alloc_base/component_export.h" +-#include "partition_alloc/partition_alloc_forward.h" +- +-// Internal Allocator can be used to get heap allocations required to +-// implement Partition Allocator's feature. +-// As Internal Allocator being Partition Allocator with minimal configuration, +-// it is not allowed to use this allocator for PA's core implementation to avoid +-// reentrancy issues. Also don't use this when satisfying the very first PA-E +-// allocation of the process. +- +-namespace partition_alloc::internal { +- +-PA_COMPONENT_EXPORT(PARTITION_ALLOC) +-PartitionRoot& InternalAllocatorRoot(); +- +-// A class that meets C++ named requirements, Allocator. +-template +-class InternalAllocator { +- public: +- // Member types required by allocator completeness requirements. +- using value_type = T; +- using size_type = std::size_t; +- using difference_type = std::ptrdiff_t; +- using propagate_on_container_move_assignment = std::true_type; +- +- value_type* allocate(std::size_t count); +- +- void deallocate(value_type* ptr, std::size_t); +-}; +- +-// Inherit this to make a class allocated on the internal partition. +-struct PA_COMPONENT_EXPORT(PARTITION_ALLOC) InternalPartitionAllocated { +- static void* operator new(size_t count); +- static void* operator new(size_t count, std::align_val_t alignment); +- // Though we do not forward placement new, we need to define this explicitly +- // to allow it. +- static void* operator new(std::size_t, void* ptr) { return ptr; } +- static void operator delete(void* ptr); +- static void operator delete(void* ptr, std::align_val_t); +-}; +- +-// Create an object on heap in the internal partition. +-template +-T* ConstructAtInternalPartition(Args&&... args); +- +-// Destroy an object on heap in the internal partition. +-template +-void DestroyAtInternalPartition(T* ptr); +- +-// A deleter for `std::unique_ptr`. +-struct PA_COMPONENT_EXPORT(PARTITION_ALLOC) InternalPartitionDeleter final { +- void operator()(void* ptr) const; +-}; +- +-} // namespace partition_alloc::internal +- +-#endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_SRC_PARTITION_ALLOC_INTERNAL_ALLOCATOR_FORWARD_H_ +--- a/base/allocator/partition_allocator/src/partition_alloc/shim/nonscannable_allocator.cc ++++ b/base/allocator/partition_allocator/src/partition_alloc/shim/nonscannable_allocator.cc +@@ -10,7 +10,7 @@ + #include "partition_alloc/shim/allocator_shim_default_dispatch_to_partition_alloc.h" + + #if BUILDFLAG(USE_STARSCAN) +-#include "partition_alloc/internal_allocator.h" ++#include "partition_alloc/starscan/metadata_allocator.h" + #include "partition_alloc/starscan/pcscan.h" + #endif + #endif // BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) +@@ -68,7 +68,7 @@ void NonScannableAllocatorImpl(opts)); + if constexpr (quarantinable) { + partition_alloc::internal::PCScan::RegisterNonScannableRoot( +--- a/base/allocator/partition_allocator/src/partition_alloc/shim/nonscannable_allocator.h ++++ b/base/allocator/partition_allocator/src/partition_alloc/shim/nonscannable_allocator.h +@@ -18,7 +18,7 @@ + #include "partition_alloc/partition_alloc.h" + + #if BUILDFLAG(USE_STARSCAN) +-#include "partition_alloc/internal_allocator_forward.h" ++#include "partition_alloc/starscan/metadata_allocator.h" + #endif + #endif // BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC) + +@@ -67,7 +67,7 @@ class NonScannableAllocatorImpl final { + + #if BUILDFLAG(USE_STARSCAN) + std::unique_ptr ++ partition_alloc::internal::PCScanMetadataDeleter> + allocator_; + std::atomic_bool pcscan_enabled_{false}; + #endif // BUILDFLAG(USE_STARSCAN) +--- /dev/null ++++ b/base/allocator/partition_allocator/src/partition_alloc/starscan/metadata_allocator.cc +@@ -0,0 +1,35 @@ ++// Copyright 2021 The Chromium Authors ++// Use of this source code is governed by a BSD-style license that can be ++// found in the LICENSE file. ++ ++#include "partition_alloc/partition_root.h" ++ ++#include ++ ++#include "partition_alloc/partition_alloc_base/component_export.h" ++#include "partition_alloc/partition_alloc_base/no_destructor.h" ++ ++namespace partition_alloc::internal { ++ ++namespace { ++constexpr PartitionOptions kConfig{}; ++} // namespace ++ ++PA_COMPONENT_EXPORT(PARTITION_ALLOC) ++PartitionRoot& PCScanMetadataAllocator() { ++ static internal::base::NoDestructor allocator(kConfig); ++ return *allocator; ++} ++ ++// TODO(tasak): investigate whether PartitionAlloc tests really need this ++// function or not. If we found no tests need, remove it. ++void ReinitPCScanMetadataAllocatorForTesting() { ++ // First, purge memory owned by PCScanMetadataAllocator. ++ PCScanMetadataAllocator().PurgeMemory(PurgeFlags::kDecommitEmptySlotSpans | ++ PurgeFlags::kDiscardUnusedSystemPages); ++ // Then, reinit the allocator. ++ PCScanMetadataAllocator().ResetForTesting(true); // IN-TEST ++ PCScanMetadataAllocator().Init(kConfig); ++} ++ ++} // namespace partition_alloc::internal +--- /dev/null ++++ b/base/allocator/partition_allocator/src/partition_alloc/starscan/metadata_allocator.h +@@ -0,0 +1,86 @@ ++// Copyright 2021 The Chromium Authors ++// Use of this source code is governed by a BSD-style license that can be ++// found in the LICENSE file. ++ ++#ifndef BASE_ALLOCATOR_PARTITION_ALLOCATOR_SRC_PARTITION_ALLOC_STARSCAN_METADATA_ALLOCATOR_H_ ++#define BASE_ALLOCATOR_PARTITION_ALLOCATOR_SRC_PARTITION_ALLOC_STARSCAN_METADATA_ALLOCATOR_H_ ++ ++#include ++ ++#include "partition_alloc/partition_alloc_base/component_export.h" ++#include "partition_alloc/partition_alloc_constants.h" ++#include "partition_alloc/partition_root.h" ++ ++namespace partition_alloc::internal { ++ ++PA_COMPONENT_EXPORT(PARTITION_ALLOC) ++PartitionRoot& PCScanMetadataAllocator(); ++void ReinitPCScanMetadataAllocatorForTesting(); ++ ++// STL allocator which is needed to keep internal data structures required by ++// PCScan. ++template ++class MetadataAllocator { ++ public: ++ using value_type = T; ++ ++ MetadataAllocator() = default; ++ ++ template ++ MetadataAllocator(const MetadataAllocator&) {} // NOLINT ++ ++ template ++ MetadataAllocator& operator=(const MetadataAllocator&) { ++ return *this; ++ } ++ ++ template ++ bool operator==(const MetadataAllocator&) { ++ return true; ++ } ++ ++ template ++ bool operator!=(const MetadataAllocator& o) { ++ return !operator==(o); ++ } ++ ++ value_type* allocate(size_t size) { ++ return static_cast( ++ PCScanMetadataAllocator() ++ .AllocInline( ++ size * sizeof(value_type))); ++ } ++ ++ void deallocate(value_type* ptr, size_t size) { ++ PCScanMetadataAllocator().FreeInline(ptr); ++ } ++}; ++ ++// Inherit from it to make a class allocated on the metadata partition. ++struct AllocatedOnPCScanMetadataPartition { ++ static void* operator new(size_t size) { ++ return PCScanMetadataAllocator() ++ .AllocInline(size); ++ } ++ static void operator delete(void* ptr) { ++ PCScanMetadataAllocator().FreeInline(ptr); ++ } ++}; ++ ++template ++T* MakePCScanMetadata(Args&&... args) { ++ auto* memory = static_cast( ++ PCScanMetadataAllocator() ++ .AllocInline(sizeof(T))); ++ return new (memory) T(std::forward(args)...); ++} ++ ++struct PCScanMetadataDeleter final { ++ inline void operator()(void* ptr) const { ++ PCScanMetadataAllocator().FreeInline(ptr); ++ } ++}; ++ ++} // namespace partition_alloc::internal ++ ++#endif // BASE_ALLOCATOR_PARTITION_ALLOCATOR_SRC_PARTITION_ALLOC_STARSCAN_METADATA_ALLOCATOR_H_ +--- a/base/allocator/partition_allocator/src/partition_alloc/starscan/pcscan.cc ++++ b/base/allocator/partition_allocator/src/partition_alloc/starscan/pcscan.cc +@@ -93,6 +93,7 @@ void PCScan::SetClearType(ClearType clea + + void PCScan::UninitForTesting() { + PCScanInternal::Instance().ClearRootsForTesting(); // IN-TEST ++ ReinitPCScanMetadataAllocatorForTesting(); // IN-TEST + } + + void PCScan::ReinitForTesting(InitConfig config) { +--- a/base/allocator/partition_allocator/src/partition_alloc/starscan/pcscan_internal.cc ++++ b/base/allocator/partition_allocator/src/partition_alloc/starscan/pcscan_internal.cc +@@ -20,7 +20,6 @@ + #include "build/build_config.h" + #include "partition_alloc/address_pool_manager.h" + #include "partition_alloc/allocation_guard.h" +-#include "partition_alloc/internal_allocator.h" + #include "partition_alloc/page_allocator.h" + #include "partition_alloc/page_allocator_constants.h" + #include "partition_alloc/partition_address_space.h" +@@ -41,6 +40,7 @@ + #include "partition_alloc/partition_alloc_constants.h" + #include "partition_alloc/partition_page.h" + #include "partition_alloc/reservation_offset_table.h" ++#include "partition_alloc/starscan/metadata_allocator.h" + #include "partition_alloc/starscan/pcscan_scheduling.h" + #include "partition_alloc/starscan/raceful_worklist.h" + #include "partition_alloc/starscan/scan_loop.h" +@@ -176,16 +176,16 @@ static_assert(kSuperPageSize >= sizeof(Q + #endif // PA_CONFIG(STARSCAN_USE_CARD_TABLE) + + template +-using MetadataVector = std::vector>; ++using MetadataVector = std::vector>; + template +-using MetadataSet = std::set, InternalAllocator>; ++using MetadataSet = std::set, MetadataAllocator>; + template + using MetadataHashMap = + std::unordered_map, + std::equal_to<>, +- InternalAllocator>>; ++ MetadataAllocator>>; + + struct GetSlotStartResult final { + PA_ALWAYS_INLINE bool is_found() const { +@@ -478,7 +478,7 @@ class PCScanScanLoop; + // This class is responsible for performing the entire PCScan task. + // TODO(bikineev): Move PCScan algorithm out of PCScanTask. + class PCScanTask final : public base::RefCountedThreadSafe, +- public InternalPartitionAllocated { ++ public AllocatedOnPCScanMetadataPartition { + public: + // Creates and initializes a PCScan state. + PCScanTask(PCScan& pcscan, size_t quarantine_last_size); +--- a/base/allocator/partition_allocator/src/partition_alloc/starscan/pcscan_internal.h ++++ b/base/allocator/partition_allocator/src/partition_alloc/starscan/pcscan_internal.h +@@ -13,9 +13,9 @@ + #include + #include + +-#include "partition_alloc/internal_allocator_forward.h" + #include "partition_alloc/partition_alloc_base/memory/scoped_refptr.h" + #include "partition_alloc/partition_alloc_base/no_destructor.h" ++#include "partition_alloc/starscan/metadata_allocator.h" + #include "partition_alloc/starscan/pcscan.h" + #include "partition_alloc/starscan/starscan_fwd.h" + #include "partition_alloc/starscan/write_protector.h" +@@ -32,14 +32,13 @@ class PCScanInternal final { + using Root = PCScan::Root; + using TaskHandle = scoped_refptr; + +- using SuperPages = +- std::vector>; +- using RootsMap = std::unordered_map< +- Root*, +- SuperPages, +- std::hash, +- std::equal_to<>, +- internal::InternalAllocator>>; ++ using SuperPages = std::vector>; ++ using RootsMap = ++ std::unordered_map, ++ std::equal_to<>, ++ MetadataAllocator>>; + + static PCScanInternal& Instance() { + // Since the data that PCScanInternal holds is cold, it's fine to have the +@@ -116,7 +115,7 @@ class PCScanInternal final { + void*, + std::hash, + std::equal_to<>, +- internal::InternalAllocator< ++ MetadataAllocator< + std::pair>>; + + PCScanInternal(); +--- a/base/allocator/partition_allocator/src/partition_alloc/starscan/raceful_worklist.h ++++ b/base/allocator/partition_allocator/src/partition_alloc/starscan/raceful_worklist.h +@@ -9,10 +9,10 @@ + #include + #include + +-#include "partition_alloc/internal_allocator_forward.h" + #include "partition_alloc/partition_alloc_base/compiler_specific.h" + #include "partition_alloc/partition_alloc_base/rand_util.h" + #include "partition_alloc/partition_alloc_check.h" ++#include "partition_alloc/starscan/metadata_allocator.h" + + namespace partition_alloc::internal { + +@@ -30,7 +30,7 @@ class RacefulWorklist { + std::atomic is_being_visited{false}; + std::atomic is_visited{false}; + }; +- using Underlying = std::vector>; ++ using Underlying = std::vector>; + + public: + class RandomizedView { +@@ -88,7 +88,7 @@ template + void RacefulWorklist::RandomizedView::Visit(Function f) { + auto& data = worklist_.data_; + std::vector> ++ MetadataAllocator> + to_revisit; + + // To avoid worklist iteration, quick check if the worklist was already +--- a/base/allocator/partition_allocator/src/partition_alloc/starscan/snapshot.cc ++++ b/base/allocator/partition_allocator/src/partition_alloc/starscan/snapshot.cc +@@ -7,7 +7,6 @@ + #include + #include + +-#include "partition_alloc/internal_allocator.h" + #include "partition_alloc/partition_alloc_check.h" + #include "partition_alloc/starscan/pcscan_internal.h" + +--- a/base/allocator/partition_allocator/src/partition_alloc/starscan/snapshot.h ++++ b/base/allocator/partition_allocator/src/partition_alloc/starscan/snapshot.h +@@ -8,13 +8,12 @@ + #include + #include + +-#include "partition_alloc/internal_allocator_forward.h" + #include "partition_alloc/starscan/pcscan_internal.h" + #include "partition_alloc/starscan/raceful_worklist.h" + + namespace partition_alloc::internal { + +-class StarScanSnapshot final : public InternalPartitionAllocated { ++class StarScanSnapshot final : public AllocatedOnPCScanMetadataPartition { + public: + using SuperPageBase = uintptr_t; + using SuperPagesWorklist = RacefulWorklist; +--- a/base/allocator/partition_allocator/src/partition_alloc/starscan/stats_collector.cc ++++ b/base/allocator/partition_allocator/src/partition_alloc/starscan/stats_collector.cc +@@ -4,7 +4,6 @@ + + #include "partition_alloc/starscan/stats_collector.h" + +-#include "partition_alloc/internal_allocator.h" + #include "partition_alloc/partition_alloc_base/time/time.h" + #include "partition_alloc/starscan/logging.h" + #include "partition_alloc/starscan/stats_reporter.h" +--- a/base/allocator/partition_allocator/src/partition_alloc/starscan/stats_collector.h ++++ b/base/allocator/partition_allocator/src/partition_alloc/starscan/stats_collector.h +@@ -14,10 +14,9 @@ + #include + #include + +-#include "partition_alloc/internal_allocator_forward.h" + #include "partition_alloc/partition_alloc_base/threading/platform_thread.h" + #include "partition_alloc/partition_alloc_base/time/time.h" +-#include "partition_alloc/partition_alloc_check.h" ++#include "partition_alloc/starscan/metadata_allocator.h" + #include "partition_alloc/starscan/starscan_fwd.h" + + namespace partition_alloc { +@@ -74,14 +73,13 @@ class StatsCollector final { + using IdType = StatsCollector::IdType; + using PerThreadEvents = + std::array(IdType::kNumIds)>; +- using UnderlyingMap = +- std::unordered_map, +- std::equal_to<>, +- internal::InternalAllocator< +- std::pair>>; ++ using UnderlyingMap = std::unordered_map< ++ internal::base::PlatformThreadId, ++ PerThreadEvents, ++ std::hash, ++ std::equal_to<>, ++ MetadataAllocator>>; + + inline void RegisterBeginEventFromCurrentThread(IdType id); + inline void RegisterEndEventFromCurrentThread(IdType id); +@@ -139,9 +137,8 @@ class StatsCollector final { + void ReportTracesAndHists(partition_alloc::StatsReporter& reporter) const; + + private: +- using MetadataString = std::basic_string, +- internal::InternalAllocator>; ++ using MetadataString = ++ std::basic_string, MetadataAllocator>; + + MetadataString ToUMAString(ScannerId id) const; + MetadataString ToUMAString(MutatorId id) const; +--- a/base/allocator/partition_allocator/src/partition_alloc/starscan/write_protector.h ++++ b/base/allocator/partition_allocator/src/partition_alloc/starscan/write_protector.h +@@ -10,7 +10,7 @@ + #include + + #include "build/build_config.h" +-#include "partition_alloc/internal_allocator_forward.h" ++#include "partition_alloc/starscan/metadata_allocator.h" + #include "partition_alloc/starscan/pcscan.h" + #include "partition_alloc/starscan/raceful_worklist.h" + +@@ -19,7 +19,7 @@ namespace partition_alloc::internal { + // Interface for page protection/unprotection. This is used in DCScan to catch + // concurrent mutator writes. Protection is done when the scanner starts + // scanning a range. Unprotection happens at the end of the scanning phase. +-class WriteProtector : public internal::InternalPartitionAllocated { ++class WriteProtector : public AllocatedOnPCScanMetadataPartition { + public: + virtual ~WriteProtector() = default; + diff --git a/common-files/chromium-patches/use-std_to_address-from-libcxx/6261.patch b/common-files/chromium-patches/use-std_to_address-from-libcxx/6261.patch new file mode 100644 index 000000000..1e35614cc --- /dev/null +++ b/common-files/chromium-patches/use-std_to_address-from-libcxx/6261.patch @@ -0,0 +1,29 @@ +https://sources.debian.org/patches/chromium/121.0.6167.139-1/fixes/std-to-address.patch + +--- a/mojo/public/cpp/bindings/type_converter.h ++++ b/mojo/public/cpp/bindings/type_converter.h +@@ -11,6 +11,11 @@ + #include + #include + ++namespace { ++template constexpr T *clang_to_address(T *P) { return P; } ++template auto clang_to_address(const T &P) -> decltype(P.operator->()) { return P.operator->(); } ++} ++ + namespace mojo { + + // NOTE: When possible, please consider using StructTraits / UnionTraits / +@@ -100,11 +105,11 @@ + template + requires requires(const U& obj) { + not std::is_pointer_v; +- { mojo::ConvertTo(std::to_address(obj)) } -> std::same_as; ++ { mojo::ConvertTo(::clang_to_address(obj)) } -> std::same_as; + } + inline T ConvertTo(const U& obj) { +- return mojo::ConvertTo(std::to_address(obj)); ++ return mojo::ConvertTo(::clang_to_address(obj)); + } + + template diff --git a/common-files/chromium-patches/x11-fix-dynamic-loaded-libraries/6261.patch b/common-files/chromium-patches/x11-fix-dynamic-loaded-libraries/6261.patch new file mode 100644 index 000000000..7963702c0 --- /dev/null +++ b/common-files/chromium-patches/x11-fix-dynamic-loaded-libraries/6261.patch @@ -0,0 +1,28 @@ +--- a/ui/base/x/x11_cursor_loader.cc ++++ b/ui/base/x/x11_cursor_loader.cc +@@ -138,7 +138,11 @@ + void operator()(void* ptr) const { dlclose(ptr); } + }; + ++#ifdef __TERMUX__ ++ std::unique_ptr lib(dlopen("libXcursor.so", RTLD_LAZY)); ++#else + std::unique_ptr lib(dlopen("libXcursor.so.1", RTLD_LAZY)); ++#endif + if (!lib) + return ""; + +--- a/ui/gfx/x/xlib_support.cc ++++ b/ui/gfx/x/xlib_support.cc +@@ -42,7 +42,11 @@ + CHECK(xlib_loader->Load("libX11.so.6")); + + auto* xlib_xcb_loader = GetXlibXcbLoader(); ++#ifdef __TERMUX__ ++ CHECK(xlib_xcb_loader->Load("libX11-xcb.so")); ++#else + CHECK(xlib_xcb_loader->Load("libX11-xcb.so.1")); ++#endif + + CHECK(xlib_loader->XInitThreads()); + diff --git a/common-files/chromium-patches/y-loss_based_bwe_v2_config-constructor/6261.patch b/common-files/chromium-patches/y-loss_based_bwe_v2_config-constructor/6261.patch new file mode 100644 index 000000000..07328e66b --- /dev/null +++ b/common-files/chromium-patches/y-loss_based_bwe_v2_config-constructor/6261.patch @@ -0,0 +1,14 @@ +--- a/third_party/webrtc/modules/congestion_controller/goog_cc/loss_based_bwe_v2.h ++++ b/third_party/webrtc/modules/congestion_controller/goog_cc/loss_based_bwe_v2.h +@@ -84,7 +84,10 @@ + DataRate loss_limited_bandwidth = DataRate::MinusInfinity(); + }; + +- struct Config { ++ class Config { ++ public: ++ Config() {} ++ + double bandwidth_rampup_upper_bound_factor = 0.0; + double bandwidth_rampup_upper_bound_factor_in_hold = 0; + double bandwidth_rampup_hold_threshold = 0; diff --git a/common-files/chromium-patches/z-iwyu-blink-include-bitset-2/6261.patch b/common-files/chromium-patches/z-iwyu-blink-include-bitset-2/6261.patch new file mode 100644 index 000000000..eed31bf78 --- /dev/null +++ b/common-files/chromium-patches/z-iwyu-blink-include-bitset-2/6261.patch @@ -0,0 +1,11 @@ +--- a/third_party/blink/renderer/platform/peerconnection/resolution_monitor.cc ++++ b/third_party/blink/renderer/platform/peerconnection/resolution_monitor.cc +@@ -2,6 +2,8 @@ + // Use of this source code is governed by a BSD-style license that can be + // found in the LICENSE file. + ++#include ++ + #include "third_party/blink/renderer/platform/peerconnection/resolution_monitor.h" + + #include "base/containers/span.h" diff --git a/common-files/chromium-patches/z-iwyu-display_color_management-include-string/6261.patch b/common-files/chromium-patches/z-iwyu-display_color_management-include-string/6261.patch new file mode 100644 index 000000000..724502d98 --- /dev/null +++ b/common-files/chromium-patches/z-iwyu-display_color_management-include-string/6261.patch @@ -0,0 +1,10 @@ +--- a/ui/display/types/display_color_management.h ++++ b/ui/display/types/display_color_management.h +@@ -5,6 +5,7 @@ + #define UI_DISPLAY_TYPES_DISPLAY_COLOR_MANAGEMENT_H_ + + #include ++#include + #include + + #include "third_party/skia/modules/skcms/skcms.h"