From 749cc96c2799bf9f81f54d246e295e4c5ce3b7eb Mon Sep 17 00:00:00 2001 From: "Laio O. Seman" Date: Wed, 7 Feb 2024 10:04:24 -0300 Subject: [PATCH 01/14] add(chromium): bolted chromium --- chromium-bolt/PKGBUILD | 362 +++++++++ ...simplify-blink-NativeValueTraitsBase.patch | 747 ++++++++++++++++++ chromium-bolt/chromium-121-constexpr.patch | 12 + chromium-bolt/compiler-rt-16.patch | 36 + .../drop-flags-unsupported-by-clang16.patch | 51 ++ chromium-bolt/fetch-chromium-release | 44 ++ chromium-bolt/icu-74.patch | 21 + chromium-bolt/profiler.py | 52 ++ chromium-bolt/relocs.patch | 10 + chromium-bolt/relocs2.patch | 19 + ...se-oauth2-client-switches-as-default.patch | 17 + 11 files changed, 1371 insertions(+) create mode 100644 chromium-bolt/PKGBUILD create mode 100644 chromium-bolt/REVERT-simplify-blink-NativeValueTraitsBase.patch create mode 100644 chromium-bolt/chromium-121-constexpr.patch create mode 100644 chromium-bolt/compiler-rt-16.patch create mode 100644 chromium-bolt/drop-flags-unsupported-by-clang16.patch create mode 100644 chromium-bolt/fetch-chromium-release create mode 100644 chromium-bolt/icu-74.patch create mode 100644 chromium-bolt/profiler.py create mode 100644 chromium-bolt/relocs.patch create mode 100644 chromium-bolt/relocs2.patch create mode 100644 chromium-bolt/use-oauth2-client-switches-as-default.patch diff --git a/chromium-bolt/PKGBUILD b/chromium-bolt/PKGBUILD new file mode 100644 index 000000000..712463769 --- /dev/null +++ b/chromium-bolt/PKGBUILD @@ -0,0 +1,362 @@ +# Maintainer: Evangelos Foutras +# Contributor: Pierre Schmitz +# Contributor: Jan "heftig" Steffens +# Contributor: Daniel J Griffiths + +pkgname=chromium +pkgver=121.0.6167.164 +pkgrel=1 +_launcher_ver=8 +_manual_clone=0 +_system_clang=1 +pkgdesc="A web browser built for speed, simplicity, and security" +arch=('x86_64') +url="https://www.chromium.org/Home" +license=('BSD-3-Clause') +depends=('gtk3' 'nss' 'alsa-lib' 'xdg-utils' 'libxss' 'libcups' 'libgcrypt' + 'ttf-liberation' 'systemd' 'dbus' 'libpulse' 'pciutils' 'libva' + 'libffi' 'desktop-file-utils' 'hicolor-icon-theme') +makedepends=('python' 'gn' 'ninja' 'clang' 'lld' 'gperf' 'nodejs' 'pipewire' + 'rust' 'qt5-base' 'java-runtime-headless' 'git') +optdepends=('pipewire: WebRTC desktop sharing under Wayland' + 'kdialog: support for native dialogs in Plasma' + 'qt5-base: enable Qt5 with --enable-features=AllowQt' + 'gtk4: for --gtk-version=4 (GTK4 IME might work better on Wayland)' + 'org.freedesktop.secrets: password storage backend on GNOME / Xfce' + 'kwallet: support for storing passwords in KWallet on Plasma') +options=('!strip') # Chromium adds its own flags for ThinLTO +source=( + https://commondatastorage.googleapis.com/chromium-browser-official/chromium-$pkgver.tar.xz + https://github.com/foutrelis/chromium-launcher/archive/v$_launcher_ver/chromium-launcher-$_launcher_ver.tar.gz + https://gitlab.com/Matt.Jolly/chromium-patches/-/archive/${pkgver%%.*}/chromium-patches-${pkgver%%.*}.tar.bz2 + REVERT-simplify-blink-NativeValueTraitsBase.patch::https://github.com/chromium/chromium/commit/940af9f2c87b.patch + icu-74.patch + chromium-121-constexpr.patch + drop-flags-unsupported-by-clang16.patch + compiler-rt-16.patch + use-oauth2-client-switches-as-default.patch + relocs.patch + relocs2.patch) +sha256sums=('e12cc967bef7a79630828792f02d95297a06eb905c98e4c6e065fd5e74d6f9ff' + '213e50f48b67feb4441078d50b0fd431df34323be15be97c55302d3fdac4483a' + 'e9113c1ed2900b84b488e608774ce25212d3c60094abdae005d8a943df9b505e' + '318df8f8662071cebcdf953698408058e17f59f184500b7e12e01a04a4206b50' + 'ff9ebd86b0010e1c604d47303ab209b1d76c3e888c423166779cefbc22de297f' + '09677c39ff9b910c732a049252969bfa03587e70502765d68b0345bac396c0b2' + '8d1cdf3ddd8ff98f302c90c13953f39cd804b3479b13b69b8ef138ac57c83556' + '8a2649dcc6ff8d8f24ddbe40dc2a171824f681c6f33c39c4792b645b87c9dcab' + 'e393174d7695d0bafed69e868c5fbfecf07aa6969f3b64596d0bae8b067e1711') + +if (( _manual_clone )); then + source[0]=fetch-chromium-release + makedepends+=('python-httplib2' 'python-pyparsing' 'python-six') +fi + +# Possible replacements are listed in build/linux/unbundle/replace_gn_files.py +# Keys are the names in the above script; values are the dependencies in Arch +declare -gA _system_libs=( + #[brotli]=brotli + [dav1d]=dav1d + #[ffmpeg]=ffmpeg # YouTube playback stopped working in Chromium 120 + [flac]=flac + [fontconfig]=fontconfig + #[freetype]=freetype2 + [harfbuzz-ng]=harfbuzz + [icu]=icu + #[jsoncpp]=jsoncpp # needs libstdc++ + #[libaom]=aom + #[libavif]=libavif # needs https://github.com/AOMediaCodec/libavif/commit/5410b23f76 + [libdrm]= + [libjpeg]=libjpeg + [libpng]=libpng + #[libvpx]=libvpx + [libwebp]=libwebp + [libxml]=libxml2 + [libxslt]=libxslt + [opus]=opus + #[re2]=re2 # needs libstdc++ + #[snappy]=snappy # needs libstdc++ + #[woff2]=woff2 # needs libstdc++ + [zlib]=minizip +) +_unwanted_bundled_libs=( + $(printf "%s\n" ${!_system_libs[@]} | sed 's/^libjpeg$/&_turbo/') +) +depends+=(${_system_libs[@]}) + +# Google API keys (see https://www.chromium.org/developers/how-tos/api-keys) +# Note: These are for Arch Linux use ONLY. For your own distribution, please +# get your own set of keys. +# +# Starting with Chromium 89 (2021-03-02) the OAuth2 credentials have been left +# out: https://archlinux.org/news/chromium-losing-sync-support-in-early-march/ +_google_api_key=AIzaSyDwr302FpOSkGRpLlUpPThNTDPbXcIn_FM + +prepare() { + if (( _manual_clone )); then + ./fetch-chromium-release $pkgver + fi + cd chromium-$pkgver + + # Allow building against system libraries in official builds + sed -i 's/OFFICIAL_BUILD/GOOGLE_CHROME_BUILD/' \ + tools/generate_shim_headers/generate_shim_headers.py + + # https://crbug.com/893950 + sed -i -e 's/\/malloc/' -e 's/\/free/' \ + third_party/blink/renderer/core/xml/*.cc \ + third_party/blink/renderer/core/xml/parser/xml_document_parser.cc \ + third_party/libxml/chromium/*.cc \ + third_party/maldoca/src/maldoca/ole/oss_utils.h + + # Use the --oauth2-client-id= and --oauth2-client-secret= switches for + # setting GOOGLE_DEFAULT_CLIENT_ID and GOOGLE_DEFAULT_CLIENT_SECRET at + # runtime -- this allows signing into Chromium without baked-in values + patch -Np1 -i ../use-oauth2-client-switches-as-default.patch + + # Upstream fixes + + # Fix build with ICU 74 + patch -Np1 -i ../icu-74.patch + + # Fix "error: defaulted definition of equality comparison operator cannot + # be declared constexpr because it invokes a non-constexpr comparison + # function" (patch from Fedora) + patch -Np1 -i ../chromium-121-constexpr.patch + + # Revert usage of C++20 features which likely need newer clang + patch -Rp1 -i ../REVERT-simplify-blink-NativeValueTraitsBase.patch + + # Drop compiler flags that need newer clang + patch -Np1 -i ../drop-flags-unsupported-by-clang16.patch + + # Allow libclang_rt.builtins from compiler-rt 16 to be used + patch -Np1 -i ../compiler-rt-16.patch + + # Fixes for building with libstdc++ instead of libc++ + patch -Np1 -i ../chromium-patches-*/chromium-114-ruy-include.patch + patch -Np1 -i ../chromium-patches-*/chromium-117-material-color-include.patch + patch -Np1 -i ../chromium-patches-*/chromium-119-clang16.patch + + patch -Np1 -i ../relocs.patch + patch -Np1 -i ../relocs2.patch + + # Link to system tools required by the build + mkdir -p third_party/node/linux/node-linux-x64/bin + ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/ + ln -s /usr/bin/java third_party/jdk/current/bin/ + + if (( !_system_clang )); then + # Use prebuilt rust as system rust cannot be used due to the error: + # error: the option `Z` is only accepted on the nightly compiler + ./tools/rust/update_rust.py + + # To link to rust libraries we need to compile with prebuilt clang + ./tools/clang/scripts/update.py + fi + + # Remove bundled libraries for which we will use the system copies; this + # *should* do what the remove_bundled_libraries.py script does, with the + # added benefit of not having to list all the remaining libraries + local _lib + for _lib in ${_unwanted_bundled_libs[@]}; do + find "third_party/$_lib" -type f \ + \! -path "third_party/$_lib/chromium/*" \ + \! -path "third_party/$_lib/google/*" \ + \! -path "third_party/harfbuzz-ng/utils/hb_scoped.h" \ + \! -regex '.*\.\(gn\|gni\|isolate\)' \ + -delete + done + + ./build/linux/unbundle/replace_gn_files.py \ + --system-libraries "${!_system_libs[@]}" +} + +build() { + make -C chromium-launcher-$_launcher_ver + + cd chromium-$pkgver + + if (( _system_clang )); then + export CC=clang + export CXX=clang++ + export AR=ar + export NM=nm + else + local _clang_path="$PWD/third_party/llvm-build/Release+Asserts/bin" + export CC=$_clang_path/clang + export CXX=$_clang_path/clang++ + export AR=$_clang_path/llvm-ar + export NM=$_clang_path/llvm-nm + fi + + local _flags=( + 'custom_toolchain="//build/toolchain/linux/unbundle:default"' + 'host_toolchain="//build/toolchain/linux/unbundle:default"' + 'is_official_build=true' # implies is_cfi=true on x86_64 + 'symbol_level=0' # sufficient for backtraces on x86(_64) + 'is_cfi=false' + 'is_debug=false' + 'treat_warnings_as_errors=false' + 'disable_fieldtrial_testing_config=true' + 'blink_enable_generated_code_formatting=false' + 'ffmpeg_branding="Chrome"' + 'proprietary_codecs=true' + 'rtc_use_pipewire=true' + 'link_pulseaudio=true' + 'use_custom_libcxx=true' # https://github.com/llvm/llvm-project/issues/61705 + 'use_sysroot=false' + 'use_system_libffi=true' + 'enable_hangout_services_extension=true' + 'enable_widevine=true' + 'enable_nacl=false' + "google_api_key=\"$_google_api_key\"" + ) + + if [[ -n ${_system_libs[icu]+set} ]]; then + _flags+=('icu_use_data_file=false') + fi + + if (( _system_clang )); then + local _clang_version=$( + clang --version | grep -m1 version | sed 's/.* \([0-9]\+\).*/\1/') + + _flags+=( + 'clang_base_path="/usr"' + 'clang_use_chrome_plugins=false' + "clang_version=17" + 'chrome_pgo_phase=0' # needs newer clang to read the bundled PGO profile + ) + + # Allow the use of nightly features with stable Rust compiler + # https://github.com/ungoogled-software/ungoogled-chromium/pull/2696#issuecomment-1918173198 + export RUSTC_BOOTSTRAP=1 + + _flags+=( + 'rust_sysroot_absolute="/usr"' + "rustc_version=\"$(rustc --version)\"" + ) + fi + + # Facilitate deterministic builds (taken from build/config/compiler/BUILD.gn) + CFLAGS+=' -Wno-builtin-macro-redefined' + CXXFLAGS+=' -Wno-builtin-macro-redefined' + CPPFLAGS+=' -D__DATE__= -D__TIME__= -D__TIMESTAMP__=' + + # Do not warn about unknown warning options + CFLAGS+=' -Wno-unknown-warning-option' + CXXFLAGS+=' -Wno-unknown-warning-option' + + # Let Chromium set its own symbol level + CFLAGS=${CFLAGS/-g } + CXXFLAGS=${CXXFLAGS/-g } + + # https://github.com/ungoogled-software/ungoogled-chromium-archlinux/issues/123 + CFLAGS=${CFLAGS/-fexceptions} + CFLAGS=${CFLAGS/-fcf-protection} + CXXFLAGS=${CXXFLAGS/-fexceptions} + CXXFLAGS=${CXXFLAGS/-fcf-protection} + + # This appears to cause random segfaults when combined with ThinLTO + # https://bugs.archlinux.org/task/73518 + CFLAGS=${CFLAGS/-fstack-clash-protection} + CXXFLAGS=${CXXFLAGS/-fstack-clash-protection} + + # https://crbug.com/957519#c122 + CXXFLAGS=${CXXFLAGS/-Wp,-D_GLIBCXX_ASSERTIONS} + + export CFLAGS+=" -fno-semantic-interposition" + export CXXLAGS+=" -fno-semantic-interposition" + + gn gen out/Release --args="${_flags[*]}" + ninja -C out/Release chrome chrome_sandbox chromedriver.unstripped + + ## Export PATH for vpython + export PATH+=":$PWD/third_party/depot_tools" + + ## Branch Sampling for BOLT + perf record -e cycles:u -j any,u -o perf.data -- \ + xvfb-run -s "-screen 0 1920x1080x24 -nolisten local" \ + vpython3 ../profiler.py + + perf2bolt out/Release/chrome -perfdata=perf.data -o perf.fdata -strict=0 + + llvm-bolt out/Default/chrome -o out/Release/chrome.bolt \ + -data=perf.fdata -dyno-stats \ + -reorder-blocks=ext-tsp -reorder-functions=hfsort \ + -split-functions -split-all-cold -split-eh \ + -skip-funcs=Builtins_.\* + +} + +package() { + cd chromium-launcher-$_launcher_ver + make PREFIX=/usr DESTDIR="$pkgdir" install + install -Dm644 LICENSE \ + "$pkgdir/usr/share/licenses/chromium/LICENSE.launcher" + + cd ../chromium-$pkgver + + install -D out/Release/chrome "$pkgdir/usr/lib/chromium/chromium" + install -D out/Release/chromedriver.unstripped "$pkgdir/usr/bin/chromedriver" + install -Dm4755 out/Release/chrome_sandbox "$pkgdir/usr/lib/chromium/chrome-sandbox" + + install -Dm644 chrome/installer/linux/common/desktop.template \ + "$pkgdir/usr/share/applications/chromium.desktop" + install -Dm644 chrome/app/resources/manpage.1.in \ + "$pkgdir/usr/share/man/man1/chromium.1" + sed -i \ + -e 's/@@MENUNAME@@/Chromium/g' \ + -e 's/@@PACKAGE@@/chromium/g' \ + -e 's/@@USR_BIN_SYMLINK_NAME@@/chromium/g' \ + "$pkgdir/usr/share/applications/chromium.desktop" \ + "$pkgdir/usr/share/man/man1/chromium.1" + + install -Dm644 chrome/installer/linux/common/chromium-browser/chromium-browser.appdata.xml \ + "$pkgdir/usr/share/metainfo/chromium.appdata.xml" + sed -ni \ + -e 's/chromium-browser\.desktop/chromium.desktop/' \ + -e '//d' \ + -e '/

