From a058070a7fc1ff0bd7be10016492957c9ce896ef Mon Sep 17 00:00:00 2001 From: Than Ngo Date: Thu, 22 Feb 2024 08:44:31 +0100 Subject: [PATCH] fixed compiler error with clang16 on epel 8/9 and fedora38 --- chromium-121-v8-c++20-p1.patch | 171 ++++++++ chromium-121-v8-c++20.patch | 743 +++++++++++++++++++++++++++++++++ chromium-122-v8-c++20.patch | 740 -------------------------------- chromium.spec | 10 +- 4 files changed, 920 insertions(+), 744 deletions(-) create mode 100644 chromium-121-v8-c++20-p1.patch create mode 100644 chromium-121-v8-c++20.patch delete mode 100644 chromium-122-v8-c++20.patch diff --git a/chromium-121-v8-c++20-p1.patch b/chromium-121-v8-c++20-p1.patch new file mode 100644 index 00000000..bdf6c01d --- /dev/null +++ b/chromium-121-v8-c++20-p1.patch @@ -0,0 +1,171 @@ +commit ce71348a09f6689dd01a68db64b172191d0182d8 +Author: Andrey Kosyakov +Date: Thu Dec 21 18:38:38 2023 +0000 + + [bindings] Use v8::Array::Iterate for converting script wrappables + + + This changes CreateIDLSequenceFromV8Array to use the new + v8::Array::Iterate() operation. + This speeds up the "execBundles" part of the microbenchmark + at crbug.com/dawn/1858 by around 3x. + This depends on crrev.com/c/4846594 landing (and rolling) first. + + This is a slight re-work of https://crrev.com/c/4847447/3, + originally by jkummerow@chromium.org + + Bug: v8:14218, dawn:1858, 1511239 + Change-Id: Ia266556d05b4d53e6942e12609d1c08882b4ff0f + Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5132129 + Commit-Queue: Andrey Kosyakov + Reviewed-by: Yuki Shiino + Cr-Commit-Position: refs/heads/main@{#1240236} + +diff --git a/third_party/blink/renderer/bindings/core/v8/native_value_traits.h b/third_party/blink/renderer/bindings/core/v8/native_value_traits.h +index 1e5a0790df6da..a5c28b37e9454 100644 +--- a/third_party/blink/renderer/bindings/core/v8/native_value_traits.h ++++ b/third_party/blink/renderer/bindings/core/v8/native_value_traits.h +@@ -84,6 +84,12 @@ struct NativeValueTraitsBase { + std::is_pointer_v || + requires(ImplType value) { value.IsNull(); }; + ++ // 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, +diff --git 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 +index 5011503dcf1c0..f085b6e905161 100644 +--- 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 +@@ -1037,10 +1037,86 @@ CreateIDLSequenceFromV8ArraySlow(v8::Isolate* isolate, + return {}; + } + +- typename NativeValueTraits>::ImplType result; ++ using ResultType = typename NativeValueTraits>::ImplType; ++ ResultType 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; +@@ -1056,6 +1132,7 @@ CreateIDLSequenceFromV8ArraySlow(v8::Isolate* isolate, + 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; +@@ -1398,6 +1475,7 @@ struct NativeValueTraits : public NativeValueTraitsBase { + } + }; + ++// Interface types + template + requires std::derived_from + struct NativeValueTraits> +@@ -1470,12 +1548,21 @@ struct NativeValueTraits : public NativeValueTraitsBase { + template + requires std::derived_from + struct NativeValueTraits : 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/chromium-121-v8-c++20.patch b/chromium-121-v8-c++20.patch new file mode 100644 index 00000000..3b3bb50f --- /dev/null +++ b/chromium-121-v8-c++20.patch @@ -0,0 +1,743 @@ +commit 940af9f2c87b436559b97c53763aa9eaaf1254eb +Author: Jeremy Roman +Date: Wed Nov 15 16:24:54 2023 +0000 + + Use C++20 features to simplify blink::NativeValueTraitsBase. + + These allow some of the metaprogramming bits to be simplified a little. + + Change-Id: I052b4397586d21348401616e1792afdb9662f975 + Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5030335 + Reviewed-by: Yuki Shiino + Commit-Queue: Jeremy Roman + Cr-Commit-Position: refs/heads/main@{#1224978} + +diff --git a/third_party/blink/renderer/bindings/core/v8/native_value_traits.h b/third_party/blink/renderer/bindings/core/v8/native_value_traits.h +index 7fc91d14acc71..1e5a0790df6da 100644 +--- 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,6 +5,7 @@ + #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" +@@ -30,7 +31,7 @@ class ExceptionState; + // return toInt32(isolate, value, exceptionState, NormalConversion); + // } + // } +-template ++template + struct NativeValueTraits; + + // This declaration serves only as a blueprint for specializations: the +@@ -45,22 +46,15 @@ struct NativeValueTraits; + + namespace bindings { + +-template +-struct NativeValueTraitsHasIsNull : std::false_type {}; +- + template +-struct NativeValueTraitsHasIsNull< +- T, +- std::void_t().IsNull())>> : std::true_type {}; ++struct ImplTypeFor { ++ using type = T; ++}; + + template +-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; ++ requires std::derived_from ++struct ImplTypeFor { ++ using type = typename T::ImplType; + }; + + } // namespace bindings +@@ -78,37 +72,17 @@ struct NativeValueTraitsHasNullValue { + // 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 +-struct NativeValueTraitsBase { +- STATIC_ONLY(NativeValueTraitsBase); +- +- 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>> { ++struct NativeValueTraitsBase { + STATIC_ONLY(NativeValueTraitsBase); + +- using ImplType = typename T::ImplType; ++ using ImplType = bindings::ImplTypeFor::type; + ++ // Pointer types have nullptr as IDL null value. ++ // ScriptValue, String, and union types have IsNull member function. + static constexpr bool has_null_value = +- bindings::NativeValueTraitsHasNullValue::value; ++ std::is_pointer_v || ++ requires(ImplType value) { value.IsNull(); }; + + template + static decltype(auto) ArgumentValue(v8::Isolate* isolate, +diff --git 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 +index 508ea6d8eea48..18de71d84023f 100644 +--- 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,6 +7,7 @@ + #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 { +@@ -698,12 +699,11 @@ DOMArrayBufferBase* NativeValueTraits< + // ArrayBufferView + + template +-NotShared NativeValueTraits< +- NotShared, +- typename std::enable_if_t::value>>:: +- NativeValue(v8::Isolate* isolate, +- v8::Local value, +- ExceptionState& exception_state) { ++ requires std::derived_from ++NotShared NativeValueTraits>::NativeValue( ++ v8::Isolate* isolate, ++ v8::Local value, ++ ExceptionState& exception_state) { + return NativeValueImpl< + RecipeTrait>, ToDOMViewType, + Nullablity::kIsNotNullable, BufferSizeCheck::kCheck, +@@ -712,13 +712,12 @@ NotShared NativeValueTraits< + } + + template +-NotShared NativeValueTraits< +- NotShared, +- typename std::enable_if_t::value>>:: +- ArgumentValue(v8::Isolate* isolate, +- int argument_index, +- v8::Local value, +- ExceptionState& exception_state) { ++ requires std::derived_from ++NotShared NativeValueTraits>::ArgumentValue( ++ v8::Isolate* isolate, ++ int argument_index, ++ v8::Local value, ++ ExceptionState& exception_state) { + return ArgumentValueImpl< + RecipeTrait>, ToDOMViewType, + Nullablity::kIsNotNullable, BufferSizeCheck::kCheck, +@@ -729,12 +728,11 @@ NotShared NativeValueTraits< + // [AllowShared] ArrayBufferView + + template +-MaybeShared NativeValueTraits< +- MaybeShared, +- typename std::enable_if_t::value>>:: +- NativeValue(v8::Isolate* isolate, +- v8::Local value, +- ExceptionState& exception_state) { ++ requires std::derived_from ++MaybeShared NativeValueTraits>::NativeValue( ++ v8::Isolate* isolate, ++ v8::Local value, ++ ExceptionState& exception_state) { + return NativeValueImpl>, + ToDOMViewType, + Nullablity::kIsNotNullable, BufferSizeCheck::kCheck, +@@ -743,13 +741,12 @@ MaybeShared NativeValueTraits< + } + + template +-MaybeShared NativeValueTraits< +- MaybeShared, +- typename std::enable_if_t::value>>:: +- ArgumentValue(v8::Isolate* isolate, +- int argument_index, +- v8::Local value, +- ExceptionState& exception_state) { ++ requires std::derived_from ++MaybeShared NativeValueTraits>::ArgumentValue( ++ v8::Isolate* isolate, ++ int argument_index, ++ v8::Local value, ++ ExceptionState& exception_state) { + return ArgumentValueImpl>, + ToDOMViewType, + Nullablity::kIsNotNullable, BufferSizeCheck::kCheck, +@@ -760,12 +757,12 @@ MaybeShared NativeValueTraits< + // [AllowShared, BufferSourceTypeNoSizeLimit] ArrayBufferView + + template +-MaybeShared NativeValueTraits< +- IDLBufferSourceTypeNoSizeLimit>, +- typename std::enable_if_t::value>>:: +- NativeValue(v8::Isolate* isolate, +- v8::Local value, +- ExceptionState& exception_state) { ++ requires std::derived_from ++MaybeShared ++NativeValueTraits>>::NativeValue( ++ v8::Isolate* isolate, ++ v8::Local value, ++ ExceptionState& exception_state) { + return NativeValueImpl< + RecipeTrait>, ToDOMViewType, + Nullablity::kIsNotNullable, BufferSizeCheck::kDoNotCheck, +@@ -774,13 +771,12 @@ MaybeShared NativeValueTraits< + } + + template +-MaybeShared NativeValueTraits< +- IDLBufferSourceTypeNoSizeLimit>, +- typename std::enable_if_t::value>>:: +- ArgumentValue(v8::Isolate* isolate, +- int argument_index, +- v8::Local value, +- ExceptionState& exception_state) { ++ requires std::derived_from ++MaybeShared NativeValueTraits>>::ArgumentValue(v8::Isolate* isolate, ++ int argument_index, ++ v8::Local value, ++ ExceptionState& exception_state) { + return ArgumentValueImpl< + RecipeTrait>, ToDOMViewType, + Nullablity::kIsNotNullable, BufferSizeCheck::kDoNotCheck, +@@ -791,12 +787,11 @@ MaybeShared NativeValueTraits< + // Nullable ArrayBufferView + + template +-NotShared NativeValueTraits< +- IDLNullable>, +- typename std::enable_if_t::value>>:: +- NativeValue(v8::Isolate* isolate, +- v8::Local value, +- ExceptionState& exception_state) { ++ requires std::derived_from ++NotShared NativeValueTraits>>::NativeValue( ++ v8::Isolate* isolate, ++ v8::Local value, ++ ExceptionState& exception_state) { + return NativeValueImpl< + RecipeTrait>, ToDOMViewType, + Nullablity::kIsNullable, BufferSizeCheck::kCheck, +@@ -805,13 +800,12 @@ NotShared NativeValueTraits< + } + + template +-NotShared NativeValueTraits< +- IDLNullable>, +- typename std::enable_if_t::value>>:: +- ArgumentValue(v8::Isolate* isolate, +- int argument_index, +- v8::Local value, +- ExceptionState& exception_state) { ++ requires std::derived_from ++NotShared NativeValueTraits>>::ArgumentValue( ++ v8::Isolate* isolate, ++ int argument_index, ++ v8::Local value, ++ ExceptionState& exception_state) { + return ArgumentValueImpl< + RecipeTrait>, ToDOMViewType, + Nullablity::kIsNullable, BufferSizeCheck::kCheck, +@@ -822,12 +816,11 @@ NotShared NativeValueTraits< + // Nullable [AllowShared] ArrayBufferView + + template +-MaybeShared NativeValueTraits< +- IDLNullable>, +- typename std::enable_if_t::value>>:: +- NativeValue(v8::Isolate* isolate, +- v8::Local value, +- ExceptionState& exception_state) { ++ requires std::derived_from ++MaybeShared NativeValueTraits>>::NativeValue( ++ v8::Isolate* isolate, ++ v8::Local value, ++ ExceptionState& exception_state) { + return NativeValueImpl>, + ToDOMViewType, + Nullablity::kIsNullable, BufferSizeCheck::kCheck, +@@ -836,13 +829,12 @@ MaybeShared NativeValueTraits< + } + + template +-MaybeShared NativeValueTraits< +- IDLNullable>, +- typename std::enable_if_t::value>>:: +- ArgumentValue(v8::Isolate* isolate, +- int argument_index, +- v8::Local value, +- ExceptionState& exception_state) { ++ requires std::derived_from ++MaybeShared NativeValueTraits>>::ArgumentValue( ++ v8::Isolate* isolate, ++ int argument_index, ++ v8::Local value, ++ ExceptionState& exception_state) { + return ArgumentValueImpl>, + ToDOMViewType, + Nullablity::kIsNullable, BufferSizeCheck::kCheck, +@@ -853,9 +845,9 @@ MaybeShared NativeValueTraits< + // Nullable [AllowShared, BufferSourceTypeNoSizeLimit] ArrayBufferView + + template +-MaybeShared NativeValueTraits< +- IDLNullable>>, +- typename std::enable_if_t::value>>:: ++ requires std::derived_from ++MaybeShared ++NativeValueTraits>>>:: + ArgumentValue(v8::Isolate* isolate, + int argument_index, + v8::Local value, +@@ -870,13 +862,11 @@ MaybeShared NativeValueTraits< + // [AllowShared, FlexibleArrayBufferView] ArrayBufferView + + template +-T NativeValueTraits::value>>:: +- ArgumentValue(v8::Isolate* isolate, +- int argument_index, +- v8::Local value, +- ExceptionState& exception_state) { ++ requires std::derived_from ++T NativeValueTraits::ArgumentValue(v8::Isolate* isolate, ++ int argument_index, ++ v8::Local value, ++ ExceptionState& exception_state) { + return ArgumentValueImpl, ToFlexibleArrayBufferView, + Nullablity::kIsNotNullable, BufferSizeCheck::kCheck, + ResizableAllowance::kDisallowResizable, +@@ -888,13 +878,12 @@ T NativeValueTraits +-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) { ++ requires std::derived_from ++T NativeValueTraits>::ArgumentValue( ++ v8::Isolate* isolate, ++ int argument_index, ++ v8::Local value, ++ ExceptionState& exception_state) { + return ArgumentValueImpl< + RecipeTrait, ToFlexibleArrayBufferView, Nullablity::kIsNotNullable, + BufferSizeCheck::kDoNotCheck, ResizableAllowance::kDisallowResizable, +@@ -905,13 +894,12 @@ T NativeValueTraits, + // Nullable [AllowShared, FlexibleArrayBufferView] ArrayBufferView + + template +-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) { ++ requires std::derived_from ++T NativeValueTraits>::ArgumentValue( ++ v8::Isolate* isolate, ++ int argument_index, ++ v8::Local value, ++ ExceptionState& exception_state) { + return ArgumentValueImpl, ToFlexibleArrayBufferView, + Nullablity::kIsNullable, BufferSizeCheck::kCheck, + ResizableAllowance::kDisallowResizable, +diff --git 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 +index 899929dcf49f9..5011503dcf1c0 100644 +--- 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,6 +5,9 @@ + #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" +@@ -715,9 +718,8 @@ struct CORE_EXPORT NativeValueTraits< + }; + + template +-struct NativeValueTraits< +- T, +- typename std::enable_if_t::value>> { ++ requires std::derived_from ++struct NativeValueTraits { + // NotShared or MaybeShared should be used instead. + static T* NativeValue(v8::Isolate* isolate, + v8::Local value, +@@ -729,9 +731,8 @@ struct NativeValueTraits< + }; + + template +-struct NativeValueTraits< +- IDLNullable, +- typename std::enable_if_t::value>> { ++ requires std::derived_from ++struct NativeValueTraits> { + // NotShared or MaybeShared should be used instead. + static T* NativeValue(v8::Isolate* isolate, + v8::Local value, +@@ -743,9 +744,8 @@ struct NativeValueTraits< + }; + + template +-struct NativeValueTraits< +- NotShared, +- typename std::enable_if_t::value>> ++ requires std::derived_from ++struct NativeValueTraits> + : public NativeValueTraitsBase> { + static NotShared NativeValue(v8::Isolate* isolate, + v8::Local value, +@@ -758,9 +758,8 @@ struct NativeValueTraits< + }; + + template +-struct NativeValueTraits< +- IDLNullable>, +- typename std::enable_if_t::value>> ++ requires std::derived_from ++struct NativeValueTraits>> + : public NativeValueTraitsBase> { + static NotShared NativeValue(v8::Isolate* isolate, + v8::Local value, +@@ -773,9 +772,8 @@ struct NativeValueTraits< + }; + + template +-struct NativeValueTraits< +- MaybeShared, +- typename std::enable_if_t::value>> ++ requires std::derived_from ++struct NativeValueTraits> + : public NativeValueTraitsBase> { + static MaybeShared NativeValue(v8::Isolate* isolate, + v8::Local value, +@@ -788,9 +786,8 @@ struct NativeValueTraits< + }; + + template +-struct NativeValueTraits< +- IDLBufferSourceTypeNoSizeLimit>, +- typename std::enable_if_t::value>> ++ requires std::derived_from ++struct NativeValueTraits>> + : public NativeValueTraitsBase> { + // FlexibleArrayBufferView uses this in its implementation, so we cannot + // delete it. +@@ -805,9 +802,8 @@ struct NativeValueTraits< + }; + + template +-struct NativeValueTraits< +- IDLNullable>, +- typename std::enable_if_t::value>> ++ requires std::derived_from ++struct NativeValueTraits>> + : public NativeValueTraitsBase> { + static MaybeShared NativeValue(v8::Isolate* isolate, + v8::Local value, +@@ -820,9 +816,9 @@ struct NativeValueTraits< + }; + + template ++ requires std::derived_from + struct NativeValueTraits< +- IDLNullable>>, +- typename std::enable_if_t::value>> ++ IDLNullable>>> + : public NativeValueTraitsBase> { + // BufferSourceTypeNoSizeLimit must be used only as arguments. + static MaybeShared NativeValue(v8::Isolate* isolate, +@@ -836,11 +832,8 @@ struct NativeValueTraits< + }; + + template +-struct NativeValueTraits< +- T, +- typename std::enable_if_t< +- std::is_base_of::value>> +- : public NativeValueTraitsBase { ++ requires std::derived_from ++struct NativeValueTraits : public NativeValueTraitsBase { + // FlexibleArrayBufferView must be used only as arguments. + static T NativeValue(v8::Isolate* isolate, + v8::Local value, +@@ -853,10 +846,8 @@ struct NativeValueTraits< + }; + + template +-struct NativeValueTraits< +- IDLBufferSourceTypeNoSizeLimit, +- typename std::enable_if_t< +- std::is_base_of::value>> ++ requires std::derived_from ++struct NativeValueTraits> + : public NativeValueTraitsBase { + // BufferSourceTypeNoSizeLimit and FlexibleArrayBufferView must be used only + // as arguments. +@@ -871,11 +862,8 @@ struct NativeValueTraits< + }; + + template +-struct NativeValueTraits< +- IDLNullable, +- typename std::enable_if_t< +- std::is_base_of::value>> +- : public NativeValueTraitsBase { ++ requires std::derived_from ++struct NativeValueTraits> : public NativeValueTraitsBase { + // FlexibleArrayBufferView must be used only as arguments. + static T NativeValue(v8::Isolate* isolate, + v8::Local value, +@@ -1134,9 +1122,8 @@ NativeValueTraits>::NativeValue( + } + + template +-struct NativeValueTraits>, +- typename std::enable_if_t< +- NativeValueTraits>::has_null_value>> ++ requires NativeValueTraits>::has_null_value ++struct NativeValueTraits>> + : public NativeValueTraitsBase>*> { + using ImplType = typename NativeValueTraits>::ImplType*; + +@@ -1203,9 +1190,8 @@ struct NativeValueTraits> + : public NativeValueTraits> {}; + + template +-struct NativeValueTraits>, +- typename std::enable_if_t< +- NativeValueTraits>::has_null_value>> ++ requires NativeValueTraits>::has_null_value ++struct NativeValueTraits>> + : public NativeValueTraits>> {}; + + // Record types +@@ -1335,10 +1321,8 @@ struct NativeValueTraits> + + // Callback function types + template +-struct NativeValueTraits< +- T, +- typename std::enable_if_t::value>> +- : public NativeValueTraitsBase { ++ requires std::derived_from ++struct NativeValueTraits : public NativeValueTraitsBase { + static T* NativeValue(v8::Isolate* isolate, + v8::Local value, + ExceptionState& exception_state) { +@@ -1361,9 +1345,8 @@ struct NativeValueTraits< + }; + + template +-struct NativeValueTraits< +- IDLNullable, +- typename std::enable_if_t::value>> ++ requires std::derived_from ++struct NativeValueTraits> + : public NativeValueTraitsBase> { + static T* NativeValue(v8::Isolate* isolate, + v8::Local value, +@@ -1392,10 +1375,8 @@ struct NativeValueTraits< + + // Callback interface types + template +-struct NativeValueTraits< +- T, +- typename std::enable_if_t::value>> +- : public NativeValueTraitsBase { ++ requires std::derived_from ++struct NativeValueTraits : public NativeValueTraitsBase { + static T* NativeValue(v8::Isolate* isolate, + v8::Local value, + ExceptionState& exception_state) { +@@ -1418,9 +1399,8 @@ struct NativeValueTraits< + }; + + template +-struct NativeValueTraits< +- IDLNullable, +- typename std::enable_if_t::value>> ++ requires std::derived_from ++struct NativeValueTraits> + : public NativeValueTraitsBase> { + static T* NativeValue(v8::Isolate* isolate, + v8::Local value, +@@ -1449,11 +1429,8 @@ struct NativeValueTraits< + + // Dictionary types + template +-struct NativeValueTraits< +- T, +- typename std::enable_if_t< +- std::is_base_of::value>> +- : public NativeValueTraitsBase { ++ requires std::derived_from ++struct NativeValueTraits : public NativeValueTraitsBase { + static T* NativeValue(v8::Isolate* isolate, + v8::Local value, + ExceptionState& exception_state) { +@@ -1464,14 +1441,11 @@ struct NativeValueTraits< + // We don't support nullable dictionary types in general since it's quite + // confusing and often misused. + template +-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 { ++ requires std::derived_from && ++ (std::same_as || ++ std::same_as || ++ std::same_as) ++struct NativeValueTraits> : public NativeValueTraitsBase { + static T* NativeValue(v8::Isolate* isolate, + v8::Local value, + ExceptionState& exception_state) { +@@ -1483,11 +1457,8 @@ struct NativeValueTraits< + + // Enumeration types + template +-struct NativeValueTraits< +- T, +- typename std::enable_if_t< +- std::is_base_of::value>> +- : public NativeValueTraitsBase { ++ requires std::derived_from ++struct NativeValueTraits : public NativeValueTraitsBase { + static T NativeValue(v8::Isolate* isolate, + v8::Local value, + ExceptionState& exception_state) { +@@ -1497,10 +1468,8 @@ struct NativeValueTraits< + + // Interface types + template +-struct NativeValueTraits< +- T, +- typename std::enable_if_t::value>> +- : public NativeValueTraitsBase { ++ requires std::derived_from ++struct NativeValueTraits : public NativeValueTraitsBase { + static inline T* NativeValue(v8::Isolate* isolate, + v8::Local value, + ExceptionState& exception_state) { +@@ -1528,9 +1497,8 @@ struct NativeValueTraits< + }; + + template +-struct NativeValueTraits< +- IDLNullable, +- typename std::enable_if_t::value>> ++ requires std::derived_from ++struct NativeValueTraits> + : public NativeValueTraitsBase> { + static inline T* NativeValue(v8::Isolate* isolate, + v8::Local value, +@@ -1565,10 +1533,8 @@ struct NativeValueTraits< + }; + + template +-struct NativeValueTraits< +- T, +- typename std::enable_if_t::value>> +- : public NativeValueTraitsBase { ++ requires std::derived_from ++struct NativeValueTraits : public NativeValueTraitsBase { + static T* NativeValue(v8::Isolate* isolate, + v8::Local value, + ExceptionState& exception_state) { +@@ -1584,10 +1550,8 @@ struct NativeValueTraits< + }; + + template +-struct NativeValueTraits< +- IDLNullable, +- typename std::enable_if_t::value>> +- : public NativeValueTraitsBase { ++ requires std::derived_from ++struct NativeValueTraits> : public NativeValueTraitsBase { + static T* NativeValue(v8::Isolate* isolate, + v8::Local value, + ExceptionState& exception_state) { +@@ -1608,9 +1572,8 @@ struct NativeValueTraits< + + // Nullable types + template +-struct NativeValueTraits< +- IDLNullable, +- typename std::enable_if_t::has_null_value>> ++ requires(!NativeValueTraits::has_null_value) ++struct NativeValueTraits> + : public NativeValueTraitsBase> { + // https://webidl.spec.whatwg.org/#es-nullable-type + using ImplType = +@@ -1642,9 +1605,8 @@ struct NativeValueTraits>>; + + // Optional types + template +-struct NativeValueTraits, +- typename std::enable_if_t::ImplType>::value>> ++ requires std::is_arithmetic_v::ImplType> ++struct NativeValueTraits> + : public NativeValueTraitsBase::ImplType> { + using ImplType = typename NativeValueTraits::ImplType; + +@@ -1666,9 +1628,8 @@ struct NativeValueTraits, + }; + + template +-struct NativeValueTraits, +- typename std::enable_if_t::ImplType>::value>> ++ requires std::is_pointer_v::ImplType> ++struct NativeValueTraits> + : public NativeValueTraitsBase::ImplType> { + using ImplType = typename NativeValueTraits::ImplType; + diff --git a/chromium-122-v8-c++20.patch b/chromium-122-v8-c++20.patch deleted file mode 100644 index 2b40db23..00000000 --- a/chromium-122-v8-c++20.patch +++ /dev/null @@ -1,740 +0,0 @@ -commit 940af9f2c87b436559b97c53763aa9eaaf1254eb -Author: Jeremy Roman -Date: Wed Nov 15 16:24:54 2023 +0000 - - Use C++20 features to simplify blink::NativeValueTraitsBase. - - These allow some of the metaprogramming bits to be simplified a little. - - Change-Id: I052b4397586d21348401616e1792afdb9662f975 - Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5030335 - Reviewed-by: Yuki Shiino - Commit-Queue: Jeremy Roman - Cr-Commit-Position: refs/heads/main@{#1224978} - -diff -up chromium-122.0.6261.57/third_party/blink/renderer/bindings/core/v8/native_value_traits_buffer_sources.cc.me chromium-122.0.6261.57/third_party/blink/renderer/bindings/core/v8/native_value_traits_buffer_sources.cc ---- chromium-122.0.6261.57/third_party/blink/renderer/bindings/core/v8/native_value_traits_buffer_sources.cc.me 2024-02-21 01:20:53.138946500 +0100 -+++ chromium-122.0.6261.57/third_party/blink/renderer/bindings/core/v8/native_value_traits_buffer_sources.cc 2024-02-21 12:33:53.226207103 +0100 -@@ -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 @@ DOMArrayBufferBase* NativeValueTraits< - // 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 @@ NotShared NativeValueTraits -- 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 @@ NotShared NativeValueTraits -- 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 @@ MaybeShared NativeValueTraits -- 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 @@ MaybeShared NativeValueTraits -- 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 @@ NativeValueTraits -- 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 @@ MaybeShared NativeValueTraits -- 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 @@ NotShared NativeValueTraits -- 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 @@ MaybeShared NativeValueTraits -- 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 @@ MaybeShared NativeValueTraits -- 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 @@ NativeValueTraits -- 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 @@ T NativeValueTraits::ArgumentValue(v8 - // 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 @@ T NativeValueTraits -- 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, -diff -up chromium-122.0.6261.57/third_party/blink/renderer/bindings/core/v8/native_value_traits.h.me chromium-122.0.6261.57/third_party/blink/renderer/bindings/core/v8/native_value_traits.h ---- chromium-122.0.6261.57/third_party/blink/renderer/bindings/core/v8/native_value_traits.h.me 2024-02-21 01:20:53.138946500 +0100 -+++ chromium-122.0.6261.57/third_party/blink/renderer/bindings/core/v8/native_value_traits.h 2024-02-21 12:33:53.225207075 +0100 -@@ -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 @@ class ExceptionState; - // return toInt32(isolate, value, exceptionState, NormalConversion); - // } - // } --template -+template - struct NativeValueTraits; - - // This declaration serves only as a blueprint for specializations: the -@@ -46,15 +45,22 @@ struct NativeValueTraits; - - 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 @@ struct ImplTypeFor { - // 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 -diff -up chromium-122.0.6261.57/third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h.me chromium-122.0.6261.57/third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h ---- chromium-122.0.6261.57/third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h.me 2024-02-21 01:20:53.138946500 +0100 -+++ chromium-122.0.6261.57/third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h 2024-02-21 12:33:53.227207131 +0100 -@@ -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 @@ struct CORE_EXPORT NativeValueTraits< - }; - - 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 @@ struct NativeValueTraits { - }; - - 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 @@ struct NativeValueTraits> - }; - - 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 @@ struct NativeValueTraits> - }; - - 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 @@ struct NativeValueTraits -- 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 @@ struct NativeValueTraits> - }; - - 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 @@ struct NativeValueTraits -- 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 @@ struct NativeValueTraits -- 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 @@ struct NativeValueTraits< - }; - - 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 @@ struct NativeValueTraits : public Nat - }; - - 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 @@ struct NativeValueTraits -- 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 @@ NativeValueTraits>::Nativ - } - - 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 @@ struct NativeValueTraits> - : 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 @@ struct NativeValueTraits - - // 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 @@ struct NativeValueTraits : public Nat - }; - - 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 @@ struct NativeValueTraits> - - // 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 @@ struct NativeValueTraits : public Nat - - // 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 @@ struct NativeValueTraits> - - // 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 @@ struct NativeValueTraits : public Nat - // 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 @@ struct NativeValueTraits> - - // 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 @@ struct NativeValueTraits : public Nat - - // 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 @@ struct NativeValueTraits : public Nat - }; - - 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 @@ struct NativeValueTraits> - }; - - 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 @@ struct NativeValueTraits : public Nat - }; - - 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 @@ struct NativeValueTraits> - - // 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 @@ struct NativeValueTraits -- 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 @@ struct NativeValueTraits> - }; - - 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/chromium.spec b/chromium.spec index 3a14f94c..ea5b2ff8 100644 --- a/chromium.spec +++ b/chromium.spec @@ -430,9 +430,9 @@ Patch304: chromium-117-string-convert.patch Patch306: chromium-119-assert.patch # compiler errors on epel -Patch307: chromium-122-clang16-buildflags.patch # revert it for old clang on rhel and f38 -Patch308: chromium-122-v8-c++20.patch +Patch307: chromium-121-v8-c++20-p1.patch +Patch308: chromium-121-v8-c++20.patch Patch309: chromium-122-constexpr.patch # missing include header files @@ -446,6 +446,7 @@ Patch312: chromium-119-fstack-protector-strong.patch # fixed static assert error Patch313: chromium-122-static-assert.patch +Patch314: chromium-122-clang16-buildflags.patch # build error Patch351: chromium-121-mnemonic-error.patch @@ -1115,10 +1116,11 @@ udev. %endif %if 0%{?rhel} || 0%{?fedora} && 0%{?fedora} < 39 -%patch -P307 -p1 -b .clang16-buildflag -%patch -P308 -p1 -b .v8-c++20 +%patch -P307 -p1 -R -b .v8-c++20 +%patch -P308 -p1 -R -b .v8-c++20 %patch -P309 -p1 -b .constexpr %patch -P313 -p1 -b .static-assert +%patch -P314 -p1 -b .clang16-buildflag %endif %patch -P310 -p1 -b .missing-header-files