/N;/

\n.*\(We invite\|Chromium supports Vorbis\)/,/<\/p>/d' \ + -e '/^ +Date: Wed, 15 Nov 2023 16:24:54 +0000 +Subject: [PATCH] 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} +--- + .../bindings/core/v8/native_value_traits.h | 54 ++---- + .../v8/native_value_traits_buffer_sources.cc | 166 ++++++++---------- + .../core/v8/native_value_traits_impl.h | 159 +++++++---------- + 3 files changed, 151 insertions(+), 228 deletions(-) + +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 7fc91d14acc71a2..1e5a0790df6da81 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 508ea6d8eea481e..18de71d84023f0c 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 899929dcf49f90a..5011503dcf1c0c8 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-bolt/chromium-121-constexpr.patch b/chromium-bolt/chromium-121-constexpr.patch new file mode 100644 index 000000000..a0b7166a5 --- /dev/null +++ b/chromium-bolt/chromium-121-constexpr.patch @@ -0,0 +1,12 @@ +diff -up chromium-121.0.6167.57/components/performance_manager/resource_attribution/query_params.h.me chromium-121.0.6167.57/components/performance_manager/resource_attribution/query_params.h +--- chromium-121.0.6167.57/components/performance_manager/resource_attribution/query_params.h.me 2024-01-18 17:00:24.791582422 +0100 ++++ chromium-121.0.6167.57/components/performance_manager/resource_attribution/query_params.h 2024-01-18 17:22:21.521682845 +0100 +@@ -27,7 +27,7 @@ struct QueryParams { + QueryParams(const QueryParams& other); + QueryParams& operator=(const QueryParams& other); + +- friend constexpr bool operator==(const QueryParams&, ++ friend bool operator==(const QueryParams&, + const QueryParams&) = default; + + // Individual resource contexts to measure. diff --git a/chromium-bolt/compiler-rt-16.patch b/chromium-bolt/compiler-rt-16.patch new file mode 100644 index 000000000..e14829ad2 --- /dev/null +++ b/chromium-bolt/compiler-rt-16.patch @@ -0,0 +1,36 @@ +diff --git a/build/config/clang/BUILD.gn b/build/config/clang/BUILD.gn +index d4de2e0cca0..57359c32121 100644 +--- a/build/config/clang/BUILD.gn ++++ b/build/config/clang/BUILD.gn +@@ -130,12 +130,15 @@ template("clang_lib") { + } else if (is_linux || is_chromeos) { + if (current_cpu == "x64") { + _dir = "x86_64-unknown-linux-gnu" ++ _suffix = "-x86_64" + } else if (current_cpu == "x86") { + _dir = "i386-unknown-linux-gnu" ++ _suffix = "-i386" + } else if (current_cpu == "arm") { + _dir = "armv7-unknown-linux-gnueabihf" + } else if (current_cpu == "arm64") { + _dir = "aarch64-unknown-linux-gnu" ++ _suffix = "-aarch64" + } else { + assert(false) # Unhandled cpu type + } +@@ -166,6 +169,15 @@ template("clang_lib") { + assert(false) # Unhandled target platform + } + ++ # Bit of a hack to make this find builtins from compiler-rt 16 ++ if (is_linux || is_chromeos) { ++ if (clang_version == "16") { ++ _dir = "linux" ++ } else { ++ _suffix = "" ++ } ++ } ++ + _clang_lib_dir = "$clang_base_path/lib/clang/$clang_version/lib" + _lib_file = "${_prefix}clang_rt.${_libname}${_suffix}.${_ext}" + libs = [ "$_clang_lib_dir/$_dir/$_lib_file" ] diff --git a/chromium-bolt/drop-flags-unsupported-by-clang16.patch b/chromium-bolt/drop-flags-unsupported-by-clang16.patch new file mode 100644 index 000000000..a180426eb --- /dev/null +++ b/chromium-bolt/drop-flags-unsupported-by-clang16.patch @@ -0,0 +1,51 @@ +diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn +index 80bc79e5fb3..13b200e4cb0 100644 +--- a/build/config/compiler/BUILD.gn ++++ b/build/config/compiler/BUILD.gn +@@ -616,24 +616,6 @@ config("compiler") { + } + } + +- # TODO(crbug.com/1488374): This causes binary size growth and potentially +- # other problems. +- # TODO(crbug.com/1491036): This isn't supported by Cronet's mainline llvm version. +- if (default_toolchain != "//build/toolchain/cros:target" && +- !llvm_android_mainline) { +- cflags += [ +- "-mllvm", +- "-split-threshold-for-reg-with-hint=0", +- ] +- if (use_thin_lto && is_a_target_toolchain) { +- if (is_win) { +- ldflags += [ "-mllvm:-split-threshold-for-reg-with-hint=0" ] +- } else { +- ldflags += [ "-Wl,-mllvm,-split-threshold-for-reg-with-hint=0" ] +- } +- } +- } +- + # TODO(crbug.com/1235145): Investigate why/if this should be needed. + if (is_win) { + cflags += [ "/clang:-ffp-contract=off" ] +@@ -768,7 +750,6 @@ config("compiler") { + ldflags += [ + "/opt:lldltojobs=all", + "-mllvm:-import-instr-limit=$import_instr_limit", +- "-mllvm:-disable-auto-upgrade-debug-info", + ] + } else { + ldflags += [ "-flto=thin" ] +@@ -800,13 +781,6 @@ config("compiler") { + if (is_apple) { + ldflags += [ "-Wcrl,object_path_lto" ] + } +- if (!is_chromeos) { +- # TODO(https://crbug.com/972449): turn on for ChromeOS when that +- # toolchain has this flag. +- # We only use one version of LLVM within a build so there's no need to +- # upgrade debug info, which can be expensive since it runs the verifier. +- ldflags += [ "-Wl,-mllvm,-disable-auto-upgrade-debug-info" ] +- } + } + + # TODO(https://crbug.com/1211155): investigate why this isn't effective on diff --git a/chromium-bolt/fetch-chromium-release b/chromium-bolt/fetch-chromium-release new file mode 100644 index 000000000..0ada8ae2d --- /dev/null +++ b/chromium-bolt/fetch-chromium-release @@ -0,0 +1,44 @@ +#!/bin/bash + +set -e + +readonly VERSION=$1 +if [[ -z $VERSION ]]; then + echo >&2 'No version given as an argument' + exit 1 +fi + +mkdir chromium-checkout +cd chromium-checkout +cat >.gclient <= 58 ++#if U_ICU_VERSION_MAJOR_NUM >= 74 ++#define BA_LB_COUNT (U_LB_COUNT - 8) ++#elif U_ICU_VERSION_MAJOR_NUM >= 58 + #define BA_LB_COUNT (U_LB_COUNT - 3) + #else + #define BA_LB_COUNT U_LB_COUNT diff --git a/chromium-bolt/profiler.py b/chromium-bolt/profiler.py new file mode 100644 index 000000000..92091971d --- /dev/null +++ b/chromium-bolt/profiler.py @@ -0,0 +1,52 @@ +# Script to run the Speedometer 2.0 and 2.1 benchmarks using Selenium +# Laio O. Seman + +from selenium import webdriver +from selenium.webdriver.chrome.options import Options +from selenium.webdriver.common.by import By +from selenium.webdriver.support.ui import WebDriverWait +from selenium.webdriver.support import expected_conditions as EC +from time import sleep + +def setup_driver(): + chrome_options = Options() + chrome_options.add_argument("--headless") + chrome_options.add_argument("--no-sandbox") + chrome_options.add_argument("--disable-gpu") + chrome_options.add_argument("--window-size=1920,1080") + chrome_options.add_argument("--disable-dev-shm-usage") + driver = webdriver.Chrome(options=chrome_options) + return driver + +def run_speedometer(driver, version='2.0'): + base_url = 'https://browserbench.org/Speedometer' + if version not in ['2.0', '2.1']: + print("Invalid Speedometer version specified. Defaulting to 2.0.") + version = '2.0' + full_url = f"{base_url}{version}/" + driver.get(full_url) + + driver.save_screenshot(f"speedometer_{version}_start.png") + + start_button = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.TAG_NAME, "button"))) + start_button.click() + + # Wait for the details button to be visible + details_button = WebDriverWait(driver, 60).until(EC.visibility_of_element_located((By.CLASS_NAME, "show-details"))) + details_button.click() + + driver.save_screenshot(f"speedometer_{version}_b.png") + + +def main(): + driver = setup_driver() + try: + # Run Speedometer 2.0 + run_speedometer(driver, '2.0') + # Run Speedometer 2.1 + run_speedometer(driver, '2.1') + finally: + driver.quit() + +if __name__ == "__main__": + main() diff --git a/chromium-bolt/relocs.patch b/chromium-bolt/relocs.patch new file mode 100644 index 000000000..0a0aaa999 --- /dev/null +++ b/chromium-bolt/relocs.patch @@ -0,0 +1,10 @@ +--- a/build/config/BUILDCONFIG.gn ++++ b/build/config/BUILDCONFIG.gn +@@ -352,6 +352,7 @@ + "//build/config/compiler/pgo:default_pgo_flags", + "//build/config/coverage:default_coverage", + "//build/config/sanitizers:default_sanitizer_flags", ++ "//build/config/compiler:emit-relocs", + ] + + if (is_win) { diff --git a/chromium-bolt/relocs2.patch b/chromium-bolt/relocs2.patch new file mode 100644 index 000000000..d56c3a55f --- /dev/null +++ b/chromium-bolt/relocs2.patch @@ -0,0 +1,19 @@ +--- a/build/config/compiler/BUILD.gn ++++ b/build/config/compiler/BUILD.gn +@@ -246,6 +246,15 @@ + } + } + ++# Emit relocs for BOLT ++config("emit-relocs") { ++ if (!using_sanitizer && is_linux) { ++ ldflags = [ ++ "-Wl,--emit-relocs", ++ ] ++ } ++} ++ + # compiler --------------------------------------------------------------------- + # + # Base compiler configuration. + \ No newline at end of file diff --git a/chromium-bolt/use-oauth2-client-switches-as-default.patch b/chromium-bolt/use-oauth2-client-switches-as-default.patch new file mode 100644 index 000000000..9d9c57bfb --- /dev/null +++ b/chromium-bolt/use-oauth2-client-switches-as-default.patch @@ -0,0 +1,17 @@ +diff -upr chromium-89.0.4389.58.orig/google_apis/google_api_keys.cc chromium-89.0.4389.58/google_apis/google_api_keys.cc +--- chromium-89.0.4389.58.orig/google_apis/google_api_keys.cc 2021-02-24 22:37:18.494007649 +0000 ++++ chromium-89.0.4389.58/google_apis/google_api_keys.cc 2021-02-24 22:35:00.865777600 +0000 +@@ -154,11 +154,11 @@ class APIKeyCache { + + std::string default_client_id = CalculateKeyValue( + GOOGLE_DEFAULT_CLIENT_ID, +- STRINGIZE_NO_EXPANSION(GOOGLE_DEFAULT_CLIENT_ID), nullptr, ++ STRINGIZE_NO_EXPANSION(GOOGLE_DEFAULT_CLIENT_ID), ::switches::kOAuth2ClientID, + std::string(), environment.get(), command_line, gaia_config); + std::string default_client_secret = CalculateKeyValue( + GOOGLE_DEFAULT_CLIENT_SECRET, +- STRINGIZE_NO_EXPANSION(GOOGLE_DEFAULT_CLIENT_SECRET), nullptr, ++ STRINGIZE_NO_EXPANSION(GOOGLE_DEFAULT_CLIENT_SECRET), ::switches::kOAuth2ClientSecret, + std::string(), environment.get(), command_line, gaia_config); + + // We currently only allow overriding the baked-in values for the From 5c123b8fc1fdc5613ec55134ccbdf759d7b63ad9 Mon Sep 17 00:00:00 2001 From: "Laio O. Seman" Date: Wed, 7 Feb 2024 10:05:36 -0300 Subject: [PATCH 02/14] fix(chromium): small fixes --- chromium-bolt/PKGBUILD | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/chromium-bolt/PKGBUILD b/chromium-bolt/PKGBUILD index 712463769..ebe9fb2df 100644 --- a/chromium-bolt/PKGBUILD +++ b/chromium-bolt/PKGBUILD @@ -36,7 +36,8 @@ source=( compiler-rt-16.patch use-oauth2-client-switches-as-default.patch relocs.patch - relocs2.patch) + relocs2.patch + profiler.py) sha256sums=('e12cc967bef7a79630828792f02d95297a06eb905c98e4c6e065fd5e74d6f9ff' '213e50f48b67feb4441078d50b0fd431df34323be15be97c55302d3fdac4483a' 'e9113c1ed2900b84b488e608774ce25212d3c60094abdae005d8a943df9b505e' @@ -224,7 +225,7 @@ build() { _flags+=( 'clang_base_path="/usr"' 'clang_use_chrome_plugins=false' - "clang_version=17" + "clang_version=\"$_clang_version\"" 'chrome_pgo_phase=0' # needs newer clang to read the bundled PGO profile ) From e36e44559102da2831a94ab18fdaa4af7337c525 Mon Sep 17 00:00:00 2001 From: "Laio O. Seman" Date: Fri, 9 Feb 2024 07:38:22 -0300 Subject: [PATCH 03/14] fix(chromium): re-enabling pgo on chromium --- chromium-bolt/PKGBUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chromium-bolt/PKGBUILD b/chromium-bolt/PKGBUILD index ebe9fb2df..af920a482 100644 --- a/chromium-bolt/PKGBUILD +++ b/chromium-bolt/PKGBUILD @@ -226,7 +226,7 @@ build() { 'clang_base_path="/usr"' 'clang_use_chrome_plugins=false' "clang_version=\"$_clang_version\"" - 'chrome_pgo_phase=0' # needs newer clang to read the bundled PGO profile + #'chrome_pgo_phase=0' # needs newer clang to read the bundled PGO profile ) # Allow the use of nightly features with stable Rust compiler From 94c82fb687daee499b6111fe8b473e4202b1a3f9 Mon Sep 17 00:00:00 2001 From: "Laio O. Seman" Date: Fri, 9 Feb 2024 15:59:01 -0300 Subject: [PATCH 04/14] fix(chromium): bolting profiler path --- chromium-bolt/PKGBUILD | 7 +++++-- chromium-bolt/profiler.py | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/chromium-bolt/PKGBUILD b/chromium-bolt/PKGBUILD index af920a482..f2338d1cd 100644 --- a/chromium-bolt/PKGBUILD +++ b/chromium-bolt/PKGBUILD @@ -8,7 +8,7 @@ pkgver=121.0.6167.164 pkgrel=1 _launcher_ver=8 _manual_clone=0 -_system_clang=1 +_system_clang=0 pkgdesc="A web browser built for speed, simplicity, and security" arch=('x86_64') url="https://www.chromium.org/Home" @@ -282,12 +282,15 @@ build() { perf2bolt out/Release/chrome -perfdata=perf.data -o perf.fdata -strict=0 - llvm-bolt out/Default/chrome -o out/Release/chrome.bolt \ + llvm-bolt out/Release/chrome -o out/Release/chrome.bolt \ -data=perf.fdata -dyno-stats \ -reorder-blocks=ext-tsp -reorder-functions=hfsort \ -split-functions -split-all-cold -split-eh \ -skip-funcs=Builtins_.\* + mv out/Release/chrome out/Release/chrome.orig + mv out/Release/chrome.bolt out/Release/chrome + } package() { diff --git a/chromium-bolt/profiler.py b/chromium-bolt/profiler.py index 92091971d..c8790f189 100644 --- a/chromium-bolt/profiler.py +++ b/chromium-bolt/profiler.py @@ -10,6 +10,7 @@ def setup_driver(): chrome_options = Options() + chrome_options.binary_location = 'out/Release/chrome' # Specify the path to Chrome binary here chrome_options.add_argument("--headless") chrome_options.add_argument("--no-sandbox") chrome_options.add_argument("--disable-gpu") From 9ada82cbc958a802331c7020cbe13156cd2245c9 Mon Sep 17 00:00:00 2001 From: "Laio O. Seman" Date: Fri, 9 Feb 2024 16:07:28 -0300 Subject: [PATCH 05/14] fix(chromium): add options, conflicts, and name --- chromium-bolt/PKGBUILD | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/chromium-bolt/PKGBUILD b/chromium-bolt/PKGBUILD index f2338d1cd..2a9e76ebd 100644 --- a/chromium-bolt/PKGBUILD +++ b/chromium-bolt/PKGBUILD @@ -3,9 +3,10 @@ # Contributor: Jan "heftig" Steffens # Contributor: Daniel J Griffiths -pkgname=chromium +pkgname=chromium-bolt pkgver=121.0.6167.164 pkgrel=1 +conflicts=(chromium) _launcher_ver=8 _manual_clone=0 _system_clang=0 @@ -24,7 +25,7 @@ optdepends=('pipewire: WebRTC desktop sharing under Wayland' 'gtk4: for --gtk-version=4 (GTK4 IME might work better on Wayland)' 'org.freedesktop.secrets: password storage backend on GNOME / Xfce' 'kwallet: support for storing passwords in KWallet on Plasma') -options=('!strip') # Chromium adds its own flags for ThinLTO +options=('!strip', '!lto') # Chromium adds its own flags for ThinLTO source=( https://commondatastorage.googleapis.com/chromium-browser-official/chromium-$pkgver.tar.xz https://github.com/foutrelis/chromium-launcher/archive/v$_launcher_ver/chromium-launcher-$_launcher_ver.tar.gz From 45a34a60df00281dab999dd443393301fc65e41b Mon Sep 17 00:00:00 2001 From: "Laio O. Seman" Date: Fri, 9 Feb 2024 16:08:55 -0300 Subject: [PATCH 06/14] fix(chromium): no comma here --- chromium-bolt/PKGBUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chromium-bolt/PKGBUILD b/chromium-bolt/PKGBUILD index 2a9e76ebd..6afdc1013 100644 --- a/chromium-bolt/PKGBUILD +++ b/chromium-bolt/PKGBUILD @@ -25,7 +25,7 @@ optdepends=('pipewire: WebRTC desktop sharing under Wayland' 'gtk4: for --gtk-version=4 (GTK4 IME might work better on Wayland)' 'org.freedesktop.secrets: password storage backend on GNOME / Xfce' 'kwallet: support for storing passwords in KWallet on Plasma') -options=('!strip', '!lto') # Chromium adds its own flags for ThinLTO +options=('!strip' '!lto') # Chromium adds its own flags for ThinLTO source=( https://commondatastorage.googleapis.com/chromium-browser-official/chromium-$pkgver.tar.xz https://github.com/foutrelis/chromium-launcher/archive/v$_launcher_ver/chromium-launcher-$_launcher_ver.tar.gz From 6d8688e76b97e5340fee995dc2aedc65e4958bcd Mon Sep 17 00:00:00 2001 From: "Laio O. Seman" Date: Sun, 11 Feb 2024 22:23:23 -0300 Subject: [PATCH 07/14] update(chromium): hfsort changed to hfsort+ --- chromium-bolt/PKGBUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chromium-bolt/PKGBUILD b/chromium-bolt/PKGBUILD index 6afdc1013..ace5d53c1 100644 --- a/chromium-bolt/PKGBUILD +++ b/chromium-bolt/PKGBUILD @@ -285,7 +285,7 @@ build() { llvm-bolt out/Release/chrome -o out/Release/chrome.bolt \ -data=perf.fdata -dyno-stats \ - -reorder-blocks=ext-tsp -reorder-functions=hfsort \ + -reorder-blocks=ext-tsp -reorder-functions=hfsort+ \ -split-functions -split-all-cold -split-eh \ -skip-funcs=Builtins_.\* From e31e80ae4c2863cc15891999d3556445bfc85133 Mon Sep 17 00:00:00 2001 From: "Laio O. Seman" Date: Fri, 16 Feb 2024 15:36:57 -0300 Subject: [PATCH 08/14] fix(chromium): fixes for building on docker --- chromium-bolt/PKGBUILD | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/chromium-bolt/PKGBUILD b/chromium-bolt/PKGBUILD index ace5d53c1..1065f71a7 100644 --- a/chromium-bolt/PKGBUILD +++ b/chromium-bolt/PKGBUILD @@ -18,7 +18,8 @@ depends=('gtk3' 'nss' 'alsa-lib' 'xdg-utils' 'libxss' 'libcups' 'libgcrypt' 'ttf-liberation' 'systemd' 'dbus' 'libpulse' 'pciutils' 'libva' 'libffi' 'desktop-file-utils' 'hicolor-icon-theme') makedepends=('python' 'gn' 'ninja' 'clang' 'lld' 'gperf' 'nodejs' 'pipewire' - 'rust' 'qt5-base' 'java-runtime-headless' 'git') + 'rust' 'qt5-base' 'java-runtime-headless' 'git' + 'xorg-server-xvfb' 'llvm-bolt' 'perf') optdepends=('pipewire: WebRTC desktop sharing under Wayland' 'kdialog: support for native dialogs in Plasma' 'qt5-base: enable Qt5 with --enable-features=AllowQt' @@ -273,13 +274,22 @@ build() { gn gen out/Release --args="${_flags[*]}" ninja -C out/Release chrome chrome_sandbox chromedriver.unstripped + # cp chromedriver.unstripped to chromedriver + cp out/Release/chromedriver.unstripped out/Release/chromedriver + ## Export PATH for vpython export PATH+=":$PWD/third_party/depot_tools" + # Add out/Release to PATH for selenium + export PATH="$PWD/out/Release:$PATH" + + # Move profiler to current directory + cp ../profiler.py . + ## Branch Sampling for BOLT perf record -e cycles:u -j any,u -o perf.data -- \ xvfb-run -s "-screen 0 1920x1080x24 -nolisten local" \ - vpython3 ../profiler.py + vpython3 profiler.py perf2bolt out/Release/chrome -perfdata=perf.data -o perf.fdata -strict=0 From 99ee8954da0d1f935aa167c23e414e1b21fb44b8 Mon Sep 17 00:00:00 2001 From: "Laio O. Seman" Date: Fri, 16 Feb 2024 17:21:39 -0300 Subject: [PATCH 09/14] updating to 122 --- .../0001-adjust-buffer-format-order.patch | 65 +++ ...001-enable-linux-unstable-deb-target.patch | 33 ++ ...d-implement-text_input_manager-fixes.patch | 42 ++ ...land-implement-text_input_manager_v3.patch | 521 ++++++++++++++++++ .../0001-vaapi-flag-ozone-wayland.patch | 23 + chromium-bolt/PKGBUILD | 56 +- ...ate-for-converting-script-wrappables.patch | 174 ++++++ chromium-bolt/chromium-constexpr.patch | 48 ++ .../drop-flags-unsupported-by-clang16.patch | 25 +- ...port-ICU-74-in-LazyTextBreakIterator.patch | 148 +++++ 10 files changed, 1100 insertions(+), 35 deletions(-) create mode 100644 chromium-bolt/0001-adjust-buffer-format-order.patch create mode 100644 chromium-bolt/0001-enable-linux-unstable-deb-target.patch create mode 100644 chromium-bolt/0001-ozone-wayland-implement-text_input_manager-fixes.patch create mode 100644 chromium-bolt/0001-ozone-wayland-implement-text_input_manager_v3.patch create mode 100644 chromium-bolt/0001-vaapi-flag-ozone-wayland.patch create mode 100644 chromium-bolt/REVERT-use-v8-Array-Iterate-for-converting-script-wrappables.patch create mode 100644 chromium-bolt/chromium-constexpr.patch create mode 100644 chromium-bolt/support-ICU-74-in-LazyTextBreakIterator.patch diff --git a/chromium-bolt/0001-adjust-buffer-format-order.patch b/chromium-bolt/0001-adjust-buffer-format-order.patch new file mode 100644 index 000000000..23830ce74 --- /dev/null +++ b/chromium-bolt/0001-adjust-buffer-format-order.patch @@ -0,0 +1,65 @@ +From 44a44adecbc97242371cf67f8bbd5553c95fa123 Mon Sep 17 00:00:00 2001 +From: Yaowei Zhou +Date: Wed, 18 Jan 2023 17:00:50 +0800 +Subject: [PATCH] Adjust the order of wayland drm and zwp dma buf in WaylandBufferFactory + +Adjust the order as buffer format implementation of zwp dma buffer from +Mutter, which will cause inconsistent with gbm support format list of +GPU process. + +Bug: N/A +Change-Id: Ice63c52fbd6eff0a099c35c0943e24c1fd1a1d70 +--- + +diff --git a/ui/ozone/platform/wayland/host/wayland_buffer_factory.cc b/ui/ozone/platform/wayland/host/wayland_buffer_factory.cc +index 2376d77..7d6c032e 100644 +--- a/ui/ozone/platform/wayland/host/wayland_buffer_factory.cc ++++ b/ui/ozone/platform/wayland/host/wayland_buffer_factory.cc +@@ -25,13 +25,13 @@ + uint32_t planes_count, + wl::OnRequestBufferCallback callback) const { + DCHECK(SupportsDmabuf()); +- if (wayland_zwp_dmabuf_) { ++ if (wayland_drm_) { ++ wayland_drm_->CreateBuffer(fd, size, strides, offsets, modifiers, format, ++ planes_count, std::move(callback)); ++ } else if (wayland_zwp_dmabuf_) { + wayland_zwp_dmabuf_->CreateBuffer(fd, size, strides, offsets, modifiers, + format, planes_count, + std::move(callback)); +- } else if (wayland_drm_) { +- wayland_drm_->CreateBuffer(fd, size, strides, offsets, modifiers, format, +- planes_count, std::move(callback)); + } else { + // This method must never be called if neither zwp_linux_dmabuf or wl_drm + // are supported. +@@ -52,10 +52,11 @@ + wl::BufferFormatsWithModifiersMap + WaylandBufferFactory::GetSupportedBufferFormats() const { + #if defined(WAYLAND_GBM) +- if (wayland_zwp_dmabuf_) +- return wayland_zwp_dmabuf_->supported_buffer_formats(); +- else if (wayland_drm_) ++ if (wayland_drm_) { + return wayland_drm_->supported_buffer_formats(); ++ } else if (wayland_zwp_dmabuf_) { ++ return wayland_zwp_dmabuf_->supported_buffer_formats(); ++ } + #endif + return {}; + } +@@ -71,10 +72,11 @@ + + bool WaylandBufferFactory::CanCreateDmabufImmed() const { + #if defined(WAYLAND_GBM) +- if (wayland_zwp_dmabuf_) +- return wayland_zwp_dmabuf_->CanCreateBufferImmed(); +- else if (wayland_drm_) ++ if (wayland_drm_) { + return wayland_drm_->CanCreateBufferImmed(); ++ } else if (wayland_zwp_dmabuf_) { ++ return wayland_zwp_dmabuf_->CanCreateBufferImmed(); ++ } + #endif + return false; + } diff --git a/chromium-bolt/0001-enable-linux-unstable-deb-target.patch b/chromium-bolt/0001-enable-linux-unstable-deb-target.patch new file mode 100644 index 000000000..4ae23e0ca --- /dev/null +++ b/chromium-bolt/0001-enable-linux-unstable-deb-target.patch @@ -0,0 +1,33 @@ +From 22fe045deac0551720d7292022f443b22703f336 Mon Sep 17 00:00:00 2001 +From: Yaowei Zhou +Date: Thu, 20 Apr 2023 14:37:26 +0800 +Subject: [PATCH] Enable "linux:unstable_deb" build target when using the chromium minigbm + +Bug: N/A +Change-Id: Ic37059be0f0719895acdba756292aed71820feba +--- + +diff --git a/third_party/minigbm/BUILD.gn b/third_party/minigbm/BUILD.gn +index 739e278..50bf5d8 100644 +--- a/third_party/minigbm/BUILD.gn ++++ b/third_party/minigbm/BUILD.gn +@@ -58,7 +58,7 @@ + } + } + +- shared_library("minigbm") { ++ static_library("minigbm") { + sources = [ + "src/amdgpu.c", + "src/dri.c", +@@ -89,8 +89,8 @@ + } + + # Clients need this to pick up the shared library correctly. +- all_dependent_configs = +- [ "//build/config/gcc:rpath_for_built_shared_libraries" ] ++ #all_dependent_configs = ++ # [ "//build/config/gcc:rpath_for_built_shared_libraries" ] + } + + # This target is used for Chromecast build, which expects the resulting lib diff --git a/chromium-bolt/0001-ozone-wayland-implement-text_input_manager-fixes.patch b/chromium-bolt/0001-ozone-wayland-implement-text_input_manager-fixes.patch new file mode 100644 index 000000000..0d4e55195 --- /dev/null +++ b/chromium-bolt/0001-ozone-wayland-implement-text_input_manager-fixes.patch @@ -0,0 +1,42 @@ + +ui/ozone/platform/wayland/host/zwp_text_input_wrapper.h + +# https://github.com/chromium/chromium/commit/de30ba3f21f824be05443d5820b988d226780d68 +Support offset of surrounding text in Lacros wayland client. + +# https://github.com/chromium/chromium/commit/71bba2b7ae8117fdf053563a864d6cff018d7e94 +Support large size surrounding text in Lacros. + +--- +diff --git a/ui/ozone/platform/wayland/host/zwp_text_input_wrapper_v3.cc b/ui/ozone/platform/wayland/host/zwp_text_input_wrapper_v3.cc +index a3ce6e4..83f2c58 100644 +--- a/ui/ozone/platform/wayland/host/zwp_text_input_wrapper_v3.cc ++++ b/ui/ozone/platform/wayland/host/zwp_text_input_wrapper_v3.cc +@@ -147,6 +147,14 @@ void ZWPTextInputWrapperV3::SetSurroundingText( + zwp_text_input_v3_commit(obj_.get()); + } + ++bool ZWPTextInputWrapperV3::HasAdvancedSurroundingTextSupport() const { ++ return false; ++} ++ ++void ZWPTextInputWrapperV3::SetSurroundingTextOffsetUtf16( ++ uint32_t offset_utf16) { ++} ++ + void ZWPTextInputWrapperV3::ResetPendingState() { + commit_string_.clear(); + delete_surrounding_text_before_length_ = 0; +diff --git a/ui/ozone/platform/wayland/host/zwp_text_input_wrapper_v3.h b/ui/ozone/platform/wayland/host/zwp_text_input_wrapper_v3.h +index 204d7e3..5d03a1d 100644 +--- a/ui/ozone/platform/wayland/host/zwp_text_input_wrapper_v3.h ++++ b/ui/ozone/platform/wayland/host/zwp_text_input_wrapper_v3.h +@@ -45,6 +45,8 @@ class ZWPTextInputWrapperV3 : public ZWPTextInputWrapper { + void SetCursorRect(const gfx::Rect& rect) override; + void SetSurroundingText(const std::string& text, + const gfx::Range& selection_range) override; ++ bool HasAdvancedSurroundingTextSupport() const override; ++ void SetSurroundingTextOffsetUtf16(uint32_t offset_utf16) override; + void SetContentType(TextInputType type, + TextInputMode mode, + uint32_t flags, diff --git a/chromium-bolt/0001-ozone-wayland-implement-text_input_manager_v3.patch b/chromium-bolt/0001-ozone-wayland-implement-text_input_manager_v3.patch new file mode 100644 index 000000000..7691178be --- /dev/null +++ b/chromium-bolt/0001-ozone-wayland-implement-text_input_manager_v3.patch @@ -0,0 +1,521 @@ +From dba362808a97ced4f43635cbd73de6b06d156527 Mon Sep 17 00:00:00 2001 +From: Moon Sungjoon +Date: Wed, 26 Apr 2023 03:25:44 +0900 +Subject: [PATCH] ui/ozone/platform/wayland: Implement text_input_manager_v3 + +Based on the original work of Lukas Lihotzki in https://crrev.com/c/3015331 + +Bug: 1227719 +Change-Id: Ib883c9087377c9f1a0dfacc45a27e3e67ccf042e +--- + +diff --git a/AUTHORS b/AUTHORS +index f275151..a43a528 100644 +--- a/AUTHORS ++++ b/AUTHORS +@@ -942,6 +942,7 @@ Mohit Bhalla + Moiseanu Rares-Marian + Momoka Yamamoto + Momoko Hattori ++Moon Sungjoon + Mostafa Sedaghat joo + Mrunal Kapade + Munira Tursunova +diff --git a/third_party/wayland-protocols/BUILD.gn b/third_party/wayland-protocols/BUILD.gn +index c84ec11..dffa0aa 100644 +--- a/third_party/wayland-protocols/BUILD.gn ++++ b/third_party/wayland-protocols/BUILD.gn +@@ -141,7 +141,10 @@ wayland_protocol("text_input_extension_protocol") { + } + + wayland_protocol("text_input_protocol") { +- sources = [ "src/unstable/text-input/text-input-unstable-v1.xml" ] ++ sources = [ ++ "src/unstable/text-input/text-input-unstable-v1.xml", ++ "src/unstable/text-input/text-input-unstable-v3.xml", ++ ] + } + + wayland_protocol("touchpad_haptics_protocol") { +diff --git a/ui/ozone/platform/wayland/BUILD.gn b/ui/ozone/platform/wayland/BUILD.gn +index 31314f3..c22888c 100644 +--- a/ui/ozone/platform/wayland/BUILD.gn ++++ b/ui/ozone/platform/wayland/BUILD.gn +@@ -221,6 +221,8 @@ source_set("wayland") { + "host/zwp_text_input_wrapper.h", + "host/zwp_text_input_wrapper_v1.cc", + "host/zwp_text_input_wrapper_v1.h", ++ "host/zwp_text_input_wrapper_v3.cc", ++ "host/zwp_text_input_wrapper_v3.h", + "ozone_platform_wayland.cc", + "ozone_platform_wayland.h", + "wayland_utils.cc", +diff --git a/ui/ozone/platform/wayland/common/wayland_object.cc b/ui/ozone/platform/wayland/common/wayland_object.cc +index bcc48aa..009667b 100644 +--- a/ui/ozone/platform/wayland/common/wayland_object.cc ++++ b/ui/ozone/platform/wayland/common/wayland_object.cc +@@ -30,6 +30,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -287,6 +288,8 @@ IMPLEMENT_WAYLAND_OBJECT_TRAITS(zwp_relative_pointer_manager_v1) + IMPLEMENT_WAYLAND_OBJECT_TRAITS(zwp_relative_pointer_v1) + IMPLEMENT_WAYLAND_OBJECT_TRAITS(zwp_text_input_manager_v1) + IMPLEMENT_WAYLAND_OBJECT_TRAITS(zwp_text_input_v1) ++IMPLEMENT_WAYLAND_OBJECT_TRAITS(zwp_text_input_manager_v3) ++IMPLEMENT_WAYLAND_OBJECT_TRAITS(zwp_text_input_v3) + IMPLEMENT_WAYLAND_OBJECT_TRAITS(zxdg_decoration_manager_v1) + IMPLEMENT_WAYLAND_OBJECT_TRAITS(zxdg_exporter_v1) + IMPLEMENT_WAYLAND_OBJECT_TRAITS(zxdg_exported_v1) +diff --git a/ui/ozone/platform/wayland/common/wayland_object.h b/ui/ozone/platform/wayland/common/wayland_object.h +index c84c084..0817e78 100644 +--- a/ui/ozone/platform/wayland/common/wayland_object.h ++++ b/ui/ozone/platform/wayland/common/wayland_object.h +@@ -202,6 +202,8 @@ DECLARE_WAYLAND_OBJECT_TRAITS(zwp_relative_pointer_manager_v1) + DECLARE_WAYLAND_OBJECT_TRAITS(zwp_relative_pointer_v1) + DECLARE_WAYLAND_OBJECT_TRAITS(zwp_text_input_manager_v1) + DECLARE_WAYLAND_OBJECT_TRAITS(zwp_text_input_v1) ++DECLARE_WAYLAND_OBJECT_TRAITS(zwp_text_input_manager_v3) ++DECLARE_WAYLAND_OBJECT_TRAITS(zwp_text_input_v3) + DECLARE_WAYLAND_OBJECT_TRAITS(zxdg_decoration_manager_v1) + DECLARE_WAYLAND_OBJECT_TRAITS(zxdg_exporter_v1) + DECLARE_WAYLAND_OBJECT_TRAITS(zxdg_exported_v1) +diff --git a/ui/ozone/platform/wayland/host/wayland_connection.cc b/ui/ozone/platform/wayland/host/wayland_connection.cc +index ad3bbd6..995b1e2 100644 +--- a/ui/ozone/platform/wayland/host/wayland_connection.cc ++++ b/ui/ozone/platform/wayland/host/wayland_connection.cc +@@ -647,6 +647,14 @@ void WaylandConnection::HandleGlobal(wl_registry* registry, + strcmp(interface, "zcr_text_input_extension_v1") == 0) { + text_input_extension_v1_ = wl::Bind( + registry, name, std::min(version, kMaxTextInputExtensionVersion)); ++ } else if (!text_input_manager_v3_ && ++ strcmp(interface, "zwp_text_input_manager_v3") == 0) { ++ text_input_manager_v3_ = wl::Bind( ++ registry, name, std::min(version, kMaxTextInputManagerVersion)); ++ if (!text_input_manager_v3_) { ++ LOG(ERROR) << "Failed to bind to zwp_text_input_manager_v3 global"; ++ return; ++ } + } else if (!xdg_decoration_manager_ && + strcmp(interface, "zxdg_decoration_manager_v1") == 0) { + xdg_decoration_manager_ = wl::Bind( +diff --git a/ui/ozone/platform/wayland/host/wayland_connection.h b/ui/ozone/platform/wayland/host/wayland_connection.h +index 6659bc5..f9739ea 100644 +--- a/ui/ozone/platform/wayland/host/wayland_connection.h ++++ b/ui/ozone/platform/wayland/host/wayland_connection.h +@@ -149,6 +149,9 @@ class WaylandConnection { + zcr_text_input_extension_v1* text_input_extension_v1() const { + return text_input_extension_v1_.get(); + } ++ zwp_text_input_manager_v3* text_input_manager_v3() const { ++ return text_input_manager_v3_.get(); ++ } + zwp_linux_explicit_synchronization_v1* linux_explicit_synchronization_v1() + const { + return linux_explicit_synchronization_.get(); +@@ -447,6 +450,7 @@ class WaylandConnection { + wl::Object zcr_stylus_v2_; + wl::Object text_input_manager_v1_; + wl::Object text_input_extension_v1_; ++ wl::Object text_input_manager_v3_; + wl::Object + linux_explicit_synchronization_; + wl::Object xdg_decoration_manager_; +diff --git a/ui/ozone/platform/wayland/host/wayland_input_method_context.cc b/ui/ozone/platform/wayland/host/wayland_input_method_context.cc +index caa5074..c2e1798 100644 +--- a/ui/ozone/platform/wayland/host/wayland_input_method_context.cc ++++ b/ui/ozone/platform/wayland/host/wayland_input_method_context.cc +@@ -35,6 +35,7 @@ + #include "ui/ozone/platform/wayland/host/wayland_seat.h" + #include "ui/ozone/platform/wayland/host/wayland_window.h" + #include "ui/ozone/platform/wayland/host/zwp_text_input_wrapper_v1.h" ++#include "ui/ozone/platform/wayland/host/zwp_text_input_wrapper_v3.h" + #include "ui/ozone/public/ozone_switches.h" + + #if BUILDFLAG(USE_XKBCOMMON) +@@ -285,11 +286,18 @@ void WaylandInputMethodContext::Init(bool initialize_for_testing) { + // If text input instance is not created then all ime context operations + // are noop. This option is because in some environments someone might not + // want to enable ime/virtual keyboard even if it's available. +- if (use_ozone_wayland_vkb && !text_input_ && +- connection_->text_input_manager_v1()) { ++ if (!use_ozone_wayland_vkb || text_input_) ++ return; ++ ++ // Prefer text_input_manager_v1 because it is more powerful. ++ // It supports preedit styling for example. ++ if (connection_->text_input_manager_v1()) { + text_input_ = std::make_unique( + connection_, this, connection_->text_input_manager_v1(), + connection_->text_input_extension_v1()); ++ } else if (connection_->text_input_manager_v3()) { ++ text_input_ = std::make_unique( ++ connection_, this, connection_->text_input_manager_v3()); + } + } + +@@ -657,6 +665,11 @@ void WaylandInputMethodContext::OnCursorPosition(int32_t index, + + void WaylandInputMethodContext::OnDeleteSurroundingText(int32_t index, + uint32_t length) { ++ // Never fail if length is 0. ++ if (length == 0) { ++ return; ++ } ++ + const auto& [surrounding_text, utf16_offset, selection, unsused_composition] = + surrounding_text_tracker_.predicted_state(); + DCHECK(selection.IsValid()); +diff --git a/ui/ozone/platform/wayland/host/zwp_text_input_wrapper_v3.cc b/ui/ozone/platform/wayland/host/zwp_text_input_wrapper_v3.cc +new file mode 100644 +index 0000000..a3ce6e4 +--- /dev/null ++++ b/ui/ozone/platform/wayland/host/zwp_text_input_wrapper_v3.cc +@@ -0,0 +1,239 @@ ++// Copyright 2023 The Chromium Authors ++// Use of this source code is governed by a BSD-style license that can be ++// found in the LICENSE file. ++ ++#include "ui/ozone/platform/wayland/host/zwp_text_input_wrapper_v3.h" ++ ++#include ++#include ++ ++#include "base/logging.h" ++#include "base/memory/ptr_util.h" ++#include "ui/base/wayland/wayland_client_input_types.h" ++#include "ui/gfx/range/range.h" ++#include "ui/ozone/platform/wayland/host/wayland_connection.h" ++#include "ui/ozone/platform/wayland/host/wayland_seat.h" ++#include "ui/ozone/platform/wayland/host/wayland_window.h" ++ ++namespace ui { ++ ++// Converts Chrome's TextInputType into wayland's content_purpose. ++// Some of TextInputType values do not have clearly corresponding wayland value, ++// and they fallback to closer type. ++uint32_t InputTypeToContentPurpose(TextInputType input_type) { ++ switch (input_type) { ++ case TEXT_INPUT_TYPE_NONE: ++ return ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NORMAL; ++ case TEXT_INPUT_TYPE_TEXT: ++ return ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NORMAL; ++ case TEXT_INPUT_TYPE_PASSWORD: ++ return ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_PASSWORD; ++ case TEXT_INPUT_TYPE_SEARCH: ++ return ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NORMAL; ++ case TEXT_INPUT_TYPE_EMAIL: ++ return ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_EMAIL; ++ case TEXT_INPUT_TYPE_NUMBER: ++ return ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NUMBER; ++ case TEXT_INPUT_TYPE_TELEPHONE: ++ return ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_PHONE; ++ case TEXT_INPUT_TYPE_URL: ++ return ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_URL; ++ case TEXT_INPUT_TYPE_DATE: ++ return ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_DATE; ++ case TEXT_INPUT_TYPE_DATE_TIME: ++ return ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_DATETIME; ++ case TEXT_INPUT_TYPE_DATE_TIME_LOCAL: ++ return ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_DATETIME; ++ case TEXT_INPUT_TYPE_MONTH: ++ return ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_DATE; ++ case TEXT_INPUT_TYPE_TIME: ++ return ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_TIME; ++ case TEXT_INPUT_TYPE_WEEK: ++ return ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_DATE; ++ case TEXT_INPUT_TYPE_TEXT_AREA: ++ return ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NORMAL; ++ case TEXT_INPUT_TYPE_CONTENT_EDITABLE: ++ return ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NORMAL; ++ case TEXT_INPUT_TYPE_DATE_TIME_FIELD: ++ return ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_DATETIME; ++ case TEXT_INPUT_TYPE_NULL: ++ return ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NORMAL; ++ } ++} ++ ++// Converts Chrome's TextInputType into wayland's content_hint. ++uint32_t InputFlagsToContentHint(int input_flags) { ++ uint32_t hint = 0; ++ if (input_flags & TEXT_INPUT_FLAG_AUTOCOMPLETE_ON) ++ hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_COMPLETION; ++ if (input_flags & TEXT_INPUT_FLAG_SPELLCHECK_ON) ++ hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_SPELLCHECK; ++ // No good match. Fallback to AUTO_CORRECTION. ++ if (input_flags & TEXT_INPUT_FLAG_AUTOCORRECT_ON) ++ hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_SPELLCHECK; ++ if (input_flags & TEXT_INPUT_FLAG_AUTOCAPITALIZE_CHARACTERS) ++ hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_AUTO_CAPITALIZATION; ++ if (input_flags & TEXT_INPUT_FLAG_AUTOCAPITALIZE_WORDS) ++ hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_AUTO_CAPITALIZATION; ++ if (input_flags & TEXT_INPUT_FLAG_AUTOCAPITALIZE_SENTENCES) ++ hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_AUTO_CAPITALIZATION; ++ if (input_flags & TEXT_INPUT_FLAG_HAS_BEEN_PASSWORD) ++ hint |= ZWP_TEXT_INPUT_V3_CONTENT_HINT_SENSITIVE_DATA; ++ return hint; ++} ++ ++ZWPTextInputWrapperV3::ZWPTextInputWrapperV3( ++ WaylandConnection* connection, ++ ZWPTextInputWrapperClient* client, ++ zwp_text_input_manager_v3* text_input_manager) ++ : connection_(connection), client_(client) { ++ static const zwp_text_input_v3_listener text_input_listener = { ++ &OnEnter, // text_input_enter, ++ &OnLeave, // text_input_leave, ++ &OnPreeditString, // text_input_preedit_string, ++ &OnCommitString, // text_input_commit_string, ++ &OnDeleteSurroundingText, // text_input_delete_surrounding_text, ++ &OnDone, // text_input_done, ++ }; ++ ++ DCHECK(text_input_manager); ++ auto* text_input = zwp_text_input_manager_v3_get_text_input( ++ text_input_manager, connection_->seat()->wl_object()); ++ obj_ = wl::Object(text_input); ++ ++ zwp_text_input_v3_add_listener(text_input, &text_input_listener, this); ++} ++ ++ZWPTextInputWrapperV3::~ZWPTextInputWrapperV3() = default; ++ ++void ZWPTextInputWrapperV3::Reset() { ++ NOTIMPLEMENTED_LOG_ONCE(); ++} ++ ++void ZWPTextInputWrapperV3::Activate(WaylandWindow* window, ++ TextInputClient::FocusReason reason) { ++ zwp_text_input_v3_enable(obj_.get()); ++ zwp_text_input_v3_commit(obj_.get()); ++} ++ ++void ZWPTextInputWrapperV3::Deactivate() { ++ zwp_text_input_v3_disable(obj_.get()); ++ zwp_text_input_v3_commit(obj_.get()); ++} ++ ++void ZWPTextInputWrapperV3::ShowInputPanel() { ++ // Not directly supported in zwp_text_input_v3 ++ // Enable again to show the screen keyboard in GNOME: ++ // https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1543#note_1051704 ++ zwp_text_input_v3_enable(obj_.get()); ++ zwp_text_input_v3_commit(obj_.get()); ++} ++ ++void ZWPTextInputWrapperV3::HideInputPanel() { ++ // unsupported in zwp_text_input_v3 ++} ++ ++void ZWPTextInputWrapperV3::SetCursorRect(const gfx::Rect& rect) { ++ zwp_text_input_v3_set_cursor_rectangle(obj_.get(), rect.x(), rect.y(), ++ rect.width(), rect.height()); ++ zwp_text_input_v3_commit(obj_.get()); ++} ++ ++void ZWPTextInputWrapperV3::SetSurroundingText( ++ const std::string& text, ++ const gfx::Range& selection_range) { ++ zwp_text_input_v3_set_surrounding_text( ++ obj_.get(), text.c_str(), selection_range.start(), selection_range.end()); ++ zwp_text_input_v3_commit(obj_.get()); ++} ++ ++void ZWPTextInputWrapperV3::ResetPendingState() { ++ commit_string_.clear(); ++ delete_surrounding_text_before_length_ = 0; ++ delete_surrounding_text_after_length_ = 0; ++ preedit_string_.clear(); ++ preedit_string_cursor_begin_ = 0; ++ preedit_string_cursor_end_ = 0; ++} ++ ++void ZWPTextInputWrapperV3::SetContentType(ui::TextInputType type, ++ ui::TextInputMode mode, ++ uint32_t flags, ++ bool should_do_learning, ++ bool can_compose_inline) { ++ // V3 doesn't have extension ++ uint32_t content_purpose = InputTypeToContentPurpose(type); ++ uint32_t content_hint = InputFlagsToContentHint(flags); ++ static_cast(flags); ++ static_cast(should_do_learning); ++ zwp_text_input_v3_set_content_type(obj_.get(), content_hint, content_purpose); ++} ++ ++void ZWPTextInputWrapperV3::OnEnter(void* data, ++ struct zwp_text_input_v3* text_input, ++ struct wl_surface* surface) { ++ NOTIMPLEMENTED_LOG_ONCE(); ++} ++ ++void ZWPTextInputWrapperV3::OnLeave(void* data, ++ struct zwp_text_input_v3* text_input, ++ struct wl_surface* surface) { ++ NOTIMPLEMENTED_LOG_ONCE(); ++} ++ ++void ZWPTextInputWrapperV3::OnPreeditString( ++ void* data, ++ struct zwp_text_input_v3* text_input, ++ const char* text, ++ int32_t cursor_begin, ++ int32_t cursor_end) { ++ auto* wti = static_cast(data); ++ wti->preedit_string_ = text ? text : ""; ++ wti->preedit_string_cursor_begin_ = cursor_begin; ++ wti->preedit_string_cursor_end_ = cursor_end; ++} ++ ++void ZWPTextInputWrapperV3::OnCommitString(void* data, ++ struct zwp_text_input_v3* text_input, ++ const char* text) { ++ auto* wti = static_cast(data); ++ wti->commit_string_ = text ? text : ""; ++} ++ ++void ZWPTextInputWrapperV3::OnDeleteSurroundingText( ++ void* data, ++ struct zwp_text_input_v3* text_input, ++ uint32_t before_length, ++ uint32_t after_length) { ++ auto* wti = static_cast(data); ++ wti->delete_surrounding_text_before_length_ = before_length; ++ wti->delete_surrounding_text_after_length_ = after_length; ++} ++ ++void ZWPTextInputWrapperV3::OnDone(void* data, ++ struct zwp_text_input_v3* text_input, ++ uint32_t serial) { ++ auto* wti = static_cast(data); ++ wti->client_->OnPreeditString("", {}, 0); ++ wti->client_->OnDeleteSurroundingText( ++ -int32_t(wti->delete_surrounding_text_before_length_), ++ int32_t(wti->delete_surrounding_text_before_length_) + ++ int32_t(wti->delete_surrounding_text_after_length_)); ++ wti->client_->OnCommitString(wti->commit_string_.c_str()); ++ wti->client_->OnPreeditString(wti->preedit_string_.c_str(), {}, ++ wti->preedit_string_cursor_begin_); ++ wti->ResetPendingState(); ++} ++ ++void ZWPTextInputWrapperV3::SetGrammarFragmentAtCursor( ++ const ui::GrammarFragment& fragment) { ++ NOTIMPLEMENTED_LOG_ONCE(); ++} ++ ++void ZWPTextInputWrapperV3::SetAutocorrectInfo( ++ const gfx::Range& autocorrect_range, ++ const gfx::Rect& autocorrect_bounds) { ++ NOTIMPLEMENTED_LOG_ONCE(); ++} ++ ++} // namespace ui +diff --git a/ui/ozone/platform/wayland/host/zwp_text_input_wrapper_v3.h b/ui/ozone/platform/wayland/host/zwp_text_input_wrapper_v3.h +new file mode 100644 +index 0000000..204d7e3 +--- /dev/null ++++ b/ui/ozone/platform/wayland/host/zwp_text_input_wrapper_v3.h +@@ -0,0 +1,98 @@ ++// Copyright 2023 The Chromium Authors ++// Use of this source code is governed by a BSD-style license that can be ++// found in the LICENSE file. ++ ++#ifndef UI_OZONE_PLATFORM_WAYLAND_HOST_ZWP_TEXT_INPUT_WRAPPER_V3_H_ ++#define UI_OZONE_PLATFORM_WAYLAND_HOST_ZWP_TEXT_INPUT_WRAPPER_V3_H_ ++ ++#include ++#include ++ ++#include ++ ++#include "base/memory/raw_ptr.h" ++#include "ui/ozone/platform/wayland/common/wayland_object.h" ++#include "ui/ozone/platform/wayland/host/zwp_text_input_wrapper.h" ++ ++namespace gfx { ++class Rect; ++} ++ ++namespace ui { ++ ++class WaylandConnection; ++class WaylandWindow; ++ ++// Text input wrapper for text-input-unstable-v3 ++class ZWPTextInputWrapperV3 : public ZWPTextInputWrapper { ++ public: ++ ZWPTextInputWrapperV3(WaylandConnection* connection, ++ ZWPTextInputWrapperClient* client, ++ zwp_text_input_manager_v3* text_input_manager); ++ ZWPTextInputWrapperV3(const ZWPTextInputWrapperV3&) = delete; ++ ZWPTextInputWrapperV3& operator=(const ZWPTextInputWrapperV3&) = delete; ++ ~ZWPTextInputWrapperV3() override; ++ ++ void Reset() override; ++ ++ void Activate(WaylandWindow* window, ++ ui::TextInputClient::FocusReason reason) override; ++ void Deactivate() override; ++ ++ void ShowInputPanel() override; ++ void HideInputPanel() override; ++ ++ void SetCursorRect(const gfx::Rect& rect) override; ++ void SetSurroundingText(const std::string& text, ++ const gfx::Range& selection_range) override; ++ void SetContentType(TextInputType type, ++ TextInputMode mode, ++ uint32_t flags, ++ bool should_do_learning, ++ bool can_compose_inline) override; ++ void SetGrammarFragmentAtCursor(const ui::GrammarFragment& fragment) override; ++ void SetAutocorrectInfo(const gfx::Range& autocorrect_range, ++ const gfx::Rect& autocorrect_bounds) override; ++ ++ private: ++ void ResetPendingState(); ++ ++ // zwp_text_input_v3_listener ++ static void OnEnter(void* data, ++ struct zwp_text_input_v3* text_input, ++ struct wl_surface* surface); ++ static void OnLeave(void* data, ++ struct zwp_text_input_v3* text_input, ++ struct wl_surface* surface); ++ static void OnPreeditString(void* data, ++ struct zwp_text_input_v3* text_input, ++ const char* text, ++ int32_t cursor_begin, ++ int32_t cursor_end); ++ static void OnCommitString(void* data, ++ struct zwp_text_input_v3* text_input, ++ const char* text); ++ static void OnDeleteSurroundingText(void* data, ++ struct zwp_text_input_v3* text_input, ++ uint32_t before_length, ++ uint32_t after_length); ++ static void OnDone(void* data, ++ struct zwp_text_input_v3* text_input, ++ uint32_t serial); ++ ++ const raw_ptr connection_; ++ wl::Object obj_; ++ const raw_ptr client_; ++ ++ // pending state until OnDone ++ std::string commit_string_; ++ uint32_t delete_surrounding_text_before_length_ = 0; ++ uint32_t delete_surrounding_text_after_length_ = 0; ++ std::string preedit_string_; // preedit string of pending state ++ int32_t preedit_string_cursor_begin_ = 0; ++ int32_t preedit_string_cursor_end_ = 0; ++}; ++ ++} // namespace ui ++ ++#endif // UI_OZONE_PLATFORM_WAYLAND_HOST_ZWP_TEXT_INPUT_WRAPPER_V3_H_ diff --git a/chromium-bolt/0001-vaapi-flag-ozone-wayland.patch b/chromium-bolt/0001-vaapi-flag-ozone-wayland.patch new file mode 100644 index 000000000..3cdaaa83a --- /dev/null +++ b/chromium-bolt/0001-vaapi-flag-ozone-wayland.patch @@ -0,0 +1,23 @@ +From 12724af6284195381377e074cc7f7c2fbc6cb05c Mon Sep 17 00:00:00 2001 +From: Yaowei Zhou +Date: Tue, 30 May 2023 12:45:27 +0800 +Subject: [PATCH] Enable VA-API flag on ozone wayland + +Bug: POC +Change-Id: I4af3c2c4925958bbca86a25a4d9c66fd8922c806 +--- + +diff --git a/ui/ozone/platform/wayland/ozone_platform_wayland.cc b/ui/ozone/platform/wayland/ozone_platform_wayland.cc +index 1de5c418..9f2f1f5 100644 +--- a/ui/ozone/platform/wayland/ozone_platform_wayland.cc ++++ b/ui/ozone/platform/wayland/ozone_platform_wayland.cc +@@ -311,6 +311,9 @@ + // arbitrary position. + properties->supports_global_screen_coordinates = + kDefaultScreenCoordinateEnabled; ++ ++ properties->supports_vaapi = true; ++ + initialised = true; + } + diff --git a/chromium-bolt/PKGBUILD b/chromium-bolt/PKGBUILD index 1065f71a7..56afcfd18 100644 --- a/chromium-bolt/PKGBUILD +++ b/chromium-bolt/PKGBUILD @@ -4,7 +4,7 @@ # Contributor: Daniel J Griffiths pkgname=chromium-bolt -pkgver=121.0.6167.164 +pkgver=122.0.6261.39 pkgrel=1 conflicts=(chromium) _launcher_ver=8 @@ -19,7 +19,7 @@ depends=('gtk3' 'nss' 'alsa-lib' 'xdg-utils' 'libxss' 'libcups' 'libgcrypt' 'libffi' 'desktop-file-utils' 'hicolor-icon-theme') makedepends=('python' 'gn' 'ninja' 'clang' 'lld' 'gperf' 'nodejs' 'pipewire' 'rust' 'qt5-base' 'java-runtime-headless' 'git' - 'xorg-server-xvfb' 'llvm-bolt' 'perf') + 'xorg-server-xvfb' 'perf' 'llvm-bolt') optdepends=('pipewire: WebRTC desktop sharing under Wayland' 'kdialog: support for native dialogs in Plasma' 'qt5-base: enable Qt5 with --enable-features=AllowQt' @@ -31,24 +31,39 @@ source=( https://commondatastorage.googleapis.com/chromium-browser-official/chromium-$pkgver.tar.xz https://github.com/foutrelis/chromium-launcher/archive/v$_launcher_ver/chromium-launcher-$_launcher_ver.tar.gz https://gitlab.com/Matt.Jolly/chromium-patches/-/archive/${pkgver%%.*}/chromium-patches-${pkgver%%.*}.tar.bz2 - REVERT-simplify-blink-NativeValueTraitsBase.patch::https://github.com/chromium/chromium/commit/940af9f2c87b.patch - icu-74.patch - chromium-121-constexpr.patch + support-ICU-74-in-LazyTextBreakIterator.patch + REVERT-simplify-blink-NativeValueTraitsBase.patch + REVERT-use-v8-Array-Iterate-for-converting-script-wrappables.patch + chromium-constexpr.patch drop-flags-unsupported-by-clang16.patch compiler-rt-16.patch use-oauth2-client-switches-as-default.patch relocs.patch relocs2.patch - profiler.py) -sha256sums=('e12cc967bef7a79630828792f02d95297a06eb905c98e4c6e065fd5e74d6f9ff' + profiler.py + 0001-vaapi-flag-ozone-wayland.patch + 0001-adjust-buffer-format-order.patch + 0001-enable-linux-unstable-deb-target.patch + 0001-ozone-wayland-implement-text_input_manager_v3.patch + 0001-ozone-wayland-implement-text_input_manager-fixes.patch) +sha256sums=('30fc98bdb497d98e63fcb4d8e76acf5201eddf7e65ee907ecf4041cc8e121be3' '213e50f48b67feb4441078d50b0fd431df34323be15be97c55302d3fdac4483a' - 'e9113c1ed2900b84b488e608774ce25212d3c60094abdae005d8a943df9b505e' + '1f6acf165578288dc84edc7d9dcfabf7d38f55153b63a37ee5afa929f0e2baad' + '8c256b2a9498a63706a6e7a55eadbeb8cc814be66a75e49aec3716c6be450c6c' '318df8f8662071cebcdf953698408058e17f59f184500b7e12e01a04a4206b50' - 'ff9ebd86b0010e1c604d47303ab209b1d76c3e888c423166779cefbc22de297f' - '09677c39ff9b910c732a049252969bfa03587e70502765d68b0345bac396c0b2' - '8d1cdf3ddd8ff98f302c90c13953f39cd804b3479b13b69b8ef138ac57c83556' + '00e06b889e4face0ef41293233ce55bd52064ab040f1fdd84aa19525f8ac3601' + 'a061f83e2b628927feb4dbc441eb54f8b8c3d81348e447cf3b90755d7cda5f54' + '53774fd7f807ad42f77d45cab9e5480cc2bcb0a5c5138110a434407521af9607' '8a2649dcc6ff8d8f24ddbe40dc2a171824f681c6f33c39c4792b645b87c9dcab' - 'e393174d7695d0bafed69e868c5fbfecf07aa6969f3b64596d0bae8b067e1711') + 'e393174d7695d0bafed69e868c5fbfecf07aa6969f3b64596d0bae8b067e1711' + '5ed8adfca50f753ce1ad26f106b2ffa33dec70ea65040726a01b717a8b02736c' + '8ae352875a1f01191eb5d4889f93d75999a6310aff91e2f4f337d5b2729fad4b' + '53bcac7288509998504f2ca4acf2a70053cce2c06c641e795d3dc368632dd447' + '9a5594293616e1390462af1f50276ee29fd6075ffab0e3f944f6346cb2eb8aec' + '8ba5c67b7eb6cacd2dbbc29e6766169f0fca3bbb07779b1a0a76c913f17d343f' + '2a44756404e13c97d000cc0d859604d6848163998ea2f838b3b9bb2c840967e3' + 'd9974ddb50777be428fd0fa1e01ffe4b587065ba6adefea33678e1b3e25d1285' + 'a2da75d0c20529f2d635050e0662941c0820264ea9371eb900b9d90b5968fa6a') if (( _manual_clone )); then source[0]=fetch-chromium-release @@ -118,16 +133,15 @@ prepare() { patch -Np1 -i ../use-oauth2-client-switches-as-default.patch # Upstream fixes - - # Fix build with ICU 74 - patch -Np1 -i ../icu-74.patch + patch -Np1 -i ../support-ICU-74-in-LazyTextBreakIterator.patch # Fix "error: defaulted definition of equality comparison operator cannot # be declared constexpr because it invokes a non-constexpr comparison # function" (patch from Fedora) - patch -Np1 -i ../chromium-121-constexpr.patch + patch -Np1 -i ../chromium-constexpr.patch # Revert usage of C++20 features which likely need newer clang + patch -Rp1 -i ../REVERT-use-v8-Array-Iterate-for-converting-script-wrappables.patch patch -Rp1 -i ../REVERT-simplify-blink-NativeValueTraitsBase.patch # Drop compiler flags that need newer clang @@ -139,11 +153,19 @@ prepare() { # Fixes for building with libstdc++ instead of libc++ patch -Np1 -i ../chromium-patches-*/chromium-114-ruy-include.patch patch -Np1 -i ../chromium-patches-*/chromium-117-material-color-include.patch - patch -Np1 -i ../chromium-patches-*/chromium-119-clang16.patch patch -Np1 -i ../relocs.patch patch -Np1 -i ../relocs2.patch + # Implement text_input_manager_v3 + # https://chromium-review.googlesource.com/c/chromium/src/+/3750452 + patch -Np1 -i ../0001-ozone-wayland-implement-text_input_manager_v3.patch + patch -Np1 -i ../0001-ozone-wayland-implement-text_input_manager-fixes.patch + + # Enable VAAPI on Wayland + patch -Np1 -i ../0001-adjust-buffer-format-order.patch + patch -Np1 -i ../0001-vaapi-flag-ozone-wayland.patch + # Link to system tools required by the build mkdir -p third_party/node/linux/node-linux-x64/bin ln -s /usr/bin/node third_party/node/linux/node-linux-x64/bin/ diff --git a/chromium-bolt/REVERT-use-v8-Array-Iterate-for-converting-script-wrappables.patch b/chromium-bolt/REVERT-use-v8-Array-Iterate-for-converting-script-wrappables.patch new file mode 100644 index 000000000..8db4a848a --- /dev/null +++ b/chromium-bolt/REVERT-use-v8-Array-Iterate-for-converting-script-wrappables.patch @@ -0,0 +1,174 @@ +From ce71348a09f6689dd01a68db64b172191d0182d8 Mon Sep 17 00:00:00 2001 +From: Andrey Kosyakov +Date: Thu, 21 Dec 2023 18:38:38 +0000 +Subject: [PATCH] [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} +--- + .../bindings/core/v8/native_value_traits.h | 6 ++ + .../core/v8/native_value_traits_impl.h | 91 ++++++++++++++++++- + 2 files changed, 95 insertions(+), 2 deletions(-) + +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 1e5a0790df6d..a5c28b37e945 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 5011503dcf1c..f085b6e90516 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-bolt/chromium-constexpr.patch b/chromium-bolt/chromium-constexpr.patch new file mode 100644 index 000000000..35acd392c --- /dev/null +++ b/chromium-bolt/chromium-constexpr.patch @@ -0,0 +1,48 @@ +diff --git a/base/types/strong_alias.h b/base/types/strong_alias.h +index 9f80b7fc8adf..4d28bd195c8a 100644 +--- a/base/types/strong_alias.h ++++ b/base/types/strong_alias.h +@@ -110,7 +110,7 @@ class StrongAlias { + // a `StrongAlias`. + friend constexpr 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/components/autofill/core/common/unique_ids.h b/components/autofill/core/common/unique_ids.h +index eb8d5d2c8ec9..6bfabf286379 100644 +--- a/components/autofill/core/common/unique_ids.h ++++ b/components/autofill/core/common/unique_ids.h +@@ -137,7 +137,7 @@ struct GlobalId { + + 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/components/performance_manager/resource_attribution/query_params.h b/components/performance_manager/resource_attribution/query_params.h +index 4616f1665e91..679dfcabe999 100644 +--- a/components/performance_manager/resource_attribution/query_params.h ++++ b/components/performance_manager/resource_attribution/query_params.h +@@ -29,7 +29,7 @@ class ContextCollection { + 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 @@ struct QueryParams { + 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/chromium-bolt/drop-flags-unsupported-by-clang16.patch b/chromium-bolt/drop-flags-unsupported-by-clang16.patch index a180426eb..a146a6d5e 100644 --- a/chromium-bolt/drop-flags-unsupported-by-clang16.patch +++ b/chromium-bolt/drop-flags-unsupported-by-clang16.patch @@ -1,8 +1,8 @@ diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn -index 80bc79e5fb3..13b200e4cb0 100644 +index 89b4755ac8b3..94b457385663 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn -@@ -616,24 +616,6 @@ config("compiler") { +@@ -618,24 +618,6 @@ config("compiler") { } } @@ -27,25 +27,14 @@ index 80bc79e5fb3..13b200e4cb0 100644 # TODO(crbug.com/1235145): Investigate why/if this should be needed. if (is_win) { cflags += [ "/clang:-ffp-contract=off" ] -@@ -768,7 +750,6 @@ config("compiler") { - ldflags += [ - "/opt:lldltojobs=all", - "-mllvm:-import-instr-limit=$import_instr_limit", -- "-mllvm:-disable-auto-upgrade-debug-info", - ] - } else { - ldflags += [ "-flto=thin" ] -@@ -800,13 +781,6 @@ config("compiler") { +@@ -802,10 +784,6 @@ config("compiler") { if (is_apple) { ldflags += [ "-Wcrl,object_path_lto" ] } -- if (!is_chromeos) { -- # TODO(https://crbug.com/972449): turn on for ChromeOS when that -- # toolchain has this flag. -- # We only use one version of LLVM within a build so there's no need to -- # upgrade debug info, which can be expensive since it runs the verifier. -- ldflags += [ "-Wl,-mllvm,-disable-auto-upgrade-debug-info" ] -- } +- +- # We only use one version of LLVM within a build so there's no need to +- # upgrade debug info, which can be expensive since it runs the verifier. +- ldflags += [ "-Wl,-mllvm,-disable-auto-upgrade-debug-info" ] } # TODO(https://crbug.com/1211155): investigate why this isn't effective on diff --git a/chromium-bolt/support-ICU-74-in-LazyTextBreakIterator.patch b/chromium-bolt/support-ICU-74-in-LazyTextBreakIterator.patch new file mode 100644 index 000000000..fd36b2e07 --- /dev/null +++ b/chromium-bolt/support-ICU-74-in-LazyTextBreakIterator.patch @@ -0,0 +1,148 @@ +From f62990fb134b7e610502b6804945debaa51960a5 Mon Sep 17 00:00:00 2001 +From: Koji Ishii +Date: Fri, 9 Feb 2024 18:47:02 +0000 +Subject: [PATCH] Support ICU 74 in `LazyTextBreakIterator` + +This patch extends the `kBreakAllLineBreakClassTable` table +for 5 new LineBreak classes in ICU 74. + +They are for Brahmic scripts, which "line breaks can occur at +the boundaries of any orthographic syllable"[1]. The +`break-all` has no additional break opportunities that all +entries are `0`. + +This patch also adds `0` for 3 classes added in ICU 58[2], +instead of doing so in code, to make future additions +possible. + +[1] https://unicode.org/reports/tr14/#BreakOpportunities +[2] https://chromiumcodereview.appspot.com/2440923002 + +Bug: 324419151 +Change-Id: I8002edb927280f63b5b668b09076cc71feaeac3e +Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5279337 +Auto-Submit: Koji Ishii +Commit-Queue: Ian Kilpatrick +Reviewed-by: Ian Kilpatrick +Cr-Commit-Position: refs/heads/main@{#1258643} +--- + .../platform/text/text_break_iterator.cc | 98 ++++++++++--------- + 1 file changed, 53 insertions(+), 45 deletions(-) + +diff --git a/third_party/blink/renderer/platform/text/text_break_iterator.cc b/third_party/blink/renderer/platform/text/text_break_iterator.cc +index 703dc2399075..38ab94a0a460 100644 +--- a/third_party/blink/renderer/platform/text/text_break_iterator.cc ++++ b/third_party/blink/renderer/platform/text/text_break_iterator.cc +@@ -161,11 +161,7 @@ static const unsigned char kAsciiLineBreakTable[][(kAsciiLineBreakTableLastChar + }; + // clang-format on + +-#if U_ICU_VERSION_MAJOR_NUM >= 58 +-#define BA_LB_COUNT (U_LB_COUNT - 3) +-#else + #define BA_LB_COUNT U_LB_COUNT +-#endif + // Line breaking table for CSS word-break: break-all. This table differs from + // asciiLineBreakTable in: + // - Indices are Line Breaking Classes defined in UAX#14 Unicode Line Breaking +@@ -174,47 +170,59 @@ static const unsigned char kAsciiLineBreakTable[][(kAsciiLineBreakTableLastChar + // normal line break, not "prohibit break." + // clang-format off + static const unsigned char kBreakAllLineBreakClassTable[][BA_LB_COUNT / 8 + 1] = { +- // XX AI AL B2 BA BB BK CB CL CM CR EX GL HY ID IN IS LF NS NU OP PO PR QU SA SG SP SY ZW NL WJ H2 H3 JL JT JV CP CJ HL RI +- { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // XX +- { B(0, 1, 1, 0, 1, 0, 0, 0), B(0, 0, 0, 0, 0, 1, 0, 0), B(0, 0, 0, 1, 1, 0, 1, 0), B(1, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 1, 0) }, // AI +- { B(0, 1, 1, 0, 1, 0, 0, 0), B(0, 0, 0, 0, 0, 1, 0, 0), B(0, 0, 0, 1, 1, 0, 1, 0), B(1, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 1, 0) }, // AL +- { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // B2 +- { B(0, 1, 1, 0, 1, 0, 0, 0), B(0, 0, 0, 0, 0, 1, 0, 0), B(0, 0, 0, 1, 1, 0, 1, 0), B(1, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 1, 0) }, // BA +- { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // BB +- { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // BK +- { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // CB +- { B(0, 1, 1, 0, 1, 0, 0, 0), B(0, 0, 0, 0, 0, 1, 0, 0), B(0, 0, 0, 1, 0, 0, 1, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 1, 0) }, // CL +- { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // CM +- { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // CR +- { B(0, 1, 1, 0, 1, 0, 0, 0), B(0, 0, 0, 0, 0, 1, 0, 0), B(0, 0, 0, 1, 0, 1, 1, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 1, 0) }, // EX +- { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // GL +- { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 1, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // HY +- { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // ID +- { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // IN +- { B(0, 1, 1, 0, 1, 0, 0, 0), B(0, 0, 0, 0, 0, 1, 0, 0), B(0, 0, 0, 1, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 1, 0) }, // IS +- { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // LF +- { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // NS +- { B(0, 1, 1, 0, 1, 0, 0, 0), B(0, 0, 0, 0, 0, 1, 0, 0), B(0, 0, 0, 1, 1, 0, 1, 0), B(1, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 1, 0) }, // NU +- { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // OP +- { B(0, 1, 1, 0, 1, 0, 0, 0), B(0, 0, 0, 0, 0, 1, 0, 0), B(0, 0, 0, 1, 0, 1, 1, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 1, 0) }, // PO +- { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 1, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // PR +- { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // QU +- { B(0, 1, 1, 0, 1, 0, 0, 0), B(0, 0, 0, 0, 0, 1, 0, 0), B(0, 0, 0, 1, 1, 0, 1, 0), B(1, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 1, 0) }, // SA +- { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // SG +- { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // SP +- { B(0, 1, 1, 0, 1, 0, 0, 0), B(0, 0, 0, 0, 0, 1, 0, 0), B(0, 0, 0, 1, 1, 0, 1, 0), B(1, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 1, 0) }, // SY +- { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // ZW +- { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // NL +- { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // WJ +- { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // H2 +- { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // H3 +- { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // JL +- { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // JT +- { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // JV +- { B(0, 1, 1, 0, 1, 0, 0, 0), B(0, 0, 0, 0, 0, 1, 0, 0), B(0, 0, 0, 1, 0, 0, 1, 0), B(1, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 1, 0) }, // CP +- { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // CJ +- { B(0, 1, 1, 0, 1, 0, 0, 0), B(0, 0, 0, 0, 0, 1, 0, 0), B(0, 0, 0, 1, 1, 0, 1, 0), B(1, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 1, 0) }, // HL +- { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // RI ++ // XX AI AL B2 BA BB BK CB CL CM CR EX GL HY ID IN IS LF NS NU OP PO PR QU SA SG SP SY ZW NL WJ H2 H3 JL JT JV CP CJ HL RI EB EM ZWJ AK AP AS VF VI ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // XX ++ { B(0, 1, 1, 0, 1, 0, 0, 0), B(0, 0, 0, 0, 0, 1, 0, 0), B(0, 0, 0, 1, 1, 0, 1, 0), B(1, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 1, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // AI ++ { B(0, 1, 1, 0, 1, 0, 0, 0), B(0, 0, 0, 0, 0, 1, 0, 0), B(0, 0, 0, 1, 1, 0, 1, 0), B(1, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 1, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // AL ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // B2 ++ { B(0, 1, 1, 0, 1, 0, 0, 0), B(0, 0, 0, 0, 0, 1, 0, 0), B(0, 0, 0, 1, 1, 0, 1, 0), B(1, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 1, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // BA ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // BB ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // BK ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // CB ++ { B(0, 1, 1, 0, 1, 0, 0, 0), B(0, 0, 0, 0, 0, 1, 0, 0), B(0, 0, 0, 1, 0, 0, 1, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 1, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // CL ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // CM ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // CR ++ { B(0, 1, 1, 0, 1, 0, 0, 0), B(0, 0, 0, 0, 0, 1, 0, 0), B(0, 0, 0, 1, 0, 1, 1, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 1, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // EX ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // GL ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 1, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // HY ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // ID ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // IN ++ { B(0, 1, 1, 0, 1, 0, 0, 0), B(0, 0, 0, 0, 0, 1, 0, 0), B(0, 0, 0, 1, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 1, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // IS ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // LF ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // NS ++ { B(0, 1, 1, 0, 1, 0, 0, 0), B(0, 0, 0, 0, 0, 1, 0, 0), B(0, 0, 0, 1, 1, 0, 1, 0), B(1, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 1, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // NU ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // OP ++ { B(0, 1, 1, 0, 1, 0, 0, 0), B(0, 0, 0, 0, 0, 1, 0, 0), B(0, 0, 0, 1, 0, 1, 1, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 1, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // PO ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 1, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // PR ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // QU ++ { B(0, 1, 1, 0, 1, 0, 0, 0), B(0, 0, 0, 0, 0, 1, 0, 0), B(0, 0, 0, 1, 1, 0, 1, 0), B(1, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 1, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // SA ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // SG ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // SP ++ { B(0, 1, 1, 0, 1, 0, 0, 0), B(0, 0, 0, 0, 0, 1, 0, 0), B(0, 0, 0, 1, 1, 0, 1, 0), B(1, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 1, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // SY ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // ZW ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // NL ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // WJ ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // H2 ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // H3 ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // JL ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // JT ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // JV ++ { B(0, 1, 1, 0, 1, 0, 0, 0), B(0, 0, 0, 0, 0, 1, 0, 0), B(0, 0, 0, 1, 0, 0, 1, 0), B(1, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 1, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // CP ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // CJ ++ { B(0, 1, 1, 0, 1, 0, 0, 0), B(0, 0, 0, 0, 0, 1, 0, 0), B(0, 0, 0, 1, 1, 0, 1, 0), B(1, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 1, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // HL ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // RI ++ // Added in ICU 58. ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // EB ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // EM ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // ZWJ ++#if U_ICU_VERSION_MAJOR_NUM >= 74 ++ // Added in ICU 74. https://icu.unicode.org/download/74 ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // AK ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // AP ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // AS ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // VF ++ { B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0), B(0, 0, 0, 0, 0, 0, 0, 0) }, // VI ++#endif // U_ICU_VERSION_MAJOR_NUM >= 74 + }; + // clang-format on + From 3803f48abbcf84d63d3cabeb50e3a35873b3e15e Mon Sep 17 00:00:00 2001 From: "Laio O. Seman" Date: Wed, 21 Feb 2024 07:07:33 -0300 Subject: [PATCH 10/14] new profiler for chromium-bolt --- chromium-bolt/profiler.py | 47 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/chromium-bolt/profiler.py b/chromium-bolt/profiler.py index c8790f189..aacbb004d 100644 --- a/chromium-bolt/profiler.py +++ b/chromium-bolt/profiler.py @@ -38,6 +38,47 @@ def run_speedometer(driver, version='2.0'): driver.save_screenshot(f"speedometer_{version}_b.png") +# run https://browserbench.org/JetStream/ +def run_jetstream(driver): + base_url = 'https://browserbench.org/JetStream/' + driver.get(base_url) + + driver.save_screenshot("jetstream_start.png") + + start_button = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.CLASS_NAME, "button"))) + start_button.click() + + # Wait for the details button to be visible + details_button = WebDriverWait(driver, 60).until(EC.visibility_of_element_located((By.CLASS_NAME, "done"))) + driver.save_screenshot(f"jetstream.png") + +# run https://browserbench.org/MotionMark1.3/ +def run_motionmark(driver): + base_url = 'https://browserbench.org/MotionMark1.3/' + driver.get(base_url) + + driver.save_screenshot("motionmark_start.png") + + # wait for text to appear + element = WebDriverWait(driver, 10).until( + EC.visibility_of_element_located((By.XPATH, "//*[contains(text(), 'Run Benchmark')]")) + ) + element.click() + + sleep(60) + +# https://web.basemark.com +def run_basemark(driver): + base_url = 'https://web.basemark.com/run/' + driver.get(base_url) + + driver.save_screenshot("basemark_start.png") + + # wait for text to appear + start_button = WebDriverWait(driver, 15).until(EC.presence_of_element_located((By.CLASS_NAME, "btn"))) + start_button.click() + + sleep(60) def main(): driver = setup_driver() @@ -46,6 +87,12 @@ def main(): run_speedometer(driver, '2.0') # Run Speedometer 2.1 run_speedometer(driver, '2.1') + # Run JetStream + run_jetstream(driver) + # Run MotionMark + run_motionmark(driver) + # Run Basemark + run_basemark(driver) finally: driver.quit() From 7f08b6a7eb6a1674ece84dd86383b4c87463ac7a Mon Sep 17 00:00:00 2001 From: "Laio O. Seman" Date: Wed, 21 Feb 2024 07:09:57 -0300 Subject: [PATCH 11/14] bump version --- chromium-bolt/PKGBUILD | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/chromium-bolt/PKGBUILD b/chromium-bolt/PKGBUILD index 56afcfd18..476f7d1f2 100644 --- a/chromium-bolt/PKGBUILD +++ b/chromium-bolt/PKGBUILD @@ -4,7 +4,7 @@ # Contributor: Daniel J Griffiths pkgname=chromium-bolt -pkgver=122.0.6261.39 +pkgver=122.0.6261.57 pkgrel=1 conflicts=(chromium) _launcher_ver=8 @@ -46,7 +46,7 @@ source=( 0001-enable-linux-unstable-deb-target.patch 0001-ozone-wayland-implement-text_input_manager_v3.patch 0001-ozone-wayland-implement-text_input_manager-fixes.patch) -sha256sums=('30fc98bdb497d98e63fcb4d8e76acf5201eddf7e65ee907ecf4041cc8e121be3' +sha256sums=('1594635f8c2db05c8d17f9f2e591b554eaf821a1a2249c271e91926db49fa7cd' '213e50f48b67feb4441078d50b0fd431df34323be15be97c55302d3fdac4483a' '1f6acf165578288dc84edc7d9dcfabf7d38f55153b63a37ee5afa929f0e2baad' '8c256b2a9498a63706a6e7a55eadbeb8cc814be66a75e49aec3716c6be450c6c' From ced80f5f1262e05d873a92efb8e7aea73ed6cf49 Mon Sep 17 00:00:00 2001 From: "Laio O. Seman" Date: Wed, 21 Feb 2024 07:17:58 -0300 Subject: [PATCH 12/14] adding -F max to chromium perf --- chromium-bolt/PKGBUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chromium-bolt/PKGBUILD b/chromium-bolt/PKGBUILD index 476f7d1f2..80cf7bac0 100644 --- a/chromium-bolt/PKGBUILD +++ b/chromium-bolt/PKGBUILD @@ -309,7 +309,7 @@ build() { cp ../profiler.py . ## Branch Sampling for BOLT - perf record -e cycles:u -j any,u -o perf.data -- \ + perf record -e cycles:u -F max -j any,u -o perf.data -- \ xvfb-run -s "-screen 0 1920x1080x24 -nolisten local" \ vpython3 profiler.py From 92beaf3bbea7b76d574517d9b9f10a4b6f45944e Mon Sep 17 00:00:00 2001 From: Peter Jung Date: Sat, 23 Mar 2024 09:33:59 +0100 Subject: [PATCH 13/14] chromium-bolt: 123.0.6312.58 Signed-off-by: Peter Jung --- chromium-bolt/.SRCINFO | 91 +++++++++++++++++++ chromium-bolt/PKGBUILD | 53 ++++------- chromium-bolt/compiler-rt-adjust-paths.patch | 32 +++++++ .../drop-flag-unsupported-by-clang17.patch | 29 ++++++ 4 files changed, 169 insertions(+), 36 deletions(-) create mode 100644 chromium-bolt/.SRCINFO create mode 100644 chromium-bolt/compiler-rt-adjust-paths.patch create mode 100644 chromium-bolt/drop-flag-unsupported-by-clang17.patch diff --git a/chromium-bolt/.SRCINFO b/chromium-bolt/.SRCINFO new file mode 100644 index 000000000..52cea9959 --- /dev/null +++ b/chromium-bolt/.SRCINFO @@ -0,0 +1,91 @@ +pkgbase = chromium-bolt + pkgdesc = A web browser built for speed, simplicity, and security + pkgver = 123.0.6312.58 + pkgrel = 1 + url = https://www.chromium.org/Home + arch = x86_64 + license = BSD-3-Clause + makedepends = python + makedepends = gn + makedepends = ninja + makedepends = clang + makedepends = lld + makedepends = gperf + makedepends = nodejs + makedepends = pipewire + makedepends = rust + makedepends = qt5-base + makedepends = java-runtime-headless + makedepends = git + makedepends = xorg-server-xvfb + makedepends = perf + makedepends = llvm-bolt + depends = gtk3 + depends = nss + depends = alsa-lib + depends = xdg-utils + depends = libxss + depends = libcups + depends = libgcrypt + depends = ttf-liberation + depends = systemd + depends = dbus + depends = libpulse + depends = pciutils + depends = libva + depends = libffi + depends = desktop-file-utils + depends = hicolor-icon-theme + depends = fontconfig + depends = brotli + depends = libjpeg + depends = icu + depends = dav1d + depends = flac + depends = libxml2 + depends = libwebp + depends = minizip + depends = opus + depends = harfbuzz + depends = libxslt + depends = libpng + depends = freetype2 + optdepends = pipewire: WebRTC desktop sharing under Wayland + optdepends = kdialog: support for native dialogs in Plasma + optdepends = qt5-base: enable Qt5 with --enable-features=AllowQt + optdepends = gtk4: for --gtk-version=4 (GTK4 IME might work better on Wayland) + optdepends = org.freedesktop.secrets: password storage backend on GNOME / Xfce + optdepends = kwallet: support for storing passwords in KWallet on Plasma + conflicts = chromium + options = !strip + options = !lto + source = https://commondatastorage.googleapis.com/chromium-browser-official/chromium-123.0.6312.58.tar.xz + source = https://github.com/foutrelis/chromium-launcher/archive/v8/chromium-launcher-8.tar.gz + source = https://gitlab.com/Matt.Jolly/chromium-patches/-/archive/123/chromium-patches-123.tar.bz2 + source = drop-flag-unsupported-by-clang17.patch + source = compiler-rt-adjust-paths.patch + source = use-oauth2-client-switches-as-default.patch + source = relocs.patch + source = relocs2.patch + source = profiler.py + source = 0001-vaapi-flag-ozone-wayland.patch + source = 0001-adjust-buffer-format-order.patch + source = 0001-enable-linux-unstable-deb-target.patch + source = 0001-ozone-wayland-implement-text_input_manager_v3.patch + source = 0001-ozone-wayland-implement-text_input_manager-fixes.patch + sha256sums = f8dae4a2ff7b00bb44fa136c2101638fea4f232e4819be3f73381ddc0d3bf718 + sha256sums = 213e50f48b67feb4441078d50b0fd431df34323be15be97c55302d3fdac4483a + sha256sums = 488f02af92b148eaa91ad5015b3bf383dfc8618ebafe9c3c250cd4c7f4e27b19 + sha256sums = 3bd35dab1ded5d9e1befa10d5c6c4555fe0a76d909fb724ac57d0bf10cb666c1 + sha256sums = b3de01b7df227478687d7517f61a777450dca765756002c80c4915f271e2d961 + sha256sums = e393174d7695d0bafed69e868c5fbfecf07aa6969f3b64596d0bae8b067e1711 + sha256sums = 5ed8adfca50f753ce1ad26f106b2ffa33dec70ea65040726a01b717a8b02736c + sha256sums = 8ae352875a1f01191eb5d4889f93d75999a6310aff91e2f4f337d5b2729fad4b + sha256sums = 272ea2273efd0ed89d655fd84f4e78f02f90801509e8a32311669b2648950809 + sha256sums = 9a5594293616e1390462af1f50276ee29fd6075ffab0e3f944f6346cb2eb8aec + sha256sums = 8ba5c67b7eb6cacd2dbbc29e6766169f0fca3bbb07779b1a0a76c913f17d343f + sha256sums = 2a44756404e13c97d000cc0d859604d6848163998ea2f838b3b9bb2c840967e3 + sha256sums = d9974ddb50777be428fd0fa1e01ffe4b587065ba6adefea33678e1b3e25d1285 + sha256sums = a2da75d0c20529f2d635050e0662941c0820264ea9371eb900b9d90b5968fa6a + +pkgname = chromium-bolt diff --git a/chromium-bolt/PKGBUILD b/chromium-bolt/PKGBUILD index 80cf7bac0..1d0947972 100644 --- a/chromium-bolt/PKGBUILD +++ b/chromium-bolt/PKGBUILD @@ -4,7 +4,7 @@ # Contributor: Daniel J Griffiths pkgname=chromium-bolt -pkgver=122.0.6261.57 +pkgver=123.0.6312.58 pkgrel=1 conflicts=(chromium) _launcher_ver=8 @@ -31,12 +31,8 @@ source=( https://commondatastorage.googleapis.com/chromium-browser-official/chromium-$pkgver.tar.xz https://github.com/foutrelis/chromium-launcher/archive/v$_launcher_ver/chromium-launcher-$_launcher_ver.tar.gz https://gitlab.com/Matt.Jolly/chromium-patches/-/archive/${pkgver%%.*}/chromium-patches-${pkgver%%.*}.tar.bz2 - support-ICU-74-in-LazyTextBreakIterator.patch - REVERT-simplify-blink-NativeValueTraitsBase.patch - REVERT-use-v8-Array-Iterate-for-converting-script-wrappables.patch - chromium-constexpr.patch - drop-flags-unsupported-by-clang16.patch - compiler-rt-16.patch + drop-flag-unsupported-by-clang17.patch + compiler-rt-adjust-paths.patch use-oauth2-client-switches-as-default.patch relocs.patch relocs2.patch @@ -46,19 +42,15 @@ source=( 0001-enable-linux-unstable-deb-target.patch 0001-ozone-wayland-implement-text_input_manager_v3.patch 0001-ozone-wayland-implement-text_input_manager-fixes.patch) -sha256sums=('1594635f8c2db05c8d17f9f2e591b554eaf821a1a2249c271e91926db49fa7cd' +sha256sums=('f8dae4a2ff7b00bb44fa136c2101638fea4f232e4819be3f73381ddc0d3bf718' '213e50f48b67feb4441078d50b0fd431df34323be15be97c55302d3fdac4483a' - '1f6acf165578288dc84edc7d9dcfabf7d38f55153b63a37ee5afa929f0e2baad' - '8c256b2a9498a63706a6e7a55eadbeb8cc814be66a75e49aec3716c6be450c6c' - '318df8f8662071cebcdf953698408058e17f59f184500b7e12e01a04a4206b50' - '00e06b889e4face0ef41293233ce55bd52064ab040f1fdd84aa19525f8ac3601' - 'a061f83e2b628927feb4dbc441eb54f8b8c3d81348e447cf3b90755d7cda5f54' - '53774fd7f807ad42f77d45cab9e5480cc2bcb0a5c5138110a434407521af9607' - '8a2649dcc6ff8d8f24ddbe40dc2a171824f681c6f33c39c4792b645b87c9dcab' + '488f02af92b148eaa91ad5015b3bf383dfc8618ebafe9c3c250cd4c7f4e27b19' + '3bd35dab1ded5d9e1befa10d5c6c4555fe0a76d909fb724ac57d0bf10cb666c1' + 'b3de01b7df227478687d7517f61a777450dca765756002c80c4915f271e2d961' 'e393174d7695d0bafed69e868c5fbfecf07aa6969f3b64596d0bae8b067e1711' '5ed8adfca50f753ce1ad26f106b2ffa33dec70ea65040726a01b717a8b02736c' '8ae352875a1f01191eb5d4889f93d75999a6310aff91e2f4f337d5b2729fad4b' - '53bcac7288509998504f2ca4acf2a70053cce2c06c641e795d3dc368632dd447' + '272ea2273efd0ed89d655fd84f4e78f02f90801509e8a32311669b2648950809' '9a5594293616e1390462af1f50276ee29fd6075ffab0e3f944f6346cb2eb8aec' '8ba5c67b7eb6cacd2dbbc29e6766169f0fca3bbb07779b1a0a76c913f17d343f' '2a44756404e13c97d000cc0d859604d6848163998ea2f838b3b9bb2c840967e3' @@ -73,12 +65,12 @@ fi # Possible replacements are listed in build/linux/unbundle/replace_gn_files.py # Keys are the names in the above script; values are the dependencies in Arch declare -gA _system_libs=( - #[brotli]=brotli + [brotli]=brotli [dav1d]=dav1d #[ffmpeg]=ffmpeg # YouTube playback stopped working in Chromium 120 [flac]=flac [fontconfig]=fontconfig - #[freetype]=freetype2 + [freetype]=freetype2 [harfbuzz-ng]=harfbuzz [icu]=icu #[jsoncpp]=jsoncpp # needs libstdc++ @@ -133,25 +125,14 @@ prepare() { patch -Np1 -i ../use-oauth2-client-switches-as-default.patch # Upstream fixes - patch -Np1 -i ../support-ICU-74-in-LazyTextBreakIterator.patch - # Fix "error: defaulted definition of equality comparison operator cannot - # be declared constexpr because it invokes a non-constexpr comparison - # function" (patch from Fedora) - patch -Np1 -i ../chromium-constexpr.patch + # Drop compiler flag that needs newer clang + patch -Np1 -i ../drop-flag-unsupported-by-clang17.patch - # Revert usage of C++20 features which likely need newer clang - patch -Rp1 -i ../REVERT-use-v8-Array-Iterate-for-converting-script-wrappables.patch - patch -Rp1 -i ../REVERT-simplify-blink-NativeValueTraitsBase.patch - - # Drop compiler flags that need newer clang - patch -Np1 -i ../drop-flags-unsupported-by-clang16.patch - - # Allow libclang_rt.builtins from compiler-rt 16 to be used - patch -Np1 -i ../compiler-rt-16.patch + # Allow libclang_rt.builtins from compiler-rt >= 16 to be used + patch -Np1 -i ../compiler-rt-adjust-paths.patch # Fixes for building with libstdc++ instead of libc++ - patch -Np1 -i ../chromium-patches-*/chromium-114-ruy-include.patch patch -Np1 -i ../chromium-patches-*/chromium-117-material-color-include.patch patch -Np1 -i ../relocs.patch @@ -162,9 +143,9 @@ prepare() { patch -Np1 -i ../0001-ozone-wayland-implement-text_input_manager_v3.patch patch -Np1 -i ../0001-ozone-wayland-implement-text_input_manager-fixes.patch - # Enable VAAPI on Wayland - patch -Np1 -i ../0001-adjust-buffer-format-order.patch - patch -Np1 -i ../0001-vaapi-flag-ozone-wayland.patch +# # Enable VAAPI on Wayland +# patch -Np1 -i ../0001-adjust-buffer-format-order.patch +# patch -Np1 -i ../0001-vaapi-flag-ozone-wayland.patch # Link to system tools required by the build mkdir -p third_party/node/linux/node-linux-x64/bin diff --git a/chromium-bolt/compiler-rt-adjust-paths.patch b/chromium-bolt/compiler-rt-adjust-paths.patch new file mode 100644 index 000000000..04692200d --- /dev/null +++ b/chromium-bolt/compiler-rt-adjust-paths.patch @@ -0,0 +1,32 @@ +diff --git a/build/config/clang/BUILD.gn b/build/config/clang/BUILD.gn +index d4de2e0cca0..57359c32121 100644 +--- a/build/config/clang/BUILD.gn ++++ b/build/config/clang/BUILD.gn +@@ -130,12 +130,15 @@ template("clang_lib") { + } else if (is_linux || is_chromeos) { + if (current_cpu == "x64") { + _dir = "x86_64-unknown-linux-gnu" ++ _suffix = "-x86_64" + } else if (current_cpu == "x86") { + _dir = "i386-unknown-linux-gnu" ++ _suffix = "-i386" + } else if (current_cpu == "arm") { + _dir = "armv7-unknown-linux-gnueabihf" + } else if (current_cpu == "arm64") { + _dir = "aarch64-unknown-linux-gnu" ++ _suffix = "-aarch64" + } else { + assert(false) # Unhandled cpu type + } +@@ -166,6 +169,11 @@ template("clang_lib") { + assert(false) # Unhandled target platform + } + ++ # Bit of a hack to make this find builtins from compiler-rt >= 16 ++ if (is_linux || is_chromeos) { ++ _dir = "linux" ++ } ++ + _clang_lib_dir = "$clang_base_path/lib/clang/$clang_version/lib" + _lib_file = "${_prefix}clang_rt.${_libname}${_suffix}.${_ext}" + libs = [ "$_clang_lib_dir/$_dir/$_lib_file" ] diff --git a/chromium-bolt/drop-flag-unsupported-by-clang17.patch b/chromium-bolt/drop-flag-unsupported-by-clang17.patch new file mode 100644 index 000000000..a1412c919 --- /dev/null +++ b/chromium-bolt/drop-flag-unsupported-by-clang17.patch @@ -0,0 +1,29 @@ +diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn +index 89b4755ac8b3..94b457385663 100644 +--- a/build/config/compiler/BUILD.gn ++++ b/build/config/compiler/BUILD.gn +@@ -618,24 +618,6 @@ config("compiler") { + } + } + +- # TODO(crbug.com/1488374): This causes binary size growth and potentially +- # other problems. +- # TODO(crbug.com/1491036): This isn't supported by Cronet's mainline llvm version. +- if (default_toolchain != "//build/toolchain/cros:target" && +- !llvm_android_mainline) { +- cflags += [ +- "-mllvm", +- "-split-threshold-for-reg-with-hint=0", +- ] +- if (use_thin_lto && is_a_target_toolchain) { +- if (is_win) { +- ldflags += [ "-mllvm:-split-threshold-for-reg-with-hint=0" ] +- } else { +- ldflags += [ "-Wl,-mllvm,-split-threshold-for-reg-with-hint=0" ] +- } +- } +- } +- + # TODO(crbug.com/1235145): Investigate why/if this should be needed. + if (is_win) { + cflags += [ "/clang:-ffp-contract=off" ] From abdac62f965a169ee756d98b403f6e28318dccdd Mon Sep 17 00:00:00 2001 From: Peter Jung Date: Sat, 23 Mar 2024 09:41:33 +0100 Subject: [PATCH 14/14] chromium-bolt: Update profiler.py and install original chromium binary for benchmarking Signed-off-by: Peter Jung --- chromium-bolt/PKGBUILD | 3 ++- chromium-bolt/profiler.py | 16 +++++----------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/chromium-bolt/PKGBUILD b/chromium-bolt/PKGBUILD index 1d0947972..056fa1481 100644 --- a/chromium-bolt/PKGBUILD +++ b/chromium-bolt/PKGBUILD @@ -290,7 +290,7 @@ build() { cp ../profiler.py . ## Branch Sampling for BOLT - perf record -e cycles:u -F max -j any,u -o perf.data -- \ + perf record -e cycles:u -F 15000 -j any,u -o perf.data -- \ xvfb-run -s "-screen 0 1920x1080x24 -nolisten local" \ vpython3 profiler.py @@ -316,6 +316,7 @@ package() { cd ../chromium-$pkgver install -D out/Release/chrome "$pkgdir/usr/lib/chromium/chromium" + install -D out/Release/chrome.orig "$pkgdir/usr/lib/chromium/chromium.orig" install -D out/Release/chromedriver.unstripped "$pkgdir/usr/bin/chromedriver" install -Dm4755 out/Release/chrome_sandbox "$pkgdir/usr/lib/chromium/chrome-sandbox" diff --git a/chromium-bolt/profiler.py b/chromium-bolt/profiler.py index aacbb004d..e2139745a 100644 --- a/chromium-bolt/profiler.py +++ b/chromium-bolt/profiler.py @@ -32,11 +32,7 @@ def run_speedometer(driver, version='2.0'): start_button = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.TAG_NAME, "button"))) start_button.click() - # Wait for the details button to be visible - details_button = WebDriverWait(driver, 60).until(EC.visibility_of_element_located((By.CLASS_NAME, "show-details"))) - details_button.click() - - driver.save_screenshot(f"speedometer_{version}_b.png") + sleep(60) # run https://browserbench.org/JetStream/ def run_jetstream(driver): @@ -45,12 +41,10 @@ def run_jetstream(driver): driver.save_screenshot("jetstream_start.png") - start_button = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.CLASS_NAME, "button"))) + start_button = WebDriverWait(driver, 30).until(EC.presence_of_element_located((By.CLASS_NAME, "button"))) start_button.click() - # Wait for the details button to be visible - details_button = WebDriverWait(driver, 60).until(EC.visibility_of_element_located((By.CLASS_NAME, "done"))) - driver.save_screenshot(f"jetstream.png") + sleep(60) # run https://browserbench.org/MotionMark1.3/ def run_motionmark(driver): @@ -60,7 +54,7 @@ def run_motionmark(driver): driver.save_screenshot("motionmark_start.png") # wait for text to appear - element = WebDriverWait(driver, 10).until( + element = WebDriverWait(driver, 30).until( EC.visibility_of_element_located((By.XPATH, "//*[contains(text(), 'Run Benchmark')]")) ) element.click() @@ -75,7 +69,7 @@ def run_basemark(driver): driver.save_screenshot("basemark_start.png") # wait for text to appear - start_button = WebDriverWait(driver, 15).until(EC.presence_of_element_located((By.CLASS_NAME, "btn"))) + start_button = WebDriverWait(driver, 30).until(EC.presence_of_element_located((By.CLASS_NAME, "btn"))) start_button.click() sleep(60)