summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--INSTALL.sh148
-rw-r--r--chrome-wrapper38
-rw-r--r--chromium-102-regex_pattern-array.patch16
-rw-r--r--chromium-106-ffmpeg-duration.patch17
-rw-r--r--chromium-115-compiler-SkColor4f.patch26
-rw-r--r--chromium-117-string-convert.patch21
-rw-r--r--chromium-117-system-zstd.patch47
-rw-r--r--chromium-119-assert.patch12
-rw-r--r--chromium-120-emplace.patch463
-rw-r--r--chromium-120-make_unique-struct.patch12
-rw-r--r--chromium-121-nullptr_t-without-namespace-std.patch12
-rw-r--r--chromium-121-rust-clang_lib.patch68
-rw-r--r--chromium-122-workaround_clang_bug-structured_binding.patch70
-rw-r--r--chromium-123-missing-QtGui.patch12
-rw-r--r--chromium-123-stats-collector.patch19
-rw-r--r--chromium-124-size_t.patch16
-rw-r--r--chromium-125-appservice-include.patch26
-rw-r--r--chromium-125-assert.patch12
-rw-r--r--chromium-125-compiler.patch270
-rw-r--r--chromium-125-debian-bad-font-gc0.patch250
-rw-r--r--chromium-125-debian-bad-font-gc00.patch159
-rw-r--r--chromium-125-debian-bad-font-gc000.patch107
-rw-r--r--chromium-125-debian-bad-font-gc0000.patch425
-rw-r--r--chromium-125-debian-bad-font-gc1.patch258
-rw-r--r--chromium-125-debian-bad-font-gc11.patch420
-rw-r--r--chromium-125-debian-bad-font-gc2.patch3727
-rw-r--r--chromium-125-debian-bad-font-gc3.patch38
-rw-r--r--chromium-125-disable-FFmpegAllowLists.patch12
-rw-r--r--chromium-125-emplace-struct.patch68
-rw-r--r--chromium-125-lens-include.patch25
-rw-r--r--chromium-125-lp155-typename.patch376
-rw-r--r--chromium-125-missing-header-files.patch246
-rw-r--r--chromium-125-mojo-bindings-include.patch25
-rw-r--r--chromium-125-ninja.patch27
-rw-r--r--chromium-125-no-vector-consts.patch259
-rw-r--r--chromium-125-no_matching_constructor.patch1141
-rw-r--r--chromium-125-tabstrip-include.patch26
-rw-r--r--chromium-125-vulkan-include.patch16
-rw-r--r--chromium-91-java-only-allowed-in-android-builds.patch16
-rw-r--r--chromium-93-ffmpeg-4.4.patch67
-rw-r--r--chromium-disable-GlobalMediaControlsCastStartStop.patch13
-rw-r--r--chromium-disable-parallel-gold.patch13
-rw-r--r--chromium-libusb_interrupt_event_handler.patch15
-rw-r--r--chromium-master-prefs-path.patch16
-rw-r--r--chromium-norar.patch107
-rw-r--r--chromium-prop-codecs.patch17
-rw-r--r--chromium-symbolic.svg30
-rw-r--r--chromium.spec942
-rw-r--r--fix_building_widevinecdm_with_chromium.patch11
-rw-r--r--gcc-enable-lto.patch70
-rw-r--r--master_preferences30
-rw-r--r--riscv-build.patch13
-rw-r--r--riscv-cpuinfo.patch32
-rw-r--r--riscv-dav1d.patch53
-rw-r--r--riscv-sandbox.patch2043
-rw-r--r--riscv-swiftshader.patch25
-rw-r--r--sources2
-rw-r--r--system-libdrm.patch42
59 files changed, 12469 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..9f1553a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1,2 @@
+/chromium-125.0.6422.141.tar.xz
+/esbuild.tar.gz
diff --git a/INSTALL.sh b/INSTALL.sh
new file mode 100644
index 0000000..8491753
--- /dev/null
+++ b/INSTALL.sh
@@ -0,0 +1,148 @@
+#!/bin/bash
+set -x
+while getopts s:o:l:i: option
+do
+case "${option}" in
+s) STAGEDIR=${OPTARG};;
+o) OUTPUTDIR=${OPTARG};;
+l) LIBDIR=${OPTARG};;
+i) ICUDATAFILE=${OPTARG};;
+esac
+done
+SHLIB_PERMS="755"
+PROGNAME="chrome"
+PACKAGE="chromium-browser"
+MENUNAME="Chromium Web Browser"
+CHANNEL="stable"
+INSTALLDIR="${LIBDIR}/chromium"
+
+install -m 755 -d \
+ "${STAGEDIR}/${INSTALLDIR}" \
+ "${STAGEDIR}/usr/bin" \
+ "${STAGEDIR}/usr/share/applications" \
+ "${STAGEDIR}/usr/share/metainfo" \
+ "${STAGEDIR}/usr/share/man/man1"
+
+# app
+buildfile="${OUTPUTDIR}/${PROGNAME}"
+install -m 755 "${buildfile}" "${STAGEDIR}/${INSTALLDIR}/${PROGNAME}"
+
+# crashpad
+buildfile="${OUTPUTDIR}/chrome_crashpad_handler"
+install -m 755 "${buildfile}" "${STAGEDIR}/${INSTALLDIR}/chrome_crashpad_handler"
+
+# resources
+install -m 644 "${OUTPUTDIR}/resources.pak" "${STAGEDIR}/${INSTALLDIR}/"
+install -m 644 "${OUTPUTDIR}/chrome_100_percent.pak" "${STAGEDIR}/${INSTALLDIR}/"
+install -m 644 "${OUTPUTDIR}/chrome_200_percent.pak" "${STAGEDIR}/${INSTALLDIR}/"
+
+# ICU data file; Necessary when the GN icu_use_data_file flag is true.
+if [ "x$ICUDATAFILE" == "xtrue" ]; then
+ install -m 644 "${OUTPUTDIR}/icudtl.dat" "${STAGEDIR}/${INSTALLDIR}/"
+fi
+
+# V8 snapshot files; Necessary when the GN v8_use_external_startup_data flag
+ # is true.
+ # Use v8_context_snapshot.bin instead of snapshot_blob.bin if it is available.
+ # TODO(crbug.com/764576): Unship snapshot_blob.bin on ChromeOS and drop this branch
+install -m 644 "${OUTPUTDIR}/v8_context_snapshot.bin" "${STAGEDIR}/${INSTALLDIR}/"
+
+# l10n paks
+install -m 755 -d "${STAGEDIR}/${INSTALLDIR}/locales/"
+find "${OUTPUTDIR}/locales" -type f -name '*.pak' -print -exec \
+ cp -a {} "${STAGEDIR}/${INSTALLDIR}/locales/" \;
+find "${STAGEDIR}/${INSTALLDIR}/locales" -type f -print -exec chmod 644 {} \;
+
+# ANGLE
+if [ -f "${OUTPUTDIR}/libEGL.so" ]; then
+ for file in libEGL.so libGLESv2.so;
+ do
+ buildfile="${OUTPUTDIR}/${file}"
+ install -m ${SHLIB_PERMS} "${buildfile}" "${STAGEDIR}/${INSTALLDIR}/${file}"
+ done
+fi
+
+# ANGLE's libvulkan library
+if [ -f "${OUTPUTDIR}/libvulkan.so.1" ]; then
+ file="libvulkan.so.1"
+ buildfile="${OUTPUTDIR}/${file}"
+ install -m 755 "${buildfile}" "${STAGEDIR}/${INSTALLDIR}/${file}"
+fi
+
+# SwiftShader ES
+if [ -f "${OUTPUTDIR}/swiftshader/libEGL.so" ]; then
+ install -m 755 -d "${STAGEDIR}/${INSTALLDIR}/swiftshader/"
+ for file in libEGL.so libGLESv2.so;
+ do
+ buildfile="${OUTPUTDIR}/swiftshader/${file}"
+ install -m ${SHLIB_PERMS} "${buildfile}" "${STAGEDIR}/${INSTALLDIR}/swiftshader/${file}"
+ done
+fi
+
+# SwiftShader VK
+if [ -f "${OUTPUTDIR}/libvk_swiftshader.so" ]; then
+ install -m 755 -d "${STAGEDIR}/${INSTALLDIR}/"
+ file="libvk_swiftshader.so"
+ buildfile="${OUTPUTDIR}/${file}"
+ install -m ${SHLIB_PERMS} "${buildfile}" "${STAGEDIR}/${INSTALLDIR}/${file}"
+fi
+sed -e 's|${ICD_LIBRARY_PATH}|./libvk_swiftshader.so|g' third_party/swiftshader/src/Vulkan/vk_swiftshader_icd.json.tmpl > ${OUTPUTDIR}/vk_swiftshader_icd.json
+# Install the ICD json file to point ANGLE to libvk_swiftshader.so
+install -m 644 "${OUTPUTDIR}/vk_swiftshader_icd.json" "${STAGEDIR}/${INSTALLDIR}/"
+
+# QT shim
+if [ -f "${OUTPUTDIR}/libqt5_shim.so" ]; then
+ file="libqt5_shim.so"
+ buildfile="${OUTPUTDIR}/${file}"
+ install -m ${SHLIB_PERMS} "${buildfile}" "${STAGEDIR}/${INSTALLDIR}/${file}"
+fi
+
+# default apps
+if [ -d "${OUTPUTDIR}/default_apps" ]; then
+ cp -a "${OUTPUTDIR}/default_apps" "${STAGEDIR}/${INSTALLDIR}/"
+ find "${STAGEDIR}/${INSTALLDIR}/default_apps" -type d -exec chmod 755 '{}' \;
+ find "${STAGEDIR}/${INSTALLDIR}/default_apps" -type f -exec chmod 644 '{}' \;
+fi
+
+# launcher script and symlink
+sed \
+ -e "s#@@PROGNAME@@#${PROGNAME}#g" \
+ -e "s#@@CHANNEL@@#${CHANNEL}#g" \
+ "chrome/installer/linux/common/wrapper" > "${STAGEDIR}/${INSTALLDIR}/chrome-wrapper"
+chmod 755 "${STAGEDIR}/${INSTALLDIR}/chrome-wrapper"
+ln -s "${INSTALLDIR}/chrome-wrapper" "${STAGEDIR}/usr/bin/${PACKAGE}"
+
+# app icons
+for size in 16 32;
+do
+ icon="chrome/app/theme/default_100_percent/chromium/product_logo_${size}.png"
+ installpath="${STAGEDIR}/usr/share/icons/hicolor/${size}x${size}/apps/chromium-browser.png"
+ install -D -m 644 ${icon} ${installpath}
+done
+for size in 24 48 64 128 256;
+do
+ icon="chrome/app/theme/chromium/product_logo_${size}.png"
+ installpath="${STAGEDIR}/usr/share/icons/hicolor/${size}x${size}/apps/chromium-browser.png"
+ install -D -m 644 ${icon} ${installpath}
+done
+
+# desktop integration
+## AppData
+install -m 644 "chrome/installer/linux/common/chromium-browser/chromium-browser.appdata.xml" \
+"${STAGEDIR}/usr/share/metainfo/${PACKAGE}.appdata.xml"
+
+## Desktop file
+sed \
+ -e "s#@@MENUNAME@@#${MENUNAME}#g" \
+ -e "s#@@USR_BIN_SYMLINK_NAME@@#${PACKAGE}#g" \
+ -e "s#@@PACKAGE@@#${PACKAGE}#g" \
+ "chrome/installer/linux/common/desktop.template" > "${STAGEDIR}/usr/share/applications/${PACKAGE}.desktop"
+chmod 644 "${STAGEDIR}/usr/share/applications/${PACKAGE}.desktop"
+
+# documentation
+sed \
+ -e "s#@@MENUNAME@@#${MENUNAME}#g" \
+ -e "s#@@PACKAGE@@#${PACKAGE}#g" \
+ "chrome/app/resources/manpage.1.in" > "${STAGEDIR}/usr/share/man/man1/${PACKAGE}.1"
+gzip -9n "${STAGEDIR}/usr/share/man/man1/${PACKAGE}.1"
+chmod 644 "${STAGEDIR}/usr/share/man/man1/${PACKAGE}.1.gz"
diff --git a/chrome-wrapper b/chrome-wrapper
new file mode 100644
index 0000000..10e983d
--- /dev/null
+++ b/chrome-wrapper
@@ -0,0 +1,38 @@
+#!/bin/bash
+#
+# Copyright (c) 2011 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Let the wrapped binary know that it has been run through the wrapper.
+export CHROME_WRAPPER="`readlink -f "$0"`"
+
+HERE="`dirname "$CHROME_WRAPPER"`"
+
+# Always use our versions of ffmpeg libs.
+# This also makes RPMs find the compatibly-named library symlinks.
+export LD_LIBRARY_PATH="$HERE${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
+
+export CHROME_VERSION_EXTRA="stable"
+
+# We don't want bug-buddy intercepting our crashes. http://crbug.com/24120
+export GNOME_DISABLE_CRASH_DIALOG=SET_BY_GOOGLE_CHROME
+
+# Allow root usage
+no_sandbox=
+if [ "`id -u`" == "0" ]; then
+ no_sandbox=--no-sandbox
+fi
+# If uname is riscv64, then allow usage too
+if [ "`uname -m`" == "riscv64" ]; then
+ no_sandbox=--no-sandbox
+fi
+
+# Sanitize std{in,out,err} because they'll be shared with untrusted child
+# processes (http://crbug.com/376567).
+exec < /dev/null
+exec > >(exec cat)
+exec 2> >(exec cat >&2)
+
+# Note: exec -a below is a bashism.
+exec -a "$0" "$HERE/chrome" $no_sandbox "$@"
diff --git a/chromium-102-regex_pattern-array.patch b/chromium-102-regex_pattern-array.patch
new file mode 100644
index 0000000..2931937
--- /dev/null
+++ b/chromium-102-regex_pattern-array.patch
@@ -0,0 +1,16 @@
+Index: chromium-123.0.6312.46/components/autofill/core/browser/BUILD.gn
+===================================================================
+--- chromium-123.0.6312.46.orig/components/autofill/core/browser/BUILD.gn
++++ chromium-123.0.6312.46/components/autofill/core/browser/BUILD.gn
+@@ -58,6 +58,11 @@ action("regex_patterns_inl_h") {
+ }
+
+ static_library("browser") {
++ if (is_clang) {
++ cflags = [
++ "-fbracket-depth=1000",
++ ]
++ }
+ sources = [
+ "address_data_cleaner.cc",
+ "address_data_cleaner.h",
diff --git a/chromium-106-ffmpeg-duration.patch b/chromium-106-ffmpeg-duration.patch
new file mode 100644
index 0000000..bef339e
--- /dev/null
+++ b/chromium-106-ffmpeg-duration.patch
@@ -0,0 +1,17 @@
+Index: chromium-106.0.5249.91/media/filters/audio_file_reader.cc
+===================================================================
+--- chromium-106.0.5249.91.orig/media/filters/audio_file_reader.cc
++++ chromium-106.0.5249.91/media/filters/audio_file_reader.cc
+@@ -243,10 +243,10 @@ bool AudioFileReader::OnNewFrame(
+ // silence from being output. In the case where we are also discarding some
+ // portion of the packet (as indicated by a negative pts), we further want to
+ // adjust the duration downward by however much exists before zero.
+- if (audio_codec_ == AudioCodec::kAAC && frame->duration) {
++ if (audio_codec_ == AudioCodec::kAAC && frame->pkt_duration) {
+ const base::TimeDelta pkt_duration = ConvertFromTimeBase(
+ glue_->format_context()->streams[stream_index_]->time_base,
+- frame->duration + std::min(static_cast<int64_t>(0), frame->pts));
++ frame->pkt_duration + std::min(static_cast<int64_t>(0), frame->pts));
+ const base::TimeDelta frame_duration =
+ base::Seconds(frames_read / static_cast<double>(sample_rate_));
+
diff --git a/chromium-115-compiler-SkColor4f.patch b/chromium-115-compiler-SkColor4f.patch
new file mode 100644
index 0000000..7e17cb0
--- /dev/null
+++ b/chromium-115-compiler-SkColor4f.patch
@@ -0,0 +1,26 @@
+diff -up chromium-115.0.5790.40/third_party/blink/renderer/modules/canvas/canvas2d/canvas_style.cc.me chromium-115.0.5790.40/third_party/blink/renderer/modules/canvas/canvas2d/canvas_style.cc
+--- chromium-115.0.5790.40/third_party/blink/renderer/modules/canvas/canvas2d/canvas_style.cc.me 2023-06-24 10:38:11.011511463 +0200
++++ chromium-115.0.5790.40/third_party/blink/renderer/modules/canvas/canvas2d/canvas_style.cc 2023-06-24 13:07:35.865375884 +0200
+@@ -84,6 +84,7 @@ CanvasStyle::CanvasStyle(const CanvasSty
+
+ void CanvasStyle::ApplyToFlags(cc::PaintFlags& flags,
+ float global_alpha) const {
++ SkColor4f custom_color = SkColor4f{0.0f, 0.0f, 0.0f, global_alpha};
+ switch (type_) {
+ case kColor:
+ ApplyColorToFlags(flags, global_alpha);
+@@ -91,12 +92,12 @@ void CanvasStyle::ApplyToFlags(cc::Paint
+ case kGradient:
+ GetCanvasGradient()->GetGradient()->ApplyToFlags(flags, SkMatrix::I(),
+ ImageDrawOptions());
+- flags.setColor(SkColor4f(0.0f, 0.0f, 0.0f, global_alpha));
++ flags.setColor(custom_color);
+ break;
+ case kImagePattern:
+ GetCanvasPattern()->GetPattern()->ApplyToFlags(
+ flags, AffineTransformToSkMatrix(GetCanvasPattern()->GetTransform()));
+- flags.setColor(SkColor4f(0.0f, 0.0f, 0.0f, global_alpha));
++ flags.setColor(custom_color);
+ break;
+ default:
+ NOTREACHED();
diff --git a/chromium-117-string-convert.patch b/chromium-117-string-convert.patch
new file mode 100644
index 0000000..cb48e4b
--- /dev/null
+++ b/chromium-117-string-convert.patch
@@ -0,0 +1,21 @@
+diff -up chromium-117.0.5938.62/net/dns/host_resolver_cache.cc.me chromium-117.0.5938.62/net/dns/host_resolver_cache.cc
+diff -up chromium-117.0.5938.62/net/dns/host_resolver_cache.h.me chromium-117.0.5938.62/net/dns/host_resolver_cache.h
+--- chromium-117.0.5938.62/net/dns/host_resolver_cache.h.me 2023-09-14 15:21:24.632965004 +0200
++++ chromium-117.0.5938.62/net/dns/host_resolver_cache.h 2023-09-15 09:15:48.511300845 +0200
+@@ -143,12 +143,14 @@ class NET_EXPORT HostResolverCache final
+ }
+
+ bool operator()(const Key& lhs, const KeyRef& rhs) const {
++ const std::string rhs_domain_name{rhs.domain_name};
+ return std::tie(lhs.domain_name, lhs.network_anonymization_key) <
+- std::tie(rhs.domain_name, *rhs.network_anonymization_key);
++ std::tie(rhs_domain_name, *rhs.network_anonymization_key);
+ }
+
+ bool operator()(const KeyRef& lhs, const Key& rhs) const {
+- return std::tie(lhs.domain_name, *lhs.network_anonymization_key) <
++ const std::string lhs_domain_name{lhs.domain_name};
++ return std::tie(lhs_domain_name, *lhs.network_anonymization_key) <
+ std::tie(rhs.domain_name, rhs.network_anonymization_key);
+ }
+ };
diff --git a/chromium-117-system-zstd.patch b/chromium-117-system-zstd.patch
new file mode 100644
index 0000000..1000b34
--- /dev/null
+++ b/chromium-117-system-zstd.patch
@@ -0,0 +1,47 @@
+From ae3ae3711784865bdc38bf119a6182a7b8dae91c Mon Sep 17 00:00:00 2001
+From: Matt Jolly <Matt.Jolly@footclan.ninja>
+Date: Sun, 17 Sep 2023 16:51:42 +1000
+Subject: [PATCH] Add system-zstd
+
+Index: chromium-120.0.6099.18/build/linux/unbundle/replace_gn_files.py
+===================================================================
+--- chromium-120.0.6099.18.orig/build/linux/unbundle/replace_gn_files.py
++++ chromium-120.0.6099.18/build/linux/unbundle/replace_gn_files.py
+@@ -79,6 +79,7 @@ REPLACEMENTS = {
+ 'vulkan_memory_allocator' : 'third_party/vulkan_memory_allocator/BUILD.gn',
+ 'woff2': 'third_party/woff2/BUILD.gn',
+ 'zlib': 'third_party/zlib/BUILD.gn',
++ 'zstd': 'third_party/zstd/BUILD.gn',
+ }
+
+
+Index: chromium-120.0.6099.18/build/linux/unbundle/zstd.gn
+===================================================================
+--- /dev/null
++++ chromium-120.0.6099.18/build/linux/unbundle/zstd.gn
+@@ -0,0 +1,25 @@
++import("//build/config/linux/pkg_config.gni")
++import("//build/shim_headers.gni")
++
++pkg_config("system_zstd") {
++ packages = [ "libzstd" ]
++}
++
++shim_headers("zstd_shim") {
++ root_path = "src/lib"
++ headers = [
++ "zdict.h",
++ "zstd.h",
++ "zstd_errors.h",
++ ]
++}
++
++source_set("zstd") {
++ deps = [ ":zstd_shim" ]
++ public_configs = [ ":system_zstd" ]
++}
++
++source_set("decompress") {
++ deps = [ ":zstd_shim" ]
++ public_configs = [ ":system_zstd" ]
++}
diff --git a/chromium-119-assert.patch b/chromium-119-assert.patch
new file mode 100644
index 0000000..6c502f1
--- /dev/null
+++ b/chromium-119-assert.patch
@@ -0,0 +1,12 @@
+diff -up chromium-119.0.6045.59/v8/src/base/small-vector.h.than chromium-119.0.6045.59/v8/src/base/small-vector.h
+--- chromium-119.0.6045.59/v8/src/base/small-vector.h.than 2023-11-01 16:13:12.645301345 +0100
++++ chromium-119.0.6045.59/v8/src/base/small-vector.h 2023-11-01 16:13:29.660610182 +0100
+@@ -22,7 +22,7 @@ template <typename T, size_t kSize, type
+ class SmallVector {
+ // Currently only support trivially copyable and trivially destructible data
+ // types, as it uses memcpy to copy elements and never calls destructors.
+- ASSERT_TRIVIALLY_COPYABLE(T);
++ //ASSERT_TRIVIALLY_COPYABLE(T);
+ static_assert(std::is_trivially_destructible<T>::value);
+
+ public:
diff --git a/chromium-120-emplace.patch b/chromium-120-emplace.patch
new file mode 100644
index 0000000..f12d325
--- /dev/null
+++ b/chromium-120-emplace.patch
@@ -0,0 +1,463 @@
+Index: chromium-123.0.6312.46/third_party/webrtc/modules/congestion_controller/goog_cc/loss_based_bwe_v2.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/third_party/webrtc/modules/congestion_controller/goog_cc/loss_based_bwe_v2.cc
++++ chromium-123.0.6312.46/third_party/webrtc/modules/congestion_controller/goog_cc/loss_based_bwe_v2.cc
+@@ -549,7 +549,7 @@ absl::optional<LossBasedBweV2::Config> L
+ if (!enabled.Get()) {
+ return config;
+ }
+- config.emplace();
++ config.emplace(Config());
+ config->bandwidth_rampup_upper_bound_factor =
+ bandwidth_rampup_upper_bound_factor.Get();
+ config->bandwidth_rampup_upper_bound_factor_in_hold =
+Index: chromium-123.0.6312.46/ui/gfx/x/generated_protos/randr.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/ui/gfx/x/generated_protos/randr.cc
++++ chromium-123.0.6312.46/ui/gfx/x/generated_protos/randr.cc
+@@ -305,7 +305,7 @@ void ReadEvent<RandR::NotifyEvent>(RandR
+ // data
+ auto data_expr = subCode;
+ if (CaseEq(data_expr, RandR::Notify::CrtcChange)) {
+- data.cc.emplace();
++ data.cc.emplace(RandR::NotifyEvent::Cc());
+ auto& timestamp = (*data.cc).timestamp;
+ auto& window = (*data.cc).window;
+ auto& crtc = (*data.cc).crtc;
+@@ -349,7 +349,7 @@ void ReadEvent<RandR::NotifyEvent>(RandR
+ Read(&height, &buf);
+ }
+ if (CaseEq(data_expr, RandR::Notify::OutputChange)) {
+- data.oc.emplace();
++ data.oc.emplace(RandR::NotifyEvent::Oc());
+ auto& timestamp = (*data.oc).timestamp;
+ auto& config_timestamp = (*data.oc).config_timestamp;
+ auto& window = (*data.oc).window;
+@@ -394,7 +394,7 @@ void ReadEvent<RandR::NotifyEvent>(RandR
+ subpixel_order = static_cast<Render::SubPixel>(tmp6);
+ }
+ if (CaseEq(data_expr, RandR::Notify::OutputProperty)) {
+- data.op.emplace();
++ data.op.emplace(RandR::NotifyEvent::Op());
+ auto& window = (*data.op).window;
+ auto& output = (*data.op).output;
+ auto& atom = (*data.op).atom;
+@@ -422,7 +422,7 @@ void ReadEvent<RandR::NotifyEvent>(RandR
+ Pad(&buf, 11);
+ }
+ if (CaseEq(data_expr, RandR::Notify::ProviderChange)) {
+- data.pc.emplace();
++ data.pc.emplace(RandR::NotifyEvent::Pc());
+ auto& timestamp = (*data.pc).timestamp;
+ auto& window = (*data.pc).window;
+ auto& provider = (*data.pc).provider;
+@@ -440,7 +440,7 @@ void ReadEvent<RandR::NotifyEvent>(RandR
+ Pad(&buf, 16);
+ }
+ if (CaseEq(data_expr, RandR::Notify::ProviderProperty)) {
+- data.pp.emplace();
++ data.pp.emplace(RandR::NotifyEvent::Pp());
+ auto& window = (*data.pp).window;
+ auto& provider = (*data.pp).provider;
+ auto& atom = (*data.pp).atom;
+@@ -466,7 +466,7 @@ void ReadEvent<RandR::NotifyEvent>(RandR
+ Pad(&buf, 11);
+ }
+ if (CaseEq(data_expr, RandR::Notify::ResourceChange)) {
+- data.rc.emplace();
++ data.rc.emplace(RandR::NotifyEvent::Rc());
+ auto& timestamp = (*data.rc).timestamp;
+ auto& window = (*data.rc).window;
+
+@@ -480,7 +480,7 @@ void ReadEvent<RandR::NotifyEvent>(RandR
+ Pad(&buf, 20);
+ }
+ if (CaseEq(data_expr, RandR::Notify::Lease)) {
+- data.lc.emplace();
++ data.lc.emplace(RandR::NotifyEvent::Lc());
+ auto& timestamp = (*data.lc).timestamp;
+ auto& window = (*data.lc).window;
+ auto& lease = (*data.lc).lease;
+Index: chromium-123.0.6312.46/ui/gfx/x/generated_protos/xkb.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/ui/gfx/x/generated_protos/xkb.cc
++++ chromium-123.0.6312.46/ui/gfx/x/generated_protos/xkb.cc
+@@ -5276,7 +5276,7 @@ std::unique_ptr<Xkb::GetKbdByNameReply>
+ if (CaseAnd(replies_expr, Xkb::GBNDetail::Types) ||
+ CaseAnd(replies_expr, Xkb::GBNDetail::ClientSymbols) ||
+ CaseAnd(replies_expr, Xkb::GBNDetail::ServerSymbols)) {
+- replies.types.emplace();
++ replies.types.emplace(Xkb::GetKbdByNameReply::Types());
+ auto& getmap_type = (*replies.types).getmap_type;
+ auto& typeDeviceID = (*replies.types).typeDeviceID;
+ auto& getmap_sequence = (*replies.types).getmap_sequence;
+@@ -5708,7 +5708,7 @@ std::unique_ptr<Xkb::GetKbdByNameReply>
+ }
+ }
+ if (CaseAnd(replies_expr, Xkb::GBNDetail::CompatMap)) {
+- replies.compat_map.emplace();
++ replies.compat_map.emplace(Xkb::GetKbdByNameReply::CompatMap());
+ auto& compatmap_type = (*replies.compat_map).compatmap_type;
+ auto& compatDeviceID = (*replies.compat_map).compatDeviceID;
+ auto& compatmap_sequence = (*replies.compat_map).compatmap_sequence;
+@@ -5832,7 +5832,7 @@ std::unique_ptr<Xkb::GetKbdByNameReply>
+ }
+ }
+ if (CaseAnd(replies_expr, Xkb::GBNDetail::IndicatorMaps)) {
+- replies.indicator_maps.emplace();
++ replies.indicator_maps.emplace(Xkb::GetKbdByNameReply::IndicatorMaps());
+ auto& indicatormap_type = (*replies.indicator_maps).indicatormap_type;
+ auto& indicatorDeviceID = (*replies.indicator_maps).indicatorDeviceID;
+ auto& indicatormap_sequence =
+@@ -5926,7 +5926,7 @@ std::unique_ptr<Xkb::GetKbdByNameReply>
+ }
+ if (CaseAnd(replies_expr, Xkb::GBNDetail::KeyNames) ||
+ CaseAnd(replies_expr, Xkb::GBNDetail::OtherNames)) {
+- replies.key_names.emplace();
++ replies.key_names.emplace(Xkb::GetKbdByNameReply::KeyNames());
+ auto& keyname_type = (*replies.key_names).keyname_type;
+ auto& keyDeviceID = (*replies.key_names).keyDeviceID;
+ auto& keyname_sequence = (*replies.key_names).keyname_sequence;
+@@ -6185,7 +6185,7 @@ std::unique_ptr<Xkb::GetKbdByNameReply>
+ }
+ }
+ if (CaseAnd(replies_expr, Xkb::GBNDetail::Geometry)) {
+- replies.geometry.emplace();
++ replies.geometry.emplace(Xkb::GetKbdByNameReply::Geometry());
+ auto& geometry_type = (*replies.geometry).geometry_type;
+ auto& geometryDeviceID = (*replies.geometry).geometryDeviceID;
+ auto& geometry_sequence = (*replies.geometry).geometry_sequence;
+Index: chromium-123.0.6312.46/mojo/public/cpp/bindings/lib/multiplex_router.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/mojo/public/cpp/bindings/lib/multiplex_router.cc
++++ chromium-123.0.6312.46/mojo/public/cpp/bindings/lib/multiplex_router.cc
+@@ -870,7 +870,7 @@ bool MultiplexRouter::ExclusiveSyncWaitF
+ DCHECK(!exclusive_sync_wait_);
+
+ scoped_refptr<MultiplexRouter> keep_alive(this);
+- exclusive_sync_wait_.emplace();
++ exclusive_sync_wait_.emplace(MultiplexRouter::ExclusiveSyncWaitInfo());
+ exclusive_sync_wait_->interface_id = interface_id;
+ exclusive_sync_wait_->request_id = request_id;
+ while (!exclusive_sync_wait_->finished) {
+Index: chromium-123.0.6312.46/ui/gfx/x/generated_protos/xinput.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/ui/gfx/x/generated_protos/xinput.cc
++++ chromium-123.0.6312.46/ui/gfx/x/generated_protos/xinput.cc
+@@ -567,7 +567,7 @@ void ReadEvent<Input::DeviceChangedEvent
+ // data
+ auto data_expr = type;
+ if (CaseEq(data_expr, Input::DeviceClassType::Key)) {
+- data.key.emplace();
++ data.key.emplace(Input::DeviceClass::Key());
+ uint16_t num_keys{};
+ auto& keys = (*data.key).keys;
+ size_t keys_len = keys.size();
+@@ -583,7 +583,7 @@ void ReadEvent<Input::DeviceChangedEvent
+ }
+ }
+ if (CaseEq(data_expr, Input::DeviceClassType::Button)) {
+- data.button.emplace();
++ data.button.emplace(Input::DeviceClass::Button());
+ uint16_t num_buttons{};
+ auto& state = (*data.button).state;
+ size_t state_len = state.size();
+@@ -608,7 +608,7 @@ void ReadEvent<Input::DeviceChangedEvent
+ }
+ }
+ if (CaseEq(data_expr, Input::DeviceClassType::Valuator)) {
+- data.valuator.emplace();
++ data.valuator.emplace(Input::DeviceClass::Valuator());
+ auto& number = (*data.valuator).number;
+ auto& label = (*data.valuator).label;
+ auto& min = (*data.valuator).min;
+@@ -671,7 +671,7 @@ void ReadEvent<Input::DeviceChangedEvent
+ Pad(&buf, 3);
+ }
+ if (CaseEq(data_expr, Input::DeviceClassType::Scroll)) {
+- data.scroll.emplace();
++ data.scroll.emplace(Input::DeviceClass::Scroll());
+ auto& number = (*data.scroll).number;
+ auto& scroll_type = (*data.scroll).scroll_type;
+ auto& flags = (*data.scroll).flags;
+@@ -706,7 +706,7 @@ void ReadEvent<Input::DeviceChangedEvent
+ }
+ }
+ if (CaseEq(data_expr, Input::DeviceClassType::Touch)) {
+- data.touch.emplace();
++ data.touch.emplace(Input::DeviceClass::Touch());
+ auto& mode = (*data.touch).mode;
+ auto& num_touches = (*data.touch).num_touches;
+
+@@ -719,7 +719,7 @@ void ReadEvent<Input::DeviceChangedEvent
+ Read(&num_touches, &buf);
+ }
+ if (CaseEq(data_expr, Input::DeviceClassType::Gesture)) {
+- data.gesture.emplace();
++ data.gesture.emplace(Input::DeviceClass::Gesture());
+ auto& num_touches = (*data.gesture).num_touches;
+
+ // num_touches
+@@ -2206,7 +2206,7 @@ std::unique_ptr<Input::ListInputDevicesR
+ // info
+ auto info_expr = class_id;
+ if (CaseEq(info_expr, Input::InputClass::Key)) {
+- info.key.emplace();
++ info.key.emplace(Input::InputInfo::Key());
+ auto& min_keycode = (*info.key).min_keycode;
+ auto& max_keycode = (*info.key).max_keycode;
+ auto& num_keys = (*info.key).num_keys;
+@@ -2224,14 +2224,14 @@ std::unique_ptr<Input::ListInputDevicesR
+ Pad(&buf, 2);
+ }
+ if (CaseEq(info_expr, Input::InputClass::Button)) {
+- info.button.emplace();
++ info.button.emplace(Input::InputInfo::Button());
+ auto& num_buttons = (*info.button).num_buttons;
+
+ // num_buttons
+ Read(&num_buttons, &buf);
+ }
+ if (CaseEq(info_expr, Input::InputClass::Valuator)) {
+- info.valuator.emplace();
++ info.valuator.emplace(Input::InputInfo::Valuator());
+ uint8_t axes_len{};
+ auto& mode = (*info.valuator).mode;
+ auto& motion_size = (*info.valuator).motion_size;
+@@ -3844,7 +3844,7 @@ std::unique_ptr<Input::GetFeedbackContro
+ // data
+ auto data_expr = class_id;
+ if (CaseEq(data_expr, Input::FeedbackClass::Keyboard)) {
+- data.keyboard.emplace();
++ data.keyboard.emplace(Input::FeedbackState::Keyboard());
+ auto& pitch = (*data.keyboard).pitch;
+ auto& duration = (*data.keyboard).duration;
+ auto& led_mask = (*data.keyboard).led_mask;
+@@ -3886,7 +3886,7 @@ std::unique_ptr<Input::GetFeedbackContro
+ }
+ }
+ if (CaseEq(data_expr, Input::FeedbackClass::Pointer)) {
+- data.pointer.emplace();
++ data.pointer.emplace(Input::FeedbackState::Pointer());
+ auto& accel_num = (*data.pointer).accel_num;
+ auto& accel_denom = (*data.pointer).accel_denom;
+ auto& threshold = (*data.pointer).threshold;
+@@ -3904,7 +3904,7 @@ std::unique_ptr<Input::GetFeedbackContro
+ Read(&threshold, &buf);
+ }
+ if (CaseEq(data_expr, Input::FeedbackClass::String)) {
+- data.string.emplace();
++ data.string.emplace(Input::FeedbackState::String());
+ auto& max_symbols = (*data.string).max_symbols;
+ uint16_t num_keysyms{};
+ auto& keysyms = (*data.string).keysyms;
+@@ -3924,7 +3924,7 @@ std::unique_ptr<Input::GetFeedbackContro
+ }
+ }
+ if (CaseEq(data_expr, Input::FeedbackClass::Integer)) {
+- data.integer.emplace();
++ data.integer.emplace(Input::FeedbackState::Integer());
+ auto& resolution = (*data.integer).resolution;
+ auto& min_value = (*data.integer).min_value;
+ auto& max_value = (*data.integer).max_value;
+@@ -3939,7 +3939,7 @@ std::unique_ptr<Input::GetFeedbackContro
+ Read(&max_value, &buf);
+ }
+ if (CaseEq(data_expr, Input::FeedbackClass::Led)) {
+- data.led.emplace();
++ data.led.emplace(Input::FeedbackState::Led());
+ auto& led_mask = (*data.led).led_mask;
+ auto& led_values = (*data.led).led_values;
+
+@@ -3950,7 +3950,7 @@ std::unique_ptr<Input::GetFeedbackContro
+ Read(&led_values, &buf);
+ }
+ if (CaseEq(data_expr, Input::FeedbackClass::Bell)) {
+- data.bell.emplace();
++ data.bell.emplace(Input::FeedbackState::Bell());
+ auto& percent = (*data.bell).percent;
+ auto& pitch = (*data.bell).pitch;
+ auto& duration = (*data.bell).duration;
+@@ -4768,7 +4768,7 @@ std::unique_ptr<Input::QueryDeviceStateR
+ // data
+ auto data_expr = class_id;
+ if (CaseEq(data_expr, Input::InputClass::Key)) {
+- data.key.emplace();
++ data.key.emplace(Input::InputState::Key());
+ auto& num_keys = (*data.key).num_keys;
+ auto& keys = (*data.key).keys;
+ size_t keys_len = keys.size();
+@@ -4786,7 +4786,7 @@ std::unique_ptr<Input::QueryDeviceStateR
+ }
+ }
+ if (CaseEq(data_expr, Input::InputClass::Button)) {
+- data.button.emplace();
++ data.button.emplace(Input::InputState::Button());
+ auto& num_buttons = (*data.button).num_buttons;
+ auto& buttons = (*data.button).buttons;
+ size_t buttons_len = buttons.size();
+@@ -4804,7 +4804,7 @@ std::unique_ptr<Input::QueryDeviceStateR
+ }
+ }
+ if (CaseEq(data_expr, Input::InputClass::Valuator)) {
+- data.valuator.emplace();
++ data.valuator.emplace(Input::InputState::Valuator());
+ uint8_t num_valuators{};
+ auto& mode = (*data.valuator).mode;
+ auto& valuators = (*data.valuator).valuators;
+@@ -5075,7 +5075,7 @@ std::unique_ptr<Input::GetDeviceControlR
+ // data
+ auto data_expr = control_id;
+ if (CaseEq(data_expr, Input::DeviceControl::resolution)) {
+- data.resolution.emplace();
++ data.resolution.emplace(Input::DeviceState::Resolution());
+ uint32_t num_valuators{};
+ auto& resolution_values = (*data.resolution).resolution_values;
+ size_t resolution_values_len = resolution_values.size();
+@@ -5109,7 +5109,7 @@ std::unique_ptr<Input::GetDeviceControlR
+ }
+ }
+ if (CaseEq(data_expr, Input::DeviceControl::abs_calib)) {
+- data.abs_calib.emplace();
++ data.abs_calib.emplace(Input::DeviceState::AbsCalib());
+ auto& min_x = (*data.abs_calib).min_x;
+ auto& max_x = (*data.abs_calib).max_x;
+ auto& min_y = (*data.abs_calib).min_y;
+@@ -5144,7 +5144,7 @@ std::unique_ptr<Input::GetDeviceControlR
+ Read(&button_threshold, &buf);
+ }
+ if (CaseEq(data_expr, Input::DeviceControl::core)) {
+- data.core.emplace();
++ data.core.emplace(Input::DeviceState::Core());
+ auto& status = (*data.core).status;
+ auto& iscore = (*data.core).iscore;
+
+@@ -5158,7 +5158,7 @@ std::unique_ptr<Input::GetDeviceControlR
+ Pad(&buf, 2);
+ }
+ if (CaseEq(data_expr, Input::DeviceControl::enable)) {
+- data.enable.emplace();
++ data.enable.emplace(Input::DeviceState::Enable());
+ auto& enable = (*data.enable).enable;
+
+ // enable
+@@ -5168,7 +5168,7 @@ std::unique_ptr<Input::GetDeviceControlR
+ Pad(&buf, 3);
+ }
+ if (CaseEq(data_expr, Input::DeviceControl::abs_area)) {
+- data.abs_area.emplace();
++ data.abs_area.emplace(Input::DeviceState::AbsArea());
+ auto& offset_x = (*data.abs_area).offset_x;
+ auto& offset_y = (*data.abs_area).offset_y;
+ auto& width = (*data.abs_area).width;
+@@ -6659,7 +6659,7 @@ std::unique_ptr<Input::XIQueryDeviceRepl
+ // data
+ auto data_expr = type;
+ if (CaseEq(data_expr, Input::DeviceClassType::Key)) {
+- data.key.emplace();
++ data.key.emplace(Input::DeviceClass::Key());
+ uint16_t num_keys{};
+ auto& keys = (*data.key).keys;
+ size_t keys_len = keys.size();
+@@ -6675,7 +6675,7 @@ std::unique_ptr<Input::XIQueryDeviceRepl
+ }
+ }
+ if (CaseEq(data_expr, Input::DeviceClassType::Button)) {
+- data.button.emplace();
++ data.button.emplace(Input::DeviceClass::Button());
+ uint16_t num_buttons{};
+ auto& state = (*data.button).state;
+ size_t state_len = state.size();
+@@ -6700,7 +6700,7 @@ std::unique_ptr<Input::XIQueryDeviceRepl
+ }
+ }
+ if (CaseEq(data_expr, Input::DeviceClassType::Valuator)) {
+- data.valuator.emplace();
++ data.valuator.emplace(Input::DeviceClass::Valuator());
+ auto& number = (*data.valuator).number;
+ auto& label = (*data.valuator).label;
+ auto& min = (*data.valuator).min;
+@@ -6763,7 +6763,7 @@ std::unique_ptr<Input::XIQueryDeviceRepl
+ Pad(&buf, 3);
+ }
+ if (CaseEq(data_expr, Input::DeviceClassType::Scroll)) {
+- data.scroll.emplace();
++ data.scroll.emplace(Input::DeviceClass::Scroll());
+ auto& number = (*data.scroll).number;
+ auto& scroll_type = (*data.scroll).scroll_type;
+ auto& flags = (*data.scroll).flags;
+@@ -6798,7 +6798,7 @@ std::unique_ptr<Input::XIQueryDeviceRepl
+ }
+ }
+ if (CaseEq(data_expr, Input::DeviceClassType::Touch)) {
+- data.touch.emplace();
++ data.touch.emplace(Input::DeviceClass::Touch());
+ auto& mode = (*data.touch).mode;
+ auto& num_touches = (*data.touch).num_touches;
+
+@@ -6811,7 +6811,7 @@ std::unique_ptr<Input::XIQueryDeviceRepl
+ Read(&num_touches, &buf);
+ }
+ if (CaseEq(data_expr, Input::DeviceClassType::Gesture)) {
+- data.gesture.emplace();
++ data.gesture.emplace(Input::DeviceClass::Gesture());
+ auto& num_touches = (*data.gesture).num_touches;
+
+ // num_touches
+Index: chromium-123.0.6312.46/components/viz/service/display/surface_aggregator.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/components/viz/service/display/surface_aggregator.cc
++++ chromium-123.0.6312.46/components/viz/service/display/surface_aggregator.cc
+@@ -2236,7 +2236,7 @@ AggregatedFrame SurfaceAggregator::Aggre
+ root_surface_id_ = surface_id;
+
+ // Start recording new stats for this aggregation.
+- stats_.emplace();
++ stats_.emplace(SurfaceAggregator::AggregateStatistics());
+
+ base::ElapsedTimer prewalk_timer;
+ ResolvedFrameData* resolved_frame = GetResolvedFrame(surface_id);
+Index: chromium-123.0.6312.46/third_party/blink/renderer/modules/media_controls/elements/media_control_timeline_element.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/third_party/blink/renderer/modules/media_controls/elements/media_control_timeline_element.cc
++++ chromium-123.0.6312.46/third_party/blink/renderer/modules/media_controls/elements/media_control_timeline_element.cc
+@@ -101,7 +101,7 @@ void MediaControlTimelineElement::Update
+ void MediaControlTimelineElement::SetPosition(double current_time,
+ bool suppress_aria) {
+ if (is_live_ && !live_anchor_time_ && current_time != 0) {
+- live_anchor_time_.emplace();
++ live_anchor_time_.emplace(MediaControlTimelineElement::LiveAnchorTime());
+ live_anchor_time_->clock_time_ = base::TimeTicks::Now();
+ live_anchor_time_->media_time_ = MediaElement().currentTime();
+ }
+Index: chromium-123.0.6312.46/third_party/blink/renderer/platform/graphics/paint/geometry_mapper_transform_cache.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/third_party/blink/renderer/platform/graphics/paint/geometry_mapper_transform_cache.cc
++++ chromium-123.0.6312.46/third_party/blink/renderer/platform/graphics/paint/geometry_mapper_transform_cache.cc
+@@ -70,7 +70,7 @@ void GeometryMapperTransformCache::Updat
+ to_2d_translation_root_ += translation;
+
+ if (parent.plane_root_transform_) {
+- plane_root_transform_.emplace();
++ plane_root_transform_.emplace(GeometryMapperTransformCache::PlaneRootTransform());
+ plane_root_transform_->plane_root = parent.plane_root();
+ plane_root_transform_->to_plane_root = parent.to_plane_root();
+ plane_root_transform_->to_plane_root.Translate(translation.x(),
+@@ -98,7 +98,7 @@ void GeometryMapperTransformCache::Updat
+ // as the 2d translation root.
+ plane_root_transform_ = std::nullopt;
+ } else {
+- plane_root_transform_.emplace();
++ plane_root_transform_.emplace(GeometryMapperTransformCache::PlaneRootTransform());
+ plane_root_transform_->plane_root = parent.plane_root();
+ plane_root_transform_->to_plane_root.MakeIdentity();
+ parent.ApplyToPlaneRoot(plane_root_transform_->to_plane_root);
+@@ -140,7 +140,7 @@ void GeometryMapperTransformCache::Updat
+ parent_node->UpdateScreenTransform();
+ const auto& parent = parent_node->GetTransformCache();
+
+- screen_transform_.emplace();
++ screen_transform_.emplace(GeometryMapperTransformCache::ScreenTransform());
+ parent.ApplyToScreen(screen_transform_->to_screen);
+ if (node.FlattensInheritedTransform())
+ screen_transform_->to_screen.Flatten();
diff --git a/chromium-120-make_unique-struct.patch b/chromium-120-make_unique-struct.patch
new file mode 100644
index 0000000..c848f46
--- /dev/null
+++ b/chromium-120-make_unique-struct.patch
@@ -0,0 +1,12 @@
+diff --git a/service_worker_global_scope.h b/service_worker_global_scope.h.new
+index ac4cac0..8c7d744 100644
+--- a/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.h
++++ b/third_party/blink/renderer/modules/service_worker/service_worker_global_scope.h
+@@ -777,6 +777,7 @@ class MODULES_EXPORT ServiceWorkerGlobalScope final
+ blink::BlinkStorageKey storage_key_;
+
+ struct RaceNetworkRequestInfo {
++ RaceNetworkRequestInfo(int _fetch_event_id, String _token, mojo::PendingRemote<network::mojom::blink::URLLoaderFactory> _url_loader_factory) : fetch_event_id{_fetch_event_id}, token{_token}, url_loader_factory{std::move(_url_loader_factory)} {}
+ int fetch_event_id;
+ String token;
+ mojo::PendingRemote<network::mojom::blink::URLLoaderFactory>
diff --git a/chromium-121-nullptr_t-without-namespace-std.patch b/chromium-121-nullptr_t-without-namespace-std.patch
new file mode 100644
index 0000000..3defc39
--- /dev/null
+++ b/chromium-121-nullptr_t-without-namespace-std.patch
@@ -0,0 +1,12 @@
+diff -up chromium-120.0.6099.56/third_party/blink/renderer/core/paint/fragment_data_iterator.h.than chromium-120.0.6099.56/third_party/blink/renderer/core/paint/fragment_data_iterator.h
+--- chromium-120.0.6099.56/third_party/blink/renderer/core/paint/fragment_data_iterator.h.than 2023-12-04 10:20:45.350540897 +0100
++++ chromium-120.0.6099.56/third_party/blink/renderer/core/paint/fragment_data_iterator.h 2023-12-04 10:23:17.335339670 +0100
+@@ -21,7 +21,7 @@ class FragmentDataIteratorBase {
+
+ public:
+ explicit FragmentDataIteratorBase(Head& head) : fragment_head_(head) {}
+- explicit FragmentDataIteratorBase(nullptr_t) {}
++ explicit FragmentDataIteratorBase(std::nullptr_t) {}
+
+ Data* GetFragmentData() const {
+ return !IsDone() ? &fragment_head_.at(idx_) : nullptr;
diff --git a/chromium-121-rust-clang_lib.patch b/chromium-121-rust-clang_lib.patch
new file mode 100644
index 0000000..0701fd2
--- /dev/null
+++ b/chromium-121-rust-clang_lib.patch
@@ -0,0 +1,68 @@
+From ce943790ea147d492f317097eb707745f78193a1 Mon Sep 17 00:00:00 2001
+From: misaka00251 <liuxin@iscas.ac.cn>
+Date: Fri, 29 Mar 2024 15:12:35 +0800
+Subject: [PATCH] Fix rust clang lib for openEuler
+
+---
+ build/config/clang/BUILD.gn | 31 +++++++++++++++++++++++++++++--
+ 1 file changed, 29 insertions(+), 2 deletions(-)
+
+diff --git a/build/config/clang/BUILD.gn b/build/config/clang/BUILD.gn
+index d3054d1..8b956ed 100644
+--- a/build/config/clang/BUILD.gn
++++ b/build/config/clang/BUILD.gn
+@@ -105,6 +105,7 @@ template("clang_lib") {
+ _prefix = "lib"
+ _suffix = ""
+ _ext = "a"
++ _libprefix = ""
+ if (is_win) {
+ _dir = "windows"
+ _prefix = ""
+@@ -120,7 +121,33 @@ template("clang_lib") {
+ }
+ } else if (is_apple) {
+ _dir = "darwin"
+- } else if (is_linux || is_chromeos) {
++ } else if (is_linux) {
++ _libprefix = "64"
++ if (current_cpu == "x64") {
++ if (clang_version == "17") {
++ _dir = "x86_64-openEuler-linux-gnu"
++ } else {
++ _dir = "linux"
++ _suffix ="-x86_64"
++ }
++ } else if (current_cpu == "arm64") {
++ if (clang_version == "17") {
++ _dir = "aarch64-openEuler-linux-gnu"
++ } else {
++ _dir = "linux"
++ _suffix = "-aarch64"
++ }
++ } else if (current_cpu == "riscv64") {
++ if (clang_version == "17") {
++ _dir = "riscv64-openEuler-linux-gnu"
++ } else {
++ _dir = "linux"
++ _suffix = "-riscv64"
++ }
++ } else {
++ assert(false) # Unhandled cpu type
++ }
++ } else if (is_chromeos) {
+ if (current_cpu == "x64") {
+ _dir = "x86_64-unknown-linux-gnu"
+ } else if (current_cpu == "x86") {
+@@ -159,7 +186,7 @@ template("clang_lib") {
+ assert(false) # Unhandled target platform
+ }
+
+- _clang_lib_dir = "$clang_base_path/lib/clang/$clang_version/lib"
++ _clang_lib_dir = "$clang_base_path/lib${_libprefix}/clang/$clang_version/lib/"
+ _lib_file = "${_prefix}clang_rt.${_libname}${_suffix}.${_ext}"
+ libs = [ "$_clang_lib_dir/$_dir/$_lib_file" ]
+ }
+--
+2.39.3 (Apple Git-146)
+
diff --git a/chromium-122-workaround_clang_bug-structured_binding.patch b/chromium-122-workaround_clang_bug-structured_binding.patch
new file mode 100644
index 0000000..1a5ca3f
--- /dev/null
+++ b/chromium-122-workaround_clang_bug-structured_binding.patch
@@ -0,0 +1,70 @@
+Index: chromium-123.0.6312.46/media/base/cdm_promise_adapter.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/media/base/cdm_promise_adapter.cc
++++ chromium-123.0.6312.46/media/base/cdm_promise_adapter.cc
+@@ -94,7 +94,9 @@ void CdmPromiseAdapter::RejectPromise(ui
+ void CdmPromiseAdapter::Clear(ClearReason reason) {
+ // Reject all outstanding promises.
+ DCHECK(thread_checker_.CalledOnValidThread());
+- for (auto& [promise_id, promise] : promises_) {
++ for (auto& [p_i, p_e] : promises_) {
++ auto& promise_id = p_i;
++ auto& promise = p_e;
+ TRACE_EVENT_NESTABLE_ASYNC_END1(
+ "media", "CdmPromise", TRACE_ID_WITH_SCOPE("CdmPromise", promise_id),
+ "status", "cleared");
+Index: chromium-123.0.6312.46/content/browser/service_worker/service_worker_context_wrapper.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/content/browser/service_worker/service_worker_context_wrapper.cc
++++ chromium-123.0.6312.46/content/browser/service_worker/service_worker_context_wrapper.cc
+@@ -1474,7 +1474,8 @@ void ServiceWorkerContextWrapper::MaybeP
+ return;
+ }
+
+- auto [document_url, key, callback] = std::move(*request);
++ auto [d_u, key, callback] = std::move(*request);
++ auto document_url = d_u;
+
+ DCHECK(document_url.is_valid());
+ TRACE_EVENT1("ServiceWorker",
+Index: chromium-123.0.6312.46/third_party/blink/renderer/core/layout/grid/grid_layout_algorithm.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/third_party/blink/renderer/core/layout/grid/grid_layout_algorithm.cc
++++ chromium-123.0.6312.46/third_party/blink/renderer/core/layout/grid/grid_layout_algorithm.cc
+@@ -3503,8 +3503,8 @@ void GridLayoutAlgorithm::PlaceGridItems
+ DCHECK(out_row_break_between);
+
+ const auto& container_space = GetConstraintSpace();
+- const auto& [grid_items, layout_data, tree_size] = sizing_tree.TreeRootData();
+-
++ const auto& [grid_items, l_d, tree_size] = sizing_tree.TreeRootData();
++ const auto& layout_data = l_d;
+ const auto* cached_layout_subtree = container_space.GetGridLayoutSubtree();
+ const auto container_writing_direction =
+ container_space.GetWritingDirection();
+@@ -3666,8 +3666,9 @@ void GridLayoutAlgorithm::PlaceGridItems
+
+ // TODO(ikilpatrick): Update |SetHasSeenAllChildren| and early exit if true.
+ const auto& constraint_space = GetConstraintSpace();
+- const auto& [grid_items, layout_data, tree_size] = sizing_tree.TreeRootData();
+-
++ const auto& [g_i, l_d, tree_size] = sizing_tree.TreeRootData();
++ const auto& grid_items = g_i;
++ const auto& layout_data = l_d;
+ const auto* cached_layout_subtree = constraint_space.GetGridLayoutSubtree();
+ const auto container_writing_direction =
+ constraint_space.GetWritingDirection();
+Index: chromium-123.0.6312.46/chrome/browser/predictors/lcp_critical_path_predictor/prewarm_http_disk_cache_manager.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/chrome/browser/predictors/lcp_critical_path_predictor/prewarm_http_disk_cache_manager.cc
++++ chromium-123.0.6312.46/chrome/browser/predictors/lcp_critical_path_predictor/prewarm_http_disk_cache_manager.cc
+@@ -136,7 +136,8 @@ void PrewarmHttpDiskCacheManager::MaybeP
+ std::pair<url::Origin, GURL> origin_and_url;
+ std::swap(origin_and_url, queued_jobs_.front());
+ queued_jobs_.pop();
+- const auto& [origin, url] = origin_and_url;
++ const auto& [origin, u] = origin_and_url;
++ const auto& url = u;
+ TRACE_EVENT_WITH_FLOW1(
+ "loading", "PrewarmHttpDiskCacheManager::MaybeProcessNextQueuedJob",
+ TRACE_ID_LOCAL(this),
diff --git a/chromium-123-missing-QtGui.patch b/chromium-123-missing-QtGui.patch
new file mode 100644
index 0000000..5260105
--- /dev/null
+++ b/chromium-123-missing-QtGui.patch
@@ -0,0 +1,12 @@
+diff --git a/ui/qt/BUILD.gn b/ui/qt/BUILD.gn.new
+index 2da7845..02ae3c8 100644
+--- a/ui/qt/BUILD.gn
++++ b/ui/qt/BUILD.gn
+@@ -61,6 +61,7 @@ template("qt_shim") {
+ packages = [
+ "Qt" + invoker.qt_version + "Core",
+ "Qt" + invoker.qt_version + "Widgets",
++ "Qt" + invoker.qt_version + "Gui",
+ ]
+ }
+
diff --git a/chromium-123-stats-collector.patch b/chromium-123-stats-collector.patch
new file mode 100644
index 0000000..7766d4f
--- /dev/null
+++ b/chromium-123-stats-collector.patch
@@ -0,0 +1,19 @@
+reported upstream: https://issues.chromium.org/issues/330361615
+
+The forward header includes the declaration of deallocate(), but not the
+definition. Since the definition is in a header (and presumably it gets
+inlined by the compiler), the definition doesn't actually end up in an
+object file unless the non-forward header gets included. Not having the
+definition makes the linker sad.
+
+--- a/base/allocator/partition_allocator/src/partition_alloc/starscan/stats_collector.h
++++ b/base/allocator/partition_allocator/src/partition_alloc/starscan/stats_collector.h
+@@ -14,7 +14,7 @@
+ #include <unordered_map>
+ #include <utility>
+
+-#include "partition_alloc/internal_allocator_forward.h"
++#include "partition_alloc/internal_allocator.h"
+ #include "partition_alloc/partition_alloc_base/threading/platform_thread.h"
+ #include "partition_alloc/partition_alloc_base/time/time.h"
+ #include "partition_alloc/partition_alloc_check.h"
diff --git a/chromium-124-size_t.patch b/chromium-124-size_t.patch
new file mode 100644
index 0000000..3ca84ee
--- /dev/null
+++ b/chromium-124-size_t.patch
@@ -0,0 +1,16 @@
+diff -up chromium-124.0.6367.118/third_party/perfetto/src/tracing/core/id_allocator.h.me chromium-124.0.6367.118/third_party/perfetto/src/tracing/core/id_allocator.h
+--- chromium-124.0.6367.118/third_party/perfetto/src/tracing/core/id_allocator.h.me 2024-05-06 08:32:09.637210958 +0200
++++ chromium-124.0.6367.118/third_party/perfetto/src/tracing/core/id_allocator.h 2024-05-06 08:32:26.485518448 +0200
+@@ -63,10 +63,10 @@ class IdAllocator : public IdAllocatorGe
+
+ // Tries to allocate `n` IDs. Returns a vector of `n` valid IDs or an empty
+ // vector, if not enough IDs are available.
+- std::vector<T> AllocateMultiple(size_t n) {
++ std::vector<T> AllocateMultiple(std::size_t n) {
+ std::vector<T> res;
+ res.reserve(n);
+- for (size_t i = 0; i < n; i++) {
++ for (std::size_t i = 0; i < n; i++) {
+ T id = Allocate();
+ if (id) {
+ res.push_back(id);
diff --git a/chromium-125-appservice-include.patch b/chromium-125-appservice-include.patch
new file mode 100644
index 0000000..d1b5c46
--- /dev/null
+++ b/chromium-125-appservice-include.patch
@@ -0,0 +1,26 @@
+commit 54c4f460f35e0a4003aa4dd01007188ff00295cc
+Author: Jose Dapena Paz <jdapena@igalia.com>
+Date: Wed Apr 17 08:19:26 2024 +0000
+
+ IWYU: missing include for std::optional usage in app_types.h
+
+ Bug: 40939315
+ Change-Id: I845f4dd1598e38cbe5b22fe472079c41d24a8bd5
+ Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5456358
+ Reviewed-by: Tim Sergeant <tsergeant@chromium.org>
+ Commit-Queue: José Dapena Paz <jdapena@igalia.com>
+ Cr-Commit-Position: refs/heads/main@{#1288572}
+
+diff --git a/components/services/app_service/public/cpp/app_types.h b/components/services/app_service/public/cpp/app_types.h
+index 988b6b30f48ff..833ce6d975b0b 100644
+--- a/components/services/app_service/public/cpp/app_types.h
++++ b/components/services/app_service/public/cpp/app_types.h
+@@ -5,6 +5,8 @@
+ #ifndef COMPONENTS_SERVICES_APP_SERVICE_PUBLIC_CPP_APP_TYPES_H_
+ #define COMPONENTS_SERVICES_APP_SERVICE_PUBLIC_CPP_APP_TYPES_H_
+
++#include <optional>
++
+ #include "base/component_export.h"
+ #include "components/services/app_service/public/cpp/macros.h"
+ #include "components/services/app_service/public/protos/app_types.pb.h"
diff --git a/chromium-125-assert.patch b/chromium-125-assert.patch
new file mode 100644
index 0000000..c28aafd
--- /dev/null
+++ b/chromium-125-assert.patch
@@ -0,0 +1,12 @@
+diff -up chromium-125.0.6422.60/chrome/browser/ui/webui/top_chrome/webui_contents_wrapper.h.assert chromium-125.0.6422.60/chrome/browser/ui/webui/top_chrome/webui_contents_wrapper.h
+--- chromium-125.0.6422.60/chrome/browser/ui/webui/top_chrome/webui_contents_wrapper.h.assert 2024-05-18 19:33:37.165243577 +0200
++++ chromium-125.0.6422.60/chrome/browser/ui/webui/top_chrome/webui_contents_wrapper.h 2024-05-18 19:45:51.224995489 +0200
+@@ -185,7 +185,7 @@ class WebUIContentsWrapperT : public Web
+ supports_draggable_regions,
+ T::GetWebUIName()),
+ webui_url_(webui_url) {
+- static_assert(
++ assert(
+ views_metrics::IsValidWebUINameVariant("." + T::GetWebUIName()));
+ if (is_ready_to_show()) {
+ CHECK(GetWebUIController());
diff --git a/chromium-125-compiler.patch b/chromium-125-compiler.patch
new file mode 100644
index 0000000..96ced25
--- /dev/null
+++ b/chromium-125-compiler.patch
@@ -0,0 +1,270 @@
+From 307a0f63dd9b118f4b8470ed3d7567e81fdb7a6d Mon Sep 17 00:00:00 2001
+From: Mike Gilbert <floppym@gentoo.org>
+Date: Tue, 15 Nov 2022 10:27:58 +0000
+Subject: [PATCH] Disable various compiler configs
+
+---
+ build/config/compiler/BUILD.gn | 134 +++++----------------------------
+ 1 file changed, 17 insertions(+), 117 deletions(-)
+
+Index: chromium-120.0.6099.35/build/config/compiler/BUILD.gn
+===================================================================
+--- chromium-120.0.6099.35.orig/build/config/compiler/BUILD.gn
++++ chromium-120.0.6099.35/build/config/compiler/BUILD.gn
+@@ -320,9 +320,7 @@ config("compiler") {
+
+ configs += [
+ # See the definitions below.
+- ":clang_revision",
+ ":rustc_revision",
+- ":compiler_cpu_abi",
+ ":compiler_codegen",
+ ":compiler_deterministic",
+ ]
+@@ -591,55 +589,6 @@ config("compiler") {
+ ldflags += [ "-Wl,-z,keep-text-section-prefix" ]
+ }
+
+- if (is_clang && !is_nacl && current_os != "zos") {
+- cflags += [ "-fcrash-diagnostics-dir=" + clang_diagnostic_dir ]
+- if (save_reproducers_on_lld_crash && use_lld) {
+- ldflags += [
+- "-fcrash-diagnostics=all",
+- "-fcrash-diagnostics-dir=" + clang_diagnostic_dir,
+- ]
+- }
+-
+- # TODO(hans): Remove this once Clang generates better optimized debug info
+- # by default. https://crbug.com/765793
+- cflags += [
+- "-mllvm",
+- "-instcombine-lower-dbg-declare=0",
+- ]
+- if (!is_debug && use_thin_lto && is_a_target_toolchain) {
+- if (is_win) {
+- ldflags += [ "-mllvm:-instcombine-lower-dbg-declare=0" ]
+- } else {
+- ldflags += [ "-Wl,-mllvm,-instcombine-lower-dbg-declare=0" ]
+- }
+- }
+-
+- # 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" ]
+- } else {
+- cflags += [ "-ffp-contract=off" ]
+- }
+- }
+-
+ # C11/C++11 compiler flags setup.
+ # ---------------------------
+ if (is_linux || is_chromeos || is_android || (is_nacl && is_clang) ||
+@@ -1488,46 +1488,6 @@
+ }
+ }
+
+- # Makes builds independent of absolute file path.
+- if (is_clang && strip_absolute_paths_from_debug_symbols) {
+- # If debug option is given, clang includes $cwd in debug info by default.
+- # For such build, this flag generates reproducible obj files even we use
+- # different build directory like "out/feature_a" and "out/feature_b" if
+- # we build same files with same compile flag.
+- # Other paths are already given in relative, no need to normalize them.
+- if (is_nacl) {
+- # TODO(https://crbug.com/1231236): Use -ffile-compilation-dir= here.
+- cflags += [
+- "-Xclang",
+- "-fdebug-compilation-dir",
+- "-Xclang",
+- ".",
+- ]
+- } else {
+- # -ffile-compilation-dir is an alias for both -fdebug-compilation-dir=
+- # and -fcoverage-compilation-dir=.
+- cflags += [ "-ffile-compilation-dir=." ]
+- swiftflags += [ "-file-compilation-dir=." ]
+- }
+- if (!is_win) {
+- # We don't use clang -cc1as on Windows (yet? https://crbug.com/762167)
+- asmflags = [ "-Wa,-fdebug-compilation-dir,." ]
+- }
+-
+- if (is_win && use_lld) {
+- if (symbol_level == 2 || (is_clang && using_sanitizer)) {
+- # Absolutize source file paths for PDB. Pass the real build directory
+- # if the pdb contains source-level debug information and if linker
+- # reproducibility is not critical.
+- ldflags += [ "/PDBSourcePath:" + rebase_path(root_build_dir) ]
+- } else {
+- # Use a fake fixed base directory for paths in the pdb to make the pdb
+- # output fully deterministic and independent of the build directory.
+- ldflags += [ "/PDBSourcePath:o:\fake\prefix" ]
+- }
+- }
+- }
+-
+ # Tells the compiler not to use absolute paths when passing the default
+ # paths to the tools it invokes. We don't want this because we don't
+ # really need it and it can mess up the RBE cache entries.
+@@ -1572,27 +1481,6 @@ config("compiler_deterministic") {
+ }
+ }
+
+-config("clang_revision") {
+- if (is_clang && clang_base_path == default_clang_base_path) {
+- update_args = [
+- "--print-revision",
+- "--verify-version=$clang_version",
+- ]
+- if (llvm_force_head_revision) {
+- update_args += [ "--llvm-force-head-revision" ]
+- }
+- clang_revision = exec_script("//tools/clang/scripts/update.py",
+- update_args,
+- "trim string")
+-
+- # This is here so that all files get recompiled after a clang roll and
+- # when turning clang on or off. (defines are passed via the command line,
+- # and build system rebuild things when their commandline changes). Nothing
+- # should ever read this define.
+- defines = [ "CR_CLANG_REVISION=\"$clang_revision\"" ]
+- }
+-}
+-
+ config("rustc_revision") {
+ if (rustc_revision != "") {
+ # Similar to the above config, this is here so that all files get recompiled
+@@ -1959,10 +1847,6 @@ config("chromium_code") {
+ }
+ } else {
+ cflags = [ "-Wall" ]
+- if (is_clang) {
+- # Enable extra warnings for chromium_code when we control the compiler.
+- cflags += [ "-Wextra" ]
+- }
+
+ # In Chromium code, we define __STDC_foo_MACROS in order to get the
+ # C99 macros on Mac and Linux.
+@@ -1971,24 +1855,6 @@ config("chromium_code") {
+ "__STDC_FORMAT_MACROS",
+ ]
+
+- if (!is_debug && !using_sanitizer && current_cpu != "s390x" &&
+- current_cpu != "s390" && current_cpu != "ppc64" &&
+- current_cpu != "mips" && current_cpu != "mips64" &&
+- current_cpu != "riscv64" && current_cpu != "loong64") {
+- # Non-chromium code is not guaranteed to compile cleanly with
+- # _FORTIFY_SOURCE. Also, fortified build may fail when optimizations are
+- # disabled, so only do that for Release build.
+- fortify_level = "2"
+-
+- # ChromeOS's toolchain supports a high-quality _FORTIFY_SOURCE=3
+- # implementation with a few custom glibc patches. Use that if it's
+- # available.
+- if (is_chromeos_device && !lacros_use_chromium_toolchain) {
+- fortify_level = "3"
+- }
+- defines += [ "_FORTIFY_SOURCE=" + fortify_level ]
+- }
+-
+ if (is_apple) {
+ cflags_objc = [ "-Wimplicit-retain-self" ]
+ cflags_objcc = [ "-Wimplicit-retain-self" ]
+@@ -2335,7 +2295,8 @@
+ # [0]: https://pinpoint-dot-chromeperf.appspot.com/job/147634a8be0000
+ # [1]: https://pinpoint-dot-chromeperf.appspot.com/job/132bc772be0000
+ # [2]: https://crrev.com/c/5447532
+-config("optimize") {
++config("optimize") { }
++config("xoptimize") {
+ if (is_win) {
+ cflags = [ "/O2" ] + common_optimize_on_cflags
+
+@@ -2430,7 +2297,8 @@ config("optimize") {
+ }
+
+ # Turn off optimizations.
+-config("no_optimize") {
++config("no_optimize") { }
++config("xno_optimize") {
+ if (is_win) {
+ cflags = [
+ "/Od", # Disable optimization.
+@@ -2417,7 +2377,8 @@
+ # Turns up the optimization level. Used to explicitly enable -O2 instead of
+ # -Os for select targets on platforms that use optimize_for_size. No-op
+ # elsewhere.
+-config("optimize_max") {
++config("optimize_max") { }
++config("xoptimize_max") {
+ if (is_nacl && is_nacl_irt) {
+ # The NaCl IRT is a special case and always wants its own config.
+ # Various components do:
+@@ -2503,7 +2372,8 @@ config("optimize_max") {
+ #
+ # TODO(crbug.com/621335) - rework how all of these configs are related
+ # so that we don't need this disclaimer.
+-config("optimize_speed") {
++config("optimize_speed") { }
++config("xoptimize_speed") {
+ if (is_nacl && is_nacl_irt) {
+ # The NaCl IRT is a special case and always wants its own config.
+ # Various components do:
+@@ -2529,7 +2399,8 @@ config("optimize_speed") {
+ }
+ }
+
+-config("optimize_fuzzing") {
++config("optimize_fuzzing") { }
++config("xoptimize_fuzzing") {
+ cflags = [ "-O1" ] + common_optimize_on_cflags
+ rustflags = [ "-Copt-level=1" ]
+ ldflags = common_optimize_on_ldflags
+@@ -2662,7 +2533,8 @@ config("win_pdbaltpath") {
+ }
+
+ # Full symbols.
+-config("symbols") {
++config("symbols") { }
++config("xsymbols") {
+ rustflags = []
+ if (is_win) {
+ if (is_clang) {
+@@ -2811,7 +2683,8 @@ config("symbols") {
+ # Minimal symbols.
+ # This config guarantees to hold symbol for stack trace which are shown to user
+ # when crash happens in unittests running on buildbot.
+-config("minimal_symbols") {
++config("minimal_symbols") { }
++config("xminimal_symbols") {
+ rustflags = []
+ if (is_win) {
+ # Functions, files, and line tables only.
+@@ -2896,7 +2769,8 @@ config("minimal_symbols") {
+ # This configuration contains function names only. That is, the compiler is
+ # told to not generate debug information and the linker then just puts function
+ # names in the final debug information.
+-config("no_symbols") {
++config("no_symbols") { }
++config("xno_symbols") {
+ if (is_win) {
+ ldflags = [ "/DEBUG" ]
+
diff --git a/chromium-125-debian-bad-font-gc0.patch b/chromium-125-debian-bad-font-gc0.patch
new file mode 100644
index 0000000..9e76304
--- /dev/null
+++ b/chromium-125-debian-bad-font-gc0.patch
@@ -0,0 +1,250 @@
+Revert the following commit:
+
+commit 886c849ee96e3026d28d7615cdd5af9628a2e5c8
+Author: Ian Kilpatrick <ikilpatrick@chromium.org>
+Date: Tue Feb 20 18:18:04 2024 +0000
+
+ [gc] Make UnicodeRangeSet gc'd.
+
+ There should be no user-visible behaviour change.
+
+ Bug: 41490008
+ Change-Id: I7f0003b7ff7c464d4ee36442bcff8c63da79b20c
+ Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5302778
+ Reviewed-by: Dominik Röttsches <drott@chromium.org>
+ Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
+ Cr-Commit-Position: refs/heads/main@{#1262789}
+
+--- a/third_party/blink/renderer/core/css/css_font_face.cc
++++ b/third_party/blink/renderer/core/css/css_font_face.cc
+@@ -291,7 +291,6 @@ bool CSSFontFace::UpdatePeriod() {
+ void CSSFontFace::Trace(Visitor* visitor) const {
+ visitor->Trace(segmented_font_faces_);
+ visitor->Trace(sources_);
+- visitor->Trace(ranges_);
+ visitor->Trace(font_face_);
+ }
+
+--- a/third_party/blink/renderer/core/css/css_font_face.h
++++ b/third_party/blink/renderer/core/css/css_font_face.h
+@@ -47,8 +47,8 @@ class SimpleFontData;
+
+ class CORE_EXPORT CSSFontFace final : public GarbageCollected<CSSFontFace> {
+ public:
+- CSSFontFace(FontFace* font_face, HeapVector<UnicodeRange>&& ranges)
+- : ranges_(MakeGarbageCollected<UnicodeRangeSet>(std::move(ranges))),
++ CSSFontFace(FontFace* font_face, Vector<UnicodeRange>& ranges)
++ : ranges_(base::AdoptRef(new UnicodeRangeSet(ranges))),
+ font_face_(font_face) {
+ DCHECK(font_face_);
+ }
+@@ -61,7 +61,7 @@ class CORE_EXPORT CSSFontFace final : pu
+ }
+ FontFace* GetFontFace() const { return font_face_.Get(); }
+
+- const UnicodeRangeSet* Ranges() { return ranges_.Get(); }
++ scoped_refptr<UnicodeRangeSet> Ranges() { return ranges_; }
+
+ void AddSegmentedFontFace(CSSSegmentedFontFace*);
+ void RemoveSegmentedFontFace(CSSSegmentedFontFace*);
+@@ -98,9 +98,9 @@ class CORE_EXPORT CSSFontFace final : pu
+ private:
+ void SetLoadStatus(FontFace::LoadStatusType);
+
++ scoped_refptr<UnicodeRangeSet> ranges_;
+ HeapHashSet<Member<CSSSegmentedFontFace>> segmented_font_faces_;
+ HeapDeque<Member<CSSFontFaceSource>> sources_;
+- Member<const UnicodeRangeSet> ranges_;
+ Member<FontFace> font_face_;
+ };
+
+--- a/third_party/blink/renderer/core/css/font_face.cc
++++ b/third_party/blink/renderer/core/css/font_face.cc
+@@ -90,7 +90,7 @@ const CSSValue* ParseCSSValue(const Exec
+
+ CSSFontFace* CreateCSSFontFace(FontFace* font_face,
+ const CSSValue* unicode_range) {
+- HeapVector<UnicodeRange> ranges;
++ Vector<UnicodeRange> ranges;
+ if (const auto* range_list = To<CSSValueList>(unicode_range)) {
+ unsigned num_ranges = range_list->length();
+ for (unsigned i = 0; i < num_ranges; i++) {
+@@ -100,7 +100,7 @@ CSSFontFace* CreateCSSFontFace(FontFace*
+ }
+ }
+
+- return MakeGarbageCollected<CSSFontFace>(font_face, std::move(ranges));
++ return MakeGarbageCollected<CSSFontFace>(font_face, ranges);
+ }
+
+ const CSSValue* ConvertFontMetricOverrideValue(const CSSValue* parsed_value) {
+--- a/third_party/blink/renderer/platform/fonts/font_data_for_range_set.h
++++ b/third_party/blink/renderer/platform/fonts/font_data_for_range_set.h
+@@ -39,18 +39,16 @@ class SimpleFontData;
+ class PLATFORM_EXPORT FontDataForRangeSet
+ : public GarbageCollected<FontDataForRangeSet> {
+ public:
+- explicit FontDataForRangeSet(const SimpleFontData* font_data = nullptr,
+- const UnicodeRangeSet* range_set = nullptr)
+- : font_data_(font_data), range_set_(range_set) {}
++ explicit FontDataForRangeSet(
++ const SimpleFontData* font_data = nullptr,
++ scoped_refptr<UnicodeRangeSet> range_set = nullptr)
++ : font_data_(font_data), range_set_(std::move(range_set)) {}
+
+ FontDataForRangeSet(const FontDataForRangeSet& other);
+
+ virtual ~FontDataForRangeSet() = default;
+
+- void Trace(Visitor* visitor) const {
+- visitor->Trace(font_data_);
+- visitor->Trace(range_set_);
+- }
++ void Trace(Visitor* visitor) const { visitor->Trace(font_data_); }
+
+ bool Contains(UChar32 test_char) const {
+ return !range_set_ || range_set_->Contains(test_char);
+@@ -58,7 +56,7 @@ class PLATFORM_EXPORT FontDataForRangeSe
+ bool IsEntireRange() const {
+ return !range_set_ || range_set_->IsEntireRange();
+ }
+- const UnicodeRangeSet* Ranges() const { return range_set_.Get(); }
++ UnicodeRangeSet* Ranges() const { return range_set_.get(); }
+ bool HasFontData() const { return font_data_; }
+ const SimpleFontData* FontData() const { return font_data_.Get(); }
+
+@@ -74,7 +72,7 @@ class PLATFORM_EXPORT FontDataForRangeSe
+
+ protected:
+ Member<const SimpleFontData> font_data_;
+- Member<const UnicodeRangeSet> range_set_;
++ scoped_refptr<UnicodeRangeSet> range_set_;
+ };
+
+ } // namespace blink
+--- a/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.cc
++++ b/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.cc
+@@ -508,10 +508,10 @@ const OpenTypeVerticalData& HarfBuzzFace
+ return *harfbuzz_font_data_->VerticalData();
+ }
+
+-hb_font_t* HarfBuzzFace::GetScaledFont(const UnicodeRangeSet* range_set,
++hb_font_t* HarfBuzzFace::GetScaledFont(scoped_refptr<UnicodeRangeSet> range_set,
+ VerticalLayoutCallbacks vertical_layout,
+ float specified_size) const {
+- harfbuzz_font_data_->range_set_ = range_set;
++ harfbuzz_font_data_->range_set_ = std::move(range_set);
+ harfbuzz_font_data_->UpdateFallbackMetricsAndScale(*platform_data_,
+ vertical_layout);
+
+--- a/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.h
++++ b/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.h
+@@ -66,7 +66,7 @@ class HarfBuzzFace final : public Garbag
+ // Passing in specified_size in order to control selecting the right value
+ // from the trak table. If not set, the size of the internal FontPlatformData
+ // object will be used.
+- hb_font_t* GetScaledFont(const UnicodeRangeSet*,
++ hb_font_t* GetScaledFont(scoped_refptr<UnicodeRangeSet>,
+ VerticalLayoutCallbacks,
+ float specified_size) const;
+
+--- a/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_font_data.h
++++ b/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_font_data.h
+@@ -32,7 +32,7 @@ struct HarfBuzzFontData final : public G
+ HarfBuzzFontData(const HarfBuzzFontData&) = delete;
+ HarfBuzzFontData& operator=(const HarfBuzzFontData&) = delete;
+
+- void Trace(Visitor* visitor) const { visitor->Trace(range_set_); }
++ void Trace(Visitor*) const {}
+
+ // The vertical origin and vertical advance functions in HarfBuzzFace require
+ // the ascent and height metrics as fallback in case no specific vertical
+@@ -98,7 +98,7 @@ struct HarfBuzzFontData final : public G
+ SpaceGlyphInOpenTypeTables::kUnknown;
+
+ scoped_refptr<OpenTypeVerticalData> vertical_data_;
+- Member<const UnicodeRangeSet> range_set_;
++ scoped_refptr<UnicodeRangeSet> range_set_;
+ };
+
+ } // namespace blink
+--- a/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_shaper.cc
++++ b/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_shaper.cc
+@@ -289,7 +289,7 @@ void RoundHarfBuzzBufferPositions(hb_buf
+ inline bool ShapeRange(hb_buffer_t* buffer,
+ const FontFeatures& font_features,
+ const SimpleFontData* current_font,
+- const UnicodeRangeSet* current_font_range_set,
++ scoped_refptr<UnicodeRangeSet> current_font_range_set,
+ UScriptCode current_run_script,
+ hb_direction_t direction,
+ hb_language_t language,
+@@ -325,7 +325,7 @@ inline bool ShapeRange(hb_buffer_t* buff
+ hb_buffer_set_direction(buffer, direction);
+
+ hb_font_t* hb_font =
+- face->GetScaledFont(current_font_range_set,
++ face->GetScaledFont(std::move(current_font_range_set),
+ HB_DIRECTION_IS_VERTICAL(direction)
+ ? HarfBuzzFace::kPrepareForVerticalLayout
+ : HarfBuzzFace::kNoVerticalLayout,
+--- a/third_party/blink/renderer/platform/fonts/unicode_range_set.cc
++++ b/third_party/blink/renderer/platform/fonts/unicode_range_set.cc
+@@ -31,8 +31,8 @@
+
+ namespace blink {
+
+-UnicodeRangeSet::UnicodeRangeSet(HeapVector<UnicodeRange>&& ranges)
+- : ranges_(std::move(ranges)) {
++UnicodeRangeSet::UnicodeRangeSet(const Vector<UnicodeRange>& ranges)
++ : ranges_(ranges) {
+ if (ranges_.empty())
+ return;
+
+--- a/third_party/blink/renderer/platform/fonts/unicode_range_set.h
++++ b/third_party/blink/renderer/platform/fonts/unicode_range_set.h
+@@ -26,12 +26,13 @@
+ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_UNICODE_RANGE_SET_H_
+ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_UNICODE_RANGE_SET_H_
+
+-#include "third_party/blink/renderer/platform/heap/collection_support/heap_vector.h"
+-#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
+ #include "third_party/blink/renderer/platform/platform_export.h"
++#include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
+ #include "third_party/blink/renderer/platform/wtf/text/character_names.h"
+ #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
+ #include "third_party/blink/renderer/platform/wtf/text/wtf_uchar.h"
++#include "third_party/blink/renderer/platform/wtf/thread_safe_ref_counted.h"
++#include "third_party/blink/renderer/platform/wtf/vector.h"
+
+ namespace blink {
+
+@@ -55,14 +56,13 @@ struct PLATFORM_EXPORT UnicodeRange fina
+ UChar32 to_;
+ };
+
+-class PLATFORM_EXPORT UnicodeRangeSet
+- : public GarbageCollected<UnicodeRangeSet> {
++class PLATFORM_EXPORT UnicodeRangeSet : public RefCounted<UnicodeRangeSet> {
++ USING_FAST_MALLOC(UnicodeRangeSet);
++
+ public:
+- explicit UnicodeRangeSet(HeapVector<UnicodeRange>&&);
++ explicit UnicodeRangeSet(const Vector<UnicodeRange>&);
+ UnicodeRangeSet() = default;
+
+- void Trace(Visitor* visitor) const { visitor->Trace(ranges_); }
+-
+ bool Contains(UChar32) const;
+ bool IntersectsWith(const String&) const;
+ bool IsEntireRange() const { return ranges_.empty(); }
+@@ -71,8 +71,7 @@ class PLATFORM_EXPORT UnicodeRangeSet
+ bool operator==(const UnicodeRangeSet& other) const;
+
+ private:
+- HeapVector<UnicodeRange>
+- ranges_; // If empty, represents the whole code space.
++ Vector<UnicodeRange> ranges_; // If empty, represents the whole code space.
+ };
+
+ } // namespace blink
diff --git a/chromium-125-debian-bad-font-gc00.patch b/chromium-125-debian-bad-font-gc00.patch
new file mode 100644
index 0000000..ff3a15e
--- /dev/null
+++ b/chromium-125-debian-bad-font-gc00.patch
@@ -0,0 +1,159 @@
+Revert the following commit:
+
+commit 59daae50fc3c47f7a8dbcc828446fdaa9f8c12c4
+Author: Ian Kilpatrick <ikilpatrick@chromium.org>
+Date: Tue Feb 20 18:35:11 2024 +0000
+
+ [gc] Make OpenTypeVerticalData gc'd.
+
+ There should be no user-visible behaviour change.
+
+ Bug: 41490008
+ Change-Id: Id93c85a7beb710944e07cff614cff2409c818436
+ Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5302893
+ Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
+ Reviewed-by: Dominik Röttsches <drott@chromium.org>
+ Cr-Commit-Position: refs/heads/main@{#1262805}
+
+--- a/third_party/blink/renderer/platform/fonts/font_platform_data.cc
++++ b/third_party/blink/renderer/platform/fonts/font_platform_data.cc
+@@ -308,6 +308,11 @@ SkFont FontPlatformData::CreateSkFont(co
+ }
+ #endif // !BUILDFLAG(IS_MAC) && !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_IOS)
+
++scoped_refptr<OpenTypeVerticalData> FontPlatformData::CreateVerticalData()
++ const {
++ return OpenTypeVerticalData::CreateUnscaled(typeface_);
++}
++
+ IdentifiableToken FontPlatformData::ComputeTypefaceDigest() const {
+ DCHECK(typeface_);
+ int table_count = typeface_->countTables();
+--- a/third_party/blink/renderer/platform/fonts/font_platform_data.h
++++ b/third_party/blink/renderer/platform/fonts/font_platform_data.h
+@@ -59,6 +59,7 @@ typedef const struct __CTFont* CTFontRef
+ namespace blink {
+
+ class HarfBuzzFace;
++class OpenTypeVerticalData;
+
+ class PLATFORM_EXPORT FontPlatformData
+ : public GarbageCollected<FontPlatformData> {
+@@ -137,6 +138,8 @@ class PLATFORM_EXPORT FontPlatformData
+
+ SkFont CreateSkFont(const FontDescription* = nullptr) const;
+
++ scoped_refptr<OpenTypeVerticalData> CreateVerticalData() const;
++
+ // Computes a digest from the typeface. The digest only depends on the
+ // underlying font itself, and does not vary by the style (size, weight,
+ // italics, etc). This is aimed at discovering the fingerprinting information
+--- a/third_party/blink/renderer/platform/fonts/opentype/open_type_vertical_data.h
++++ b/third_party/blink/renderer/platform/fonts/opentype/open_type_vertical_data.h
+@@ -27,10 +27,10 @@
+
+ #include "base/memory/scoped_refptr.h"
+ #include "third_party/blink/renderer/platform/fonts/glyph.h"
+-#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
+ #include "third_party/blink/renderer/platform/platform_export.h"
+ #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
+ #include "third_party/blink/renderer/platform/wtf/hash_map.h"
++#include "third_party/blink/renderer/platform/wtf/ref_counted.h"
+ #include "third_party/blink/renderer/platform/wtf/vector.h"
+ #include "third_party/skia/include/core/SkRefCnt.h"
+ #include "third_party/skia/include/core/SkTypeface.h"
+@@ -40,11 +40,14 @@ class SkFont;
+ namespace blink {
+
+ class PLATFORM_EXPORT OpenTypeVerticalData
+- : public GarbageCollected<OpenTypeVerticalData> {
+- public:
+- explicit OpenTypeVerticalData(sk_sp<SkTypeface>);
++ : public RefCounted<OpenTypeVerticalData> {
++ USING_FAST_MALLOC(OpenTypeVerticalData);
+
+- void Trace(Visitor*) const {}
++ public:
++ static scoped_refptr<OpenTypeVerticalData> CreateUnscaled(
++ sk_sp<SkTypeface> typeface) {
++ return base::AdoptRef(new OpenTypeVerticalData(typeface));
++ }
+
+ void SetScaleAndFallbackMetrics(float size_per_unit,
+ float ascent,
+@@ -60,6 +63,8 @@ class PLATFORM_EXPORT OpenTypeVerticalDa
+ float* out_xy_array) const;
+
+ private:
++ explicit OpenTypeVerticalData(sk_sp<SkTypeface>);
++
+ void LoadMetrics(sk_sp<SkTypeface>);
+ bool HasVORG() const { return !vert_origin_y_.empty(); }
+
+--- a/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.cc
++++ b/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.cc
+@@ -202,7 +202,8 @@
+ void* user_data) {
+ HarfBuzzFontData* hb_font_data =
+ reinterpret_cast<HarfBuzzFontData*>(font_data);
+- OpenTypeVerticalData* vertical_data = hb_font_data->VerticalData();
++ scoped_refptr<OpenTypeVerticalData> vertical_data =
++ hb_font_data->VerticalData();
+ if (!vertical_data) {
+ return false;
+ }
+@@ -223,7 +223,8 @@ static hb_position_t HarfBuzzGetGlyphVer
+ void* user_data) {
+ HarfBuzzFontData* hb_font_data =
+ reinterpret_cast<HarfBuzzFontData*>(font_data);
+- OpenTypeVerticalData* vertical_data = hb_font_data->VerticalData();
++ scoped_refptr<OpenTypeVerticalData> vertical_data =
++ hb_font_data->VerticalData();
+ if (!vertical_data) {
+ return SkiaScalarToHarfBuzzPosition(hb_font_data->height_fallback_);
+ }
+--- a/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_font_data.h
++++ b/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_font_data.h
+@@ -32,10 +32,7 @@ struct HarfBuzzFontData final : public G
+ HarfBuzzFontData(const HarfBuzzFontData&) = delete;
+ HarfBuzzFontData& operator=(const HarfBuzzFontData&) = delete;
+
+- void Trace(Visitor* visitor) const {
+- visitor->Trace(vertical_data_);
+- visitor->Trace(range_set_);
+- }
++ void Trace(Visitor* visitor) const { visitor->Trace(range_set_); }
+
+ // The vertical origin and vertical advance functions in HarfBuzzFace require
+ // the ascent and height metrics as fallback in case no specific vertical
+@@ -70,18 +67,18 @@ struct HarfBuzzFontData final : public G
+ }
+ }
+
+- OpenTypeVerticalData* VerticalData() {
++ scoped_refptr<OpenTypeVerticalData> VerticalData() {
+ if (!vertical_data_) {
+ DCHECK_NE(ascent_fallback_, kInvalidFallbackMetricsValue);
+ DCHECK_NE(height_fallback_, kInvalidFallbackMetricsValue);
+ DCHECK_NE(size_per_unit_, kInvalidFallbackMetricsValue);
+
+ vertical_data_ =
+- MakeGarbageCollected<OpenTypeVerticalData>(font_.refTypeface());
++ OpenTypeVerticalData::CreateUnscaled(font_.refTypeface());
+ }
+ vertical_data_->SetScaleAndFallbackMetrics(size_per_unit_, ascent_fallback_,
+ height_fallback_);
+- return vertical_data_.Get();
++ return vertical_data_;
+ }
+
+ const hb::unique_ptr<hb_font_t> unscaled_font_;
+@@ -100,7 +97,7 @@ struct HarfBuzzFontData final : public G
+ SpaceGlyphInOpenTypeTables space_in_gsub_ =
+ SpaceGlyphInOpenTypeTables::kUnknown;
+
+- Member<OpenTypeVerticalData> vertical_data_;
++ scoped_refptr<OpenTypeVerticalData> vertical_data_;
+ Member<const UnicodeRangeSet> range_set_;
+ };
+
diff --git a/chromium-125-debian-bad-font-gc000.patch b/chromium-125-debian-bad-font-gc000.patch
new file mode 100644
index 0000000..18e6c10
--- /dev/null
+++ b/chromium-125-debian-bad-font-gc000.patch
@@ -0,0 +1,107 @@
+Revert the following commit:
+
+commit 5ffa0446f51e34d06dc0539810a8a5d35ec9e3fc
+Author: Ian Kilpatrick <ikilpatrick@chromium.org>
+Date: Thu Feb 22 17:08:22 2024 +0000
+
+ [fonts][perf] Explicitly leak SimpleFontDatas via a LRU cache.
+
+ This adds a strong LRU cache to FontDataCache to retain the most
+ recently used fonts.
+
+ This covers the case where a large amount of DOM is destroyed, and
+ previously we'd release all the font related objects if the GC kicked
+ in.
+
+ Speedometer3 appears to peak at ~75 objects in the cache.
+
+ Results for different cache sizes:
+
+ Cache size: 64 | 32 | 16
+ Speedometer3: +0.9% | +0.5% | +0%
+
+ Bug: 41490008
+ Change-Id: I131b6a79f246e61e13a7d44dddbc1f9e625ed44a
+ Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5314842
+ Reviewed-by: Dominik Röttsches <drott@chromium.org>
+ Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
+ Cr-Commit-Position: refs/heads/main@{#1264027}
+
+--- a/third_party/blink/renderer/platform/fonts/font_data_cache.cc
++++ b/third_party/blink/renderer/platform/fonts/font_data_cache.cc
+@@ -36,15 +36,6 @@
+
+ namespace blink {
+
+-namespace {
+-
+-// The maximum number of strong references to retain via the LRU.
+-// This explicitly leaks fonts (and related objects) unless under extreme
+-// memory pressure where it will be cleared. DO NOT increase unnecessarily.
+-const wtf_size_t kMaxSize = 64;
+-
+-} // namespace
+-
+ const SimpleFontData* FontDataCache::Get(const FontPlatformData* platform_data,
+ bool subpixel_ascent_descent) {
+ if (!platform_data)
+@@ -64,16 +55,7 @@ const SimpleFontData* FontDataCache::Get
+ add_result.stored_value->value = MakeGarbageCollected<SimpleFontData>(
+ platform_data, nullptr, subpixel_ascent_descent);
+ }
+-
+- const SimpleFontData* result = add_result.stored_value->value;
+-
+- // Update our LRU to keep a strong reference to `result`.
+- strong_reference_lru_.PrependOrMoveToFirst(result);
+- while (strong_reference_lru_.size() > kMaxSize) {
+- strong_reference_lru_.pop_back();
+- }
+-
+- return result;
++ return add_result.stored_value->value;
+ }
+
+ } // namespace blink
+--- a/third_party/blink/renderer/platform/fonts/font_data_cache.h
++++ b/third_party/blink/renderer/platform/fonts/font_data_cache.h
+@@ -34,7 +34,6 @@
+ #include "third_party/blink/renderer/platform/fonts/font_platform_data.h"
+ #include "third_party/blink/renderer/platform/fonts/simple_font_data.h"
+ #include "third_party/blink/renderer/platform/heap/collection_support/heap_hash_map.h"
+-#include "third_party/blink/renderer/platform/heap/collection_support/heap_linked_hash_set.h"
+
+ namespace blink {
+
+@@ -59,29 +58,17 @@ class FontDataCache final {
+ FontDataCache(const FontDataCache&) = delete;
+ FontDataCache& operator=(const FontDataCache&) = delete;
+
+- void Trace(Visitor* visitor) const {
+- visitor->Trace(cache_);
+- visitor->Trace(strong_reference_lru_);
+- }
++ void Trace(Visitor* visitor) const { visitor->Trace(cache_); }
+
+ const SimpleFontData* Get(const FontPlatformData*,
+ bool subpixel_ascent_descent = false);
+- void Clear() {
+- cache_.clear();
+- strong_reference_lru_.clear();
+- }
++ void Clear() { cache_.clear(); }
+
+ private:
+ HeapHashMap<Member<const FontPlatformData>,
+ WeakMember<const SimpleFontData>,
+ FontDataCacheKeyHashTraits>
+ cache_;
+-
+- // The above `cache_` is weak, meaning its entries will potentially be
+- // cleared if no other references exist.
+- // This LRU keeps a small (limited) number of strong references alive so they
+- // won't be cleared in the above cache for performance reasons.
+- HeapLinkedHashSet<Member<const SimpleFontData>> strong_reference_lru_;
+ };
+
+ } // namespace blink
diff --git a/chromium-125-debian-bad-font-gc0000.patch b/chromium-125-debian-bad-font-gc0000.patch
new file mode 100644
index 0000000..7eaa721
--- /dev/null
+++ b/chromium-125-debian-bad-font-gc0000.patch
@@ -0,0 +1,425 @@
+Revert the following commit:
+
+
+commit cc6c0b2a9e1dbc96f3ebed713dc71960a29dc4f1
+Author: Ian Kilpatrick <ikilpatrick@chromium.org>
+Date: Tue Mar 5 20:27:13 2024 +0000
+
+ Reland "[gc] Make FontFamily immutable."
+
+ This reverts commit 748ed11510ec5bb09cc8b92f67f1f62964f023fa.
+
+ Reason for revert: Previous patch which caused MSAN issue was reapplied.
+
+ Original change's description:
+ > Revert "[gc] Make FontFamily immutable."
+ >
+ > This reverts commit ca3d3085d8b01fc74623d639c615fc57842cd26d.
+ >
+ > Reason for revert: crrev.com/c/5328767 is the reason for failure on some tests on MSAN. Please see crbug.com/327969288 for more details.
+ >
+ > Original change's description:
+ > > [gc] Make FontFamily immutable.
+ > >
+ > > Previously we'd build up font-family lists front to back, but would
+ > > need to mutate them to do so. Instead just build them backwards.
+ > >
+ > > This removes a bunch of problematic APIs (like AppendFamily - which
+ > > doesn't append), and simplifies the code.
+ > >
+ > > This will help avoid atomic write barriers once converted to oilpan.
+ > >
+ > > Bug: 41490008
+ > > Change-Id: Icfcec2d0a1716585cf42985616c02b42b6647943
+ > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5322929
+ > > Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
+ > > Reviewed-by: Dominik Röttsches <drott@chromium.org>
+ > > Cr-Commit-Position: refs/heads/main@{#1267168}
+ >
+ > Bug: 41490008, 327969288
+ > Change-Id: Ic69a5707d00cc98b97dcae3f4b8207b452ce5cbd
+ > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5333950
+ > Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
+ > Commit-Queue: Taiyo Mizuhashi <taiyo@chromium.org>
+ > Owners-Override: Taiyo Mizuhashi <taiyo@chromium.org>
+ > Cr-Commit-Position: refs/heads/main@{#1267674}
+
+ Bug: 41490008, 327969288
+ Change-Id: If1d395e324b0be15488ef5410e9bcdb219bb19c6
+ Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5344844
+ Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
+ Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
+ Cr-Commit-Position: refs/heads/main@{#1268654}
+
+--- a/third_party/blink/renderer/core/css/css_font_face.cc
++++ b/third_party/blink/renderer/core/css/css_font_face.cc
+@@ -216,8 +216,9 @@ bool CSSFontFace::MaybeLoadFont(const Fo
+
+ void CSSFontFace::Load() {
+ FontDescription font_description;
+- font_description.SetFamily(
+- FontFamily(font_face_->family(), FontFamily::Type::kFamilyName));
++ FontFamily font_family;
++ font_family.SetFamily(font_face_->family(), FontFamily::Type::kFamilyName);
++ font_description.SetFamily(font_family);
+ Load(font_description);
+ }
+
+--- a/third_party/blink/renderer/core/css/font_face_set_document.cc
++++ b/third_party/blink/renderer/core/css/font_face_set_document.cc
+@@ -195,10 +195,13 @@ bool FontFaceSetDocument::ResolveFontSty
+ ComputedStyleBuilder builder =
+ GetDocument()->GetStyleResolver().CreateComputedStyleBuilder();
+
+- FontDescription default_font_description;
+- default_font_description.SetFamily(FontFamily(
++ FontFamily font_family;
++ font_family.SetFamily(
+ FontFaceSet::DefaultFontFamily(),
+- FontFamily::InferredTypeFor(FontFaceSet::DefaultFontFamily())));
++ FontFamily::InferredTypeFor(FontFaceSet::DefaultFontFamily()));
++
++ FontDescription default_font_description;
++ default_font_description.SetFamily(font_family);
+ default_font_description.SetSpecifiedSize(FontFaceSet::kDefaultFontSize);
+ default_font_description.SetComputedSize(FontFaceSet::kDefaultFontSize);
+
+--- a/third_party/blink/renderer/core/css/font_face_set_worker.cc
++++ b/third_party/blink/renderer/core/css/font_face_set_worker.cc
+@@ -84,10 +84,13 @@ bool FontFaceSetWorker::ResolveFontStyle
+ return false;
+ }
+
+- FontDescription default_font_description;
+- default_font_description.SetFamily(FontFamily(
++ FontFamily font_family;
++ font_family.SetFamily(
+ FontFaceSet::DefaultFontFamily(),
+- FontFamily::InferredTypeFor(FontFaceSet::DefaultFontFamily())));
++ FontFamily::InferredTypeFor(FontFaceSet::DefaultFontFamily()));
++
++ FontDescription default_font_description;
++ default_font_description.SetFamily(font_family);
+ default_font_description.SetSpecifiedSize(FontFaceSet::kDefaultFontSize);
+ default_font_description.SetComputedSize(FontFaceSet::kDefaultFontSize);
+
+--- a/third_party/blink/renderer/core/css/resolver/font_builder.cc
++++ b/third_party/blink/renderer/core/css/resolver/font_builder.cc
+@@ -54,9 +54,11 @@ void FontBuilder::DidChangeWritingMode()
+ }
+
+ FontFamily FontBuilder::StandardFontFamily() const {
++ FontFamily family;
+ const AtomicString& standard_font_family = StandardFontFamilyName();
+- return FontFamily(standard_font_family,
+- FontFamily::InferredTypeFor(standard_font_family));
++ family.SetFamily(standard_font_family,
++ FontFamily::InferredTypeFor(standard_font_family));
++ return family;
+ }
+
+ AtomicString FontBuilder::StandardFontFamilyName() const {
+--- a/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc
++++ b/third_party/blink/renderer/core/css/resolver/style_builder_converter.cc
+@@ -379,8 +379,8 @@ FontDescription::FamilyDescription Style
+
+ if (const auto* system_font =
+ DynamicTo<cssvalue::CSSPendingSystemFontValue>(value)) {
+- desc.family = FontFamily(system_font->ResolveFontFamily(),
+- FontFamily::Type::kFamilyName);
++ desc.family.SetFamily(system_font->ResolveFontFamily(),
++ FontFamily::Type::kFamilyName);
+ return desc;
+ }
+
+@@ -410,8 +410,10 @@ FontDescription::FamilyDescription Style
+ // Take the previous value and wrap it in a `SharedFontFamily` adding to
+ // the linked list.
+ if (has_value) {
+- next =
+- SharedFontFamily::Create(family_name, family_type, std::move(next));
++ scoped_refptr<SharedFontFamily> shared = SharedFontFamily::Create();
++ shared->SetFamily(family_name, family_type);
++ shared->AppendFamily(next);
++ next = shared;
+ }
+ family_name = next_family_name;
+ family_type = is_generic ? FontFamily::Type::kGenericFamily
+@@ -442,7 +444,8 @@ FontDescription::FamilyDescription Style
+ }
+ #endif
+
+- desc.family = FontFamily(family_name, family_type, std::move(next));
++ desc.family.SetFamily(family_name, family_type);
++ desc.family.AppendFamily(next);
+ return desc;
+ }
+
+--- a/third_party/blink/renderer/core/html/canvas/canvas_font_cache.cc
++++ b/third_party/blink/renderer/core/html/canvas/canvas_font_cache.cc
+@@ -29,9 +29,11 @@ const int defaultFontSize = 10;
+
+ const ComputedStyle* CreateDefaultFontStyle(const Document& document) {
+ const AtomicString& default_font_family = font_family_names::kSansSerif;
++ FontFamily font_family;
++ font_family.SetFamily(default_font_family,
++ FontFamily::InferredTypeFor(default_font_family));
+ FontDescription default_font_description;
+- default_font_description.SetFamily(FontFamily(
+- default_font_family, FontFamily::InferredTypeFor(default_font_family)));
++ default_font_description.SetFamily(font_family);
+ default_font_description.SetSpecifiedSize(defaultFontSize);
+ default_font_description.SetComputedSize(defaultFontSize);
+ ComputedStyleBuilder builder =
+--- a/third_party/blink/renderer/core/page/drag_image.cc
++++ b/third_party/blink/renderer/core/page/drag_image.cc
+@@ -127,9 +127,11 @@ static Font DeriveDragLabelFont(int size
+ const AtomicString& family =
+ LayoutThemeFontProvider::SystemFontFamily(CSSValueID::kNone);
+
++ FontFamily font_family;
++ font_family.SetFamily(family, FontFamily::InferredTypeFor(family));
++
+ FontDescription description;
+- description.SetFamily(
+- FontFamily(family, FontFamily::InferredTypeFor(family)));
++ description.SetFamily(font_family);
+ description.SetWeight(font_weight);
+ description.SetSpecifiedSize(size);
+ description.SetComputedSize(size);
+--- a/third_party/blink/renderer/core/paint/embedded_object_painter.cc
++++ b/third_party/blink/renderer/core/paint/embedded_object_painter.cc
+@@ -32,9 +32,11 @@ static Font ReplacementTextFont(const Do
+ const float size = LayoutThemeFontProvider::SystemFontSize(
+ CSSValueID::kWebkitSmallControl, document);
+
++ FontFamily font_family;
++ font_family.SetFamily(family, FontFamily::InferredTypeFor(family));
++
+ FontDescription font_description;
+- font_description.SetFamily(
+- FontFamily(family, FontFamily::InferredTypeFor(family)));
++ font_description.SetFamily(font_family);
+ font_description.SetWeight(kBoldWeightValue);
+ font_description.SetSpecifiedSize(size);
+ font_description.SetComputedSize(size);
+--- a/third_party/blink/renderer/platform/exported/web_font_description.cc
++++ b/third_party/blink/renderer/platform/exported/web_font_description.cc
+@@ -49,10 +49,13 @@ WebFontDescription::WebFontDescription(c
+ }
+
+ WebFontDescription::operator FontDescription() const {
++ FontFamily font_family;
++ font_family.SetFamily(family, family_is_generic
++ ? FontFamily::Type::kGenericFamily
++ : FontFamily::Type::kFamilyName);
++
+ FontDescription desc;
+- desc.SetFamily(FontFamily(family, family_is_generic
+- ? FontFamily::Type::kGenericFamily
+- : FontFamily::Type::kFamilyName));
++ desc.SetFamily(font_family);
+ desc.SetGenericFamily(
+ static_cast<FontDescription::GenericFamilyType>(generic_family));
+ desc.SetSpecifiedSize(size);
+--- a/third_party/blink/renderer/platform/fonts/font_description.h
++++ b/third_party/blink/renderer/platform/fonts/font_description.h
+@@ -195,6 +195,7 @@ class PLATFORM_EXPORT FontDescription {
+ FamilyDescription GetFamilyDescription() const {
+ return FamilyDescription(GenericFamily(), Family());
+ }
++ FontFamily& FirstFamily() { return family_list_; }
+ const FontFamily& FirstFamily() const { return family_list_; }
+ Size GetSize() const {
+ return Size(KeywordSize(), SpecifiedSize(), IsAbsoluteSize());
+@@ -450,6 +451,10 @@ class PLATFORM_EXPORT FontDescription {
+ return fields_.subpixel_ascent_descent_;
+ }
+
++ void SetHashCategory(HashCategory category) {
++ fields_.hash_category_ = category;
++ }
++
+ HashCategory GetHashCategory() const {
+ return static_cast<HashCategory>(fields_.hash_category_);
+ }
+--- a/third_party/blink/renderer/platform/fonts/font_fallback_list.cc
++++ b/third_party/blink/renderer/platform/fonts/font_fallback_list.cc
+@@ -178,8 +178,9 @@ const FontData* FontFallbackList::GetFon
+
+ if (font_selector_) {
+ // Try the user's preferred standard font.
+- FontFamily font_family(font_family_names::kWebkitStandard,
+- FontFamily::Type::kGenericFamily);
++ FontFamily font_family;
++ font_family.SetFamily(font_family_names::kWebkitStandard,
++ FontFamily::Type::kGenericFamily);
+ if (const FontData* data =
+ font_selector_->GetFontData(font_description, font_family)) {
+ return data;
+--- a/third_party/blink/renderer/platform/fonts/font_family.cc
++++ b/third_party/blink/renderer/platform/fonts/font_family.cc
+@@ -49,6 +49,20 @@ bool operator==(const FontFamily& a, con
+ return true;
+ }
+
++wtf_size_t FontFamily::CountNames() const {
++ wtf_size_t count = 0;
++ for (const FontFamily* font_family = this; font_family;
++ font_family = font_family->Next())
++ ++count;
++ return count;
++}
++
++void FontFamily::AppendFamily(AtomicString family_name, Type family_type) {
++ scoped_refptr<SharedFontFamily> appended_family = SharedFontFamily::Create();
++ appended_family->SetFamily(family_name, family_type);
++ AppendFamily(appended_family);
++}
++
+ String FontFamily::ToString() const {
+ StringBuilder builder;
+ builder.Append(family_name_);
+--- a/third_party/blink/renderer/platform/fonts/font_family.h
++++ b/third_party/blink/renderer/platform/fonts/font_family.h
+@@ -39,18 +39,16 @@ class PLATFORM_EXPORT FontFamily {
+ DISALLOW_NEW();
+
+ public:
+- // https://drafts.csswg.org/css-fonts/#font-family-prop
+- enum class Type : uint8_t { kFamilyName, kGenericFamily };
+-
+- FontFamily(const AtomicString& family_name,
+- Type family_type,
+- scoped_refptr<SharedFontFamily> next = nullptr)
+- : family_name_(family_name),
+- next_(std::move(next)),
+- family_type_(family_type) {}
+ FontFamily() = default;
+ ~FontFamily();
+
++ // https://drafts.csswg.org/css-fonts/#font-family-prop
++ enum class Type : uint8_t { kFamilyName, kGenericFamily };
++
++ void SetFamily(const AtomicString& family_name, Type family_type) {
++ family_name_ = family_name;
++ family_type_ = family_type;
++ }
+ // Return this font family's name. Note that it is never quoted nor escaped.
+ // For web-exposed serialization, please rely instead on the functions
+ // ComputedStyleUtils::ValueForFontFamily(const FontFamily&) and
+@@ -59,8 +57,13 @@ class PLATFORM_EXPORT FontFamily {
+ const AtomicString& FamilyName() const { return family_name_; }
+ bool FamilyIsGeneric() const { return family_type_ == Type::kGenericFamily; }
+
++ // Returns number of linked `FontFamily` including `this`, so return value is
++ // greater than or equal to 1. When `Next()` is `nullptr`, return value is 1.
++ wtf_size_t CountNames() const;
+ const FontFamily* Next() const;
+
++ void AppendFamily(scoped_refptr<SharedFontFamily>);
++ void AppendFamily(AtomicString family_name, Type family_type);
+ scoped_refptr<SharedFontFamily> ReleaseNext();
+
+ bool IsPrewarmed() const { return is_prewarmed_; }
+@@ -93,19 +96,12 @@ class PLATFORM_EXPORT SharedFontFamily :
+ SharedFontFamily(const SharedFontFamily&) = delete;
+ SharedFontFamily& operator=(const SharedFontFamily&) = delete;
+
+- static scoped_refptr<SharedFontFamily> Create(
+- const AtomicString& family_name,
+- Type family_type,
+- scoped_refptr<SharedFontFamily> next = nullptr) {
+- return base::AdoptRef(
+- new SharedFontFamily(family_name, family_type, std::move(next)));
++ static scoped_refptr<SharedFontFamily> Create() {
++ return base::AdoptRef(new SharedFontFamily);
+ }
+
+ private:
+- SharedFontFamily(const AtomicString& family_name,
+- Type family_type,
+- scoped_refptr<SharedFontFamily> next)
+- : FontFamily(family_name, family_type, std::move(next)) {}
++ SharedFontFamily() = default;
+ };
+
+ PLATFORM_EXPORT bool operator==(const FontFamily&, const FontFamily&);
+@@ -125,6 +121,10 @@ inline const FontFamily* FontFamily::Nex
+ return next_.get();
+ }
+
++inline void FontFamily::AppendFamily(scoped_refptr<SharedFontFamily> family) {
++ next_ = std::move(family);
++}
++
+ inline scoped_refptr<SharedFontFamily> FontFamily::ReleaseNext() {
+ return std::move(next_);
+ }
+--- a/third_party/blink/renderer/platform/graphics/placeholder_image.cc
++++ b/third_party/blink/renderer/platform/graphics/placeholder_image.cc
+@@ -85,18 +85,23 @@ void DrawCenteredIcon(cc::PaintCanvas* c
+ }
+
+ FontDescription CreatePlaceholderFontDescription(float scale_factor) {
+- scoped_refptr<SharedFontFamily> arial = SharedFontFamily::Create(
+- font_family_names::kArial, FontFamily::Type::kFamilyName);
+- scoped_refptr<SharedFontFamily> helvetica = SharedFontFamily::Create(
+- font_family_names::kHelvetica, FontFamily::Type::kFamilyName, arial);
+- scoped_refptr<SharedFontFamily> helvetica_neue =
+- SharedFontFamily::Create(font_family_names::kHelveticaNeue,
+- FontFamily::Type::kFamilyName, helvetica);
+- FontFamily roboto(font_family_names::kRoboto, FontFamily::Type::kFamilyName,
+- helvetica_neue);
+-
+ FontDescription description;
+- description.SetFamily(roboto);
++ description.FirstFamily().SetFamily(font_family_names::kRoboto,
++ FontFamily::Type::kFamilyName);
++
++ scoped_refptr<SharedFontFamily> helvetica_neue = SharedFontFamily::Create();
++ helvetica_neue->SetFamily(font_family_names::kHelveticaNeue,
++ FontFamily::Type::kFamilyName);
++ scoped_refptr<SharedFontFamily> helvetica = SharedFontFamily::Create();
++ helvetica->SetFamily(font_family_names::kHelvetica,
++ FontFamily::Type::kFamilyName);
++ scoped_refptr<SharedFontFamily> arial = SharedFontFamily::Create();
++ arial->SetFamily(font_family_names::kArial, FontFamily::Type::kFamilyName);
++
++ helvetica->AppendFamily(std::move(arial));
++ helvetica_neue->AppendFamily(std::move(helvetica));
++ description.FirstFamily().AppendFamily(std::move(helvetica_neue));
++
+ description.SetGenericFamily(FontDescription::kSansSerifFamily);
+ description.SetComputedSize(scale_factor * kFontSize);
+ description.SetWeight(FontSelectionValue(500));
+--- a/third_party/blink/renderer/platform/testing/font_test_helpers.cc
++++ b/third_party/blink/renderer/platform/testing/font_test_helpers.cc
+@@ -127,9 +127,11 @@ Font CreateTestFont(const AtomicString&
+ size_t data_size,
+ float size,
+ const FontDescription::VariantLigatures* ligatures) {
++ FontFamily family;
++ family.SetFamily(family_name, FontFamily::Type::kFamilyName);
++
+ FontDescription font_description;
+- font_description.SetFamily(
+- FontFamily(family_name, FontFamily::Type::kFamilyName));
++ font_description.SetFamily(family);
+ font_description.SetSpecifiedSize(size);
+ font_description.SetComputedSize(size);
+ if (ligatures)
+@@ -143,9 +145,11 @@ Font CreateTestFont(const AtomicString&
+ float size,
+ const FontDescription::VariantLigatures* ligatures,
+ void (*init_font_description)(FontDescription*)) {
++ FontFamily family;
++ family.SetFamily(family_name, FontFamily::Type::kFamilyName);
++
+ FontDescription font_description;
+- font_description.SetFamily(
+- FontFamily(family_name, FontFamily::Type::kFamilyName));
++ font_description.SetFamily(family);
+ font_description.SetSpecifiedSize(size);
+ font_description.SetComputedSize(size);
+ if (ligatures)
diff --git a/chromium-125-debian-bad-font-gc1.patch b/chromium-125-debian-bad-font-gc1.patch
new file mode 100644
index 0000000..6cbf1c3
--- /dev/null
+++ b/chromium-125-debian-bad-font-gc1.patch
@@ -0,0 +1,258 @@
+This is a revert of the commit below. While it doesn't strictly fix any
+bugs, it's needed to support bad-font-gc2.patch building.
+
+commit 9a8fc2e22363c954af239c06798bf85a9c928295
+Author: Ian Kilpatrick <ikilpatrick@chromium.org>
+Date: Wed Feb 14 19:35:11 2024 +0000
+
+ [gc] Make FontCustomPlatformData gc'd.
+
+ There should be no user-visible behaviour change.
+
+ Bug: 41490008
+ Change-Id: I6364bf4c5b5dce9f99d8e2d7e1f84537c5493c33
+ Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5293060
+ Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
+ Reviewed-by: Dominik Röttsches <drott@chromium.org>
+ Cr-Commit-Position: refs/heads/main@{#1260637}
+
+--- a/third_party/blink/renderer/core/css/binary_data_font_face_source.cc
++++ b/third_party/blink/renderer/core/css/binary_data_font_face_source.cc
+@@ -27,16 +27,13 @@ BinaryDataFontFaceSource::BinaryDataFont
+ return;
+ }
+ probe::FontsUpdated(context, font_face, String(),
+- custom_platform_data_.Get());
++ custom_platform_data_.get());
+ }
+
+-void BinaryDataFontFaceSource::Trace(Visitor* visitor) const {
+- visitor->Trace(custom_platform_data_);
+- CSSFontFaceSource::Trace(visitor);
+-}
++BinaryDataFontFaceSource::~BinaryDataFontFaceSource() = default;
+
+ bool BinaryDataFontFaceSource::IsValid() const {
+- return custom_platform_data_;
++ return custom_platform_data_.get();
+ }
+
+ SimpleFontData* BinaryDataFontFaceSource::CreateFontData(
+--- a/third_party/blink/renderer/core/css/binary_data_font_face_source.h
++++ b/third_party/blink/renderer/core/css/binary_data_font_face_source.h
+@@ -16,14 +16,14 @@ class FontCustomPlatformData;
+ class BinaryDataFontFaceSource final : public CSSFontFaceSource {
+ public:
+ BinaryDataFontFaceSource(CSSFontFace*, SharedBuffer*, String&);
+- void Trace(Visitor*) const override;
++ ~BinaryDataFontFaceSource() override;
+ bool IsValid() const override;
+
+ private:
+ SimpleFontData* CreateFontData(const FontDescription&,
+ const FontSelectionCapabilities&) override;
+
+- Member<const FontCustomPlatformData> custom_platform_data_;
++ scoped_refptr<FontCustomPlatformData> custom_platform_data_;
+ };
+
+ } // namespace blink
+--- a/third_party/blink/renderer/core/css/remote_font_face_source.cc
++++ b/third_party/blink/renderer/core/css/remote_font_face_source.cc
+@@ -262,7 +262,7 @@ void RemoteFontFaceSource::NotifyFinishe
+ FontInvalidationReason::kFontFaceLoaded);
+ if (custom_font_data_) {
+ probe::FontsUpdated(execution_context, face_->GetFontFace(),
+- resource->Url().GetString(), custom_font_data_.Get());
++ resource->Url().GetString(), custom_font_data_.get());
+ }
+ }
+ }
+@@ -456,7 +456,6 @@ void RemoteFontFaceSource::BeginLoadIfNe
+ void RemoteFontFaceSource::Trace(Visitor* visitor) const {
+ visitor->Trace(face_);
+ visitor->Trace(font_selector_);
+- visitor->Trace(custom_font_data_);
+ CSSFontFaceSource::Trace(visitor);
+ FontResourceClient::Trace(visitor);
+ }
+--- a/third_party/blink/renderer/core/css/remote_font_face_source.h
++++ b/third_party/blink/renderer/core/css/remote_font_face_source.h
+@@ -43,7 +43,7 @@ class RemoteFontFaceSource final : publi
+ bool IsPendingDataUrl() const override;
+
+ const FontCustomPlatformData* GetCustomPlaftormData() const override {
+- return custom_font_data_.Get();
++ return custom_font_data_.get();
+ }
+
+ void BeginLoadIfNeeded() override;
+@@ -157,7 +157,7 @@ class RemoteFontFaceSource final : publi
+ Member<FontSelector> font_selector_;
+
+ // |nullptr| if font is not loaded or failed to decode.
+- Member<const FontCustomPlatformData> custom_font_data_;
++ scoped_refptr<FontCustomPlatformData> custom_font_data_;
+ // |nullptr| if font is not loaded or failed to decode.
+ String url_;
+
+--- a/third_party/blink/renderer/core/loader/resource/font_resource.cc
++++ b/third_party/blink/renderer/core/loader/resource/font_resource.cc
+@@ -112,7 +112,7 @@ void FontResource::StartLoadLimitTimersI
+ kFontLoadWaitLong);
+ }
+
+-const FontCustomPlatformData* FontResource::GetCustomFontData() {
++scoped_refptr<FontCustomPlatformData> FontResource::GetCustomFontData() {
+ if (!font_data_ && !ErrorOccurred() && !IsLoading()) {
+ if (Data()) {
+ auto decode_start_time = base::TimeTicks::Now();
+@@ -225,7 +225,6 @@ void FontResource::AddClearDataObserver(
+ }
+
+ void FontResource::Trace(Visitor* visitor) const {
+- visitor->Trace(font_data_);
+ visitor->Trace(clear_data_observers_);
+ Resource::Trace(visitor);
+ }
+--- a/third_party/blink/renderer/core/loader/resource/font_resource.h
++++ b/third_party/blink/renderer/core/loader/resource/font_resource.h
+@@ -72,7 +72,7 @@ class CORE_EXPORT FontResource final : p
+
+ String OtsParsingMessage() const { return ots_parsing_message_; }
+
+- const FontCustomPlatformData* GetCustomFontData();
++ scoped_refptr<FontCustomPlatformData> GetCustomFontData();
+
+ // Returns true if the loading priority of the remote font resource can be
+ // lowered. The loading priority of the font can be lowered only if the
+@@ -112,7 +112,7 @@ class CORE_EXPORT FontResource final : p
+ kMaxValue = kLongLimitExceeded,
+ };
+
+- Member<FontCustomPlatformData> font_data_;
++ scoped_refptr<FontCustomPlatformData> font_data_;
+ String ots_parsing_message_;
+ LoadLimitState load_limit_state_;
+ bool cors_failed_;
+--- a/third_party/blink/renderer/platform/fonts/font_custom_platform_data.cc
++++ b/third_party/blink/renderer/platform/fonts/font_custom_platform_data.cc
+@@ -115,7 +115,7 @@ const FontPlatformData* FontCustomPlatfo
+ const ResolvedFontFeatures& resolved_font_features,
+ FontOrientation orientation,
+ const FontVariationSettings* variation_settings,
+- const FontPalette* palette) const {
++ const FontPalette* palette) {
+ DCHECK(base_typeface_);
+
+ sk_sp<SkTypeface> return_typeface = base_typeface_;
+@@ -304,7 +304,7 @@ String FontCustomPlatformData::FamilyNam
+ localized_string.fString.size());
+ }
+
+-FontCustomPlatformData* FontCustomPlatformData::Create(
++scoped_refptr<FontCustomPlatformData> FontCustomPlatformData::Create(
+ SharedBuffer* buffer,
+ String& ots_parse_message) {
+ DCHECK(buffer);
+@@ -321,8 +321,8 @@ FontCustomPlatformData* FontCustomPlatfo
+ if (v8::Isolate* isolate = v8::Isolate::TryGetCurrent()) {
+ isolate->AdjustAmountOfExternalAllocatedMemory(data_size);
+ }
+- return MakeGarbageCollected<FontCustomPlatformData>(std::move(typeface),
+- data_size);
++ return base::AdoptRef(
++ new FontCustomPlatformData(std::move(typeface), data_size));
+ }
+
+ bool FontCustomPlatformData::MayBeIconFont() const {
+--- a/third_party/blink/renderer/platform/fonts/font_custom_platform_data.h
++++ b/third_party/blink/renderer/platform/fonts/font_custom_platform_data.h
+@@ -39,7 +39,6 @@
+ #include "third_party/blink/renderer/platform/fonts/opentype/variable_axes_names.h"
+ #include "third_party/blink/renderer/platform/fonts/resolved_font_features.h"
+ #include "third_party/blink/renderer/platform/fonts/text_rendering_mode.h"
+-#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
+ #include "third_party/blink/renderer/platform/platform_export.h"
+ #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
+ #include "third_party/blink/renderer/platform/wtf/forward.h"
+@@ -55,17 +54,16 @@ class FontPlatformData;
+ class FontVariationSettings;
+
+ class PLATFORM_EXPORT FontCustomPlatformData
+- : public GarbageCollected<FontCustomPlatformData> {
++ : public RefCounted<FontCustomPlatformData> {
++ USING_FAST_MALLOC(FontCustomPlatformData);
++
+ public:
+- static FontCustomPlatformData* Create(SharedBuffer*,
+- String& ots_parse_message);
+- FontCustomPlatformData(sk_sp<SkTypeface>, size_t data_size);
++ static scoped_refptr<FontCustomPlatformData> Create(SharedBuffer*,
++ String& ots_parse_message);
+ FontCustomPlatformData(const FontCustomPlatformData&) = delete;
+ FontCustomPlatformData& operator=(const FontCustomPlatformData&) = delete;
+ ~FontCustomPlatformData();
+
+- void Trace(Visitor*) const {}
+-
+ // The size argument should come from EffectiveFontSize() and
+ // adjusted_specified_size should come from AdjustedSpecifiedSize() of
+ // FontDescription. The latter is needed for correctly applying
+@@ -82,7 +80,7 @@ class PLATFORM_EXPORT FontCustomPlatform
+ const ResolvedFontFeatures& resolved_font_features,
+ FontOrientation = FontOrientation::kHorizontal,
+ const FontVariationSettings* = nullptr,
+- const FontPalette* = nullptr) const;
++ const FontPalette* = nullptr);
+
+ String FamilyNameForInspector() const;
+
+@@ -93,6 +91,7 @@ class PLATFORM_EXPORT FontCustomPlatform
+ bool MayBeIconFont() const;
+
+ private:
++ FontCustomPlatformData(sk_sp<SkTypeface>, size_t data_size);
+ sk_sp<SkTypeface> base_typeface_;
+ size_t data_size_;
+
+--- a/third_party/blink/renderer/platform/testing/font_test_helpers.cc
++++ b/third_party/blink/renderer/platform/testing/font_test_helpers.cc
+@@ -29,7 +29,7 @@ class TestFontSelector : public FontSele
+ static TestFontSelector* Create(const uint8_t* data, size_t size) {
+ scoped_refptr<SharedBuffer> font_buffer = SharedBuffer::Create(data, size);
+ String ots_parse_message;
+- FontCustomPlatformData* font_custom_platform_data =
++ scoped_refptr<FontCustomPlatformData> font_custom_platform_data =
+ FontCustomPlatformData::Create(font_buffer.get(), ots_parse_message);
+ if (!font_custom_platform_data)
+ return nullptr;
+@@ -37,17 +37,12 @@ class TestFontSelector : public FontSele
+ std::move(font_custom_platform_data));
+ }
+
+- TestFontSelector(FontCustomPlatformData* custom_platform_data)
+- : custom_platform_data_(custom_platform_data) {
++ TestFontSelector(scoped_refptr<FontCustomPlatformData> custom_platform_data)
++ : custom_platform_data_(std::move(custom_platform_data)) {
+ DCHECK(custom_platform_data_);
+ }
+ ~TestFontSelector() override = default;
+
+- void Trace(Visitor* visitor) const override {
+- visitor->Trace(custom_platform_data_);
+- FontSelector::Trace(visitor);
+- }
+-
+ FontData* GetFontData(const FontDescription& font_description,
+ const FontFamily&) override {
+ FontSelectionCapabilities normal_capabilities(
+@@ -117,7 +112,7 @@ class TestFontSelector : public FontSele
+ }
+
+ private:
+- Member<FontCustomPlatformData> custom_platform_data_;
++ scoped_refptr<FontCustomPlatformData> custom_platform_data_;
+ };
+
+ } // namespace
diff --git a/chromium-125-debian-bad-font-gc11.patch b/chromium-125-debian-bad-font-gc11.patch
new file mode 100644
index 0000000..da30199
--- /dev/null
+++ b/chromium-125-debian-bad-font-gc11.patch
@@ -0,0 +1,420 @@
+Revert the following commit:
+
+commit 2eefeabb12fb7e92f2508116a5ed959c57659be1
+Author: Ian Kilpatrick <ikilpatrick@chromium.org>
+Date: Tue Feb 20 17:40:39 2024 +0000
+
+ [gc] Make HarfBuzzFontData & friends gc'd.
+
+ Previously we had a HbFontCacheEntry which was used to hold onto the
+ HarfBuzzFontData, and a hb_font_t.
+
+ HarfBuzzFontData is used for holding data specific for various
+ harfbuzz callbacks, but we can also hold onto the hb_font_t there.
+
+ There should be no user-visible behaviour change.
+
+ Bug: 41490008
+ Change-Id: Icaa7ad3b2f75e9807b88014a9a15406cb76eb52e
+ Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5302175
+ Reviewed-by: Dominik Röttsches <drott@chromium.org>
+ Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
+ Cr-Commit-Position: refs/heads/main@{#1262752}
+
+--- a/third_party/blink/renderer/platform/fonts/font_global_context.cc
++++ b/third_party/blink/renderer/platform/fonts/font_global_context.cc
+@@ -8,6 +8,7 @@
+ #include "third_party/blink/renderer/platform/fonts/font_cache.h"
+ #include "third_party/blink/renderer/platform/fonts/font_unique_name_lookup.h"
+ #include "third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.h"
++#include "third_party/blink/renderer/platform/fonts/shaping/harfbuzz_font_cache.h"
+ #include "third_party/blink/renderer/platform/privacy_budget/identifiability_digest_helpers.h"
+ #include "third_party/blink/renderer/platform/wtf/thread_specific.h"
+
+@@ -50,6 +51,15 @@ FontUniqueNameLookup* FontGlobalContext:
+ return Get().font_unique_name_lookup_.get();
+ }
+
++HarfBuzzFontCache& FontGlobalContext::GetHarfBuzzFontCache() {
++ std::unique_ptr<HarfBuzzFontCache>& global_context_harfbuzz_font_cache =
++ Get().harfbuzz_font_cache_;
++ if (!global_context_harfbuzz_font_cache) {
++ global_context_harfbuzz_font_cache = std::make_unique<HarfBuzzFontCache>();
++ }
++ return *global_context_harfbuzz_font_cache;
++}
++
+ IdentifiableToken FontGlobalContext::GetOrComputeTypefaceDigest(
+ const FontPlatformData& source) {
+ SkTypeface* typeface = source.Typeface();
+--- a/third_party/blink/renderer/platform/fonts/font_global_context.h
++++ b/third_party/blink/renderer/platform/fonts/font_global_context.h
+@@ -9,7 +9,6 @@
+ #include "base/types/pass_key.h"
+ #include "third_party/blink/public/common/privacy_budget/identifiable_token.h"
+ #include "third_party/blink/renderer/platform/fonts/font_cache.h"
+-#include "third_party/blink/renderer/platform/fonts/shaping/harfbuzz_font_cache.h"
+ #include "third_party/blink/renderer/platform/platform_export.h"
+ #include "third_party/blink/renderer/platform/text/layout_locale.h"
+ #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
+@@ -34,19 +33,14 @@ class PLATFORM_EXPORT FontGlobalContext
+ static FontGlobalContext& Get();
+ static FontGlobalContext* TryGet();
+
+- void Trace(Visitor* visitor) const {
+- visitor->Trace(font_cache_);
+- visitor->Trace(harfbuzz_font_cache_);
+- }
++ void Trace(Visitor* visitor) const { visitor->Trace(font_cache_); }
+
+ FontGlobalContext(const FontGlobalContext&) = delete;
+ FontGlobalContext& operator=(const FontGlobalContext&) = delete;
+
+ static inline FontCache& GetFontCache() { return Get().font_cache_; }
+
+- static HarfBuzzFontCache& GetHarfBuzzFontCache() {
+- return Get().harfbuzz_font_cache_;
+- }
++ static HarfBuzzFontCache& GetHarfBuzzFontCache();
+
+ static FontUniqueNameLookup* GetFontUniqueNameLookup();
+
+@@ -62,7 +56,7 @@ class PLATFORM_EXPORT FontGlobalContext
+
+ private:
+ FontCache font_cache_;
+- HarfBuzzFontCache harfbuzz_font_cache_;
++ std::unique_ptr<HarfBuzzFontCache> harfbuzz_font_cache_;
+ std::unique_ptr<FontUniqueNameLookup> font_unique_name_lookup_;
+ base::HashingLRUCache<SkTypefaceID, IdentifiableToken> typeface_digest_cache_;
+ base::HashingLRUCache<SkTypefaceID, IdentifiableToken>
+--- a/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.cc
++++ b/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.cc
+@@ -65,14 +65,20 @@
+
+ HarfBuzzFace::HarfBuzzFace(const FontPlatformData* platform_data,
+ uint64_t unique_id)
+- : platform_data_(platform_data),
+- harfbuzz_font_data_(FontGlobalContext::GetHarfBuzzFontCache().GetOrCreate(
+- unique_id,
+- platform_data)) {}
++ : platform_data_(platform_data), unique_id_(unique_id) {
++ HbFontCacheEntry* const cache_entry =
++ FontGlobalContext::GetHarfBuzzFontCache().RefOrNew(unique_id_,
++ platform_data);
++ unscaled_font_ = cache_entry->HbFont();
++ harfbuzz_font_data_ = cache_entry->HbFontData();
++}
++
++HarfBuzzFace::~HarfBuzzFace() {
++ FontGlobalContext::GetHarfBuzzFontCache().Remove(unique_id_);
++}
+
+ void HarfBuzzFace::Trace(Visitor* visitor) const {
+ visitor->Trace(platform_data_);
+- visitor->Trace(harfbuzz_font_data_);
+ }
+
+ bool HarfBuzzFace::ignore_variation_selectors_ = false;
+@@ -234,17 +240,14 @@ bool HarfBuzzFace::HasSpaceInLigaturesOr
+
+ hb::unique_ptr<hb_set_t> glyphs(hb_set_create());
+
+- hb_font_t* unscaled_font = harfbuzz_font_data_->unscaled_font_.get();
+-
+ // Check whether computing is needed and compute for gpos/gsub.
+ if (features & kKerning &&
+ harfbuzz_font_data_->space_in_gpos_ ==
+ HarfBuzzFontData::SpaceGlyphInOpenTypeTables::kUnknown) {
+- if (space == kInvalidCodepoint && !GetSpaceGlyph(unscaled_font, space)) {
++ if (space == kInvalidCodepoint && !GetSpaceGlyph(unscaled_font_, space))
+ return false;
+- }
+ // Compute for gpos.
+- hb_face_t* face = hb_font_get_face(unscaled_font);
++ hb_face_t* face = hb_font_get_face(unscaled_font_);
+ DCHECK(face);
+ harfbuzz_font_data_->space_in_gpos_ =
+ hb_ot_layout_has_positioning(face) &&
+@@ -258,11 +261,10 @@ bool HarfBuzzFace::HasSpaceInLigaturesOr
+ if (features & kLigatures &&
+ harfbuzz_font_data_->space_in_gsub_ ==
+ HarfBuzzFontData::SpaceGlyphInOpenTypeTables::kUnknown) {
+- if (space == kInvalidCodepoint && !GetSpaceGlyph(unscaled_font, space)) {
++ if (space == kInvalidCodepoint && !GetSpaceGlyph(unscaled_font_, space))
+ return false;
+- }
+ // Compute for gpos.
+- hb_face_t* face = hb_font_get_face(unscaled_font);
++ hb_face_t* face = hb_font_get_face(unscaled_font_);
+ DCHECK(face);
+ harfbuzz_font_data_->space_in_gsub_ =
+ hb_ot_layout_has_substitution(face) &&
+@@ -280,14 +282,14 @@ bool HarfBuzzFace::HasSpaceInLigaturesOr
+ }
+
+ unsigned HarfBuzzFace::UnitsPerEmFromHeadTable() {
+- hb_face_t* face = hb_font_get_face(harfbuzz_font_data_->unscaled_font_.get());
++ hb_face_t* face = hb_font_get_face(unscaled_font_);
+ return hb_face_get_upem(face);
+ }
+
+ Glyph HarfBuzzFace::HbGlyphForCharacter(UChar32 character) {
+ hb_codepoint_t glyph = 0;
+- HarfBuzzGetNominalGlyph(harfbuzz_font_data_->unscaled_font_.get(),
+- harfbuzz_font_data_, character, &glyph, nullptr);
++ HarfBuzzGetNominalGlyph(unscaled_font_, harfbuzz_font_data_, character,
++ &glyph, nullptr);
+ return glyph;
+ }
+
+@@ -329,7 +331,7 @@ hb_codepoint_t HarfBuzzFace::HarfBuzzGet
+ UChar32 variation_selector) {
+ DCHECK(RuntimeEnabledFeatures::FontVariationSequencesEnabled());
+ hb_codepoint_t glyph = 0;
+- HarfBuzzGetGlyph(harfbuzz_font_data_->unscaled_font_.get(),
++ HarfBuzzGetGlyph(unscaled_font_,
+ harfbuzz_font_data_, character, variation_selector, &glyph,
+ nullptr);
+ return glyph;
+@@ -444,10 +446,9 @@ static hb::unique_ptr<hb_face_t> CreateF
+ return face;
+ }
+
+-namespace {
+-
+-HarfBuzzFontData* CreateHarfBuzzFontData(hb_face_t* face,
+- SkTypeface* typeface) {
++static scoped_refptr<HbFontCacheEntry> CreateHbFontCacheEntry(
++ hb_face_t* face,
++ SkTypeface* typeface) {
+ hb::unique_ptr<hb_font_t> ot_font(hb_font_create(face));
+ hb_ot_font_set_funcs(ot_font.get());
+
+@@ -466,26 +467,25 @@ HarfBuzzFontData* CreateHarfBuzzFontData
+ // Creating a sub font means that non-available functions
+ // are found from the parent.
+ hb_font_t* const unscaled_font = hb_font_create_sub_font(ot_font.get());
+- HarfBuzzFontData* data =
+- MakeGarbageCollected<HarfBuzzFontData>(unscaled_font);
++ scoped_refptr<HbFontCacheEntry> cache_entry =
++ HbFontCacheEntry::Create(unscaled_font);
+ hb_font_set_funcs(unscaled_font,
+- HarfBuzzSkiaFontFuncs::Get().GetFunctions(typeface), data,
+- nullptr);
+- return data;
++ HarfBuzzSkiaFontFuncs::Get().GetFunctions(typeface),
++ cache_entry->HbFontData(), nullptr);
++ return cache_entry;
+ }
+
+-} // namespace
+-
+-HarfBuzzFontData* HarfBuzzFontCache::GetOrCreate(
++HbFontCacheEntry* HarfBuzzFontCache::RefOrNew(
+ uint64_t unique_id,
+ const FontPlatformData* platform_data) {
+ const auto& result = font_map_.insert(unique_id, nullptr);
+ if (result.is_new_entry) {
+ hb::unique_ptr<hb_face_t> face = CreateFace(platform_data);
+ result.stored_value->value =
+- CreateHarfBuzzFontData(face.get(), platform_data->Typeface());
++ CreateHbFontCacheEntry(face.get(), platform_data->Typeface());
+ }
+- return result.stored_value->value.Get();
++ result.stored_value->value->AddRef();
++ return result.stored_value->value.get();
+ }
+
+ static_assert(
+@@ -516,18 +516,17 @@ hb_font_t* HarfBuzzFace::GetScaledFont(s
+ vertical_layout);
+
+ int scale = SkiaScalarToHarfBuzzPosition(platform_data_->size());
+- hb_font_t* unscaled_font = harfbuzz_font_data_->unscaled_font_.get();
+- hb_font_set_scale(unscaled_font, scale, scale);
++ hb_font_set_scale(unscaled_font_, scale, scale);
+ // See contended discussion in https://github.com/harfbuzz/harfbuzz/pull/1484
+ // Setting ptem here is critical for HarfBuzz to know where to lookup spacing
+ // offset in the AAT trak table, the unit pt in ptem here means "CoreText"
+ // points. After discussion on the pull request and with Apple developers, the
+ // meaning of HarfBuzz' hb_font_set_ptem API was changed to expect the
+ // equivalent of CSS pixels here.
+- hb_font_set_ptem(unscaled_font, specified_size > 0 ? specified_size
+- : platform_data_->size());
++ hb_font_set_ptem(unscaled_font_, specified_size > 0 ? specified_size
++ : platform_data_->size());
+
+- return unscaled_font;
++ return unscaled_font_;
+ }
+
+ hb_font_t* HarfBuzzFace::GetScaledFont() const {
+--- a/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.h
++++ b/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.h
+@@ -55,6 +55,7 @@ class HarfBuzzFace final : public Garbag
+ HarfBuzzFace(const FontPlatformData* platform_data, uint64_t);
+ HarfBuzzFace(const HarfBuzzFace&) = delete;
+ HarfBuzzFace& operator=(const HarfBuzzFace&) = delete;
++ ~HarfBuzzFace();
+
+ void Trace(Visitor*) const;
+
+@@ -106,7 +106,11 @@
+ void PrepareHarfBuzzFontData();
+
+ Member<const FontPlatformData> platform_data_;
+- Member<HarfBuzzFontData> harfbuzz_font_data_;
++ const uint64_t unique_id_;
++ // TODO(crbug.com/1489080): When briefly given MiraclePtr protection,
++ // these members were both found dangling.
++ hb_font_t* unscaled_font_;
++ HarfBuzzFontData* harfbuzz_font_data_;
+ static bool ignore_variation_selectors_;
+ };
+
+--- a/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_font_cache.cc
++++ b/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_font_cache.cc
+@@ -8,8 +8,38 @@
+
+ namespace blink {
+
+-void HarfBuzzFontCache::Trace(Visitor* visitor) const {
+- visitor->Trace(font_map_);
++HbFontCacheEntry::HbFontCacheEntry(hb_font_t* font)
++ : hb_font_(hb::unique_ptr<hb_font_t>(font)),
++ hb_font_data_(std::make_unique<HarfBuzzFontData>()) {}
++
++HbFontCacheEntry::~HbFontCacheEntry() = default;
++
++scoped_refptr<HbFontCacheEntry> HbFontCacheEntry::Create(hb_font_t* hb_font) {
++ DCHECK(hb_font);
++ return base::AdoptRef(new HbFontCacheEntry(hb_font));
++}
++
++HarfBuzzFontCache::HarfBuzzFontCache() = default;
++HarfBuzzFontCache::~HarfBuzzFontCache() = default;
++
++// See "harfbuzz_face.cc" for |HarfBuzzFontCache::GetOrCreateFontData()|
++// implementation.
++
++void HarfBuzzFontCache::Remove(uint64_t unique_id) {
++ auto it = font_map_.find(unique_id);
++ // TODO(https://crbug.com/1417160): In tests such as FontObjectThreadedTest
++ // that test taking down FontGlobalContext an object may not be found due to
++ // existing issues with refcounting of font objects at thread destruction
++ // time.
++ if (it == font_map_.end()) {
++ return;
++ }
++ DCHECK(!it.Get()->value->HasOneRef());
++ it.Get()->value->Release();
++ if (!it.Get()->value->HasOneRef()) {
++ return;
++ }
++ font_map_.erase(it);
+ }
+
+ } // namespace blink
+--- a/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_font_cache.h
++++ b/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_font_cache.h
+@@ -6,9 +6,12 @@
+ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_SHAPING_HARFBUZZ_FONT_CACHE_H_
+
+ #include "third_party/blink/renderer/platform/fonts/font_metrics.h"
+-#include "third_party/blink/renderer/platform/heap/collection_support/heap_hash_map.h"
+-#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
+-#include "third_party/blink/renderer/platform/heap/member.h"
++#include "third_party/blink/renderer/platform/fonts/unicode_range_set.h"
++
++#include <hb.h>
++#include <hb-cplusplus.hh>
++
++#include <memory>
+
+ namespace blink {
+
+@@ -22,21 +25,39 @@ struct HarfBuzzFontData;
+ // FIXME, crbug.com/609099: We should fix the FontCache to only keep one
+ // FontPlatformData object independent of size, then consider using this here.
+
+-class HarfBuzzFontCache final {
+- DISALLOW_NEW();
++class HbFontCacheEntry : public RefCounted<HbFontCacheEntry> {
++ USING_FAST_MALLOC(HbFontCacheEntry);
++
++ public:
++ static scoped_refptr<HbFontCacheEntry> Create(hb_font_t* hb_font);
++
++ hb_font_t* HbFont() { return hb_font_.get(); }
++ HarfBuzzFontData* HbFontData() { return hb_font_data_.get(); }
++
++ ~HbFontCacheEntry();
+
++ private:
++ explicit HbFontCacheEntry(hb_font_t* font);
++
++ hb::unique_ptr<hb_font_t> hb_font_;
++ std::unique_ptr<HarfBuzzFontData> hb_font_data_;
++};
++
++class HarfBuzzFontCache final {
+ public:
+- void Trace(Visitor* visitor) const;
+- // See "harfbuzz_face.cc" for |HarfBuzzFontCache::GetOrCreateFontData()|
+- // implementation.
+- HarfBuzzFontData* GetOrCreate(uint64_t unique_id,
+- const FontPlatformData* platform_data);
++ HarfBuzzFontCache();
++ ~HarfBuzzFontCache();
++
++ HbFontCacheEntry* RefOrNew(uint64_t unique_id,
++ const FontPlatformData* platform_data);
++ void Remove(uint64_t unique_id);
+
+ private:
+- HeapHashMap<uint64_t,
+- WeakMember<HarfBuzzFontData>,
+- IntWithZeroKeyHashTraits<uint64_t>>
+- font_map_;
++ using HbFontDataMap = HashMap<uint64_t,
++ scoped_refptr<HbFontCacheEntry>,
++ IntWithZeroKeyHashTraits<uint64_t>>;
++
++ HbFontDataMap font_map_;
+ };
+
+ } // namespace blink
+--- a/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_font_data.h
++++ b/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_font_data.h
+@@ -22,18 +22,15 @@ const unsigned kInvalidFallbackMetricsVa
+ // The HarfBuzzFontData struct carries user-pointer data for
+ // |hb_font_t| callback functions/operations. It contains metrics and OpenType
+ // layout information related to a font scaled to a particular size.
+-struct HarfBuzzFontData final : public GarbageCollected<HarfBuzzFontData> {
++struct HarfBuzzFontData final {
++ USING_FAST_MALLOC(HarfBuzzFontData);
++
+ public:
+- explicit HarfBuzzFontData(hb_font_t* unscaled_font)
+- : unscaled_font_(hb::unique_ptr<hb_font_t>(unscaled_font)),
+- vertical_data_(nullptr),
+- range_set_(nullptr) {}
++ HarfBuzzFontData() : vertical_data_(nullptr), range_set_(nullptr) {}
+
+ HarfBuzzFontData(const HarfBuzzFontData&) = delete;
+ HarfBuzzFontData& operator=(const HarfBuzzFontData&) = delete;
+
+- void Trace(Visitor*) const {}
+-
+ // The vertical origin and vertical advance functions in HarfBuzzFace require
+ // the ascent and height metrics as fallback in case no specific vertical
+ // layout information is found from the font.
+@@ -81,7 +78,6 @@ struct HarfBuzzFontData final : public G
+ return vertical_data_;
+ }
+
+- const hb::unique_ptr<hb_font_t> unscaled_font_;
+ SkFont font_;
+
+ // Capture these scaled fallback metrics from FontPlatformData so that a
diff --git a/chromium-125-debian-bad-font-gc2.patch b/chromium-125-debian-bad-font-gc2.patch
new file mode 100644
index 0000000..b718479
--- /dev/null
+++ b/chromium-125-debian-bad-font-gc2.patch
@@ -0,0 +1,3727 @@
+Chromium 123 was buggy, with tabs regularly hanging/crashing. The culprit
+was the GC cleaning up font cache stuff, and deadlocking in a FontCacheKey
+destructor:
+
+Thread 54 (Thread 0x7fffc55fe6c0 (LWP 413811) "Chrome_InProcRe"):
+#0 0x00007ffff6720719 in syscall () from /lib/x86_64-linux-gnu/libc.so.6
+#1 0x000055555c1752d9 in partition_alloc::internal::SpinningMutex::LockSlow() ()
+#2 0x000055555c185529 in allocator_shim::internal::PartitionFree(allocator_shim::AllocatorDispatch const*, void*, void*) ()
+#3 0x000055555f7db46b in blink::FontCacheKey::~FontCacheKey() ()
+#4 0x000055555f7db6f4 in WTF::WeakProcessingHashTableHelper<(WTF::WeakHandlingFlag)1, blink::FontCacheKey, WTF::KeyValuePair<blink::FontCacheKey, cppgc::internal::BasicMember<blink::SegmentedFontData const, cppgc::internal::WeakMemberTag, cppgc::internal::DijkstraWriteBarrierPolicy, cppgc::internal::DisabledCheckingPolicy, cppgc::internal::CompressedPointer> >, WTF::KeyValuePairExtractor, WTF::HashMapValueTraits<WTF::HashTraits<blink::FontCacheKey>, WTF::HashTraits<cppgc::internal::BasicMember<blink::SegmentedFontData const, cppgc::internal::WeakMemberTag, cppgc::internal::DijkstraWriteBarrierPolicy, cppgc::internal::DisabledCheckingPolicy, cppgc::internal::CompressedPointer> > >, WTF::HashTraits<blink::FontCacheKey>, blink::HeapAllocator>::Process(cppgc::LivenessBroker const&, void const*) ()
+#5 0x0000555559544bef in cppgc::internal::MarkerBase::ProcessWeakness() ()
+#6 0x000055555954487e in cppgc::internal::MarkerBase::LeaveAtomicPause() ()
+#7 0x0000555558e8115a in v8::internal::CppHeap::FinishMarkingAndStartSweeping() ()
+#8 0x0000555558ebcdc0 in v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::internal::GarbageCollectionReason, char const*) ()
+#9 0x0000555558ecfe14 in v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags)::$_0::operator()() const ()
+#10 0x0000555558ecfb65 in void heap::base::Stack::SetMarkerAndCallbackImpl<v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags)::$_0>(heap::base::Stack*, void*, void const*) ()
+--Type <RET> for more, q to quit, c to continue without paging--
+#11 0x000055555955216b in PushAllRegistersAndIterateStack ()
+#12 0x0000555558eb8c19 in v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) ()
+#13 0x0000555558eba3eb in v8::internal::Heap::FinalizeIncrementalMarkingAtomically(v8::internal::GarbageCollectionReason) ()
+#14 0x0000555558ed20db in v8::internal::IncrementalMarkingJob::Task::RunInternal() ()
+#15 0x000055555c0c49d6 in base::TaskAnnotator::RunTaskImpl(base::PendingTask&) ()
+#16 0x000055555c0daf88 in base::sequence_manager::internal::ThreadControllerImpl::DoWork(base::sequence_manager::internal::ThreadControllerImpl::WorkType) ()
+#17 0x000055555c0c49d6 in base::TaskAnnotator::RunTaskImpl(base::PendingTask&) ()
+#18 0x000055555c0dd8f9 in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl(base::LazyNow*) ()
+#19 0x000055555c0dd3bf in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() ()
+#20 0x000055555c0ddd75 in non-virtual thunk to base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWork() ()
+#21 0x000055555c07eb4f in base::MessagePumpDefault::Run(base::MessagePump::Delegate*) ()
+#22 0x000055555c0de110 in base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run(bool, base::TimeDelta) ()
+#23 0x000055555c0a4c26 in base::RunLoop::Run(base::Location const&) ()
+#24 0x000055555c100155 in base::Thread::Run(base::RunLoop*) ()
+#25 0x000055555c100342 in base::Thread::ThreadMain() ()
+
+
+The commit below modified font stuff to go from using scoped_refptrs to
+getting cleaned up via GC. Reverting it fixes chromium's behavior for us.
+It would be good to get a proper fix for this, but reverting this will
+have to do for now.
+
+
+commit bff9ec6754f7bf97c61d84663ee2ccc5055e9eb3
+Author: Ian Kilpatrick <ikilpatrick@chromium.org>
+Date: Tue Feb 13 19:15:19 2024 +0000
+
+ [gc] Make SimpleFontData & FontPlatformData & friends gc'd.
+
+ The largest change is making the associated caches for these objects
+ weak collections instead of relying on the relatively complex purging
+ logic.
+
+ https://variable-lizards.glitch.me/ appears not to leak.
+
+ There should be no user-visible behaviour change.
+
+ Bug: 41490008
+ Change-Id: Iba581842459cf31f7f4fe60d83665f393a7d06a3
+ Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5262982
+ Reviewed-by: Caleb Raitto <caraitto@chromium.org>
+ Reviewed-by: Dominik Röttsches <drott@chromium.org>
+ Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
+ Cr-Commit-Position: refs/heads/main@{#1259965}
+
+--- a/third_party/blink/renderer/core/css/binary_data_font_face_source.cc
++++ b/third_party/blink/renderer/core/css/binary_data_font_face_source.cc
+@@ -36,10 +36,10 @@ bool BinaryDataFontFaceSource::IsValid()
+ return custom_platform_data_.get();
+ }
+
+-SimpleFontData* BinaryDataFontFaceSource::CreateFontData(
++scoped_refptr<SimpleFontData> BinaryDataFontFaceSource::CreateFontData(
+ const FontDescription& font_description,
+ const FontSelectionCapabilities& font_selection_capabilities) {
+- return MakeGarbageCollected<SimpleFontData>(
++ return SimpleFontData::Create(
+ custom_platform_data_->GetFontPlatformData(
+ font_description.EffectiveFontSize(),
+ font_description.AdjustedSpecifiedSize(),
+@@ -56,7 +56,7 @@ SimpleFontData* BinaryDataFontFaceSource
+ : ResolvedFontFeatures(),
+ font_description.Orientation(), font_description.VariationSettings(),
+ font_description.GetFontPalette()),
+- MakeGarbageCollected<CustomFontData>());
++ CustomFontData::Create());
+ }
+
+ } // namespace blink
+--- a/third_party/blink/renderer/core/css/binary_data_font_face_source.h
++++ b/third_party/blink/renderer/core/css/binary_data_font_face_source.h
+@@ -20,8 +20,9 @@ class BinaryDataFontFaceSource final : p
+ bool IsValid() const override;
+
+ private:
+- SimpleFontData* CreateFontData(const FontDescription&,
+- const FontSelectionCapabilities&) override;
++ scoped_refptr<SimpleFontData> CreateFontData(
++ const FontDescription&,
++ const FontSelectionCapabilities&) override;
+
+ scoped_refptr<FontCustomPlatformData> custom_platform_data_;
+ };
+--- a/third_party/blink/renderer/core/css/css_custom_font_data.h
++++ b/third_party/blink/renderer/core/css/css_custom_font_data.h
+@@ -31,18 +31,13 @@ class CSSCustomFontData final : public C
+ public:
+ enum FallbackVisibility { kInvisibleFallback, kVisibleFallback };
+
+- CSSCustomFontData(CSSFontFaceSource* source, FallbackVisibility visibility)
+- : font_face_source_(source), fallback_visibility_(visibility) {
+- if (source) {
+- is_loading_ = source->IsLoading();
+- }
++ static scoped_refptr<CSSCustomFontData> Create(
++ CSSFontFaceSource* source,
++ FallbackVisibility visibility) {
++ return base::AdoptRef(new CSSCustomFontData(source, visibility));
+ }
+- ~CSSCustomFontData() override = default;
+
+- void Trace(Visitor* visitor) const override {
+- visitor->Trace(font_face_source_);
+- CustomFontData::Trace(visitor);
+- }
++ ~CSSCustomFontData() override = default;
+
+ bool ShouldSkipDrawing() const override {
+ if (font_face_source_) {
+@@ -66,7 +61,16 @@ class CSSCustomFontData final : public C
+ }
+
+ private:
+- Member<CSSFontFaceSource> font_face_source_;
++ CSSCustomFontData(CSSFontFaceSource* source, FallbackVisibility visibility)
++ : font_face_source_(source), fallback_visibility_(visibility) {
++ if (source) {
++ is_loading_ = source->IsLoading();
++ }
++ }
++
++ // TODO(Oilpan): consider moving (Custom)FontFace hierarchy to the heap,
++ // thereby making this reference a Member<>.
++ WeakPersistent<CSSFontFaceSource> font_face_source_;
+ FallbackVisibility fallback_visibility_;
+ mutable bool is_loading_ = false;
+ };
+--- a/third_party/blink/renderer/core/css/css_font_face.cc
++++ b/third_party/blink/renderer/core/css/css_font_face.cc
+@@ -114,7 +114,7 @@ bool CSSFontFace::FallbackVisibilityChan
+ return true;
+ }
+
+-const SimpleFontData* CSSFontFace::GetFontData(
++scoped_refptr<SimpleFontData> CSSFontFace::GetFontData(
+ const FontDescription& font_description) {
+ if (!IsValid()) {
+ return nullptr;
+@@ -140,7 +140,7 @@ const SimpleFontData* CSSFontFace::GetFo
+ return nullptr;
+ }
+
+- if (const SimpleFontData* result =
++ if (scoped_refptr<SimpleFontData> result =
+ source->GetFontData(size_adjusted_description,
+ font_face_->GetFontSelectionCapabilities())) {
+ // The font data here is created using the primary font's description.
+@@ -149,7 +149,7 @@ const SimpleFontData* CSSFontFace::GetFo
+ if (size_adjusted_description.HasSizeAdjust()) {
+ if (auto adjusted_size =
+ FontSizeFunctions::MetricsMultiplierAdjustedFontSize(
+- result, size_adjusted_description)) {
++ result.get(), size_adjusted_description)) {
+ size_adjusted_description.SetAdjustedSize(adjusted_size.value());
+ result =
+ source->GetFontData(size_adjusted_description,
+--- a/third_party/blink/renderer/core/css/css_font_face.h
++++ b/third_party/blink/renderer/core/css/css_font_face.h
+@@ -76,7 +76,7 @@ class CORE_EXPORT CSSFontFace final : pu
+ bool FontLoaded(CSSFontFaceSource*);
+ bool FallbackVisibilityChanged(RemoteFontFaceSource*);
+
+- const SimpleFontData* GetFontData(const FontDescription&);
++ scoped_refptr<SimpleFontData> GetFontData(const FontDescription&);
+
+ FontFace::LoadStatusType LoadStatus() const {
+ return font_face_->LoadStatus();
+--- a/third_party/blink/renderer/core/css/css_font_face_source.cc
++++ b/third_party/blink/renderer/core/css/css_font_face_source.cc
+@@ -31,11 +31,22 @@
+ #include "third_party/blink/renderer/platform/fonts/font_face_creation_params.h"
+ #include "third_party/blink/renderer/platform/fonts/simple_font_data.h"
+
++namespace {
++// An excessive amount of SimpleFontData objects is generated from
++// CSSFontFaceSource if a lot of varying FontDescriptions point to a web
++// font. These FontDescriptions can vary in size, font-feature-settings or
++// font-variation settings. Well known cases are animations of font-variation
++// settings, compare crbug.com/778352. For a start, let's reduce this number to
++// 1024, which is still a large number and should have enough steps for font
++// animations from the same font face source, but avoids unbounded growth.
++const size_t kMaxCachedFontData = 1024;
++} // namespace
++
+ namespace blink {
+
+ CSSFontFaceSource::~CSSFontFaceSource() = default;
+
+-const SimpleFontData* CSSFontFaceSource::GetFontData(
++scoped_refptr<SimpleFontData> CSSFontFaceSource::GetFontData(
+ const FontDescription& font_description,
+ const FontSelectionCapabilities& font_selection_capabilities) {
+ // If the font hasn't loaded or an error occurred, then we've got nothing.
+@@ -53,12 +64,52 @@ const SimpleFontData* CSSFontFaceSource:
+ FontCacheKey key =
+ font_description.CacheKey(FontFaceCreationParams(), is_unique_match);
+
+- auto result = font_data_table_.insert(key, nullptr);
+- if (result.is_new_entry) {
+- result.stored_value->value =
+- CreateFontData(font_description, font_selection_capabilities);
++ // Get or create the font data. Take care to avoid dangling references into
++ // font_data_table_, because it is modified below during pruning.
++ scoped_refptr<SimpleFontData> font_data;
++ {
++ auto* it = font_data_table_.insert(key, nullptr).stored_value;
++ if (!it->value) {
++ it->value = CreateFontData(font_description, font_selection_capabilities);
++ }
++ font_data = it->value;
++ }
++
++ font_cache_key_age.PrependOrMoveToFirst(key);
++ PruneOldestIfNeeded();
++
++ DCHECK_LE(font_data_table_.size(), kMaxCachedFontData);
++ // No release, because fontData is a reference to a RefPtr that is held in the
++ // font_data_table_.
++ return font_data;
++}
++
++void CSSFontFaceSource::PruneOldestIfNeeded() {
++ if (font_cache_key_age.size() > kMaxCachedFontData) {
++ DCHECK_EQ(font_cache_key_age.size() - 1, kMaxCachedFontData);
++ const FontCacheKey& key = font_cache_key_age.back();
++ auto font_data_entry = font_data_table_.Take(key);
++ font_cache_key_age.pop_back();
++ DCHECK_EQ(font_cache_key_age.size(), kMaxCachedFontData);
++ if (font_data_entry && font_data_entry->GetCustomFontData()) {
++ font_data_entry->GetCustomFontData()->ClearFontFaceSource();
++ }
++ }
++}
++
++void CSSFontFaceSource::PruneTable() {
++ if (font_data_table_.empty()) {
++ return;
++ }
++
++ for (const auto& item : font_data_table_) {
++ SimpleFontData* font_data = item.value.get();
++ if (font_data && font_data->GetCustomFontData()) {
++ font_data->GetCustomFontData()->ClearFontFaceSource();
++ }
+ }
+- return result.stored_value->value.Get();
++ font_cache_key_age.clear();
++ font_data_table_.clear();
+ }
+
+ } // namespace blink
+--- a/third_party/blink/renderer/core/css/css_font_face_source.h
++++ b/third_party/blink/renderer/core/css/css_font_face_source.h
+@@ -30,9 +30,7 @@
+ #include "third_party/blink/renderer/core/css/font_display.h"
+ #include "third_party/blink/renderer/platform/fonts/font_cache_key.h"
+ #include "third_party/blink/renderer/platform/fonts/font_selection_types.h"
+-#include "third_party/blink/renderer/platform/heap/collection_support/heap_hash_map.h"
+ #include "third_party/blink/renderer/platform/heap/garbage_collected.h"
+-#include "third_party/blink/renderer/platform/heap/member.h"
+ #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
+ #include "third_party/blink/renderer/platform/wtf/hash_map.h"
+ #include "third_party/blink/renderer/platform/wtf/linked_hash_set.h"
+@@ -71,8 +69,8 @@ class CORE_EXPORT CSSFontFaceSource
+ return nullptr;
+ }
+
+- const SimpleFontData* GetFontData(const FontDescription&,
+- const FontSelectionCapabilities&);
++ scoped_refptr<SimpleFontData> GetFontData(const FontDescription&,
++ const FontSelectionCapabilities&);
+
+ // TODO(https://crbug.com/947461): IsLocalFontAvailable must not have a
+ // FontDescription argument.
+@@ -93,29 +91,28 @@ class CORE_EXPORT CSSFontFaceSource
+ virtual bool HadBlankText() { return false; }
+ virtual void PaintRequested() {}
+
+- virtual void Trace(Visitor* visitor) const {
+- visitor->Trace(font_data_table_);
+- }
++ virtual void Trace(Visitor* visitor) const {}
+
+ protected:
+ CSSFontFaceSource() = default;
+- virtual const SimpleFontData* CreateFontData(
++ virtual scoped_refptr<SimpleFontData> CreateFontData(
+ const FontDescription&,
+ const FontSelectionCapabilities&) = 0;
+-
+- void ClearTable() { font_data_table_.clear(); }
++ void PruneTable();
+
+ // Report the font lookup for metrics collection. Only used for local font
+ // face sources currently.
+ virtual void ReportFontLookup(const FontDescription& font_description,
+- const SimpleFontData* font_data,
++ SimpleFontData* font_data,
+ bool is_loading_fallback = false) {}
+
+ private:
+- using FontDataTable =
+- HeapHashMap<FontCacheKey, WeakMember<const SimpleFontData>>;
++ void PruneOldestIfNeeded();
++ using FontDataTable = HashMap<FontCacheKey, scoped_refptr<SimpleFontData>>;
++ using FontCacheKeyAgeList = LinkedHashSet<FontCacheKey>;
+
+ FontDataTable font_data_table_;
++ FontCacheKeyAgeList font_cache_key_age;
+ };
+
+ } // namespace blink
+--- a/third_party/blink/renderer/core/css/css_font_selector.cc
++++ b/third_party/blink/renderer/core/css/css_font_selector.cc
+@@ -162,7 +162,7 @@ void CSSFontSelector::FontCacheInvalidat
+ DispatchInvalidationCallbacks(FontInvalidationReason::kGeneralInvalidation);
+ }
+
+-const FontData* CSSFontSelector::GetFontData(
++scoped_refptr<FontData> CSSFontSelector::GetFontData(
+ const FontDescription& font_description,
+ const FontFamily& font_family) {
+ const auto& family_name = font_family.FamilyName();
+@@ -252,13 +252,13 @@ const FontData* CSSFontSelector::GetFont
+ family_name, request_description.GetScript(),
+ request_description.GenericFamily(), settings_family_name);
+
+- const SimpleFontData* font_data =
++ scoped_refptr<SimpleFontData> font_data =
+ FontCache::Get().GetFontData(request_description, settings_family_name);
+ if (font_data && request_description.HasSizeAdjust()) {
+ DCHECK(RuntimeEnabledFeatures::CSSFontSizeAdjustEnabled());
+ if (auto adjusted_size =
+ FontSizeFunctions::MetricsMultiplierAdjustedFontSize(
+- font_data, request_description)) {
++ font_data.get(), request_description)) {
+ FontDescription size_adjusted_description(request_description);
+ size_adjusted_description.SetAdjustedSize(adjusted_size.value());
+ font_data = FontCache::Get().GetFontData(size_adjusted_description,
+--- a/third_party/blink/renderer/core/css/css_font_selector.h
++++ b/third_party/blink/renderer/core/css/css_font_selector.h
+@@ -49,8 +49,8 @@ class CORE_EXPORT CSSFontSelector : publ
+
+ unsigned Version() const override { return font_face_cache_->Version(); }
+
+- const FontData* GetFontData(const FontDescription&,
+- const FontFamily&) override;
++ scoped_refptr<FontData> GetFontData(const FontDescription&,
++ const FontFamily&) override;
+
+ void FontFaceInvalidated(FontInvalidationReason) override;
+
+--- a/third_party/blink/renderer/core/css/css_font_selector_base.cc
++++ b/third_party/blink/renderer/core/css/css_font_selector_base.cc
+@@ -87,21 +87,21 @@ void CSSFontSelectorBase::ReportFailedLo
+ void CSSFontSelectorBase::ReportFontLookupByUniqueOrFamilyName(
+ const AtomicString& name,
+ const FontDescription& font_description,
+- const SimpleFontData* resulting_font_data) {
++ scoped_refptr<SimpleFontData> resulting_font_data) {
+ if (FontMatchingMetrics* font_matching_metrics = GetFontMatchingMetrics()) {
+ font_matching_metrics->ReportFontLookupByUniqueOrFamilyName(
+- name, font_description, resulting_font_data);
++ name, font_description, resulting_font_data.get());
+ }
+ }
+
+ void CSSFontSelectorBase::ReportFontLookupByUniqueNameOnly(
+ const AtomicString& name,
+ const FontDescription& font_description,
+- const SimpleFontData* resulting_font_data,
++ scoped_refptr<SimpleFontData> resulting_font_data,
+ bool is_loading_fallback) {
+ if (FontMatchingMetrics* font_matching_metrics = GetFontMatchingMetrics()) {
+ font_matching_metrics->ReportFontLookupByUniqueNameOnly(
+- name, font_description, resulting_font_data, is_loading_fallback);
++ name, font_description, resulting_font_data.get(), is_loading_fallback);
+ }
+ }
+
+@@ -109,20 +109,20 @@ void CSSFontSelectorBase::ReportFontLook
+ UChar32 fallback_character,
+ FontFallbackPriority fallback_priority,
+ const FontDescription& font_description,
+- const SimpleFontData* resulting_font_data) {
++ scoped_refptr<SimpleFontData> resulting_font_data) {
+ if (FontMatchingMetrics* font_matching_metrics = GetFontMatchingMetrics()) {
+ font_matching_metrics->ReportFontLookupByFallbackCharacter(
+ fallback_character, fallback_priority, font_description,
+- resulting_font_data);
++ resulting_font_data.get());
+ }
+ }
+
+ void CSSFontSelectorBase::ReportLastResortFallbackFontLookup(
+ const FontDescription& font_description,
+- const SimpleFontData* resulting_font_data) {
++ scoped_refptr<SimpleFontData> resulting_font_data) {
+ if (FontMatchingMetrics* font_matching_metrics = GetFontMatchingMetrics()) {
+ font_matching_metrics->ReportLastResortFallbackFontLookup(
+- font_description, resulting_font_data);
++ font_description, resulting_font_data.get());
+ }
+ }
+
+--- a/third_party/blink/renderer/core/css/css_font_selector_base.h
++++ b/third_party/blink/renderer/core/css/css_font_selector_base.h
+@@ -46,23 +46,23 @@ class CORE_EXPORT CSSFontSelectorBase :
+ void ReportFontLookupByUniqueOrFamilyName(
+ const AtomicString& name,
+ const FontDescription& font_description,
+- const SimpleFontData* resulting_font_data) override;
++ scoped_refptr<SimpleFontData> resulting_font_data) override;
+
+ void ReportFontLookupByUniqueNameOnly(
+ const AtomicString& name,
+ const FontDescription& font_description,
+- const SimpleFontData* resulting_font_data,
++ scoped_refptr<SimpleFontData> resulting_font_data,
+ bool is_loading_fallback = false) override;
+
+ void ReportFontLookupByFallbackCharacter(
+ UChar32 fallback_character,
+ FontFallbackPriority fallback_priority,
+ const FontDescription& font_description,
+- const SimpleFontData* resulting_font_data) override;
++ scoped_refptr<SimpleFontData> resulting_font_data) override;
+
+ void ReportLastResortFallbackFontLookup(
+ const FontDescription& font_description,
+- const SimpleFontData* resulting_font_data) override;
++ scoped_refptr<SimpleFontData> resulting_font_data) override;
+
+ void ReportFontFamilyLookupByGenericFamily(
+ const AtomicString& generic_font_family_name,
+--- a/third_party/blink/renderer/core/css/css_segmented_font_face.cc
++++ b/third_party/blink/renderer/core/css/css_segmented_font_face.cc
+@@ -38,16 +38,42 @@
+ #include "third_party/blink/renderer/platform/fonts/segmented_font_data.h"
+ #include "third_party/blink/renderer/platform/fonts/simple_font_data.h"
+
++// See comment below in CSSSegmentedFontFace::GetFontData - the cache from
++// CSSSegmentedFontFace (which represents a group of @font-face declarations
++// with identical FontSelectionCapabilities but differing by unicode-range) to
++// FontData/SegmentedFontData, (i.e. the actual font blobs that can be used for
++// shaping and painting retrieved from a CSSFontFaceSource) is usually small
++// (less than a dozen, up to tens) for non-animation-cases, but grows fast to
++// thousands when animating variable font parameters. Set a limit until we start
++// dropping cache entries in animation scenarios.
++static constexpr size_t kFontDataTableMaxSize = 250;
++
+ namespace blink {
+
++// static
++CSSSegmentedFontFace* CSSSegmentedFontFace::Create(
++ FontSelectionCapabilities capabilities) {
++ return MakeGarbageCollected<CSSSegmentedFontFace>(capabilities);
++}
++
+ CSSSegmentedFontFace::CSSSegmentedFontFace(
+ FontSelectionCapabilities font_selection_capabilities)
+ : font_selection_capabilities_(font_selection_capabilities),
++ font_data_table_(kFontDataTableMaxSize),
+ font_faces_(MakeGarbageCollected<FontFaceList>()),
+ approximate_character_count_(0) {}
+
+ CSSSegmentedFontFace::~CSSSegmentedFontFace() = default;
+
++void CSSSegmentedFontFace::PruneTable() {
++ // Make sure the glyph page tree prunes out all uses of this custom font.
++ if (!font_data_table_.size()) {
++ return;
++ }
++
++ font_data_table_.Clear();
++}
++
+ bool CSSSegmentedFontFace::IsValid() const {
+ // Valid if at least one font face is valid.
+ return font_faces_->ForEachUntilTrue(
+@@ -57,12 +83,12 @@ bool CSSSegmentedFontFace::IsValid() con
+ }
+
+ void CSSSegmentedFontFace::FontFaceInvalidated() {
+- font_data_table_.clear();
++ PruneTable();
+ }
+
+ void CSSSegmentedFontFace::AddFontFace(FontFace* font_face,
+ bool css_connected) {
+- font_data_table_.clear();
++ PruneTable();
+ font_face->CssFontFace()->AddSegmentedFontFace(this);
+ font_faces_->Insert(font_face, css_connected);
+ }
+@@ -72,11 +98,11 @@ void CSSSegmentedFontFace::RemoveFontFac
+ return;
+ }
+
+- font_data_table_.clear();
++ PruneTable();
+ font_face->CssFontFace()->RemoveSegmentedFontFace(this);
+ }
+
+-const FontData* CSSSegmentedFontFace::GetFontData(
++scoped_refptr<FontData> CSSSegmentedFontFace::GetFontData(
+ const FontDescription& font_description) {
+ if (!IsValid()) {
+ return nullptr;
+@@ -98,16 +124,16 @@ const FontData* CSSSegmentedFontFace::Ge
+ // usually only a small number of FontData/SegmentedFontData instances created
+ // per CSSSegmentedFontFace. Whereas in variable font animations, this number
+ // grows rapidly.
+- auto it = font_data_table_.find(key);
++ auto it = font_data_table_.Get(key);
+ if (it != font_data_table_.end()) {
+- const SegmentedFontData* cached_font_data = it->value.Get();
++ scoped_refptr<SegmentedFontData> cached_font_data = it->second;
+ if (cached_font_data && cached_font_data->NumFaces()) {
+ return cached_font_data;
+ }
+ }
+
+- SegmentedFontData* created_font_data =
+- MakeGarbageCollected<SegmentedFontData>();
++ scoped_refptr<SegmentedFontData> created_font_data =
++ SegmentedFontData::Create();
+
+ FontDescription requested_font_description(font_description);
+ const FontSelectionRequest& font_selection_request =
+@@ -126,16 +152,26 @@ const FontData* CSSSegmentedFontFace::Ge
+ if (!font_face->CssFontFace()->IsValid()) {
+ return;
+ }
+- if (const SimpleFontData* face_font_data =
++ if (scoped_refptr<SimpleFontData> face_font_data =
+ font_face->CssFontFace()->GetFontData(requested_font_description)) {
+ DCHECK(!face_font_data->IsSegmented());
+- created_font_data->AppendFace(MakeGarbageCollected<FontDataForRangeSet>(
+- std::move(face_font_data), font_face->CssFontFace()->Ranges()));
++ if (face_font_data->IsCustomFont()) {
++ created_font_data->AppendFace(base::AdoptRef(new FontDataForRangeSet(
++ std::move(face_font_data), font_face->CssFontFace()->Ranges())));
++ } else {
++ created_font_data->AppendFace(
++ base::AdoptRef(new FontDataForRangeSetFromCache(
++ std::move(face_font_data),
++ font_face->CssFontFace()->Ranges())));
++ }
+ }
+ });
+
+ if (created_font_data->NumFaces()) {
+- font_data_table_.insert(std::move(key), created_font_data);
++ scoped_refptr<SegmentedFontData> put_to_cache(created_font_data);
++ font_data_table_.Put(std::move(key), std::move(put_to_cache));
++ // No release, we have a reference to an object in the cache which should
++ // retain the ref count it has.
+ return created_font_data;
+ }
+
+@@ -186,7 +222,6 @@ void CSSSegmentedFontFace::Match(const S
+ }
+
+ void CSSSegmentedFontFace::Trace(Visitor* visitor) const {
+- visitor->Trace(font_data_table_);
+ visitor->Trace(font_faces_);
+ }
+
+--- a/third_party/blink/renderer/core/css/css_segmented_font_face.h
++++ b/third_party/blink/renderer/core/css/css_segmented_font_face.h
+@@ -32,7 +32,6 @@
+ #include "third_party/blink/renderer/platform/fonts/font_cache_key.h"
+ #include "third_party/blink/renderer/platform/fonts/font_selection_types.h"
+ #include "third_party/blink/renderer/platform/fonts/segmented_font_data.h"
+-#include "third_party/blink/renderer/platform/heap/collection_support/heap_hash_map.h"
+ #include "third_party/blink/renderer/platform/heap/collection_support/heap_linked_hash_set.h"
+ #include "third_party/blink/renderer/platform/heap/collection_support/heap_vector.h"
+ #include "third_party/blink/renderer/platform/heap/garbage_collected.h"
+@@ -84,6 +83,8 @@ class FontFaceList : public GarbageColle
+ class CSSSegmentedFontFace final
+ : public GarbageCollected<CSSSegmentedFontFace> {
+ public:
++ static CSSSegmentedFontFace* Create(FontSelectionCapabilities);
++
+ explicit CSSSegmentedFontFace(FontSelectionCapabilities);
+ ~CSSSegmentedFontFace();
+
+@@ -99,7 +100,7 @@ class CSSSegmentedFontFace final
+ void RemoveFontFace(FontFace*);
+ bool IsEmpty() const { return font_faces_->IsEmpty(); }
+
+- const FontData* GetFontData(const FontDescription&);
++ scoped_refptr<FontData> GetFontData(const FontDescription&);
+
+ bool CheckFont(UChar32) const;
+ void Match(const String&, HeapVector<Member<FontFace>>*) const;
+@@ -112,11 +113,12 @@ class CSSSegmentedFontFace final
+ void Trace(Visitor*) const;
+
+ private:
++ void PruneTable();
+ bool IsValid() const;
+
+ FontSelectionCapabilities font_selection_capabilities_;
+
+- HeapHashMap<FontCacheKey, WeakMember<const SegmentedFontData>>
++ base::HashingLRUCache<FontCacheKey, scoped_refptr<SegmentedFontData>>
+ font_data_table_;
+
+ // All non-CSS-connected FontFaces are stored after the CSS-connected ones.
+--- a/third_party/blink/renderer/core/css/font_face_cache.cc
++++ b/third_party/blink/renderer/core/css/font_face_cache.cc
+@@ -85,8 +85,8 @@ void FontFaceCache::CapabilitiesSet::Add
+ const auto result =
+ map_.insert(font_face->GetFontSelectionCapabilities(), nullptr);
+ if (result.is_new_entry) {
+- result.stored_value->value = MakeGarbageCollected<CSSSegmentedFontFace>(
+- font_face->GetFontSelectionCapabilities());
++ result.stored_value->value =
++ CSSSegmentedFontFace::Create(font_face->GetFontSelectionCapabilities());
+ }
+
+ result.stored_value->value->AddFontFace(font_face, css_connected);
+--- a/third_party/blink/renderer/core/css/local_font_face_source.cc
++++ b/third_party/blink/renderer/core/css/local_font_face_source.cc
+@@ -52,22 +52,23 @@ bool LocalFontFaceSource::IsLocalFontAva
+ return font_available;
+ }
+
+-const SimpleFontData* LocalFontFaceSource::CreateLoadingFallbackFontData(
++scoped_refptr<SimpleFontData>
++LocalFontFaceSource::CreateLoadingFallbackFontData(
+ const FontDescription& font_description) {
+ FontCachePurgePreventer font_cache_purge_preventer;
+- const SimpleFontData* temporary_font =
+- FontCache::Get().GetLastResortFallbackFont(font_description);
++ scoped_refptr<SimpleFontData> temporary_font =
++ FontCache::Get().GetLastResortFallbackFont(font_description,
++ kDoNotRetain);
+ if (!temporary_font) {
+ NOTREACHED();
+ return nullptr;
+ }
+- CSSCustomFontData* css_font_data = MakeGarbageCollected<CSSCustomFontData>(
+- this, CSSCustomFontData::kVisibleFallback);
+- return MakeGarbageCollected<SimpleFontData>(&temporary_font->PlatformData(),
+- css_font_data);
++ scoped_refptr<CSSCustomFontData> css_font_data =
++ CSSCustomFontData::Create(this, CSSCustomFontData::kVisibleFallback);
++ return SimpleFontData::Create(temporary_font->PlatformData(), css_font_data);
+ }
+
+-const SimpleFontData* LocalFontFaceSource::CreateFontData(
++scoped_refptr<SimpleFontData> LocalFontFaceSource::CreateFontData(
+ const FontDescription& font_description,
+ const FontSelectionCapabilities&) {
+ if (!IsValid()) {
+@@ -84,9 +85,9 @@ const SimpleFontData* LocalFontFaceSourc
+ }
+
+ if (IsValid() && IsLoading()) {
+- const SimpleFontData* fallback_font_data =
++ scoped_refptr<SimpleFontData> fallback_font_data =
+ CreateLoadingFallbackFontData(font_description);
+- ReportFontLookup(font_description, fallback_font_data,
++ ReportFontLookup(font_description, fallback_font_data.get(),
+ true /* is_loading_fallback */);
+ return fallback_font_data;
+ }
+@@ -110,10 +111,10 @@ const SimpleFontData* LocalFontFaceSourc
+ #endif
+ // TODO(https://crbug.com/1302264): Enable passing down of font-palette
+ // information here (font_description.GetFontPalette()).
+- const SimpleFontData* font_data = FontCache::Get().GetFontData(
++ scoped_refptr<SimpleFontData> font_data = FontCache::Get().GetFontData(
+ unstyled_description, font_name_, AlternateFontName::kLocalUniqueFace);
+- histograms_.Record(font_data);
+- ReportFontLookup(unstyled_description, font_data);
++ histograms_.Record(font_data.get());
++ ReportFontLookup(unstyled_description, font_data.get());
+ return font_data;
+ }
+
+@@ -132,7 +133,7 @@ void LocalFontFaceSource::BeginLoadIfNee
+ }
+
+ void LocalFontFaceSource::NotifyFontUniqueNameLookupReady() {
+- ClearTable();
++ PruneTable();
+
+ if (face_->FontLoaded(this)) {
+ font_selector_->FontFaceInvalidated(
+@@ -168,7 +169,7 @@ void LocalFontFaceSource::Trace(Visitor*
+
+ void LocalFontFaceSource::ReportFontLookup(
+ const FontDescription& font_description,
+- const SimpleFontData* font_data,
++ SimpleFontData* font_data,
+ bool is_loading_fallback) {
+ font_selector_->ReportFontLookupByUniqueNameOnly(
+ font_name_, font_description, font_data, is_loading_fallback);
+--- a/third_party/blink/renderer/core/css/local_font_face_source.h
++++ b/third_party/blink/renderer/core/css/local_font_face_source.h
+@@ -48,15 +48,16 @@ class LocalFontFaceSource final : public
+ void NotifyFontUniqueNameLookupReady();
+
+ protected:
+- const SimpleFontData* CreateLoadingFallbackFontData(const FontDescription&);
++ scoped_refptr<SimpleFontData> CreateLoadingFallbackFontData(
++ const FontDescription&);
+
+ private:
+- const SimpleFontData* CreateFontData(
++ scoped_refptr<SimpleFontData> CreateFontData(
+ const FontDescription&,
+ const FontSelectionCapabilities&) override;
+
+ void ReportFontLookup(const FontDescription& font_description,
+- const SimpleFontData* font_data,
++ SimpleFontData* font_data,
+ bool is_loading_fallback = false) override;
+
+ class LocalFontHistograms {
+--- a/third_party/blink/renderer/core/css/offscreen_font_selector.cc
++++ b/third_party/blink/renderer/core/css/offscreen_font_selector.cc
+@@ -39,7 +39,7 @@ void OffscreenFontSelector::RegisterForI
+ void OffscreenFontSelector::UnregisterForInvalidationCallbacks(
+ FontSelectorClient* client) {}
+
+-const FontData* OffscreenFontSelector::GetFontData(
++scoped_refptr<FontData> OffscreenFontSelector::GetFontData(
+ const FontDescription& font_description,
+ const FontFamily& font_family) {
+ const auto& family_name = font_family.FamilyName();
+@@ -60,11 +60,11 @@ const FontData* OffscreenFontSelector::G
+ family_name, font_description.GetScript(),
+ font_description.GenericFamily(), settings_family_name);
+
+- const auto* font_data =
++ auto font_data =
+ FontCache::Get().GetFontData(font_description, settings_family_name);
+
+ ReportFontLookupByUniqueOrFamilyName(settings_family_name, font_description,
+- font_data);
++ font_data.get());
+
+ return font_data;
+ }
+--- a/third_party/blink/renderer/core/css/offscreen_font_selector.h
++++ b/third_party/blink/renderer/core/css/offscreen_font_selector.h
+@@ -26,8 +26,8 @@ class CORE_EXPORT OffscreenFontSelector
+
+ unsigned Version() const override { return 1; }
+
+- const FontData* GetFontData(const FontDescription&,
+- const FontFamily&) override;
++ scoped_refptr<FontData> GetFontData(const FontDescription&,
++ const FontFamily&) override;
+
+ void RegisterForInvalidationCallbacks(FontSelectorClient*) override;
+ void UnregisterForInvalidationCallbacks(FontSelectorClient*) override;
+--- a/third_party/blink/renderer/core/css/remote_font_face_source.cc
++++ b/third_party/blink/renderer/core/css/remote_font_face_source.cc
+@@ -240,7 +240,8 @@ void RemoteFontFaceSource::NotifyFinishe
+ }
+
+ ClearResource();
+- ClearTable();
++
++ PruneTable();
+
+ if (GetDocument()) {
+ if (!GetDocument()->RenderingHasBegun()) {
+@@ -305,7 +306,7 @@ bool RemoteFontFaceSource::UpdatePeriod(
+ // Invalidate the font if its fallback visibility has changed.
+ if (IsLoading() && period_ != new_period &&
+ (period_ == kBlockPeriod || new_period == kBlockPeriod)) {
+- ClearTable();
++ PruneTable();
+ if (face_->FallbackVisibilityChanged(this)) {
+ font_selector_->FontFaceInvalidated(
+ FontInvalidationReason::kGeneralInvalidation);
+@@ -349,7 +350,7 @@ bool RemoteFontFaceSource::IsLowPriority
+ return is_intervention_triggered_;
+ }
+
+-const SimpleFontData* RemoteFontFaceSource::CreateFontData(
++scoped_refptr<SimpleFontData> RemoteFontFaceSource::CreateFontData(
+ const FontDescription& font_description,
+ const FontSelectionCapabilities& font_selection_capabilities) {
+ if (period_ == kFailurePeriod || !IsValid()) {
+@@ -362,7 +363,7 @@ const SimpleFontData* RemoteFontFaceSour
+
+ histograms_.RecordFallbackTime();
+
+- return MakeGarbageCollected<SimpleFontData>(
++ return SimpleFontData::Create(
+ custom_font_data_->GetFontPlatformData(
+ font_description.EffectiveFontSize(),
+ font_description.AdjustedSpecifiedSize(),
+@@ -379,24 +380,25 @@ const SimpleFontData* RemoteFontFaceSour
+ : ResolvedFontFeatures(),
+ font_description.Orientation(), font_description.VariationSettings(),
+ font_description.GetFontPalette()),
+- MakeGarbageCollected<CustomFontData>());
++ CustomFontData::Create());
+ }
+
+-const SimpleFontData* RemoteFontFaceSource::CreateLoadingFallbackFontData(
++scoped_refptr<SimpleFontData>
++RemoteFontFaceSource::CreateLoadingFallbackFontData(
+ const FontDescription& font_description) {
+ // This temporary font is not retained and should not be returned.
+ FontCachePurgePreventer font_cache_purge_preventer;
+- const SimpleFontData* temporary_font =
+- FontCache::Get().GetLastResortFallbackFont(font_description);
++ scoped_refptr<SimpleFontData> temporary_font =
++ FontCache::Get().GetLastResortFallbackFont(font_description,
++ kDoNotRetain);
+ if (!temporary_font) {
+ DUMP_WILL_BE_NOTREACHED_NORETURN();
+ return nullptr;
+ }
+- CSSCustomFontData* css_font_data = MakeGarbageCollected<CSSCustomFontData>(
++ scoped_refptr<CSSCustomFontData> css_font_data = CSSCustomFontData::Create(
+ this, period_ == kBlockPeriod ? CSSCustomFontData::kInvisibleFallback
+ : CSSCustomFontData::kVisibleFallback);
+- return MakeGarbageCollected<SimpleFontData>(&temporary_font->PlatformData(),
+- css_font_data);
++ return SimpleFontData::Create(temporary_font->PlatformData(), css_font_data);
+ }
+
+ void RemoteFontFaceSource::BeginLoadIfNeeded() {
+--- a/third_party/blink/renderer/core/css/remote_font_face_source.h
++++ b/third_party/blink/renderer/core/css/remote_font_face_source.h
+@@ -66,10 +66,11 @@ class RemoteFontFaceSource final : publi
+ void Trace(Visitor*) const override;
+
+ protected:
+- const SimpleFontData* CreateFontData(
++ scoped_refptr<SimpleFontData> CreateFontData(
+ const FontDescription&,
+ const FontSelectionCapabilities&) override;
+- const SimpleFontData* CreateLoadingFallbackFontData(const FontDescription&);
++ scoped_refptr<SimpleFontData> CreateLoadingFallbackFontData(
++ const FontDescription&);
+
+ private:
+ // Periods of the Font Display Timeline.
+--- a/third_party/blink/renderer/core/frame/font_matching_metrics.cc
++++ b/third_party/blink/renderer/core/frame/font_matching_metrics.cc
+@@ -127,7 +127,7 @@ void FontMatchingMetrics::ReportLocalFon
+ }
+
+ void FontMatchingMetrics::InsertFontHashIntoMap(IdentifiableTokenKey input_key,
+- const SimpleFontData* font_data,
++ SimpleFontData* font_data,
+ TokenToTokenHashMap& hash_map) {
+ DCHECK(IdentifiabilityStudyShouldSampleFonts());
+ if (hash_map.Contains(input_key)) {
+@@ -160,7 +160,7 @@ FontMatchingMetrics::GetTokenBuilderWith
+ void FontMatchingMetrics::ReportFontLookupByUniqueOrFamilyName(
+ const AtomicString& name,
+ const FontDescription& font_description,
+- const SimpleFontData* resulting_font_data) {
++ SimpleFontData* resulting_font_data) {
+ Dactyloscoper::TraceFontLookup(
+ execution_context_, name, font_description,
+ Dactyloscoper::FontLookupType::kUniqueOrFamilyName);
+@@ -184,7 +184,7 @@ void FontMatchingMetrics::ReportFontLook
+ void FontMatchingMetrics::ReportFontLookupByUniqueNameOnly(
+ const AtomicString& name,
+ const FontDescription& font_description,
+- const SimpleFontData* resulting_font_data,
++ SimpleFontData* resulting_font_data,
+ bool is_loading_fallback) {
+ // We ignore lookups that result in loading fallbacks for now as they should
+ // only be temporary.
+@@ -217,7 +217,7 @@ void FontMatchingMetrics::ReportFontLook
+ UChar32 fallback_character,
+ FontFallbackPriority fallback_priority,
+ const FontDescription& font_description,
+- const SimpleFontData* resulting_font_data) {
++ SimpleFontData* resulting_font_data) {
+ if (!IdentifiabilityStudySettings::Get()->ShouldSampleType(
+ IdentifiableSurface::Type::kLocalFontLookupByFallbackCharacter)) {
+ return;
+@@ -236,7 +236,7 @@ void FontMatchingMetrics::ReportFontLook
+
+ void FontMatchingMetrics::ReportLastResortFallbackFontLookup(
+ const FontDescription& font_description,
+- const SimpleFontData* resulting_font_data) {
++ SimpleFontData* resulting_font_data) {
+ if (!IdentifiabilityStudySettings::Get()->ShouldSampleType(
+ IdentifiableSurface::Type::kLocalFontLookupAsLastResort)) {
+ return;
+@@ -361,8 +361,7 @@ void FontMatchingMetrics::PublishAllMetr
+ PublishEmojiGlyphMetrics();
+ }
+
+-int64_t FontMatchingMetrics::GetHashForFontData(
+- const SimpleFontData* font_data) {
++int64_t FontMatchingMetrics::GetHashForFontData(SimpleFontData* font_data) {
+ return font_data ? FontGlobalContext::Get()
+ .GetOrComputeTypefaceDigest(font_data->PlatformData())
+ .ToUkmMetricValue()
+@@ -370,7 +369,7 @@ int64_t FontMatchingMetrics::GetHashForF
+ }
+
+ IdentifiableToken FontMatchingMetrics::GetPostScriptNameTokenForFontData(
+- const SimpleFontData* font_data) {
++ SimpleFontData* font_data) {
+ DCHECK(font_data);
+ return FontGlobalContext::Get().GetOrComputePostScriptNameDigest(
+ font_data->PlatformData());
+--- a/third_party/blink/renderer/core/frame/font_matching_metrics.h
++++ b/third_party/blink/renderer/core/frame/font_matching_metrics.h
+@@ -100,16 +100,15 @@ class FontMatchingMetrics {
+ void ReportFontLookupByUniqueOrFamilyName(
+ const AtomicString& name,
+ const FontDescription& font_description,
+- const SimpleFontData* resulting_font_data);
++ SimpleFontData* resulting_font_data);
+
+ // Reports a local font was looked up by a name and font description. This
+ // only includes lookups where the name is allowed to match PostScript names
+ // and full font names, but not family names.
+- void ReportFontLookupByUniqueNameOnly(
+- const AtomicString& name,
+- const FontDescription& font_description,
+- const SimpleFontData* resulting_font_data,
+- bool is_loading_fallback = false);
++ void ReportFontLookupByUniqueNameOnly(const AtomicString& name,
++ const FontDescription& font_description,
++ SimpleFontData* resulting_font_data,
++ bool is_loading_fallback = false);
+
+ // Reports a font was looked up by a fallback character, fallback priority,
+ // and a font description.
+@@ -117,12 +116,12 @@ class FontMatchingMetrics {
+ UChar32 fallback_character,
+ FontFallbackPriority fallback_priority,
+ const FontDescription& font_description,
+- const SimpleFontData* resulting_font_data);
++ SimpleFontData* resulting_font_data);
+
+ // Reports a last-resort fallback font was looked up by a font description.
+ void ReportLastResortFallbackFontLookup(
+ const FontDescription& font_description,
+- const SimpleFontData* resulting_font_data);
++ SimpleFontData* resulting_font_data);
+
+ // Reports a generic font family name was matched according to the script and
+ // the user's preferences to a font family name.
+@@ -171,7 +170,7 @@ class FontMatchingMetrics {
+ // nullptr, then the typeface digest will also be saved with its PostScript
+ // name in |font_load_postscript_name_|.
+ void InsertFontHashIntoMap(IdentifiableTokenKey input_key,
+- const SimpleFontData* font_data,
++ SimpleFontData* font_data,
+ TokenToTokenHashMap& hash_map);
+
+ // Reports a local font's existence was looked up by a name, but its actual
+@@ -194,14 +193,14 @@ class FontMatchingMetrics {
+
+ // Get a hash that uniquely represents the font data. Returns 0 if |font_data|
+ // is nullptr.
+- int64_t GetHashForFontData(const SimpleFontData* font_data);
++ int64_t GetHashForFontData(SimpleFontData* font_data);
+
+ void Initialize();
+
+ // Get a token that uniquely represents the typeface's PostScript name. May
+ // represent the empty string if no PostScript name was found.
+ IdentifiableToken GetPostScriptNameTokenForFontData(
+- const SimpleFontData* font_data);
++ SimpleFontData* font_data);
+
+ TokenToTokenHashMap font_lookups_by_unique_or_family_name_;
+ TokenToTokenHashMap font_lookups_by_unique_name_only_;
+--- a/third_party/blink/renderer/core/html/forms/internal_popup_menu.cc
++++ b/third_party/blink/renderer/core/html/forms/internal_popup_menu.cc
+@@ -132,8 +132,8 @@ class PopupMenuCSSFontSelector : public
+
+ // We don't override willUseFontData() for now because the old PopupListBox
+ // only worked with fonts loaded when opening the popup.
+- const FontData* GetFontData(const FontDescription&,
+- const FontFamily&) override;
++ scoped_refptr<FontData> GetFontData(const FontDescription&,
++ const FontFamily&) override;
+
+ void Trace(Visitor*) const override;
+
+@@ -152,7 +152,7 @@ PopupMenuCSSFontSelector::PopupMenuCSSFo
+
+ PopupMenuCSSFontSelector::~PopupMenuCSSFontSelector() = default;
+
+-const FontData* PopupMenuCSSFontSelector::GetFontData(
++scoped_refptr<FontData> PopupMenuCSSFontSelector::GetFontData(
+ const FontDescription& description,
+ const FontFamily& font_family) {
+ return owner_font_selector_->GetFontData(description, font_family);
+--- a/third_party/blink/renderer/core/inspector/inspector_css_agent.cc
++++ b/third_party/blink/renderer/core/inspector/inspector_css_agent.cc
+@@ -122,7 +122,6 @@
+ #include "third_party/blink/renderer/platform/fonts/font_custom_platform_data.h"
+ #include "third_party/blink/renderer/platform/fonts/shaping/caching_word_shaper.h"
+ #include "third_party/blink/renderer/platform/fonts/shaping/shape_result_view.h"
+-#include "third_party/blink/renderer/platform/heap/collection_support/clear_collection_scope.h"
+ #include "third_party/blink/renderer/platform/heap/garbage_collected.h"
+ #include "third_party/blink/renderer/platform/text/text_run.h"
+ #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
+@@ -200,10 +199,10 @@ HeapVector<Member<CSSStyleRule>> FilterD
+ }
+
+ void CollectPlatformFontsFromRunFontDataList(
+- const HeapVector<ShapeResult::RunFontData>& run_font_data_list,
++ const Vector<ShapeResult::RunFontData>& run_font_data_list,
+ HashMap<std::pair<int, String>, std::pair<int, String>>* font_stats) {
+ for (const auto& run_font_data : run_font_data_list) {
+- const auto* simple_font_data = run_font_data.font_data_.Get();
++ const auto* simple_font_data = run_font_data.font_data_;
+ String family_name = simple_font_data->PlatformData().FontFamilyName();
+ if (family_name.IsNull())
+ family_name = "";
+@@ -1733,8 +1732,7 @@ void InspectorCSSAgent::CollectPlatformF
+ if (!shape_result) {
+ continue;
+ }
+- HeapVector<ShapeResult::RunFontData> run_font_data_list;
+- ClearCollectionScope clear_scope(&run_font_data_list);
++ Vector<ShapeResult::RunFontData> run_font_data_list;
+ shape_result->GetRunFontData(&run_font_data_list);
+ CollectPlatformFontsFromRunFontDataList(run_font_data_list, font_stats);
+ }
+--- a/third_party/blink/renderer/core/layout/inline/inline_box_state.cc
++++ b/third_party/blink/renderer/core/layout/inline/inline_box_state.cc
+@@ -19,7 +19,6 @@
+ #include "third_party/blink/renderer/core/style/computed_style.h"
+ #include "third_party/blink/renderer/core/svg/svg_length_functions.h"
+ #include "third_party/blink/renderer/platform/fonts/shaping/shape_result_view.h"
+-#include "third_party/blink/renderer/platform/heap/collection_support/clear_collection_scope.h"
+
+ namespace blink {
+
+@@ -169,8 +168,7 @@ void InlineBoxState::EnsureTextMetrics(c
+
+ void InlineBoxState::AccumulateUsedFonts(const ShapeResultView* shape_result) {
+ const auto baseline_type = style->GetFontBaseline();
+- HeapHashSet<Member<const SimpleFontData>> fallback_fonts;
+- ClearCollectionScope clear_scope(&fallback_fonts);
++ HashSet<const SimpleFontData*> fallback_fonts;
+ shape_result->FallbackFonts(&fallback_fonts);
+ for (const SimpleFontData* const fallback_font : fallback_fonts) {
+ FontHeight fallback_metrics =
+--- a/third_party/blink/renderer/core/layout/inline/ruby_utils.cc
++++ b/third_party/blink/renderer/core/layout/inline/ruby_utils.cc
+@@ -12,7 +12,6 @@
+ #include "third_party/blink/renderer/core/layout/layout_object_inlines.h"
+ #include "third_party/blink/renderer/core/layout/physical_box_fragment.h"
+ #include "third_party/blink/renderer/platform/fonts/font_height.h"
+-#include "third_party/blink/renderer/platform/heap/collection_support/clear_collection_scope.h"
+
+ namespace blink {
+
+@@ -33,10 +32,11 @@ std::tuple<LayoutUnit, LayoutUnit> Adjus
+ primary_font_data->GetFontMetrics().FixedAscent(font_baseline);
+ const LayoutUnit primary_descent = line_height - primary_ascent;
+
++ DCHECK(IsMainThread());
++ DEFINE_STATIC_LOCAL(Vector<ShapeResult::RunFontData>, run_fonts, ());
++ DCHECK_EQ(run_fonts.size(), 0u);
+ // We don't use ShapeResultView::FallbackFonts() because we can't know if the
+ // primary font is actually used with FallbackFonts().
+- HeapVector<ShapeResult::RunFontData> run_fonts;
+- ClearCollectionScope clear_scope(&run_fonts);
+ shape_view.GetRunFontData(&run_fonts);
+ const LayoutUnit kNoDiff = LayoutUnit::Max();
+ LayoutUnit over_diff = kNoDiff;
+@@ -60,6 +60,7 @@ std::tuple<LayoutUnit, LayoutUnit> Adjus
+ over_diff = std::min(over_diff, current_over_diff);
+ under_diff = std::min(under_diff, current_under_diff);
+ }
++ run_fonts.resize(0);
+ if (over_diff == kNoDiff)
+ over_diff = LayoutUnit();
+ if (under_diff == kNoDiff)
+@@ -956,8 +957,7 @@ FontHeight ComputeEmHeight(const Logical
+ FontHeight result_height;
+ // We don't use ShapeResultView::FallbackFonts() because we can't know if
+ // the primary font is actually used with FallbackFonts().
+- HeapVector<ShapeResult::RunFontData> run_fonts;
+- ClearCollectionScope clear_scope(&run_fonts);
++ Vector<ShapeResult::RunFontData> run_fonts;
+ shape_result_view->GetRunFontData(&run_fonts);
+ for (const auto& run_font : run_fonts) {
+ const SimpleFontData* font_data = run_font.font_data_;
+--- a/third_party/blink/renderer/core/layout/layout_font_accessor_win.cc
++++ b/third_party/blink/renderer/core/layout/layout_font_accessor_win.cc
+@@ -16,7 +16,6 @@
+ #include "third_party/blink/renderer/platform/fonts/font_platform_data.h"
+ #include "third_party/blink/renderer/platform/fonts/shaping/shape_result_view.h"
+ #include "third_party/blink/renderer/platform/fonts/simple_font_data.h"
+-#include "third_party/blink/renderer/platform/heap/collection_support/clear_collection_scope.h"
+
+ namespace blink {
+
+@@ -36,8 +35,7 @@ void GetFontsUsedByFragment(const Physic
+ shape_result_view->PrimaryFont()->PlatformData().FontFamilyName();
+ if (!font_family.empty())
+ result.font_names.insert(font_family);
+- HeapHashSet<Member<const SimpleFontData>> fallback_font_data;
+- ClearCollectionScope clear_scope(&fallback_font_data);
++ HashSet<const SimpleFontData*> fallback_font_data;
+ shape_result_view->FallbackFonts(&fallback_font_data);
+ for (const SimpleFontData* font_data : fallback_font_data) {
+ result.font_names.insert(font_data->PlatformData().FontFamilyName());
+--- a/third_party/blink/renderer/modules/font_access/font_metadata.cc
++++ b/third_party/blink/renderer/modules/font_access/font_metadata.cc
+@@ -77,7 +77,7 @@ void FontMetadata::BlobImpl(ScriptPromis
+ SetUpFontUniqueLookupIfNecessary();
+
+ FontDescription description;
+- const SimpleFontData* font_data =
++ scoped_refptr<SimpleFontData> font_data =
+ FontCache::Get().GetFontData(description, AtomicString(postscriptName),
+ AlternateFontName::kLocalUniqueFace);
+ if (!font_data) {
+--- a/third_party/blink/renderer/platform/BUILD.gn
++++ b/third_party/blink/renderer/platform/BUILD.gn
+@@ -621,6 +621,7 @@ component("platform") {
+ "fonts/font_cache_memory_dump_provider.h",
+ "fonts/font_custom_platform_data.cc",
+ "fonts/font_custom_platform_data.h",
++ "fonts/font_data.cc",
+ "fonts/font_data.h",
+ "fonts/font_data_cache.cc",
+ "fonts/font_data_cache.h",
+--- a/third_party/blink/renderer/platform/fonts/android/font_cache_android.cc
++++ b/third_party/blink/renderer/platform/fonts/android/font_cache_android.cc
+@@ -127,7 +127,7 @@ sk_sp<SkTypeface> FontCache::CreateLocal
+ return nullptr;
+ }
+
+-const SimpleFontData* FontCache::PlatformFallbackFontForCharacter(
++scoped_refptr<SimpleFontData> FontCache::PlatformFallbackFontForCharacter(
+ const FontDescription& font_description,
+ UChar32 c,
+ const SimpleFontData*,
+@@ -158,7 +158,7 @@ const SimpleFontData* FontCache::Platfor
+ if (fallback_priority == FontFallbackPriority::kEmojiEmoji &&
+ base::FeatureList::IsEnabled(features::kGMSCoreEmoji)) {
+ auto skia_fallback_is_noto_color_emoji = [&]() {
+- const FontPlatformData* skia_fallback_result = GetFontPlatformData(
++ FontPlatformData* skia_fallback_result = GetFontPlatformData(
+ font_description, FontFaceCreationParams(family_name));
+
+ // Determining the PostScript name is required as Skia on Android gives
+@@ -175,14 +175,15 @@ const SimpleFontData* FontCache::Platfor
+ };
+
+ if (family_name.empty() || skia_fallback_is_noto_color_emoji()) {
+- const FontPlatformData* emoji_gms_core_font = GetFontPlatformData(
++ FontPlatformData* emoji_gms_core_font = GetFontPlatformData(
+ font_description,
+ FontFaceCreationParams(AtomicString(kNotoColorEmojiCompat)));
+ if (emoji_gms_core_font) {
+ SkTypeface* probe_coverage_typeface = emoji_gms_core_font->Typeface();
+ if (probe_coverage_typeface &&
+ probe_coverage_typeface->unicharToGlyph(c)) {
+- return FontDataFromFontPlatformData(emoji_gms_core_font);
++ return FontDataFromFontPlatformData(emoji_gms_core_font,
++ kDoNotRetain);
+ }
+ }
+ }
+@@ -192,10 +193,12 @@ const SimpleFontData* FontCache::Platfor
+ // font was not found or an OEM emoji font was not to be overridden.
+
+ if (family_name.empty())
+- return GetLastResortFallbackFont(font_description);
++ return GetLastResortFallbackFont(font_description, kDoNotRetain);
+
+- return FontDataFromFontPlatformData(GetFontPlatformData(
+- font_description, FontFaceCreationParams(family_name)));
++ return FontDataFromFontPlatformData(
++ GetFontPlatformData(font_description,
++ FontFaceCreationParams(family_name)),
++ kDoNotRetain);
+ }
+
+ // static
+--- a/third_party/blink/renderer/platform/fonts/custom_font_data.h
++++ b/third_party/blink/renderer/platform/fonts/custom_font_data.h
+@@ -22,8 +22,8 @@
+ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_CUSTOM_FONT_DATA_H_
+
+ #include "base/memory/scoped_refptr.h"
+-#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
+ #include "third_party/blink/renderer/platform/platform_export.h"
++#include "third_party/blink/renderer/platform/wtf/thread_safe_ref_counted.h"
+
+ namespace blink {
+
+@@ -34,17 +34,22 @@ namespace blink {
+ // * `BinaryDataFontFaceSource` as loaded font resource
+ // * `LocalFontFaceSource` as derived class `CSSCustomFontData`
+ // * `RemoteFontFaceSource` as derived class `CSSCustomFontData`
+-class PLATFORM_EXPORT CustomFontData : public GarbageCollected<CustomFontData> {
++class PLATFORM_EXPORT CustomFontData : public RefCounted<CustomFontData> {
+ public:
+- CustomFontData() = default;
++ static scoped_refptr<CustomFontData> Create() {
++ return base::AdoptRef(new CustomFontData());
++ }
++
+ virtual ~CustomFontData() = default;
+- virtual void Trace(Visitor*) const {}
+
+ virtual void BeginLoadIfNeeded() const {}
+ virtual bool IsLoading() const { return false; }
+ virtual bool IsLoadingFallback() const { return false; }
+ virtual bool ShouldSkipDrawing() const { return false; }
+ virtual bool IsPendingDataUrl() const { return false; }
++
++ protected:
++ CustomFontData() = default;
+ };
+
+ } // namespace blink
+--- a/third_party/blink/renderer/platform/fonts/font_cache.cc
++++ b/third_party/blink/renderer/platform/fonts/font_cache.cc
+@@ -87,7 +87,10 @@ FontCache& FontCache::Get() {
+ return FontGlobalContext::GetFontCache();
+ }
+
+-FontCache::FontCache() : font_manager_(sk_ref_sp(static_font_manager_)) {
++FontCache::FontCache()
++ : font_manager_(sk_ref_sp(static_font_manager_)),
++ font_platform_data_cache_(FontPlatformDataCache::Create()),
++ font_data_cache_(FontDataCache::Create()) {
+ #if BUILDFLAG(IS_WIN)
+ if (!font_manager_ || should_use_test_font_mgr) {
+ // This code path is only for unit tests. This SkFontMgr does not work in
+@@ -113,14 +116,12 @@ FontCache::~FontCache() = default;
+
+ void FontCache::Trace(Visitor* visitor) const {
+ visitor->Trace(font_cache_clients_);
+- visitor->Trace(font_platform_data_cache_);
+- visitor->Trace(fallback_list_shaper_cache_);
+- visitor->Trace(font_data_cache_);
+ visitor->Trace(font_fallback_map_);
++ visitor->Trace(fallback_list_shaper_cache_);
+ }
+
+ #if !BUILDFLAG(IS_MAC)
+-const FontPlatformData* FontCache::SystemFontPlatformData(
++FontPlatformData* FontCache::SystemFontPlatformData(
+ const FontDescription& font_description) {
+ const AtomicString& family = FontCache::SystemFontFamily();
+ #if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_FUCHSIA) || \
+@@ -135,7 +136,7 @@ const FontPlatformData* FontCache::Syste
+ }
+ #endif
+
+-const FontPlatformData* FontCache::GetFontPlatformData(
++FontPlatformData* FontCache::GetFontPlatformData(
+ const FontDescription& font_description,
+ const FontFaceCreationParams& creation_params,
+ AlternateFontName alternate_font_name) {
+@@ -153,7 +154,7 @@ const FontPlatformData* FontCache::GetFo
+ }
+ #endif
+
+- return font_platform_data_cache_.GetOrCreateFontPlatformData(
++ return font_platform_data_cache_->GetOrCreateFontPlatformData(
+ this, font_description, creation_params, alternate_font_name);
+ }
+
+@@ -175,26 +176,34 @@ void FontCache::AcceptLanguagesChanged(c
+ Get().InvalidateShapeCache();
+ }
+
+-const SimpleFontData* FontCache::GetFontData(
++scoped_refptr<SimpleFontData> FontCache::GetFontData(
+ const FontDescription& font_description,
+ const AtomicString& family,
+- AlternateFontName altername_font_name) {
+- if (const FontPlatformData* platform_data = GetFontPlatformData(
++ AlternateFontName altername_font_name,
++ ShouldRetain should_retain) {
++ if (FontPlatformData* platform_data = GetFontPlatformData(
+ font_description,
+ FontFaceCreationParams(
+ AdjustFamilyNameToAvoidUnsupportedFonts(family)),
+ altername_font_name)) {
+ return FontDataFromFontPlatformData(
+- platform_data, font_description.SubpixelAscentDescent());
++ platform_data, should_retain, font_description.SubpixelAscentDescent());
+ }
+
+ return nullptr;
+ }
+
+-const SimpleFontData* FontCache::FontDataFromFontPlatformData(
++scoped_refptr<SimpleFontData> FontCache::FontDataFromFontPlatformData(
+ const FontPlatformData* platform_data,
++ ShouldRetain should_retain,
+ bool subpixel_ascent_descent) {
+- return font_data_cache_.Get(platform_data, subpixel_ascent_descent);
++#if DCHECK_IS_ON()
++ if (should_retain == kDoNotRetain)
++ DCHECK(purge_prevent_count_);
++#endif
++
++ return font_data_cache_->Get(platform_data, should_retain,
++ subpixel_ascent_descent);
+ }
+
+ bool FontCache::IsPlatformFamilyMatchAvailable(
+@@ -223,7 +232,15 @@ String FontCache::FirstAvailableOrFirst(
+ gfx::FontList::FirstAvailableOrFirst(families.Utf8().c_str()));
+ }
+
+-const SimpleFontData* FontCache::FallbackFontForCharacter(
++SimpleFontData* FontCache::GetNonRetainedLastResortFallbackFont(
++ const FontDescription& font_description) {
++ auto font = GetLastResortFallbackFont(font_description, kDoNotRetain);
++ if (font)
++ font->AddRef();
++ return font.get();
++}
++
++scoped_refptr<SimpleFontData> FontCache::FallbackFontForCharacter(
+ const FontDescription& description,
+ UChar32 lookup_char,
+ const SimpleFontData* font_data_to_substitute,
+@@ -240,12 +257,21 @@ const SimpleFontData* FontCache::Fallbac
+ Character::IsNonCharacter(lookup_char))
+ return nullptr;
+ base::ElapsedTimer timer;
+- const SimpleFontData* result = PlatformFallbackFontForCharacter(
++ scoped_refptr<SimpleFontData> result = PlatformFallbackFontForCharacter(
+ description, lookup_char, font_data_to_substitute, fallback_priority);
+ FontPerformance::AddSystemFallbackFontTime(timer.Elapsed());
+ return result;
+ }
+
++void FontCache::ReleaseFontData(const SimpleFontData* font_data) {
++ font_data_cache_->Release(font_data);
++}
++
++void FontCache::PurgePlatformFontDataCache() {
++ TRACE_EVENT0("fonts,ui", "FontCache::PurgePlatformFontDataCache");
++ font_platform_data_cache_->Purge(*font_data_cache_);
++}
++
+ void FontCache::PurgeFallbackListShaperCache() {
+ TRACE_EVENT0("fonts,ui", "FontCache::PurgeFallbackListShaperCache");
+ for (auto& shape_cache : fallback_list_shaper_cache_.Values()) {
+@@ -257,13 +283,17 @@ void FontCache::InvalidateShapeCache() {
+ PurgeFallbackListShaperCache();
+ }
+
+-void FontCache::Purge() {
++void FontCache::Purge(PurgeSeverity purge_severity) {
+ // Ideally we should never be forcing the purge while the
+ // FontCachePurgePreventer is in scope, but we call purge() at any timing
+ // via MemoryPressureListenerRegistry.
+ if (purge_prevent_count_)
+ return;
+
++ if (!font_data_cache_->Purge(purge_severity))
++ return;
++
++ PurgePlatformFontDataCache();
+ PurgeFallbackListShaperCache();
+ }
+
+@@ -279,15 +309,14 @@ uint16_t FontCache::Generation() {
+
+ void FontCache::Invalidate() {
+ TRACE_EVENT0("fonts,ui", "FontCache::Invalidate");
+- font_platform_data_cache_.Clear();
+- font_data_cache_.Clear();
++ font_platform_data_cache_->Clear();
+ generation_++;
+
+ for (const auto& client : font_cache_clients_) {
+ client->FontCacheInvalidated();
+ }
+
+- Purge();
++ Purge(kForcePurge);
+ }
+
+ void FontCache::CrashWithFontInfo(const FontDescription* font_description) {
+@@ -320,6 +349,16 @@ void FontCache::CrashWithFontInfo(const
+ CHECK(false);
+ }
+
++void FontCache::DumpFontPlatformDataCache(
++ base::trace_event::ProcessMemoryDump* memory_dump) {
++ DCHECK(IsMainThread());
++ base::trace_event::MemoryAllocatorDump* dump =
++ memory_dump->CreateAllocatorDump("font_caches/font_platform_data_cache");
++ dump->AddScalar("size", "bytes", font_platform_data_cache_->ByteSize());
++ memory_dump->AddSuballocation(dump->guid(),
++ WTF::Partitions::kAllocatedObjectPoolName);
++}
++
+ void FontCache::DumpShapeResultCache(
+ base::trace_event::ProcessMemoryDump* memory_dump) {
+ DCHECK(IsMainThread());
+--- a/third_party/blink/renderer/platform/fonts/font_cache.h
++++ b/third_party/blink/renderer/platform/fonts/font_cache.h
+@@ -36,13 +36,13 @@
+ #include <string>
+
+ #include "base/gtest_prod_util.h"
++#include "base/memory/scoped_refptr.h"
+ #include "build/build_config.h"
+ #include "third_party/blink/renderer/platform/fonts/fallback_list_composite_key.h"
+ #include "third_party/blink/renderer/platform/fonts/font_cache_client.h"
+ #include "third_party/blink/renderer/platform/fonts/font_data_cache.h"
+ #include "third_party/blink/renderer/platform/fonts/font_face_creation_params.h"
+ #include "third_party/blink/renderer/platform/fonts/font_fallback_priority.h"
+-#include "third_party/blink/renderer/platform/fonts/font_platform_data_cache.h"
+ #include "third_party/blink/renderer/platform/fonts/shaping/shape_cache.h"
+ #include "third_party/blink/renderer/platform/heap/collection_support/heap_hash_set.h"
+ #include "third_party/blink/renderer/platform/platform_export.h"
+@@ -75,6 +75,7 @@ class FontFaceCreationParams;
+ class FontFallbackMap;
+ class FontGlobalContext;
+ class FontPlatformData;
++class FontPlatformDataCache;
+ class SimpleFontData;
+ class WebFontPrewarmer;
+
+@@ -106,7 +107,9 @@ class PLATFORM_EXPORT FontCache final {
+
+ void Trace(Visitor*) const;
+
+- const SimpleFontData* FallbackFontForCharacter(
++ void ReleaseFontData(const SimpleFontData*);
++
++ scoped_refptr<SimpleFontData> FallbackFontForCharacter(
+ const FontDescription&,
+ UChar32,
+ const SimpleFontData* font_data_to_substitute,
+@@ -115,11 +118,14 @@ class PLATFORM_EXPORT FontCache final {
+ // Also implemented by the platform.
+ void PlatformInit();
+
+- const SimpleFontData* GetFontData(
++ scoped_refptr<SimpleFontData> GetFontData(
+ const FontDescription&,
+ const AtomicString&,
+- AlternateFontName = AlternateFontName::kAllowAlternate);
+- const SimpleFontData* GetLastResortFallbackFont(const FontDescription&);
++ AlternateFontName = AlternateFontName::kAllowAlternate,
++ ShouldRetain = kRetain);
++ scoped_refptr<SimpleFontData> GetLastResortFallbackFont(const FontDescription&,
++ ShouldRetain = kRetain);
++ SimpleFontData* GetNonRetainedLastResortFallbackFont(const FontDescription&);
+
+ // Should be used in determining whether family names listed in font-family:
+ // ... are available locally. Only returns true if family name matches.
+@@ -212,12 +218,12 @@ class PLATFORM_EXPORT FontCache final {
+ return *status_font_family_name_;
+ }
+
+- const SimpleFontData* GetFallbackFamilyNameFromHardcodedChoices(
++ scoped_refptr<SimpleFontData> GetFallbackFamilyNameFromHardcodedChoices(
+ const FontDescription&,
+ UChar32 codepoint,
+ FontFallbackPriority fallback_priority);
+
+- const SimpleFontData* GetDWriteFallbackFamily(
++ scoped_refptr<SimpleFontData> GetDWriteFallbackFamily(
+ const FontDescription&,
+ UChar32 codepoint,
+ FontFallbackPriority fallback_priority);
+@@ -245,8 +251,9 @@ class PLATFORM_EXPORT FontCache final {
+ gfx::FallbackFontData*);
+ #endif // BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
+
+- const SimpleFontData* FontDataFromFontPlatformData(
++ scoped_refptr<SimpleFontData> FontDataFromFontPlatformData(
+ const FontPlatformData*,
++ ShouldRetain = kRetain,
+ bool subpixel_ascent_descent = false);
+
+ void InvalidateShapeCache();
+@@ -254,6 +261,7 @@ class PLATFORM_EXPORT FontCache final {
+ static void CrashWithFontInfo(const FontDescription*);
+
+ // Memory reporting
++ void DumpFontPlatformDataCache(base::trace_event::ProcessMemoryDump*);
+ void DumpShapeResultCache(base::trace_event::ProcessMemoryDump*);
+
+ FontFallbackMap& GetFontFallbackMap();
+@@ -268,7 +276,7 @@ class PLATFORM_EXPORT FontCache final {
+ // elements.
+ using Bcp47Vector = WTF::Vector<const char*, 4>;
+
+- const SimpleFontData* PlatformFallbackFontForCharacter(
++ scoped_refptr<SimpleFontData> PlatformFallbackFontForCharacter(
+ const FontDescription&,
+ UChar32,
+ const SimpleFontData* font_data_to_substitute,
+@@ -283,26 +291,26 @@ class PLATFORM_EXPORT FontCache final {
+ friend class FontGlobalContext;
+ FontCache();
+
+- void Purge();
++ void Purge(PurgeSeverity = kPurgeIfNeeded);
+
+ void DisablePurging() { purge_prevent_count_++; }
+ void EnablePurging() {
+ DCHECK(purge_prevent_count_);
+ if (!--purge_prevent_count_)
+- Purge();
++ Purge(kPurgeIfNeeded);
+ }
+
+ // FIXME: This method should eventually be removed.
+- const FontPlatformData* GetFontPlatformData(
++ FontPlatformData* GetFontPlatformData(
+ const FontDescription&,
+ const FontFaceCreationParams&,
+ AlternateFontName = AlternateFontName::kAllowAlternate);
+ #if !BUILDFLAG(IS_MAC)
+- const FontPlatformData* SystemFontPlatformData(const FontDescription&);
++ FontPlatformData* SystemFontPlatformData(const FontDescription&);
+ #endif // !BUILDFLAG(IS_MAC)
+
+ // These methods are implemented by each platform.
+- const FontPlatformData* CreateFontPlatformData(
++ std::unique_ptr<FontPlatformData> CreateFontPlatformData(
+ const FontDescription&,
+ const FontFaceCreationParams&,
+ float font_size,
+@@ -321,8 +329,9 @@ class PLATFORM_EXPORT FontCache final {
+ #endif // BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_LINUX) ||
+ // BUILDFLAG(IS_CHROMEOS)
+
+- const SimpleFontData* FallbackOnStandardFontStyle(const FontDescription&,
+- UChar32);
++ scoped_refptr<SimpleFontData> FallbackOnStandardFontStyle(
++ const FontDescription&,
++ UChar32);
+
+ // Don't purge if this count is > 0;
+ int purge_prevent_count_ = 0;
+@@ -356,16 +365,17 @@ class PLATFORM_EXPORT FontCache final {
+ uint16_t generation_ = 0;
+ bool platform_init_ = false;
+ HeapHashSet<WeakMember<FontCacheClient>> font_cache_clients_;
+- FontPlatformDataCache font_platform_data_cache_;
++ std::unique_ptr<FontPlatformDataCache> font_platform_data_cache_;
+ HeapHashMap<FallbackListCompositeKey,
+ WeakMember<ShapeCache>,
+ FallbackListCompositeKeyTraits>
+ fallback_list_shaper_cache_;
+
+- FontDataCache font_data_cache_;
++ std::unique_ptr<FontDataCache> font_data_cache_;
+
+ Member<FontFallbackMap> font_fallback_map_;
+
++ void PurgePlatformFontDataCache();
+ void PurgeFallbackListShaperCache();
+
+ friend class SimpleFontData; // For fontDataFromFontPlatformData
+--- a/third_party/blink/renderer/platform/fonts/font_cache_memory_dump_provider.cc
++++ b/third_party/blink/renderer/platform/fonts/font_cache_memory_dump_provider.cc
+@@ -21,6 +21,7 @@ bool FontCacheMemoryDumpProvider::OnMemo
+ DCHECK(IsMainThread());
+ if (auto* context = FontGlobalContext::TryGet()) {
+ FontCache& cache = context->GetFontCache();
++ cache.DumpFontPlatformDataCache(memory_dump);
+ cache.DumpShapeResultCache(memory_dump);
+ }
+ return true;
+--- a/third_party/blink/renderer/platform/fonts/font_custom_platform_data.cc
++++ b/third_party/blink/renderer/platform/fonts/font_custom_platform_data.cc
+@@ -103,7 +103,7 @@ FontCustomPlatformData::~FontCustomPlatf
+ }
+ }
+
+-const FontPlatformData* FontCustomPlatformData::GetFontPlatformData(
++FontPlatformData FontCustomPlatformData::GetFontPlatformData(
+ float size,
+ float adjusted_specified_size,
+ bool bold,
+@@ -276,11 +276,10 @@ const FontPlatformData* FontCustomPlatfo
+ return_typeface = palette_typeface;
+ }
+ }
+- return MakeGarbageCollected<FontPlatformData>(
+- std::move(return_typeface), std::string(), size,
+- synthetic_bold && !base_typeface_->isBold(),
+- synthetic_italic && !base_typeface_->isItalic(), text_rendering,
+- resolved_font_features, orientation);
++ return FontPlatformData(std::move(return_typeface), std::string(), size,
++ synthetic_bold && !base_typeface_->isBold(),
++ synthetic_italic && !base_typeface_->isItalic(),
++ text_rendering, resolved_font_features, orientation);
+ }
+
+ Vector<VariationAxis> FontCustomPlatformData::GetVariationAxes() const {
+--- a/third_party/blink/renderer/platform/fonts/font_custom_platform_data.h
++++ b/third_party/blink/renderer/platform/fonts/font_custom_platform_data.h
+@@ -68,7 +68,7 @@ class PLATFORM_EXPORT FontCustomPlatform
+ // adjusted_specified_size should come from AdjustedSpecifiedSize() of
+ // FontDescription. The latter is needed for correctly applying
+ // font-optical-sizing: auto; independent of zoom level.
+- const FontPlatformData* GetFontPlatformData(
++ FontPlatformData GetFontPlatformData(
+ float size,
+ float adjusted_specified_size,
+ bool bold,
+--- /dev/null
++++ b/third_party/blink/renderer/platform/fonts/font_data.cc
+@@ -0,0 +1,32 @@
++/*
++ * Copyright (C) 2008 Apple Inc. All rights reserved.
++ *
++ * Redistribution and use in source and binary forms, with or without
++ * modification, are permitted provided that the following conditions
++ * are met:
++ * 1. Redistributions of source code must retain the above copyright
++ * notice, this list of conditions and the following disclaimer.
++ * 2. Redistributions in binary form must reproduce the above copyright
++ * notice, this list of conditions and the following disclaimer in the
++ * documentation and/or other materials provided with the distribution.
++ *
++ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
++ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
++ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
++ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
++ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
++ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
++ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
++ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
++ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
++ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++ */
++
++#include "third_party/blink/renderer/platform/fonts/font_data.h"
++
++namespace blink {
++
++FontData::~FontData() = default;
++
++} // namespace blink
+--- a/third_party/blink/renderer/platform/fonts/font_data.h
++++ b/third_party/blink/renderer/platform/fonts/font_data.h
+@@ -27,24 +27,23 @@
+ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_FONT_DATA_H_
+
+ #include "base/memory/scoped_refptr.h"
+-#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
+ #include "third_party/blink/renderer/platform/platform_export.h"
+ #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
+ #include "third_party/blink/renderer/platform/wtf/forward.h"
+ #include "third_party/blink/renderer/platform/wtf/text/wtf_uchar.h"
++#include "third_party/blink/renderer/platform/wtf/thread_safe_ref_counted.h"
+
+ namespace blink {
+
+ class SimpleFontData;
+
+-class PLATFORM_EXPORT FontData : public GarbageCollected<FontData> {
++class PLATFORM_EXPORT FontData : public RefCounted<FontData> {
+ public:
+ FontData() = default;
+ FontData(const FontData&) = delete;
+ FontData& operator=(const FontData&) = delete;
+- virtual ~FontData() = default;
+
+- virtual void Trace(Visitor*) const {}
++ virtual ~FontData();
+
+ virtual const SimpleFontData* FontDataForCharacter(UChar32) const = 0;
+ virtual bool IsCustomFont() const = 0;
+--- a/third_party/blink/renderer/platform/fonts/font_data_cache.cc
++++ b/third_party/blink/renderer/platform/fonts/font_data_cache.cc
+@@ -36,8 +36,23 @@
+
+ namespace blink {
+
+-const SimpleFontData* FontDataCache::Get(const FontPlatformData* platform_data,
+- bool subpixel_ascent_descent) {
++#if !BUILDFLAG(IS_ANDROID)
++const unsigned kCMaxInactiveFontData = 250;
++const unsigned kCTargetInactiveFontData = 200;
++#else
++const unsigned kCMaxInactiveFontData = 225;
++const unsigned kCTargetInactiveFontData = 200;
++#endif
++
++// static
++std::unique_ptr<FontDataCache> FontDataCache::Create() {
++ return std::make_unique<FontDataCache>();
++}
++
++scoped_refptr<SimpleFontData> FontDataCache::Get(
++ const FontPlatformData* platform_data,
++ ShouldRetain should_retain,
++ bool subpixel_ascent_descent) {
+ if (!platform_data)
+ return nullptr;
+
+@@ -50,12 +65,98 @@ const SimpleFontData* FontDataCache::Get
+ return nullptr;
+ }
+
+- auto add_result = cache_.insert(platform_data, nullptr);
+- if (add_result.is_new_entry) {
+- add_result.stored_value->value = MakeGarbageCollected<SimpleFontData>(
+- platform_data, nullptr, subpixel_ascent_descent);
++ Cache::iterator result = cache_.find(platform_data);
++ if (result == cache_.end()) {
++ std::pair<scoped_refptr<SimpleFontData>, unsigned> new_value(
++ SimpleFontData::Create(*platform_data, nullptr,
++ subpixel_ascent_descent),
++ should_retain == kRetain ? 1 : 0);
++ // The new SimpleFontData takes a copy of the incoming FontPlatformData
++ // object. The incoming key may be temporary. So, for cache storage, take
++ // the address of the newly created FontPlatformData that is copied an owned
++ // by SimpleFontData.
++ cache_.Set(&new_value.first->PlatformData(), new_value);
++ if (should_retain == kDoNotRetain)
++ inactive_font_data_.insert(new_value.first);
++ return std::move(new_value.first);
++ }
++
++ if (!result.Get()->value.second) {
++ DCHECK(inactive_font_data_.Contains(result.Get()->value.first));
++ inactive_font_data_.erase(result.Get()->value.first);
++ }
++
++ if (should_retain == kRetain) {
++ result.Get()->value.second++;
++ } else if (!result.Get()->value.second) {
++ // If shouldRetain is DoNotRetain and count is 0, we want to remove the
++ // fontData from m_inactiveFontData (above) and re-add here to update LRU
++ // position.
++ inactive_font_data_.insert(result.Get()->value.first);
++ }
++
++ return result.Get()->value.first;
++}
++
++bool FontDataCache::Contains(const FontPlatformData* font_platform_data) const {
++ return cache_.Contains(font_platform_data);
++}
++
++void FontDataCache::Release(const SimpleFontData* font_data) {
++ DCHECK(!font_data->IsCustomFont());
++
++ Cache::iterator it = cache_.find(&(font_data->PlatformData()));
++ if (it == cache_.end())
++ return;
++
++ DCHECK(it->value.second);
++ if (!--it->value.second)
++ inactive_font_data_.insert(it->value.first);
++}
++
++bool FontDataCache::Purge(PurgeSeverity purge_severity) {
++ if (purge_severity == kForcePurge)
++ return PurgeLeastRecentlyUsed(INT_MAX);
++
++ if (inactive_font_data_.size() > kCMaxInactiveFontData)
++ return PurgeLeastRecentlyUsed(inactive_font_data_.size() -
++ kCTargetInactiveFontData);
++
++ return false;
++}
++
++bool FontDataCache::PurgeLeastRecentlyUsed(int count) {
++ // Guard against reentry when e.g. a deleted FontData releases its small caps
++ // FontData.
++ if (is_purging_)
++ return false;
++
++ base::AutoReset<bool> is_purging_auto_reset(&is_purging_, true);
++
++ Vector<scoped_refptr<SimpleFontData>, 20> font_data_to_delete;
++ auto end = inactive_font_data_.end();
++ auto it = inactive_font_data_.begin();
++ for (int i = 0; i < count && it != end; ++it, ++i) {
++ const scoped_refptr<SimpleFontData>& font_data = *it;
++ cache_.erase(&(font_data->PlatformData()));
++ // We should not delete SimpleFontData here because deletion can modify
++ // m_inactiveFontData. See http://trac.webkit.org/changeset/44011
++ font_data_to_delete.push_back(font_data);
++ }
++
++ if (it == end) {
++ // Removed everything
++ inactive_font_data_.clear();
++ } else {
++ for (int i = 0; i < count; ++i)
++ inactive_font_data_.erase(inactive_font_data_.begin());
+ }
+- return add_result.stored_value->value;
++
++ bool did_work = font_data_to_delete.size();
++
++ font_data_to_delete.clear();
++
++ return did_work;
+ }
+
+ } // namespace blink
+--- a/third_party/blink/renderer/platform/fonts/font_data_cache.h
++++ b/third_party/blink/renderer/platform/fonts/font_data_cache.h
+@@ -33,10 +33,14 @@
+
+ #include "third_party/blink/renderer/platform/fonts/font_platform_data.h"
+ #include "third_party/blink/renderer/platform/fonts/simple_font_data.h"
+-#include "third_party/blink/renderer/platform/heap/collection_support/heap_hash_map.h"
++#include "third_party/blink/renderer/platform/wtf/hash_map.h"
++#include "third_party/blink/renderer/platform/wtf/linked_hash_set.h"
+
+ namespace blink {
+
++enum ShouldRetain { kRetain, kDoNotRetain };
++enum PurgeSeverity { kPurgeIfNeeded, kForcePurge };
++
+ struct FontDataCacheKeyHashTraits : GenericHashTraits<const FontPlatformData*> {
+ STATIC_ONLY(FontDataCacheKeyHashTraits);
+ static unsigned GetHash(const FontPlatformData* platform_data) {
+@@ -51,24 +55,36 @@ struct FontDataCacheKeyHashTraits : Gene
+ };
+
+ class FontDataCache final {
+- DISALLOW_NEW();
++ USING_FAST_MALLOC(FontDataCache);
+
+ public:
++ static std::unique_ptr<FontDataCache> Create();
++
+ FontDataCache() = default;
+ FontDataCache(const FontDataCache&) = delete;
+ FontDataCache& operator=(const FontDataCache&) = delete;
+
+- void Trace(Visitor* visitor) const { visitor->Trace(cache_); }
+-
+- const SimpleFontData* Get(const FontPlatformData*,
+- bool subpixel_ascent_descent = false);
+- void Clear() { cache_.clear(); }
++ scoped_refptr<SimpleFontData> Get(const FontPlatformData*,
++ ShouldRetain = kRetain,
++ bool subpixel_ascent_descent = false);
++ bool Contains(const FontPlatformData*) const;
++ void Release(const SimpleFontData*);
++
++ // Purges items in FontDataCache according to provided severity.
++ // Returns true if any removal of cache items actually occurred.
++ bool Purge(PurgeSeverity);
+
+ private:
+- HeapHashMap<Member<const FontPlatformData>,
+- WeakMember<const SimpleFontData>,
+- FontDataCacheKeyHashTraits>
+- cache_;
++ bool PurgeLeastRecentlyUsed(int count);
++
++ typedef HashMap<const FontPlatformData*,
++ std::pair<scoped_refptr<SimpleFontData>, unsigned>,
++ FontDataCacheKeyHashTraits>
++ Cache;
++
++ Cache cache_;
++ LinkedHashSet<scoped_refptr<SimpleFontData>> inactive_font_data_;
++ bool is_purging_ = false;
+ };
+
+ } // namespace blink
+--- a/third_party/blink/renderer/platform/fonts/font_data_for_range_set.cc
++++ b/third_party/blink/renderer/platform/fonts/font_data_for_range_set.cc
+@@ -13,4 +13,10 @@ FontDataForRangeSet::FontDataForRangeSet
+ range_set_ = other.range_set_;
+ }
+
++FontDataForRangeSetFromCache::~FontDataForRangeSetFromCache() {
++ if (font_data_ && !font_data_->IsCustomFont()) {
++ FontCache::Get().ReleaseFontData(font_data_.get());
++ }
++}
++
+ } // namespace blink
+--- a/third_party/blink/renderer/platform/fonts/font_data_for_range_set.h
++++ b/third_party/blink/renderer/platform/fonts/font_data_for_range_set.h
+@@ -37,19 +37,17 @@ namespace blink {
+ class SimpleFontData;
+
+ class PLATFORM_EXPORT FontDataForRangeSet
+- : public GarbageCollected<FontDataForRangeSet> {
++ : public RefCounted<FontDataForRangeSet> {
+ public:
+ explicit FontDataForRangeSet(
+- const SimpleFontData* font_data = nullptr,
++ scoped_refptr<SimpleFontData> font_data = nullptr,
+ scoped_refptr<UnicodeRangeSet> range_set = nullptr)
+- : font_data_(font_data), range_set_(std::move(range_set)) {}
++ : font_data_(std::move(font_data)), range_set_(std::move(range_set)) {}
+
+ FontDataForRangeSet(const FontDataForRangeSet& other);
+
+ virtual ~FontDataForRangeSet() = default;
+
+- void Trace(Visitor* visitor) const { visitor->Trace(font_data_); }
+-
+ bool Contains(UChar32 test_char) const {
+ return !range_set_ || range_set_->Contains(test_char);
+ }
+@@ -57,8 +55,8 @@ class PLATFORM_EXPORT FontDataForRangeSe
+ return !range_set_ || range_set_->IsEntireRange();
+ }
+ UnicodeRangeSet* Ranges() const { return range_set_.get(); }
+- bool HasFontData() const { return font_data_; }
+- const SimpleFontData* FontData() const { return font_data_.Get(); }
++ bool HasFontData() const { return font_data_.get(); }
++ const SimpleFontData* FontData() const { return font_data_.get(); }
+
+ // TODO(xiaochengh): |FontData::IsLoadingFallback()| returns true if the
+ // FontData is a pending custom font. We should rename it for better clarity.
+@@ -71,10 +69,20 @@ class PLATFORM_EXPORT FontDataForRangeSe
+ }
+
+ protected:
+- Member<const SimpleFontData> font_data_;
++ scoped_refptr<SimpleFontData> font_data_;
+ scoped_refptr<UnicodeRangeSet> range_set_;
+ };
+
++class PLATFORM_EXPORT FontDataForRangeSetFromCache
++ : public FontDataForRangeSet {
++ public:
++ explicit FontDataForRangeSetFromCache(
++ scoped_refptr<SimpleFontData> font_data,
++ scoped_refptr<UnicodeRangeSet> range_set = nullptr)
++ : FontDataForRangeSet(std::move(font_data), std::move(range_set)) {}
++ ~FontDataForRangeSetFromCache() override;
++};
++
+ } // namespace blink
+
+ #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_FONT_DATA_FOR_RANGE_SET_H_
+--- a/third_party/blink/renderer/platform/fonts/font_fallback_iterator.cc
++++ b/third_party/blink/renderer/platform/fonts/font_fallback_iterator.cc
+@@ -60,8 +60,8 @@ void FontFallbackIterator::WillUseRange(
+ selector->WillUseRange(font_description_, family, range_set);
+ }
+
+-FontDataForRangeSet* FontFallbackIterator::UniqueOrNext(
+- FontDataForRangeSet* candidate,
++scoped_refptr<FontDataForRangeSet> FontFallbackIterator::UniqueOrNext(
++ scoped_refptr<FontDataForRangeSet> candidate,
+ const Vector<UChar32>& hint_list) {
+ if (!candidate->HasFontData())
+ return Next(hint_list);
+@@ -104,18 +104,18 @@ bool FontFallbackIterator::NeedsHintList
+ return font_data->IsSegmented();
+ }
+
+-FontDataForRangeSet* FontFallbackIterator::Next(
++scoped_refptr<FontDataForRangeSet> FontFallbackIterator::Next(
+ const Vector<UChar32>& hint_list) {
+ if (fallback_stage_ == kOutOfLuck)
+- return MakeGarbageCollected<FontDataForRangeSet>();
++ return base::AdoptRef(new FontDataForRangeSet());
+
+ if (fallback_stage_ == kFallbackPriorityFonts) {
+ // Only try one fallback priority font,
+ // then proceed to regular system fallback.
+ fallback_stage_ = kSystemFonts;
+- FontDataForRangeSet* fallback_priority_font_range =
+- MakeGarbageCollected<FontDataForRangeSet>(
+- FallbackPriorityFont(hint_list[0]));
++ scoped_refptr<FontDataForRangeSet> fallback_priority_font_range =
++ base::AdoptRef(
++ new FontDataForRangeSet(FallbackPriorityFont(hint_list[0])));
+ if (fallback_priority_font_range->HasFontData())
+ return UniqueOrNext(std::move(fallback_priority_font_range), hint_list);
+ return Next(hint_list);
+@@ -123,11 +123,11 @@ FontDataForRangeSet* FontFallbackIterato
+
+ if (fallback_stage_ == kSystemFonts) {
+ // We've reached pref + system fallback.
+- const SimpleFontData* system_font = UniqueSystemFontForHintList(hint_list);
++ scoped_refptr<SimpleFontData> system_font = UniqueSystemFontForHintList(hint_list);
+ if (system_font) {
+ // Fallback fonts are not retained in the FontDataCache.
+- return UniqueOrNext(
+- MakeGarbageCollected<FontDataForRangeSet>(system_font), hint_list);
++ return UniqueOrNext(base::AdoptRef(new FontDataForRangeSet(system_font)),
++ hint_list);
+ }
+
+ // If we don't have options from the system fallback anymore or had
+@@ -137,16 +137,18 @@ FontDataForRangeSet* FontFallbackIterato
+ // LastResort font, not just Times or Arial.
+ FontCache& font_cache = FontCache::Get();
+ fallback_stage_ = kFirstCandidateForNotdefGlyph;
+- const SimpleFontData* last_resort =
+- font_cache.GetLastResortFallbackFont(font_description_);
++ scoped_refptr<SimpleFontData> last_resort =
++ font_cache.GetLastResortFallbackFont(font_description_).get();
+
+ if (FontSelector* font_selector = font_fallback_list_->GetFontSelector()) {
+- font_selector->ReportLastResortFallbackFontLookup(font_description_,
+- last_resort);
++ font_selector->ReportLastResortFallbackFontLookup(
++ font_description_,
++ last_resort.get());
+ }
+
+- return UniqueOrNext(MakeGarbageCollected<FontDataForRangeSet>(last_resort),
+- hint_list);
++ return UniqueOrNext(
++ base::AdoptRef(new FontDataForRangeSetFromCache(last_resort)),
++ hint_list);
+ }
+
+ if (fallback_stage_ == kFirstCandidateForNotdefGlyph) {
+@@ -177,13 +179,13 @@ FontDataForRangeSet* FontFallbackIterato
+ // Skip forward to the next font family for the next call to next().
+ current_font_data_index_++;
+ if (!font_data->IsLoading()) {
+- SimpleFontData* non_segmented =
++ scoped_refptr<SimpleFontData> non_segmented =
+ const_cast<SimpleFontData*>(To<SimpleFontData>(font_data));
+ // The fontData object that we have here is tracked in m_fontList of
+ // FontFallbackList and gets released in the font cache when the
+ // FontFallbackList is destroyed.
+ return UniqueOrNext(
+- MakeGarbageCollected<FontDataForRangeSet>(non_segmented), hint_list);
++ base::AdoptRef(new FontDataForRangeSet(non_segmented)), hint_list);
+ }
+ return Next(hint_list);
+ }
+@@ -197,7 +199,7 @@ FontDataForRangeSet* FontFallbackIterato
+ }
+
+ DCHECK_LT(segmented_face_index_, segmented->NumFaces());
+- FontDataForRangeSet* current_segmented_face =
++ scoped_refptr<FontDataForRangeSet> current_segmented_face =
+ segmented->FaceAt(segmented_face_index_);
+ segmented_face_index_++;
+
+@@ -208,7 +210,7 @@ FontDataForRangeSet* FontFallbackIterato
+ current_font_data_index_++;
+ }
+
+- if (RangeSetContributesForHint(hint_list, current_segmented_face)) {
++ if (RangeSetContributesForHint(hint_list, current_segmented_face.get())) {
+ const SimpleFontData* current_segmented_face_font_data =
+ current_segmented_face->FontData();
+ if (const CustomFontData* current_segmented_face_custom_font_data =
+@@ -222,15 +224,17 @@ FontDataForRangeSet* FontFallbackIterato
+ return Next(hint_list);
+ }
+
+-const SimpleFontData* FontFallbackIterator::FallbackPriorityFont(UChar32 hint) {
+- const SimpleFontData* font_data = FontCache::Get().FallbackFontForCharacter(
+- font_description_, hint,
+- font_fallback_list_->PrimarySimpleFontData(font_description_),
+- font_fallback_priority_);
++scoped_refptr<SimpleFontData> FontFallbackIterator::FallbackPriorityFont(
++ UChar32 hint) {
++ scoped_refptr<SimpleFontData> font_data =
++ FontCache::Get().FallbackFontForCharacter(
++ font_description_, hint,
++ font_fallback_list_->PrimarySimpleFontData(font_description_),
++ font_fallback_priority_);
+
+ if (FontSelector* font_selector = font_fallback_list_->GetFontSelector()) {
+ font_selector->ReportFontLookupByFallbackCharacter(
+- hint, font_fallback_priority_, font_description_, font_data);
++ hint, font_fallback_priority_, font_description_, font_data.get());
+ }
+ return font_data;
+ }
+@@ -255,7 +259,7 @@ static inline unsigned ChooseHintIndex(c
+ return 0;
+ }
+
+-const SimpleFontData* FontFallbackIterator::UniqueSystemFontForHintList(
++scoped_refptr<SimpleFontData> FontFallbackIterator::UniqueSystemFontForHintList(
+ const Vector<UChar32>& hint_list) {
+ // When we're asked for a fallback for the same characters again, we give up
+ // because the shaper must have previously tried shaping with the font
+@@ -270,13 +274,13 @@ const SimpleFontData* FontFallbackIterat
+ return nullptr;
+ previously_asked_for_hint_.insert(hint);
+
+- const SimpleFontData* font_data = font_cache.FallbackFontForCharacter(
++ scoped_refptr<SimpleFontData> font_data = font_cache.FallbackFontForCharacter(
+ font_description_, hint,
+ font_fallback_list_->PrimarySimpleFontData(font_description_));
+
+ if (FontSelector* font_selector = font_fallback_list_->GetFontSelector()) {
+ font_selector->ReportFontLookupByFallbackCharacter(
+- hint, FontFallbackPriority::kText, font_description_, font_data);
++ hint, FontFallbackPriority::kText, font_description_, font_data.get());
+ }
+ return font_data;
+ }
+--- a/third_party/blink/renderer/platform/fonts/font_fallback_iterator.h
++++ b/third_party/blink/renderer/platform/fonts/font_fallback_iterator.h
+@@ -5,13 +5,14 @@
+ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_FONT_FALLBACK_ITERATOR_H_
+ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_FONT_FALLBACK_ITERATOR_H_
+
++#include "base/memory/scoped_refptr.h"
+ #include "third_party/blink/renderer/platform/fonts/font_data_for_range_set.h"
+ #include "third_party/blink/renderer/platform/fonts/font_fallback_priority.h"
+-#include "third_party/blink/renderer/platform/heap/collection_support/heap_vector.h"
+ #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
+ #include "third_party/blink/renderer/platform/wtf/hash_set.h"
+ #include "third_party/blink/renderer/platform/wtf/ref_counted.h"
+ #include "third_party/blink/renderer/platform/wtf/text/wtf_uchar.h"
++#include "third_party/blink/renderer/platform/wtf/vector.h"
+
+ namespace blink {
+
+@@ -48,7 +48,7 @@
+ // Some system fallback APIs (Windows, Android) require a character, or a
+ // portion of the string to be passed. On Mac and Linux, we get a list of
+ // fonts without passing in characters.
+- FontDataForRangeSet* Next(const Vector<UChar32>& hint_list);
++ scoped_refptr<FontDataForRangeSet> Next(const Vector<UChar32>& hint_list);
+
+ void Reset();
+
+@@ -50,11 +51,12 @@ class FontFallbackIterator {
+ bool AlreadyLoadingRangeForHintChar(UChar32 hint_char);
+ void WillUseRange(const AtomicString& family, const FontDataForRangeSet&);
+
+- FontDataForRangeSet* UniqueOrNext(FontDataForRangeSet* candidate,
+- const Vector<UChar32>& hint_list);
++ scoped_refptr<FontDataForRangeSet> UniqueOrNext(
++ scoped_refptr<FontDataForRangeSet> candidate,
++ const Vector<UChar32>& hint_list);
+
+- const SimpleFontData* FallbackPriorityFont(UChar32 hint);
+- const SimpleFontData* UniqueSystemFontForHintList(
++ scoped_refptr<SimpleFontData> FallbackPriorityFont(UChar32 hint);
++ scoped_refptr<SimpleFontData> UniqueSystemFontForHintList(
+ const Vector<UChar32>& hint_list);
+
+ const FontDescription& font_description_;
+@@ -82,8 +84,8 @@ class FontFallbackIterator {
+ // candidate to be used for rendering the .notdef glyph, and set HasNext() to
+ // false.
+ HashSet<uint32_t> unique_font_data_for_range_sets_returned_;
+- FontDataForRangeSet* first_candidate_ = nullptr;
+- HeapVector<Member<FontDataForRangeSet>> tracked_loading_range_sets_;
++ scoped_refptr<FontDataForRangeSet> first_candidate_;
++ Vector<scoped_refptr<FontDataForRangeSet>> tracked_loading_range_sets_;
+ FontFallbackPriority font_fallback_priority_;
+ };
+
+--- a/third_party/blink/renderer/platform/fonts/font_fallback_list.cc
++++ b/third_party/blink/renderer/platform/fonts/font_fallback_list.cc
+@@ -52,9 +52,17 @@ FontFallbackList::FontFallbackList(FontS
+ is_invalid_(false),
+ nullify_primary_font_data_for_test_(false) {}
+
++FontFallbackList::~FontFallbackList() {
++ unsigned num_fonts = font_list_.size();
++ for (unsigned i = 0; i < num_fonts; ++i) {
++ if (!font_list_[i]->IsCustomFont()) {
++ DCHECK(!font_list_[i]->IsSegmented());
++ FontCache::Get().ReleaseFontData(To<SimpleFontData>(font_list_[i].get()));
++ }
++ }
++}
++
+ void FontFallbackList::Trace(Visitor* visitor) const {
+- visitor->Trace(font_list_);
+- visitor->Trace(cached_primary_simple_font_data_);
+ visitor->Trace(font_selector_);
+ visitor->Trace(ng_shape_cache_);
+ visitor->Trace(shape_cache_);
+@@ -98,8 +106,8 @@ const SimpleFontData* FontFallbackList::
+ return font_data->FontDataForCharacter(kSpaceCharacter);
+
+ FontCache& font_cache = FontCache::Get();
+- const SimpleFontData* last_resort_fallback =
+- font_cache.GetLastResortFallbackFont(font_description);
++ SimpleFontData* last_resort_fallback =
++ font_cache.GetLastResortFallbackFont(font_description).get();
+ DCHECK(last_resort_fallback);
+ return last_resort_fallback;
+ }
+@@ -137,7 +145,7 @@ const SimpleFontData* FontFallbackList::
+ }
+ }
+
+-const FontData* FontFallbackList::GetFontData(
++scoped_refptr<FontData> FontFallbackList::GetFontData(
+ const FontDescription& font_description) {
+ const FontFamily* curr_family = &font_description.Family();
+ for (int i = 0; curr_family && i < family_index_; i++)
+@@ -148,7 +156,7 @@ const FontData* FontFallbackList::GetFon
+ if (!font_selector_) {
+ // Don't query system fonts for empty font family name.
+ if (!curr_family->FamilyName().empty()) {
+- if (auto* result = FontCache::Get().GetFontData(
++ if (auto result = FontCache::Get().GetFontData(
+ font_description, curr_family->FamilyName())) {
+ return result;
+ }
+@@ -156,7 +164,7 @@ const FontData* FontFallbackList::GetFon
+ continue;
+ }
+
+- const FontData* result =
++ scoped_refptr<FontData> result =
+ font_selector_->GetFontData(font_description, *curr_family);
+ // Don't query system fonts for empty font family name.
+ if (!result && !curr_family->FamilyName().empty()) {
+@@ -164,7 +172,7 @@ const FontData* FontFallbackList::GetFon
+ curr_family->FamilyName());
+ font_selector_->ReportFontLookupByUniqueOrFamilyName(
+ curr_family->FamilyName(), font_description,
+- DynamicTo<SimpleFontData>(result));
++ DynamicTo<SimpleFontData>(result.get()));
+ }
+ if (result) {
+ font_selector_->ReportSuccessfulFontFamilyMatch(
+@@ -181,18 +189,18 @@ const FontData* FontFallbackList::GetFon
+ FontFamily font_family;
+ font_family.SetFamily(font_family_names::kWebkitStandard,
+ FontFamily::Type::kGenericFamily);
+- if (const FontData* data =
++ if (scoped_refptr<FontData> data =
+ font_selector_->GetFontData(font_description, font_family)) {
+ return data;
+ }
+ }
+
+ // Still no result. Hand back our last resort fallback font.
+- auto* last_resort =
++ auto last_resort =
+ FontCache::Get().GetLastResortFallbackFont(font_description);
+ if (font_selector_) {
+ font_selector_->ReportLastResortFallbackFontLookup(font_description,
+- last_resort);
++ last_resort.get());
+ }
+ return last_resort;
+ }
+@@ -202,7 +210,7 @@ const FontData* FontFallbackList::FontDa
+ unsigned realized_font_index) {
+ // This fallback font is already in our list.
+ if (realized_font_index < font_list_.size())
+- return font_list_[realized_font_index].Get();
++ return font_list_[realized_font_index].get();
+
+ // Make sure we're not passing in some crazy value here.
+ DCHECK_EQ(realized_font_index, font_list_.size());
+@@ -216,7 +224,7 @@ const FontData* FontFallbackList::FontDa
+ // the same spot in the list twice. GetFontData will adjust our
+ // |family_index_| as it scans for the right font to make.
+ DCHECK_EQ(FontCache::Get().Generation(), generation_);
+- const FontData* result = GetFontData(font_description);
++ scoped_refptr<FontData> result = GetFontData(font_description);
+ if (result) {
+ font_list_.push_back(result);
+ if (result->IsLoadingFallback())
+@@ -224,7 +232,7 @@ const FontData* FontFallbackList::FontDa
+ if (result->IsCustomFont())
+ has_custom_font_ = true;
+ }
+- return result;
++ return result.get();
+ }
+
+ bool FontFallbackList::ComputeCanShapeWordByWord(
+--- a/third_party/blink/renderer/platform/fonts/font_fallback_list.h
++++ b/third_party/blink/renderer/platform/fonts/font_fallback_list.h
+@@ -49,6 +49,7 @@ class PLATFORM_EXPORT FontFallbackList
+
+ FontFallbackList(const FontFallbackList&) = delete;
+ FontFallbackList& operator=(const FontFallbackList&) = delete;
++ ~FontFallbackList();
+
+ void Trace(Visitor*) const;
+
+@@ -116,7 +117,7 @@ class PLATFORM_EXPORT FontFallbackList
+ bool HasCustomFont() const { return has_custom_font_; }
+
+ private:
+- const FontData* GetFontData(const FontDescription&);
++ scoped_refptr<FontData> GetFontData(const FontDescription&);
+
+ const SimpleFontData* DeterminePrimarySimpleFontData(const FontDescription&);
+ const SimpleFontData* DeterminePrimarySimpleFontDataCore(
+@@ -124,8 +125,8 @@ class PLATFORM_EXPORT FontFallbackList
+
+ bool ComputeCanShapeWordByWord(const FontDescription&);
+
+- HeapVector<Member<const FontData>, 1> font_list_;
+- Member<const SimpleFontData> cached_primary_simple_font_data_ = nullptr;
++ Vector<scoped_refptr<FontData>, 1> font_list_;
++ const SimpleFontData* cached_primary_simple_font_data_ = nullptr;
+ const Member<FontSelector> font_selector_;
+ int family_index_ = 0;
+ const uint16_t generation_;
+--- a/third_party/blink/renderer/platform/fonts/font_platform_data.cc
++++ b/third_party/blink/renderer/platform/fonts/font_platform_data.cc
+@@ -158,10 +158,6 @@ FontPlatformData::FontPlatformData(sk_sp
+
+ FontPlatformData::~FontPlatformData() = default;
+
+-void FontPlatformData::Trace(Visitor* visitor) const {
+- visitor->Trace(harfbuzz_face_);
+-}
+-
+ #if BUILDFLAG(IS_MAC)
+ CTFontRef FontPlatformData::CtFont() const {
+ return SkTypeface_GetCTFontRef(typeface_.get());
+@@ -213,10 +209,11 @@ SkTypeface* FontPlatformData::Typeface()
+
+ HarfBuzzFace* FontPlatformData::GetHarfBuzzFace() const {
+ if (!harfbuzz_face_) {
+- harfbuzz_face_ = MakeGarbageCollected<HarfBuzzFace>(this, UniqueID());
++ harfbuzz_face_ =
++ HarfBuzzFace::Create(const_cast<FontPlatformData*>(this), UniqueID());
+ }
+
+- return harfbuzz_face_.Get();
++ return harfbuzz_face_.get();
+ }
+
+ bool FontPlatformData::HasSpaceInLigaturesOrKerning(
+@@ -246,7 +243,7 @@ unsigned FontPlatformData::GetHash() con
+ }
+
+ #if !BUILDFLAG(IS_MAC)
+-bool FontPlatformData::FontContainsCharacter(UChar32 character) const {
++bool FontPlatformData::FontContainsCharacter(UChar32 character) {
+ return CreateSkFont().unicharToGlyph(character);
+ }
+ #endif
+--- a/third_party/blink/renderer/platform/fonts/font_platform_data.h
++++ b/third_party/blink/renderer/platform/fonts/font_platform_data.h
+@@ -39,8 +39,6 @@
+ #include "third_party/blink/renderer/platform/fonts/font_orientation.h"
+ #include "third_party/blink/renderer/platform/fonts/resolved_font_features.h"
+ #include "third_party/blink/renderer/platform/fonts/small_caps_iterator.h"
+-#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
+-#include "third_party/blink/renderer/platform/heap/member.h"
+ #include "third_party/blink/renderer/platform/platform_export.h"
+ #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
+ #include "third_party/blink/renderer/platform/wtf/forward.h"
+@@ -61,8 +59,9 @@ namespace blink {
+ class HarfBuzzFace;
+ class OpenTypeVerticalData;
+
+-class PLATFORM_EXPORT FontPlatformData
+- : public GarbageCollected<FontPlatformData> {
++class PLATFORM_EXPORT FontPlatformData {
++ USING_FAST_MALLOC(FontPlatformData);
++
+ public:
+ // Used for deleted values in the font cache's hash tables. The hash table
+ // will create us with this structure, and it will compare other values
+@@ -83,8 +82,6 @@ class PLATFORM_EXPORT FontPlatformData
+ FontOrientation = FontOrientation::kHorizontal);
+ ~FontPlatformData();
+
+- void Trace(Visitor*) const;
+-
+ #if BUILDFLAG(IS_MAC)
+ // Returns nullptr for FreeType backed SkTypefaces, compare
+ // FontCustomPlatformData, which are used for variable fonts on Mac OS
+@@ -129,7 +126,7 @@ class PLATFORM_EXPORT FontPlatformData
+
+ bool IsHashTableDeletedValue() const { return is_hash_table_deleted_value_; }
+ #if !BUILDFLAG(IS_MAC)
+- bool FontContainsCharacter(UChar32 character) const;
++ bool FontContainsCharacter(UChar32 character);
+ #endif
+
+ #if !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_MAC)
+@@ -185,7 +182,7 @@ class PLATFORM_EXPORT FontPlatformData
+ WebFontRenderStyle style_;
+ #endif
+
+- mutable Member<HarfBuzzFace> harfbuzz_face_;
++ mutable scoped_refptr<HarfBuzzFace> harfbuzz_face_;
+ bool is_hash_table_deleted_value_ = false;
+ };
+
+--- a/third_party/blink/renderer/platform/fonts/font_platform_data_cache.cc
++++ b/third_party/blink/renderer/platform/fonts/font_platform_data_cache.cc
+@@ -38,13 +38,20 @@
+
+ namespace blink {
+
++// static
++std::unique_ptr<FontPlatformDataCache> FontPlatformDataCache::Create() {
++ return std::make_unique<FontPlatformDataCache>();
++}
++
+ FontPlatformDataCache::FontPlatformDataCache()
+ : font_size_limit_(std::nextafter(
+ (static_cast<float>(std::numeric_limits<unsigned>::max()) - 2.f) /
+ static_cast<float>(blink::FontCacheKey::PrecisionMultiplier()),
+ 0.f)) {}
+
+-const FontPlatformData* FontPlatformDataCache::GetOrCreateFontPlatformData(
++FontPlatformDataCache::~FontPlatformDataCache() = default;
++
++FontPlatformData* FontPlatformDataCache::GetOrCreateFontPlatformData(
+ FontCache* font_cache,
+ const FontDescription& font_description,
+ const FontFaceCreationParams& creation_params,
+@@ -60,13 +67,15 @@ const FontPlatformData* FontPlatformData
+
+ auto it = map_.find(key);
+ if (it != map_.end()) {
+- return it->value.Get();
++ return it->value.get();
+ }
+
+- if (const FontPlatformData* result = font_cache->CreateFontPlatformData(
+- font_description, creation_params, size, alternate_font_name)) {
+- map_.insert(key, result);
+- return result;
++ if (std::unique_ptr<FontPlatformData> result =
++ font_cache->CreateFontPlatformData(font_description, creation_params,
++ size, alternate_font_name)) {
++ FontPlatformData* result_ptr = result.get();
++ map_.insert(key, std::move(result));
++ return result_ptr;
+ }
+
+ if (alternate_font_name != AlternateFontName::kAllowAlternate ||
+@@ -82,16 +91,35 @@ const FontPlatformData* FontPlatformData
+ return nullptr;
+
+ FontFaceCreationParams create_by_alternate_family(alternate_name);
+- if (const FontPlatformData* result = GetOrCreateFontPlatformData(
++ if (FontPlatformData* result = GetOrCreateFontPlatformData(
+ font_cache, font_description, create_by_alternate_family,
+ AlternateFontName::kNoAlternate)) {
+ // Cache the platform_data under the old name.
+ // "accessibility/font-changed.html" reaches here.
+- map_.insert(key, result);
++ map_.insert(key, std::make_unique<FontPlatformData>(*result));
+ return result;
+ }
+
+ return nullptr;
+ }
+
++size_t FontPlatformDataCache::ByteSize() const {
++ return map_.size() * sizeof(std::unique_ptr<FontPlatformData>);
++}
++
++void FontPlatformDataCache::Clear() {
++ map_.clear();
++}
++
++void FontPlatformDataCache::Purge(const FontDataCache& font_data_cache) {
++ Vector<FontCacheKey> keys_to_remove;
++ keys_to_remove.ReserveInitialCapacity(map_.size());
++ for (auto& entry : map_) {
++ if (entry.value && !font_data_cache.Contains(entry.value.get())) {
++ keys_to_remove.push_back(entry.key);
++ }
++ }
++ map_.RemoveAll(keys_to_remove);
++}
++
+ } // namespace blink
+--- a/third_party/blink/renderer/platform/fonts/font_platform_data_cache.h
++++ b/third_party/blink/renderer/platform/fonts/font_platform_data_cache.h
+@@ -31,13 +31,13 @@
+ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_FONT_PLATFORM_DATA_CACHE_H_
+
+ #include "third_party/blink/renderer/platform/fonts/font_cache_key.h"
+-#include "third_party/blink/renderer/platform/heap/collection_support/heap_hash_map.h"
+-#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
++#include "third_party/blink/renderer/platform/wtf/hash_map.h"
+
+ namespace blink {
+
+ enum class AlternateFontName;
+ class FontCache;
++class FontDataCache;
+ class FontDescription;
+ class FontFaceCreationParams;
+ class FontPlatformData;
+@@ -45,23 +45,30 @@ class FontPlatformData;
+ // `FontPlatformDataCache` is the shared cache mapping from `FontDescription`
+ // to `FontPlatformData`.
+ class FontPlatformDataCache final {
+- DISALLOW_NEW();
+-
+ public:
++ static std::unique_ptr<FontPlatformDataCache> Create();
++
+ FontPlatformDataCache();
++ ~FontPlatformDataCache();
++
++ FontPlatformDataCache(const FontPlatformDataCache&) = delete;
++ FontPlatformDataCache(FontPlatformDataCache&&) = delete;
+
+- void Trace(Visitor* visitor) const { visitor->Trace(map_); }
++ FontPlatformDataCache operator=(const FontPlatformDataCache&) = delete;
++ FontPlatformDataCache operator=(FontPlatformDataCache&&) = delete;
+
+- const FontPlatformData* GetOrCreateFontPlatformData(
++ FontPlatformData* GetOrCreateFontPlatformData(
+ FontCache* font_cache,
+ const FontDescription& font_description,
+ const FontFaceCreationParams& creation_params,
+ AlternateFontName alternate_font_name);
+
+- void Clear() { map_.clear(); }
++ size_t ByteSize() const;
++ void Clear();
++ void Purge(const FontDataCache& font_data_cache);
+
+ private:
+- HeapHashMap<FontCacheKey, WeakMember<const FontPlatformData>> map_;
++ HashMap<FontCacheKey, std::unique_ptr<FontPlatformData>> map_;
+
+ // A maximum float value to which we limit incoming font sizes. This is the
+ // smallest float so that multiplying it by
+--- a/third_party/blink/renderer/platform/fonts/font_selector.h
++++ b/third_party/blink/renderer/platform/fonts/font_selector.h
+@@ -53,8 +53,8 @@ class UseCounter;
+ class PLATFORM_EXPORT FontSelector : public FontCacheClient {
+ public:
+ ~FontSelector() override = default;
+- virtual const FontData* GetFontData(const FontDescription&,
+- const FontFamily&) = 0;
++ virtual scoped_refptr<FontData> GetFontData(const FontDescription&,
++ const FontFamily&) = 0;
+
+ // TODO(crbug.com/542629): The String variant of this method should be
+ // replaced with a better approach, now that we only have complex text.
+@@ -92,7 +92,7 @@ class PLATFORM_EXPORT FontSelector : pub
+ virtual void ReportFontLookupByUniqueOrFamilyName(
+ const AtomicString& name,
+ const FontDescription& font_description,
+- const SimpleFontData* resulting_font_data) = 0;
++ scoped_refptr<SimpleFontData> resulting_font_data) = 0;
+
+ // Called whenever a page attempts to find a local font based on a name. This
+ // only includes lookups where the name is allowed to match PostScript names
+@@ -100,7 +100,7 @@ class PLATFORM_EXPORT FontSelector : pub
+ virtual void ReportFontLookupByUniqueNameOnly(
+ const AtomicString& name,
+ const FontDescription& font_description,
+- const SimpleFontData* resulting_font_data,
++ scoped_refptr<SimpleFontData> resulting_font_data,
+ bool is_loading_fallback = false) = 0;
+
+ // Called whenever a page attempts to find a local font based on a fallback
+@@ -109,12 +109,12 @@ class PLATFORM_EXPORT FontSelector : pub
+ UChar32 fallback_character,
+ FontFallbackPriority fallback_priority,
+ const FontDescription& font_description,
+- const SimpleFontData* resulting_font_data) = 0;
++ scoped_refptr<SimpleFontData> resulting_font_data) = 0;
+
+ // Called whenever a page attempts to find a last-resort font.
+ virtual void ReportLastResortFallbackFontLookup(
+ const FontDescription& font_description,
+- const SimpleFontData* resulting_font_data) = 0;
++ scoped_refptr<SimpleFontData> resulting_font_data) = 0;
+
+ virtual void ReportNotDefGlyph() const = 0;
+
+--- a/third_party/blink/renderer/platform/fonts/fuchsia/font_cache_fuchsia.cc
++++ b/third_party/blink/renderer/platform/fonts/fuchsia/font_cache_fuchsia.cc
+@@ -45,7 +45,7 @@ void FontCache::SetSystemFontFamily(cons
+ MutableSystemFontFamily() = family_name;
+ }
+
+-const SimpleFontData* FontCache::PlatformFallbackFontForCharacter(
++scoped_refptr<SimpleFontData> FontCache::PlatformFallbackFontForCharacter(
+ const FontDescription& font_description,
+ UChar32 character,
+ const SimpleFontData* font_data_to_substitute,
+@@ -67,12 +67,12 @@ const SimpleFontData* FontCache::Platfor
+ !typeface->isItalic() &&
+ font_description.SyntheticItalicAllowed();
+
+- const auto* font_data = MakeGarbageCollected<FontPlatformData>(
++ auto font_data = std::make_unique<FontPlatformData>(
+ std::move(typeface), std::string(), font_description.EffectiveFontSize(),
+ synthetic_bold, synthetic_italic, font_description.TextRendering(),
+ ResolvedFontFeatures(), font_description.Orientation());
+
+- return FontDataFromFontPlatformData(font_data);
++ return FontDataFromFontPlatformData(font_data.get(), kDoNotRetain);
+ }
+
+ } // namespace blink
+--- a/third_party/blink/renderer/platform/fonts/linux/font_cache_linux.cc
++++ b/third_party/blink/renderer/platform/fonts/linux/font_cache_linux.cc
+@@ -62,7 +62,7 @@ bool FontCache::GetFontForCharacter(UCha
+ }
+ }
+
+-const SimpleFontData* FontCache::PlatformFallbackFontForCharacter(
++scoped_refptr<SimpleFontData> FontCache::PlatformFallbackFontForCharacter(
+ const FontDescription& font_description,
+ UChar32 c,
+ const SimpleFontData*,
+@@ -77,9 +77,11 @@ const SimpleFontData* FontCache::Platfor
+ AtomicString family_name = GetFamilyNameForCharacter(
+ font_manager_.get(), c, font_description, nullptr, fallback_priority);
+ if (family_name.empty())
+- return GetLastResortFallbackFont(font_description);
+- return FontDataFromFontPlatformData(GetFontPlatformData(
+- font_description, FontFaceCreationParams(family_name)));
++ return GetLastResortFallbackFont(font_description, kDoNotRetain);
++ return FontDataFromFontPlatformData(
++ GetFontPlatformData(font_description,
++ FontFaceCreationParams(family_name)),
++ kDoNotRetain);
+ }
+
+ if (fallback_priority == FontFallbackPriority::kEmojiEmoji) {
+@@ -94,7 +96,7 @@ const SimpleFontData* FontCache::Platfor
+ if (fallback_priority != FontFallbackPriority::kEmojiEmoji &&
+ (font_description.Style() == kItalicSlopeValue ||
+ font_description.Weight() >= kBoldThreshold)) {
+- const SimpleFontData* font_data =
++ scoped_refptr<SimpleFontData> font_data =
+ FallbackOnStandardFontStyle(font_description, c);
+ if (font_data)
+ return font_data;
+@@ -137,16 +139,16 @@ const SimpleFontData* FontCache::Platfor
+ description.SetStyle(kNormalSlopeValue);
+ }
+
+- const FontPlatformData* substitute_platform_data =
++ FontPlatformData* substitute_platform_data =
+ GetFontPlatformData(description, creation_params);
+ if (!substitute_platform_data)
+ return nullptr;
+
+- FontPlatformData* platform_data =
+- MakeGarbageCollected<FontPlatformData>(*substitute_platform_data);
++ std::unique_ptr<FontPlatformData> platform_data(
++ new FontPlatformData(*substitute_platform_data));
+ platform_data->SetSyntheticBold(should_set_synthetic_bold);
+ platform_data->SetSyntheticItalic(should_set_synthetic_italic);
+- return FontDataFromFontPlatformData(platform_data);
++ return FontDataFromFontPlatformData(platform_data.get(), kDoNotRetain);
+ }
+
+ } // namespace blink
+--- a/third_party/blink/renderer/platform/fonts/segmented_font_data.h
++++ b/third_party/blink/renderer/platform/fonts/segmented_font_data.h
+@@ -28,7 +28,6 @@
+
+ #include "third_party/blink/renderer/platform/fonts/font_data.h"
+ #include "third_party/blink/renderer/platform/fonts/font_data_for_range_set.h"
+-#include "third_party/blink/renderer/platform/heap/collection_support/heap_vector.h"
+ #include "third_party/blink/renderer/platform/platform_export.h"
+ #include "third_party/blink/renderer/platform/wtf/casting.h"
+
+@@ -38,21 +37,20 @@ class SimpleFontData;
+
+ class PLATFORM_EXPORT SegmentedFontData : public FontData {
+ public:
+- SegmentedFontData() = default;
+-
+- void Trace(Visitor* visitor) const override {
+- visitor->Trace(faces_);
+- FontData::Trace(visitor);
++ static scoped_refptr<SegmentedFontData> Create() {
++ return base::AdoptRef(new SegmentedFontData);
+ }
+
+- void AppendFace(FontDataForRangeSet* font_data_for_range_set) {
++ void AppendFace(scoped_refptr<FontDataForRangeSet> font_data_for_range_set) {
+ faces_.push_back(std::move(font_data_for_range_set));
+ }
+ unsigned NumFaces() const { return faces_.size(); }
+- FontDataForRangeSet* FaceAt(unsigned i) const { return faces_[i].Get(); }
++ scoped_refptr<FontDataForRangeSet> FaceAt(unsigned i) const { return faces_[i]; }
+ bool ContainsCharacter(UChar32) const;
+
+ private:
++ SegmentedFontData() = default;
++
+ const SimpleFontData* FontDataForCharacter(UChar32) const override;
+
+ bool IsCustomFont() const override;
+@@ -61,7 +59,7 @@ class PLATFORM_EXPORT SegmentedFontData
+ bool IsSegmented() const override;
+ bool ShouldSkipDrawing() const override;
+
+- HeapVector<Member<FontDataForRangeSet>, 1> faces_;
++ Vector<scoped_refptr<FontDataForRangeSet>, 1> faces_;
+ };
+
+ template <>
+--- a/third_party/blink/renderer/platform/fonts/shaping/caching_word_shaper.cc
++++ b/third_party/blink/renderer/platform/fonts/shaping/caching_word_shaper.cc
+@@ -127,7 +127,7 @@ Vector<double> CachingWordShaper::Indivi
+ total_width);
+ }
+
+-HeapVector<ShapeResult::RunFontData> CachingWordShaper::GetRunFontData(
++Vector<ShapeResult::RunFontData> CachingWordShaper::GetRunFontData(
+ const TextRun& run) const {
+ ShapeResultBuffer buffer;
+ ShapeResultsForRun(GetShapeCache(), &font_, run, &buffer);
+--- a/third_party/blink/renderer/platform/fonts/shaping/caching_word_shaper.h
++++ b/third_party/blink/renderer/platform/fonts/shaping/caching_word_shaper.h
+@@ -26,6 +26,7 @@
+ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_SHAPING_CACHING_WORD_SHAPER_H_
+ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_SHAPING_CACHING_WORD_SHAPER_H_
+
++#include "base/memory/scoped_refptr.h"
+ #include "third_party/blink/renderer/platform/fonts/shaping/shape_result_buffer.h"
+ #include "third_party/blink/renderer/platform/text/text_run.h"
+ #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
+@@ -59,7 +60,7 @@ class PLATFORM_EXPORT CachingWordShaper
+ CharacterRange GetCharacterRange(const TextRun&, unsigned from, unsigned to);
+ Vector<double> IndividualCharacterAdvances(const TextRun&);
+
+- HeapVector<ShapeResult::RunFontData> GetRunFontData(const TextRun&) const;
++ Vector<ShapeResult::RunFontData> GetRunFontData(const TextRun&) const;
+
+ GlyphData EmphasisMarkGlyphData(const TextRun&) const;
+
+--- a/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.cc
++++ b/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.cc
+@@ -62,8 +62,7 @@
+
+ namespace blink {
+
+-HarfBuzzFace::HarfBuzzFace(const FontPlatformData* platform_data,
+- uint64_t unique_id)
++HarfBuzzFace::HarfBuzzFace(FontPlatformData* platform_data, uint64_t unique_id)
+ : platform_data_(platform_data), unique_id_(unique_id) {
+ HbFontCacheEntry* const cache_entry =
+ FontGlobalContext::GetHarfBuzzFontCache().RefOrNew(unique_id_,
+@@ -76,10 +76,6 @@
+ FontGlobalContext::GetHarfBuzzFontCache().Remove(unique_id_);
+ }
+
+-void HarfBuzzFace::Trace(Visitor* visitor) const {
+- visitor->Trace(platform_data_);
+-}
+-
+ bool HarfBuzzFace::ignore_variation_selectors_ = false;
+
+ static hb_bool_t HarfBuzzGetGlyph(hb_font_t* hb_font,
+@@ -426,8 +421,7 @@ static hb_blob_t* HarfBuzzSkiaGetTable(h
+ }
+
+ // TODO(yosin): We should move |CreateFace()| to "harfbuzz_font_cache.cc".
+-static hb::unique_ptr<hb_face_t> CreateFace(
+- const FontPlatformData* platform_data) {
++static hb::unique_ptr<hb_face_t> CreateFace(FontPlatformData* platform_data) {
+ hb::unique_ptr<hb_face_t> face;
+
+ sk_sp<SkTypeface> typeface = sk_ref_sp(platform_data->Typeface());
+@@ -475,9 +469,8 @@ static scoped_refptr<HbFontCacheEntry> C
+ return cache_entry;
+ }
+
+-HbFontCacheEntry* HarfBuzzFontCache::RefOrNew(
+- uint64_t unique_id,
+- const FontPlatformData* platform_data) {
++HbFontCacheEntry* HarfBuzzFontCache::RefOrNew(uint64_t unique_id,
++ FontPlatformData* platform_data) {
+ const auto& result = font_map_.insert(unique_id, nullptr);
+ if (result.is_new_entry) {
+ hb::unique_ptr<hb_face_t> face = CreateFace(platform_data);
+--- a/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.h
++++ b/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_face.h
+@@ -34,11 +34,10 @@
+ #include "third_party/blink/renderer/platform/fonts/glyph.h"
+ #include "third_party/blink/renderer/platform/fonts/typesetting_features.h"
+ #include "third_party/blink/renderer/platform/fonts/unicode_range_set.h"
+-#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
+-#include "third_party/blink/renderer/platform/heap/member.h"
+ #include "third_party/blink/renderer/platform/platform_export.h"
+ #include "third_party/blink/renderer/platform/runtime_enabled_features.h"
+ #include "third_party/blink/renderer/platform/wtf/allocator/allocator.h"
++#include "third_party/blink/renderer/platform/wtf/ref_counted.h"
+ #include "third_party/blink/renderer/platform/wtf/text/character_names.h"
+
+ #include <hb.h>
+@@ -53,15 +52,19 @@
+ // |HarfBuzzFace| is a thread specific data associated to |FontPlatformData|,
+ // hold by |HarfBuzzFontCache|.
+ class PLATFORM_EXPORT HarfBuzzFace final
+- : public GarbageCollected<HarfBuzzFace> {
++ : public RefCounted<HarfBuzzFace> {
++ USING_FAST_MALLOC(HarfBuzzFace);
++
+ public:
+- HarfBuzzFace(const FontPlatformData* platform_data, uint64_t);
++ static scoped_refptr<HarfBuzzFace> Create(FontPlatformData* platform_data,
++ uint64_t unique_id) {
++ return base::AdoptRef(new HarfBuzzFace(platform_data, unique_id));
++ }
++
+ HarfBuzzFace(const HarfBuzzFace&) = delete;
+ HarfBuzzFace& operator=(const HarfBuzzFace&) = delete;
+ ~HarfBuzzFace();
+
+- void Trace(Visitor*) const;
+-
+ enum VerticalLayoutCallbacks { kPrepareForVerticalLayout, kNoVerticalLayout };
+
+ // In order to support the restricting effect of unicode-range optionally a
+@@ -102,10 +105,11 @@
+ }
+
+ private:
++ HarfBuzzFace(FontPlatformData* platform_data, uint64_t);
+
+ void PrepareHarfBuzzFontData();
+
+- Member<const FontPlatformData> platform_data_;
++ FontPlatformData* const platform_data_;
+ const uint64_t unique_id_;
+ // TODO(crbug.com/1489080): When briefly given MiraclePtr protection,
+ // these members were both found dangling.
+--- a/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_font_cache.h
++++ b/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_font_cache.h
+@@ -49,7 +49,7 @@ class HarfBuzzFontCache final {
+ ~HarfBuzzFontCache();
+
+ HbFontCacheEntry* RefOrNew(uint64_t unique_id,
+- const FontPlatformData* platform_data);
++ FontPlatformData* platform_data);
+ void Remove(uint64_t unique_id);
+
+ private:
+--- a/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_shaper.cc
++++ b/third_party/blink/renderer/platform/fonts/shaping/harfbuzz_shaper.cc
+@@ -798,7 +798,7 @@
+ fallback_chars_hint.ReserveInitialCapacity(range_data->end -
+ range_data->start);
+ }
+- FontDataForRangeSet* current_font_data_for_range_set = nullptr;
++ scoped_refptr<FontDataForRangeSet> current_font_data_for_range_set = nullptr;
+ FallbackFontStage fallback_stage = kIntermediate;
+ while (!range_data->reshape_queue.empty()) {
+ ReshapeQueueItem current_queue_item = range_data->reshape_queue.TakeFirst();
+@@ -867,7 +867,7 @@
+ if (needs_caps_handling) {
+ case_map_intend = caps_support.NeedsCaseChange(small_caps_behavior);
+ if (caps_support.NeedsSyntheticFont(small_caps_behavior)) {
+- adjusted_font = font_data->SmallCapsFontData(font_description);
++ adjusted_font = font_data->SmallCapsFontData(font_description).get();
+ }
+ }
+
+--- a/third_party/blink/renderer/platform/fonts/shaping/shape_result.cc
++++ b/third_party/blink/renderer/platform/fonts/shaping/shape_result.cc
+@@ -79,10 +79,9 @@ ASSERT_SIZE(ShapeResult::RunInfo, SameSi
+
+ struct SameSizeAsShapeResult {
+ float width;
+- UntracedMember<void*> deprecated_ink_bounds_;
+- Vector<int> runs_;
+- Vector<int> character_position_;
+- UntracedMember<void*> primary_font_;
++ UntracedMember<void*> member;
++ Vector<int> vectors[2];
++ void *pointer;
+ unsigned start_index_;
+ unsigned num_characters_;
+ unsigned bitfields : 32;
+@@ -396,7 +395,7 @@ void ShapeResult::RunInfo::CharacterInde
+ }
+ }
+
+-ShapeResult::ShapeResult(const SimpleFontData* font_data,
++ShapeResult::ShapeResult(scoped_refptr<const SimpleFontData> font_data,
+ unsigned start_index,
+ unsigned num_characters,
+ TextDirection direction)
+@@ -436,7 +435,6 @@ void ShapeResult::Trace(Visitor* visitor
+ visitor->Trace(deprecated_ink_bounds_);
+ visitor->Trace(runs_);
+ visitor->Trace(character_position_);
+- visitor->Trace(primary_font_);
+ }
+
+ size_t ShapeResult::ByteSize() const {
+@@ -736,10 +734,10 @@ bool ShapeResult::HasFallbackFonts(const
+ return false;
+ }
+
+-void ShapeResult::GetRunFontData(HeapVector<RunFontData>* font_data) const {
++void ShapeResult::GetRunFontData(Vector<RunFontData>* font_data) const {
+ for (const auto& run : runs_) {
+ font_data->push_back(
+- RunFontData({run->font_data_.Get(), run->glyph_data_.size()}));
++ RunFontData({run->font_data_.get(), run->glyph_data_.size()}));
+ }
+ }
+
+@@ -754,7 +752,7 @@ float ShapeResult::ForEachGlyphImpl(floa
+ for (const auto& glyph_data : run.glyph_data_) {
+ glyph_callback(context, run.start_index_ + glyph_data.character_index,
+ glyph_data.glyph, *glyph_offsets, total_advance,
+- is_horizontal, run.canvas_rotation_, run.font_data_.Get());
++ is_horizontal, run.canvas_rotation_, run.font_data_.get());
+ total_advance += glyph_data.advance;
+ ++glyph_offsets;
+ }
+@@ -789,7 +787,7 @@ float ShapeResult::ForEachGlyphImpl(floa
+ auto total_advance = initial_advance;
+ unsigned run_start = run.start_index_ + index_offset;
+ bool is_horizontal = HB_DIRECTION_IS_HORIZONTAL(run.direction_);
+- const SimpleFontData* font_data = run.font_data_.Get();
++ const SimpleFontData* font_data = run.font_data_.get();
+
+ if (run.IsLtr()) { // Left-to-right
+ for (const auto& glyph_data : run.glyph_data_) {
+@@ -1679,7 +1677,7 @@ unsigned ShapeResult::CopyRangeInternal(
+ ShapeResult* ShapeResult::SubRange(unsigned start_offset,
+ unsigned end_offset) const {
+ ShapeResult* sub_range =
+- MakeGarbageCollected<ShapeResult>(primary_font_.Get(), 0, 0, Direction());
++ MakeGarbageCollected<ShapeResult>(primary_font_.get(), 0, 0, Direction());
+ CopyRange(start_offset, end_offset, sub_range);
+ return sub_range;
+ }
+--- a/third_party/blink/renderer/platform/fonts/shaping/shape_result.h
++++ b/third_party/blink/renderer/platform/fonts/shaping/shape_result.h
+@@ -139,7 +139,7 @@ typedef void (*GraphemeClusterCallback)(
+
+ class PLATFORM_EXPORT ShapeResult : public GarbageCollected<ShapeResult> {
+ public:
+- ShapeResult(const SimpleFontData*,
++ ShapeResult(scoped_refptr<const SimpleFontData>,
+ unsigned start_index,
+ unsigned num_characters,
+ TextDirection);
+@@ -152,7 +152,7 @@ class PLATFORM_EXPORT ShapeResult : publ
+ void Trace(Visitor*) const;
+
+ static ShapeResult* CreateEmpty(const ShapeResult& other) {
+- return MakeGarbageCollected<ShapeResult>(other.primary_font_.Get(), 0, 0,
++ return MakeGarbageCollected<ShapeResult>(other.primary_font_, 0, 0,
+ other.Direction());
+ }
+ static const ShapeResult* CreateForTabulationCharacters(
+@@ -184,7 +184,7 @@ class PLATFORM_EXPORT ShapeResult : publ
+ LayoutUnit SnappedWidth() const { return LayoutUnit::FromFloatCeil(width_); }
+ unsigned NumCharacters() const { return num_characters_; }
+ unsigned NumGlyphs() const { return num_glyphs_; }
+- const SimpleFontData* PrimaryFont() const { return primary_font_.Get(); }
++ const SimpleFontData* PrimaryFont() const { return primary_font_.get(); }
+ bool HasFallbackFonts(const SimpleFontData* primary_font) const;
+
+ // TODO(eae): Remove start_x and return value once ShapeResultBuffer has been
+@@ -350,12 +350,10 @@ class PLATFORM_EXPORT ShapeResult : publ
+
+ // Computes the list of fonts along with the number of glyphs for each font.
+ struct RunFontData {
+- DISALLOW_NEW();
+- void Trace(Visitor* visitor) const { visitor->Trace(font_data_); }
+- Member<SimpleFontData> font_data_;
++ SimpleFontData* font_data_;
+ wtf_size_t glyph_count_;
+ };
+- void GetRunFontData(HeapVector<RunFontData>* font_data) const;
++ void GetRunFontData(Vector<RunFontData>* font_data) const;
+
+ // Iterates over, and calls the specified callback function, for all the
+ // glyphs. Also tracks (and returns) a seeded total advance.
+@@ -510,7 +510,7 @@
+ // index to x-position and O(log n) time, using binary search, from
+ // x-position to character index.
+ mutable HeapVector<ShapeResultCharacterData> character_position_;
+- Member<const SimpleFontData> primary_font_;
++ scoped_refptr<const SimpleFontData> primary_font_;
+
+ unsigned start_index_ = 0;
+ unsigned num_characters_ = 0;
+@@ -570,6 +568,5 @@ PLATFORM_EXPORT std::ostream& operator<<
+ } // namespace blink
+
+ WTF_ALLOW_CLEAR_UNUSED_SLOTS_WITH_MEM_FUNCTIONS(blink::ShapeResult::ShapeRange)
+-WTF_ALLOW_CLEAR_UNUSED_SLOTS_WITH_MEM_FUNCTIONS(blink::ShapeResult::RunFontData)
+
+ #endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_SHAPING_SHAPE_RESULT_H_
+--- a/third_party/blink/renderer/platform/fonts/shaping/shape_result_buffer.cc
++++ b/third_party/blink/renderer/platform/fonts/shaping/shape_result_buffer.cc
+@@ -249,8 +249,8 @@ int ShapeResultBuffer::OffsetForPosition
+ return total_offset;
+ }
+
+-HeapVector<ShapeResult::RunFontData> ShapeResultBuffer::GetRunFontData() const {
+- HeapVector<ShapeResult::RunFontData> font_data;
++Vector<ShapeResult::RunFontData> ShapeResultBuffer::GetRunFontData() const {
++ Vector<ShapeResult::RunFontData> font_data;
+ for (const auto& result : results_)
+ result->GetRunFontData(&font_data);
+ return font_data;
+@@ -264,9 +264,10 @@ GlyphData ShapeResultBuffer::EmphasisMar
+ if (run->glyph_data_.IsEmpty())
+ continue;
+
+- return GlyphData(run->glyph_data_[0].glyph,
+- run->font_data_->EmphasisMarkFontData(font_description),
+- run->CanvasRotation());
++ return GlyphData(
++ run->glyph_data_[0].glyph,
++ run->font_data_->EmphasisMarkFontData(font_description).get(),
++ run->CanvasRotation());
+ }
+ }
+
+--- a/third_party/blink/renderer/platform/fonts/shaping/shape_result_buffer.h
++++ b/third_party/blink/renderer/platform/fonts/shaping/shape_result_buffer.h
+@@ -5,6 +5,7 @@
+ #ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_SHAPING_SHAPE_RESULT_BUFFER_H_
+ #define THIRD_PARTY_BLINK_RENDERER_PLATFORM_FONTS_SHAPING_SHAPE_RESULT_BUFFER_H_
+
++#include "base/memory/scoped_refptr.h"
+ #include "third_party/blink/renderer/platform/fonts/shaping/shape_result.h"
+ #include "third_party/blink/renderer/platform/heap/collection_support/heap_vector.h"
+ #include "third_party/blink/renderer/platform/platform_export.h"
+@@ -47,7 +48,7 @@ class PLATFORM_EXPORT ShapeResultBuffer
+ TextDirection,
+ float total_width) const;
+
+- HeapVector<ShapeResult::RunFontData> GetRunFontData() const;
++ Vector<ShapeResult::RunFontData> GetRunFontData() const;
+
+ GlyphData EmphasisMarkGlyphData(const FontDescription&) const;
+
+--- a/third_party/blink/renderer/platform/fonts/shaping/shape_result_inline_headers.h
++++ b/third_party/blink/renderer/platform/fonts/shaping/shape_result_inline_headers.h
+@@ -79,7 +79,7 @@ struct ShapeResult::RunInfo final
+ direction_(other.direction_),
+ canvas_rotation_(other.canvas_rotation_) {}
+
+- void Trace(Visitor* visitor) const { visitor->Trace(font_data_); }
++ void Trace(Visitor*) const {}
+
+ unsigned NumGlyphs() const { return glyph_data_.size(); }
+ bool IsLtr() const { return HB_DIRECTION_IS_FORWARD(direction_); }
+@@ -130,7 +130,7 @@ struct ShapeResult::RunInfo final
+ return nullptr;
+
+ auto* run = MakeGarbageCollected<RunInfo>(
+- font_data_.Get(), direction_, canvas_rotation_, script_,
++ font_data_.get(), direction_, canvas_rotation_, script_,
+ start_index_ + start, number_of_glyphs, number_of_characters);
+
+ run->glyph_data_.CopyFromRange(glyphs);
+@@ -154,7 +154,7 @@ struct ShapeResult::RunInfo final
+ return nullptr;
+ DCHECK_LT(start_index_, other.start_index_);
+ auto* run = MakeGarbageCollected<RunInfo>(
+- font_data_.Get(), direction_, canvas_rotation_, script_, start_index_,
++ font_data_.get(), direction_, canvas_rotation_, script_, start_index_,
+ glyph_data_.size() + other.glyph_data_.size(),
+ num_characters_ + other.num_characters_);
+ // Note: We populate |graphemes_| on demand, e.g. hit testing.
+@@ -374,7 +374,7 @@ struct ShapeResult::RunInfo final
+ }
+
+ GlyphDataCollection glyph_data_;
+- Member<SimpleFontData> font_data_;
++ scoped_refptr<SimpleFontData> font_data_;
+
+ // graphemes_[i] is the number of graphemes up to (and including) the ith
+ // character in the run.
+--- a/third_party/blink/renderer/platform/fonts/shaping/shape_result_test_info.cc
++++ b/third_party/blink/renderer/platform/fonts/shaping/shape_result_test_info.cc
+@@ -54,7 +54,7 @@ float ShapeResultTestInfo::AdvanceForTes
+
+ SimpleFontData* ShapeResultTestInfo::FontDataForTesting(
+ unsigned run_index) const {
+- return runs_[run_index]->font_data_.Get();
++ return runs_[run_index]->font_data_.get();
+ }
+
+ Vector<unsigned> ShapeResultTestInfo::CharacterIndexesForTesting() const {
+--- a/third_party/blink/renderer/platform/fonts/shaping/shape_result_view.cc
++++ b/third_party/blink/renderer/platform/fonts/shaping/shape_result_view.cc
+@@ -28,9 +28,7 @@ ShapeResultView::RunInfoPart::RunInfoPar
+ start_index_(start_index),
+ offset_(offset),
+ num_characters_(num_characters),
+- width_(width) {
+- static_assert(std::is_trivially_destructible<RunInfoPart>::value, "");
+-}
++ width_(width) {}
+
+ void ShapeResultView::RunInfoPart::Trace(Visitor* visitor) const {
+ visitor->Trace(run_);
+@@ -74,10 +72,7 @@ unsigned ShapeResultView::CharacterIndex
+ // |InitData| provides values of const member variables of |ShapeResultView|
+ // for constructor.
+ struct ShapeResultView::InitData {
+- STACK_ALLOCATED();
+-
+- public:
+- const SimpleFontData* primary_font = nullptr;
++ scoped_refptr<const SimpleFontData> primary_font;
+ unsigned start_index = 0;
+ unsigned char_index_offset = 0;
+ TextDirection direction = TextDirection::kLtr;
+@@ -188,7 +183,7 @@ ShapeResult* ShapeResultView::CreateShap
+ new_result->runs_.ReserveInitialCapacity(parts_.size());
+ for (const auto& part : RunsOrParts()) {
+ auto* new_run = MakeGarbageCollected<ShapeResult::RunInfo>(
+- part.run_->font_data_.Get(), part.run_->direction_,
++ part.run_->font_data_.get(), part.run_->direction_,
+ part.run_->canvas_rotation_, part.run_->script_, part.start_index_,
+ part.NumGlyphs(), part.num_characters_);
+ new_run->glyph_data_.CopyFromRange(part.range_);
+@@ -364,21 +359,21 @@ unsigned ShapeResultView::PreviousSafeTo
+ }
+
+ void ShapeResultView::GetRunFontData(
+- HeapVector<ShapeResult::RunFontData>* font_data) const {
++ Vector<ShapeResult::RunFontData>* font_data) const {
+ for (const auto& part : RunsOrParts()) {
+ font_data->push_back(ShapeResult::RunFontData(
+- {part.run_->font_data_.Get(),
++ {part.run_->font_data_.get(),
+ static_cast<wtf_size_t>(part.end() - part.begin())}));
+ }
+ }
+
+ void ShapeResultView::FallbackFonts(
+- HeapHashSet<Member<const SimpleFontData>>* fallback) const {
++ HashSet<const SimpleFontData*>* fallback) const {
+ DCHECK(fallback);
+ DCHECK(primary_font_);
+ for (const auto& part : RunsOrParts()) {
+ if (part.run_->font_data_ && part.run_->font_data_ != primary_font_) {
+- fallback->insert(part.run_->font_data_.Get());
++ fallback->insert(part.run_->font_data_.get());
+ }
+ }
+ }
+@@ -392,7 +387,7 @@ float ShapeResultView::ForEachGlyphImpl(
+ const auto& run = part.run_;
+ auto total_advance = initial_advance;
+ bool is_horizontal = HB_DIRECTION_IS_HORIZONTAL(run->direction_);
+- const SimpleFontData* font_data = run->font_data_.Get();
++ const SimpleFontData* font_data = run->font_data_.get();
+ const unsigned character_index_offset_for_glyph_data =
+ CharacterIndexOffsetForGlyphData(part);
+ for (const auto& glyph_data : part) {
+@@ -435,7 +430,7 @@ float ShapeResultView::ForEachGlyphImpl(
+ auto total_advance = initial_advance;
+ const auto& run = part.run_;
+ bool is_horizontal = HB_DIRECTION_IS_HORIZONTAL(run->direction_);
+- const SimpleFontData* font_data = run->font_data_.Get();
++ const SimpleFontData* font_data = run->font_data_.get();
+ const unsigned character_index_offset_for_glyph_data =
+ CharacterIndexOffsetForGlyphData(part);
+ if (run->IsLtr()) { // Left-to-right
+--- a/third_party/blink/renderer/platform/fonts/shaping/shape_result_view.h
++++ b/third_party/blink/renderer/platform/fonts/shaping/shape_result_view.h
+@@ -10,7 +10,6 @@
+ #include "third_party/blink/renderer/platform/fonts/shaping/shape_result.h"
+ #include "third_party/blink/renderer/platform/fonts/simple_font_data.h"
+ #include "third_party/blink/renderer/platform/geometry/layout_unit.h"
+-#include "third_party/blink/renderer/platform/heap/collection_support/heap_hash_set.h"
+ #include "third_party/blink/renderer/platform/platform_export.h"
+ #include "third_party/blink/renderer/platform/text/text_direction.h"
+ #include "third_party/blink/renderer/platform/wtf/forward.h"
+@@ -111,10 +110,7 @@ class PLATFORM_EXPORT ShapeResultView fi
+ ShapeResultView& operator=(const ShapeResultView&) = delete;
+ ~ShapeResultView() = default;
+
+- void Trace(Visitor* visitor) const {
+- visitor->Trace(parts_);
+- visitor->Trace(primary_font_);
+- }
++ void Trace(Visitor* visitor) const { visitor->Trace(parts_); }
+
+ ShapeResult* CreateShapeResult() const;
+
+@@ -130,7 +126,7 @@ class PLATFORM_EXPORT ShapeResultView fi
+ bool IsLtr() const { return blink::IsLtr(Direction()); }
+ bool IsRtl() const { return blink::IsRtl(Direction()); }
+ bool HasVerticalOffsets() const { return has_vertical_offsets_; }
+- void FallbackFonts(HeapHashSet<Member<const SimpleFontData>>* fallback) const;
++ void FallbackFonts(HashSet<const SimpleFontData*>* fallback) const;
+
+ unsigned PreviousSafeToBreakOffset(unsigned index) const;
+
+@@ -155,8 +151,10 @@ class PLATFORM_EXPORT ShapeResultView fi
+ // bounds.
+ gfx::RectF ComputeInkBounds() const;
+
+- const SimpleFontData* PrimaryFont() const { return primary_font_.Get(); }
+- void GetRunFontData(HeapVector<ShapeResult::RunFontData>*) const;
++ scoped_refptr<const SimpleFontData> PrimaryFont() const {
++ return primary_font_;
++ }
++ void GetRunFontData(Vector<ShapeResult::RunFontData>*) const;
+
+ void ExpandRangeToIncludePartialGlyphs(unsigned* from, unsigned* to) const;
+
+@@ -288,8 +286,7 @@ class PLATFORM_EXPORT ShapeResultView fi
+
+ unsigned StartIndexOffsetForRun() const { return char_index_offset_; }
+
+- HeapVector<RunInfoPart, 1> parts_;
+- Member<const SimpleFontData> const primary_font_;
++ scoped_refptr<const SimpleFontData> const primary_font_;
+
+ const unsigned start_index_;
+
+@@ -311,6 +308,8 @@ class PLATFORM_EXPORT ShapeResultView fi
+ // with ShapeResult::SubRange
+ const unsigned char_index_offset_;
+
++ HeapVector<RunInfoPart, 1> parts_;
++
+ private:
+ friend class ShapeResult;
+
+--- a/third_party/blink/renderer/platform/fonts/simple_font_data.cc
++++ b/third_party/blink/renderer/platform/fonts/simple_font_data.cc
+@@ -76,14 +76,14 @@ constexpr int32_t kFontObjectsMemoryCons
+ constexpr int32_t kFontObjectsMemoryConsumption = 2128;
+ #endif
+
+-SimpleFontData::SimpleFontData(const FontPlatformData* platform_data,
+- const CustomFontData* custom_data,
++SimpleFontData::SimpleFontData(const FontPlatformData& platform_data,
++ scoped_refptr<CustomFontData> custom_data,
+ bool subpixel_ascent_descent,
+ const FontMetricsOverride& metrics_override)
+ : platform_data_(platform_data),
+- font_(platform_data->size() ? platform_data->CreateSkFont()
++ font_(platform_data_.size() ? platform_data.CreateSkFont()
+ : skia::DefaultFont()),
+- custom_font_data_(custom_data) {
++ custom_font_data_(std::move(custom_data)) {
+ // Every time new SimpleFontData instance is created, Skia will ask
+ // FreeType to get the metrics for glyphs by invoking
+ // af_face_globals_get_metrics. There FT will allocate style_metrics_size
+@@ -111,7 +111,7 @@ SimpleFontData::~SimpleFontData() {
+
+ void SimpleFontData::PlatformInit(bool subpixel_ascent_descent,
+ const FontMetricsOverride& metrics_override) {
+- if (!platform_data_->size()) {
++ if (!platform_data_.size()) {
+ font_metrics_.Reset();
+ avg_char_width_ = 0;
+ max_char_width_ = 0;
+@@ -126,7 +126,7 @@ void SimpleFontData::PlatformInit(bool s
+ float descent;
+
+ FontMetrics::AscentDescentWithHacks(
+- ascent, descent, *platform_data_, font_, subpixel_ascent_descent,
++ ascent, descent, platform_data_, font_, subpixel_ascent_descent,
+ metrics_override.ascent_override, metrics_override.descent_override);
+
+ font_metrics_.SetAscent(ascent);
+@@ -164,7 +164,7 @@ void SimpleFontData::PlatformInit(bool s
+
+ float line_gap;
+ if (metrics_override.line_gap_override) {
+- line_gap = *metrics_override.line_gap_override * platform_data_->size();
++ line_gap = *metrics_override.line_gap_override * platform_data_.size();
+ } else {
+ line_gap = SkScalarToFloat(metrics.fLeading);
+ }
+@@ -261,39 +261,45 @@ bool SimpleFontData::IsSegmented() const
+ return false;
+ }
+
+-SimpleFontData* SimpleFontData::SmallCapsFontData(
++scoped_refptr<SimpleFontData> SimpleFontData::SmallCapsFontData(
+ const FontDescription& font_description) const {
+- if (!small_caps_) {
+- small_caps_ =
++ if (!derived_font_data_)
++ derived_font_data_ = std::make_unique<DerivedFontData>();
++ if (!derived_font_data_->small_caps) {
++ derived_font_data_->small_caps =
+ CreateScaledFontData(font_description, kSmallCapsFontSizeMultiplier);
+ }
+- return small_caps_;
++
++ return derived_font_data_->small_caps;
+ }
+
+-SimpleFontData* SimpleFontData::EmphasisMarkFontData(
++scoped_refptr<SimpleFontData> SimpleFontData::EmphasisMarkFontData(
+ const FontDescription& font_description) const {
+- if (!emphasis_mark_) {
+- emphasis_mark_ =
++ if (!derived_font_data_)
++ derived_font_data_ = std::make_unique<DerivedFontData>();
++ if (!derived_font_data_->emphasis_mark) {
++ derived_font_data_->emphasis_mark =
+ CreateScaledFontData(font_description, kEmphasisMarkFontSizeMultiplier);
+ }
+- return emphasis_mark_;
++
++ return derived_font_data_->emphasis_mark;
+ }
+
+-SimpleFontData* SimpleFontData::CreateScaledFontData(
++scoped_refptr<SimpleFontData> SimpleFontData::CreateScaledFontData(
+ const FontDescription& font_description,
+ float scale_factor) const {
+ const float scaled_size =
+ lroundf(font_description.ComputedSize() * scale_factor);
+- return MakeGarbageCollected<SimpleFontData>(
+- MakeGarbageCollected<FontPlatformData>(*platform_data_, scaled_size),
+- IsCustomFont() ? MakeGarbageCollected<CustomFontData>() : nullptr);
++ return SimpleFontData::Create(
++ FontPlatformData(platform_data_, scaled_size),
++ IsCustomFont() ? CustomFontData::Create() : nullptr);
+ }
+
+-SimpleFontData* SimpleFontData::MetricsOverriddenFontData(
++scoped_refptr<SimpleFontData> SimpleFontData::MetricsOverriddenFontData(
+ const FontMetricsOverride& metrics_override) const {
+- return MakeGarbageCollected<SimpleFontData>(
+- platform_data_, custom_font_data_, false /* subpixel_ascent_descent */,
+- metrics_override);
++ return base::AdoptRef(new SimpleFontData(platform_data_, custom_font_data_,
++ false /* subpixel_ascent_descent */,
++ metrics_override));
+ }
+
+ // Internal leadings can be distributed to ascent and descent.
+@@ -346,7 +352,7 @@ static std::pair<int16_t, int16_t> TypoA
+
+ void SimpleFontData::ComputeNormalizedTypoAscentAndDescent() const {
+ // Compute em height metrics from OS/2 sTypoAscender and sTypoDescender.
+- SkTypeface* typeface = platform_data_->Typeface();
++ SkTypeface* typeface = platform_data_.Typeface();
+ auto [typo_ascender, typo_descender] = TypoAscenderAndDescender(typeface);
+ if (typo_ascender > 0 &&
+ TrySetNormalizedTypoAscentAndDescent(typo_ascender, typo_descender)) {
+@@ -433,7 +439,7 @@ const std::optional<float>& SimpleFontDa
+ }
+
+ // Compute vertical advance if the orientation is `kVerticalUpright`.
+- const HarfBuzzFace* hb_face = platform_data_->GetHarfBuzzFace();
++ const HarfBuzzFace* hb_face = platform_data_.GetHarfBuzzFace();
+ const OpenTypeVerticalData& vertical_data = hb_face->VerticalData();
+ ideographic_inline_size_ = vertical_data.AdvanceHeight(cjk_water_glyph);
+ });
+@@ -461,9 +467,8 @@ const HanKerning::FontData& SimpleFontDa
+ }
+
+ gfx::RectF SimpleFontData::PlatformBoundsForGlyph(Glyph glyph) const {
+- if (!platform_data_->size()) {
++ if (!platform_data_.size())
+ return gfx::RectF();
+- }
+
+ static_assert(sizeof(glyph) == 2, "Glyph id should not be truncated.");
+
+@@ -476,18 +481,16 @@ void SimpleFontData::BoundsForGlyphs(con
+ Vector<SkRect, 256>* bounds) const {
+ DCHECK_EQ(glyphs.size(), bounds->size());
+
+- if (!platform_data_->size()) {
++ if (!platform_data_.size())
+ return;
+- }
+
+ DCHECK_EQ(bounds->size(), glyphs.size());
+ SkFontGetBoundsForGlyphs(font_, glyphs, bounds->data());
+ }
+
+ float SimpleFontData::WidthForGlyph(Glyph glyph) const {
+- if (!platform_data_->size()) {
++ if (!platform_data_.size())
+ return 0;
+- }
+
+ static_assert(sizeof(glyph) == 2, "Glyph id should not be truncated.");
+
+--- a/third_party/blink/renderer/platform/fonts/simple_font_data.h
++++ b/third_party/blink/renderer/platform/fonts/simple_font_data.h
+@@ -40,7 +40,6 @@
+ #include "third_party/blink/renderer/platform/fonts/glyph.h"
+ #include "third_party/blink/renderer/platform/fonts/shaping/han_kerning.h"
+ #include "third_party/blink/renderer/platform/fonts/typesetting_features.h"
+-#include "third_party/blink/renderer/platform/heap/member.h"
+ #include "third_party/blink/renderer/platform/platform_export.h"
+ #include "third_party/blink/renderer/platform/wtf/casting.h"
+ #include "third_party/blink/renderer/platform/wtf/text/string_hash.h"
+@@ -75,18 +74,12 @@ class FontDescription;
+ class PLATFORM_EXPORT SimpleFontData final : public FontData {
+ public:
+ // Used to create platform fonts.
+- SimpleFontData(
+- const FontPlatformData*,
+- const CustomFontData* custom_data = nullptr,
+- bool subpixel_ascent_descent = false,
+- const FontMetricsOverride& metrics_override = FontMetricsOverride());
+-
+- void Trace(Visitor* visitor) const override {
+- visitor->Trace(platform_data_);
+- visitor->Trace(small_caps_);
+- visitor->Trace(emphasis_mark_);
+- visitor->Trace(custom_font_data_);
+- FontData::Trace(visitor);
++ static scoped_refptr<SimpleFontData> Create(
++ const FontPlatformData& platform_data,
++ scoped_refptr<CustomFontData> custom_data = nullptr,
++ bool subpixel_ascent_descent = false) {
++ return base::AdoptRef(new SimpleFontData(
++ platform_data, std::move(custom_data), subpixel_ascent_descent));
+ }
+
+ SimpleFontData(const SimpleFontData&) = delete;
+@@ -95,11 +88,13 @@ class PLATFORM_EXPORT SimpleFontData fin
+ SimpleFontData& operator=(const SimpleFontData&) = delete;
+ SimpleFontData& operator=(const SimpleFontData&&) = delete;
+
+- const FontPlatformData& PlatformData() const { return *platform_data_; }
++ const FontPlatformData& PlatformData() const { return platform_data_; }
+
+- SimpleFontData* SmallCapsFontData(const FontDescription&) const;
+- SimpleFontData* EmphasisMarkFontData(const FontDescription&) const;
+- SimpleFontData* MetricsOverriddenFontData(const FontMetricsOverride&) const;
++ scoped_refptr<SimpleFontData> SmallCapsFontData(const FontDescription&) const;
++ scoped_refptr<SimpleFontData> EmphasisMarkFontData(
++ const FontDescription&) const;
++ scoped_refptr<SimpleFontData> MetricsOverriddenFontData(
++ const FontMetricsOverride&) const;
+
+ FontMetrics& GetFontMetrics() { return font_metrics_; }
+ const FontMetrics& GetFontMetrics() const { return font_metrics_; }
+@@ -154,7 +149,7 @@ class PLATFORM_EXPORT SimpleFontData fin
+
+ Glyph GlyphForCharacter(UChar32) const;
+
+- bool IsCustomFont() const override { return custom_font_data_; }
++ bool IsCustomFont() const override { return custom_font_data_.get(); }
+ bool IsLoading() const override {
+ return custom_font_data_ ? custom_font_data_->IsLoading() : false;
+ }
+@@ -169,16 +164,20 @@ class PLATFORM_EXPORT SimpleFontData fin
+ return custom_font_data_ && custom_font_data_->ShouldSkipDrawing();
+ }
+
+- const CustomFontData* GetCustomFontData() const {
+- return custom_font_data_.Get();
+- }
++ CustomFontData* GetCustomFontData() const { return custom_font_data_.get(); }
+
+ private:
++ SimpleFontData(
++ const FontPlatformData&,
++ scoped_refptr<CustomFontData> custom_data,
++ bool subpixel_ascent_descent = false,
++ const FontMetricsOverride& metrics_override = FontMetricsOverride());
++
+ void PlatformInit(bool subpixel_ascent_descent, const FontMetricsOverride&);
+ void PlatformGlyphInit();
+
+- SimpleFontData* CreateScaledFontData(const FontDescription&,
+- float scale_factor) const;
++ scoped_refptr<SimpleFontData> CreateScaledFontData(const FontDescription&,
++ float scale_factor) const;
+
+ void ComputeNormalizedTypoAscentAndDescent() const;
+ bool TrySetNormalizedTypoAscentAndDescent(float ascent, float descent) const;
+@@ -187,17 +186,30 @@ class PLATFORM_EXPORT SimpleFontData fin
+ float max_char_width_ = -1;
+ float avg_char_width_ = -1;
+
+- Member<const FontPlatformData> platform_data_;
++ const FontPlatformData platform_data_;
+ const SkFont font_;
+
+ Glyph space_glyph_ = 0;
+ float space_width_ = 0;
+ Glyph zero_glyph_ = 0;
+
+- mutable Member<SimpleFontData> small_caps_;
+- mutable Member<SimpleFontData> emphasis_mark_;
++ struct DerivedFontData final {
++ USING_FAST_MALLOC(DerivedFontData);
++
++ public:
++ DerivedFontData() = default;
++ DerivedFontData(const DerivedFontData&) = delete;
++ DerivedFontData(DerivedFontData&&) = delete;
++ DerivedFontData& operator=(const DerivedFontData&) = delete;
++ DerivedFontData& operator=(DerivedFontData&&) = delete;
++
++ scoped_refptr<SimpleFontData> small_caps;
++ scoped_refptr<SimpleFontData> emphasis_mark;
++ };
++
++ mutable std::unique_ptr<DerivedFontData> derived_font_data_;
+
+- Member<const CustomFontData> custom_font_data_;
++ const scoped_refptr<CustomFontData> custom_font_data_;
+
+ mutable std::once_flag ideographic_inline_size_once_;
+ mutable std::once_flag ideographic_advance_width_once_;
+--- a/third_party/blink/renderer/platform/fonts/skia/font_cache_skia.cc
++++ b/third_party/blink/renderer/platform/fonts/skia/font_cache_skia.cc
+@@ -94,7 +94,7 @@ AtomicString FontCache::GetFamilyNameFor
+
+ void FontCache::PlatformInit() {}
+
+-const SimpleFontData* FontCache::FallbackOnStandardFontStyle(
++scoped_refptr<SimpleFontData> FontCache::FallbackOnStandardFontStyle(
+ const FontDescription& font_description,
+ UChar32 character) {
+ FontDescription substitute_description(font_description);
+@@ -103,26 +103,27 @@ const SimpleFontData* FontCache::Fallbac
+
+ FontFaceCreationParams creation_params(
+ substitute_description.Family().FamilyName());
+- const FontPlatformData* substitute_platform_data =
++ FontPlatformData* substitute_platform_data =
+ GetFontPlatformData(substitute_description, creation_params);
+ if (substitute_platform_data &&
+ substitute_platform_data->FontContainsCharacter(character)) {
+- FontPlatformData* platform_data =
+- MakeGarbageCollected<FontPlatformData>(*substitute_platform_data);
+- platform_data->SetSyntheticBold(font_description.Weight() >=
+- kBoldThreshold &&
+- font_description.SyntheticBoldAllowed());
+- platform_data->SetSyntheticItalic(
+- font_description.Style() == kItalicSlopeValue &&
+- font_description.SyntheticItalicAllowed());
+- return FontDataFromFontPlatformData(platform_data);
++ FontPlatformData platform_data =
++ FontPlatformData(*substitute_platform_data);
++ platform_data.SetSyntheticBold(font_description.Weight() >=
++ kBoldThreshold &&
++ font_description.SyntheticBoldAllowed());
++ platform_data.SetSyntheticItalic(font_description.Style() ==
++ kItalicSlopeValue &&
++ font_description.SyntheticItalicAllowed());
++ return FontDataFromFontPlatformData(&platform_data, kDoNotRetain);
+ }
+
+ return nullptr;
+ }
+
+-const SimpleFontData* FontCache::GetLastResortFallbackFont(
+- const FontDescription& description) {
++scoped_refptr<SimpleFontData> FontCache::GetLastResortFallbackFont(
++ const FontDescription& description,
++ ShouldRetain should_retain) {
+ const FontFaceCreationParams fallback_creation_params(
+ GetFallbackFontFamily(description));
+ const FontPlatformData* font_platform_data = GetFontPlatformData(
+@@ -195,7 +196,7 @@ const SimpleFontData* FontCache::GetLast
+ #endif
+
+ DCHECK(font_platform_data);
+- return FontDataFromFontPlatformData(font_platform_data);
++ return FontDataFromFontPlatformData(font_platform_data, should_retain);
+ }
+
+ sk_sp<SkTypeface> FontCache::CreateTypeface(
+@@ -238,7 +239,7 @@ sk_sp<SkTypeface> FontCache::CreateTypef
+ }
+
+ #if !BUILDFLAG(IS_WIN)
+-const FontPlatformData* FontCache::CreateFontPlatformData(
++std::unique_ptr<FontPlatformData> FontCache::CreateFontPlatformData(
+ const FontDescription& font_description,
+ const FontFaceCreationParams& creation_params,
+ float font_size,
+@@ -293,10 +294,11 @@ const FontPlatformData* FontCache::Creat
+ ->GetResolvedFontFeatures()
+ : ResolvedFontFeatures();
+
+- FontPlatformData* font_platform_data = MakeGarbageCollected<FontPlatformData>(
+- typeface, name, font_size, synthetic_bold, synthetic_italic,
+- font_description.TextRendering(), resolved_font_features,
+- font_description.Orientation());
++ std::unique_ptr<FontPlatformData> font_platform_data =
++ std::make_unique<FontPlatformData>(
++ typeface, name, font_size, synthetic_bold, synthetic_italic,
++ font_description.TextRendering(), resolved_font_features,
++ font_description.Orientation());
+
+ font_platform_data->SetAvoidEmbeddedBitmaps(
+ BitmapGlyphsBlockList::ShouldAvoidEmbeddedBitmapsForTypeface(*typeface));
+--- a/third_party/blink/renderer/platform/testing/font_test_helpers.cc
++++ b/third_party/blink/renderer/platform/testing/font_test_helpers.cc
+@@ -43,26 +43,23 @@ class TestFontSelector : public FontSele
+ }
+ ~TestFontSelector() override = default;
+
+- FontData* GetFontData(const FontDescription& font_description,
+- const FontFamily&) override {
++ scoped_refptr<FontData> GetFontData(const FontDescription& font_description,
++ const FontFamily&) override {
+ FontSelectionCapabilities normal_capabilities(
+ {kNormalWidthValue, kNormalWidthValue},
+ {kNormalSlopeValue, kNormalSlopeValue},
+ {kNormalWeightValue, kNormalWeightValue});
+- const FontPlatformData* platform_data =
+- custom_platform_data_->GetFontPlatformData(
+- font_description.EffectiveFontSize(),
+- font_description.AdjustedSpecifiedSize(),
+- font_description.IsSyntheticBold() &&
+- font_description.SyntheticBoldAllowed(),
+- font_description.IsSyntheticItalic() &&
+- font_description.SyntheticItalicAllowed(),
+- font_description.GetFontSelectionRequest(), normal_capabilities,
+- font_description.FontOpticalSizing(),
+- font_description.TextRendering(), {},
+- font_description.Orientation());
+- return MakeGarbageCollected<SimpleFontData>(
+- platform_data, MakeGarbageCollected<CustomFontData>());
++ FontPlatformData platform_data = custom_platform_data_->GetFontPlatformData(
++ font_description.EffectiveFontSize(),
++ font_description.AdjustedSpecifiedSize(),
++ font_description.IsSyntheticBold() &&
++ font_description.SyntheticBoldAllowed(),
++ font_description.IsSyntheticItalic() &&
++ font_description.SyntheticItalicAllowed(),
++ font_description.GetFontSelectionRequest(), normal_capabilities,
++ font_description.FontOpticalSizing(), font_description.TextRendering(),
++ {}, font_description.Orientation());
++ return SimpleFontData::Create(platform_data, CustomFontData::Create());
+ }
+
+ void WillUseFontData(const FontDescription&,
+@@ -83,20 +80,20 @@ class TestFontSelector : public FontSele
+ void ReportFontLookupByUniqueOrFamilyName(
+ const AtomicString& name,
+ const FontDescription& font_description,
+- const SimpleFontData* resulting_font_data) override {}
++ scoped_refptr<SimpleFontData> resulting_font_data) override {}
+ void ReportFontLookupByUniqueNameOnly(
+ const AtomicString& name,
+ const FontDescription& font_description,
+- const SimpleFontData* resulting_font_data,
++ scoped_refptr<SimpleFontData> resulting_font_data,
+ bool is_loading_fallback = false) override {}
+ void ReportFontLookupByFallbackCharacter(
+ UChar32 hint,
+ FontFallbackPriority fallback_priority,
+ const FontDescription& font_description,
+- const SimpleFontData* resulting_font_data) override {}
++ scoped_refptr<SimpleFontData> resulting_font_data) override {}
+ void ReportLastResortFallbackFontLookup(
+ const FontDescription& font_description,
+- const SimpleFontData* resulting_font_data) override {}
++ scoped_refptr<SimpleFontData> resulting_font_data) override {}
+ void ReportNotDefGlyph() const override {}
+ void ReportEmojiSegmentGlyphCoverage(unsigned, unsigned) override {}
+ ExecutionContext* GetExecutionContext() const override { return nullptr; }
+--- a/tools/privacy_budget/font_indexer/font_indexer.cc
++++ b/tools/privacy_budget/font_indexer/font_indexer.cc
+@@ -116,7 +116,7 @@ void FontIndexer::FontListHasLoaded(base
+ bool FontIndexer::DoesFontHaveDigest(WTF::AtomicString name,
+ blink::FontDescription font_description,
+ int64_t digest) {
+- const blink::SimpleFontData* font_data =
++ scoped_refptr<blink::SimpleFontData> font_data =
+ font_cache_->GetFontData(font_description, name);
+ DCHECK(font_data);
+ return blink::FontGlobalContext::Get()
+@@ -170,7 +170,7 @@ void FontIndexer::PrintAllFontsWithName(
+ // exists and for later comparison.
+ int64_t default_font_digest;
+ {
+- const blink::SimpleFontData* font_data =
++ scoped_refptr<blink::SimpleFontData> font_data =
+ font_cache_->GetFontData(blink::FontDescription(), name);
+ default_font_digest =
+ font_data ? blink::FontGlobalContext::Get()
+@@ -231,7 +231,7 @@ void FontIndexer::PrintAllFontsWithName(
+ for (auto slope_pair : slopes) {
+ font_description.SetStyle(slope_pair.first);
+
+- if (const blink::SimpleFontData* font_data =
++ if (scoped_refptr<blink::SimpleFontData> font_data =
+ font_cache_->GetFontData(font_description, name)) {
+ uint64_t typeface_digest =
+ blink::FontGlobalContext::Get()
diff --git a/chromium-125-debian-bad-font-gc3.patch b/chromium-125-debian-bad-font-gc3.patch
new file mode 100644
index 0000000..600a400
--- /dev/null
+++ b/chromium-125-debian-bad-font-gc3.patch
@@ -0,0 +1,38 @@
+Revert the following commit (to support bad-font-gc2.patch):
+
+commit d4806d20fda56e9bac259fddf10b7439ce749add
+Author: Hao Liu <haoliuk@chromium.org>
+Date: Mon Mar 18 22:56:31 2024 +0000
+
+ Cleanup leftover non-used custom_font_data methods
+
+ This is to clean up non-used custom_font_data methods. Their usage has
+ been deleted in a previous CL.
+ https://chromium-review.googlesource.com/c/chromium/src/+/5262982/29/third_party/blink/renderer/core/css/css_font_face_source.cc#b95
+
+ Change-Id: I90c3ae794a6caf71526c81a56795e95c23cc3fb5
+ Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5368244
+ Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
+ Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
+ Cr-Commit-Position: refs/heads/main@{#1274525}
+
+--- a/third_party/blink/renderer/core/css/css_custom_font_data.h
++++ b/third_party/blink/renderer/core/css/css_custom_font_data.h
+@@ -55,6 +55,7 @@ class CSSCustomFontData final : public C
+
+ bool IsLoading() const override { return is_loading_; }
+ bool IsLoadingFallback() const override { return true; }
++ void ClearFontFaceSource() override { font_face_source_ = nullptr; }
+
+ bool IsPendingDataUrl() const override {
+ return font_face_source_ && font_face_source_->IsPendingDataUrl();
+--- a/third_party/blink/renderer/platform/fonts/custom_font_data.h
++++ b/third_party/blink/renderer/platform/fonts/custom_font_data.h
+@@ -46,6 +46,7 @@ class PLATFORM_EXPORT CustomFontData : p
+ virtual bool IsLoading() const { return false; }
+ virtual bool IsLoadingFallback() const { return false; }
+ virtual bool ShouldSkipDrawing() const { return false; }
++ virtual void ClearFontFaceSource() {}
+ virtual bool IsPendingDataUrl() const { return false; }
+
+ protected:
diff --git a/chromium-125-disable-FFmpegAllowLists.patch b/chromium-125-disable-FFmpegAllowLists.patch
new file mode 100644
index 0000000..72761b7
--- /dev/null
+++ b/chromium-125-disable-FFmpegAllowLists.patch
@@ -0,0 +1,12 @@
+diff -up chromium-122.0.6261.29/media/base/media_switches.cc.disable-FFmpegAllowLists chromium-122.0.6261.29/media/base/media_switches.cc
+--- chromium-122.0.6261.29/media/base/media_switches.cc.disable-FFmpegAllowLists 2024-02-12 15:56:50.703196471 +0100
++++ chromium-122.0.6261.29/media/base/media_switches.cc 2024-02-12 17:08:42.266076401 +0100
+@@ -1753,7 +1753,7 @@
+ // Enables FFmpeg allow lists for supported codecs / containers.
+ BASE_FEATURE(kFFmpegAllowLists,
+ "FFmpegAllowLists",
+- base::FEATURE_ENABLED_BY_DEFAULT);
++ base::FEATURE_DISABLED_BY_DEFAULT);
+
+ #if BUILDFLAG(IS_WIN)
+ // Enables audio offload when supported by endpoints.
diff --git a/chromium-125-emplace-struct.patch b/chromium-125-emplace-struct.patch
new file mode 100644
index 0000000..e188170
--- /dev/null
+++ b/chromium-125-emplace-struct.patch
@@ -0,0 +1,68 @@
+diff --git a/shared_image_backing.h b/shared_image_backing.h.new
+index 97ebd0b..fc6179c 100644
+--- a/gpu/command_buffer/service/shared_image/shared_image_backing.h
++++ b/gpu/command_buffer/service/shared_image/shared_image_backing.h
+@@ -338,7 +338,7 @@ class GPU_GLES2_EXPORT SharedImageBacking {
+ private:
+ class ScopedWriteUMA {
+ public:
+- ScopedWriteUMA() = default;
++ ScopedWriteUMA() : content_consumed_(false) {}
+
+ ScopedWriteUMA(const ScopedWriteUMA&) = delete;
+ ScopedWriteUMA& operator=(const ScopedWriteUMA&) = delete;
+@@ -352,7 +352,7 @@ class GPU_GLES2_EXPORT SharedImageBacking {
+ void SetConsumed() { content_consumed_ = true; }
+
+ private:
+- bool content_consumed_ = false;
++ bool content_consumed_;
+ };
+
+ const Mailbox mailbox_;
+diff --git a/history_item.h b/history_item.h.new
+index 15fea48..ba59305 100644
+--- a/third_party/blink/renderer/core/loader/history_item.h
++++ b/third_party/blink/renderer/core/loader/history_item.h
+@@ -77,13 +77,13 @@ class CORE_EXPORT HistoryItem final : public GarbageCollected<HistoryItem> {
+ DISALLOW_NEW();
+
+ public:
+- ViewState() = default;
++ ViewState() : page_scale_factor_(0) {}
+ ViewState(const ViewState&) = default;
+ ViewState& operator=(const ViewState&) = default;
+
+ ScrollOffset visual_viewport_scroll_offset_;
+ ScrollOffset scroll_offset_;
+- float page_scale_factor_ = 0;
++ float page_scale_factor_;
+ ScrollAnchorData scroll_anchor_data_;
+ };
+
+diff --git a/third_party/blink/public/common/interest_group/auction_config.h b/third_party/blink/public/common/interest_group/auction_config.h.new
+index 5eb6378..4187556 100644
+--- a/third_party/blink/public/common/interest_group/auction_config.h
++++ b/third_party/blink/public/common/interest_group/auction_config.h
+@@ -243,9 +243,11 @@ struct BLINK_COMMON_EXPORT AuctionConfig {
+
+ // Povides whether debug mode is enabled and, if it is, any debug key.
+ struct BLINK_COMMON_EXPORT AuctionReportBuyerDebugModeConfig {
+- bool is_enabled = false;
++ bool is_enabled;
+ std::optional<uint64_t> debug_key;
+
++ AuctionReportBuyerDebugModeConfig() : is_enabled(false) {}
++
+ friend BLINK_COMMON_EXPORT bool operator==(
+ const AuctionReportBuyerDebugModeConfig&,
+ const AuctionReportBuyerDebugModeConfig&);
+@@ -447,7 +449,7 @@ struct BLINK_COMMON_EXPORT AuctionConfig {
+ // Origin for the Coordinator to be used for Private Aggregation.
+ std::optional<url::Origin> aggregation_coordinator_origin;
+
+- static_assert(__LINE__ == 455, R"(
++ static_assert(__LINE__ == 457, R"(
+ If modifying AuctionConfig fields, please make sure to also modify:
+
+ * third_party/blink/public/mojom/interest_group/interest_group_types.mojom
diff --git a/chromium-125-lens-include.patch b/chromium-125-lens-include.patch
new file mode 100644
index 0000000..70372e3
--- /dev/null
+++ b/chromium-125-lens-include.patch
@@ -0,0 +1,25 @@
+commit 251c365ea2c268a475f91c9913fabba6b41e2b6b
+Author: Jose Dapena Paz <jdapena@igalia.com>
+Date: Tue Apr 23 08:04:27 2024 +0000
+
+ IWYU: missing include for usage of std::optional in lens_overlay_url_builder.h
+
+ Bug: 41455655
+ Change-Id: I5ef0752f0cea84b64b5b5fde84d5203d9a5bccbb
+ Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5475524
+ Reviewed-by: Colin Blundell <blundell@chromium.org>
+ Commit-Queue: José Dapena Paz <jdapena@igalia.com>
+ Cr-Commit-Position: refs/heads/main@{#1291135}
+
+diff --git a/chrome/browser/lens/lens_overlay/lens_overlay_url_builder.h b/chrome/browser/lens/lens_overlay/lens_overlay_url_builder.h
+index 00ffff4902114..1be9c645e5fea 100644
+--- a/chrome/browser/lens/lens_overlay/lens_overlay_url_builder.h
++++ b/chrome/browser/lens/lens_overlay/lens_overlay_url_builder.h
+@@ -5,6 +5,7 @@
+ #ifndef CHROME_BROWSER_LENS_LENS_OVERLAY_LENS_OVERLAY_URL_BUILDER_H_
+ #define CHROME_BROWSER_LENS_LENS_OVERLAY_LENS_OVERLAY_URL_BUILDER_H_
+
++#include <optional>
+ #include <string>
+
+ #include "third_party/lens_server_proto/lens_overlay_cluster_info.pb.h"
diff --git a/chromium-125-lp155-typename.patch b/chromium-125-lp155-typename.patch
new file mode 100644
index 0000000..9c10a00
--- /dev/null
+++ b/chromium-125-lp155-typename.patch
@@ -0,0 +1,376 @@
+
+fixed error: missing 'typename' prior to dependent type name
+
+Index: chromium-123.0.6312.46/base/containers/map_util.h
+===================================================================
+--- chromium-123.0.6312.46.orig/base/containers/map_util.h
++++ chromium-123.0.6312.46/base/containers/map_util.h
+@@ -42,7 +42,7 @@ constexpr internal::MappedType<Map>* Fin
+ template <typename Map,
+ typename Key,
+ typename MappedElementType =
+- std::pointer_traits<internal::MappedType<Map>>::element_type>
++ typename std::pointer_traits<internal::MappedType<Map>>::element_type>
+ constexpr const MappedElementType* FindPtrOrNull(const Map& map,
+ const Key& key) {
+ auto it = map.find(key);
+@@ -60,7 +60,7 @@
+ template <typename Map,
+ typename Key,
+ typename MappedElementType =
+- std::pointer_traits<internal::MappedType<Map>>::element_type>
++ typename std::pointer_traits<internal::MappedType<Map>>::element_type>
+ constexpr MappedElementType* FindPtrOrNull(Map& map, const Key& key) {
+ auto it = map.find(key);
+ return it != map.end() ? base::to_address(it->second) : nullptr;
+Index: chromium-123.0.6312.46/base/functional/bind_internal.h
+===================================================================
+--- chromium-123.0.6312.46.orig/base/functional/bind_internal.h
++++ chromium-123.0.6312.46/base/functional/bind_internal.h
+@@ -1497,11 +1497,11 @@ template <int i,
+ typename Param>
+ struct ParamCanBeBound {
+ private:
+- using UnwrappedParam = BindArgument<i>::template ForwardedAs<
++ using UnwrappedParam = typename BindArgument<i>::template ForwardedAs<
+ Unwrapped>::template ToParamWithType<Param>;
+- using ParamStorage = BindArgument<i>::template ToParamWithType<
++ using ParamStorage = typename BindArgument<i>::template ToParamWithType<
+ Param>::template StoredAs<Storage>;
+- using BoundStorage =
++ using BoundStorage = typename
+ BindArgument<i>::template BoundAs<Arg>::template StoredAs<Storage>;
+
+ template <bool v = !UnwrappedParam::kRawPtr ||
+Index: chromium-123.0.6312.46/chrome/browser/download/bubble/download_bubble_update_service.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/chrome/browser/download/bubble/download_bubble_update_service.cc
++++ chromium-123.0.6312.46/chrome/browser/download/bubble/download_bubble_update_service.cc
+@@ -90,7 +90,7 @@ ItemSortKey GetSortKey(const Item& item)
+ // Helper to get an iterator to the last element in the cache. The cache
+ // must not be empty.
+ template <typename Item>
+-SortedItems<Item>::const_iterator GetLastIter(const SortedItems<Item>& cache) {
++typename SortedItems<Item>::const_iterator GetLastIter(const SortedItems<Item>& cache) {
+ CHECK(!cache.empty());
+ auto it = cache.end();
+ return std::prev(it);
+@@ -1090,9 +1090,9 @@ bool DownloadBubbleUpdateService::CacheM
+ }
+
+ template <typename Id, typename Item>
+-SortedItems<Item>::iterator
++typename SortedItems<Item>::iterator
+ DownloadBubbleUpdateService::CacheManager::RemoveItemFromCacheByIter(
+- SortedItems<Item>::iterator iter,
++ typename SortedItems<Item>::iterator iter,
+ SortedItems<Item>& cache,
+ IterMap<Id, Item>& iter_map) {
+ CHECK(iter != cache.end());
+Index: chromium-123.0.6312.46/components/optimization_guide/core/model_execution/model_execution_util.h
+===================================================================
+--- chromium-123.0.6312.46.orig/components/optimization_guide/core/model_execution/model_execution_util.h
++++ chromium-123.0.6312.46/components/optimization_guide/core/model_execution/model_execution_util.h
+@@ -25,7 +25,7 @@ void SetExecutionRequestTemplate(
+
+ // Request is set by the feature and should always be typed.
+ auto typed_request =
+- static_cast<const FeatureType::Request&>(request_metadata);
++ static_cast<const typename FeatureType::Request&>(request_metadata);
+ *(logging_data->mutable_request_data()) = typed_request;
+ }
+
+Index: chromium-123.0.6312.46/components/optimization_guide/core/model_quality/model_quality_log_entry.h
+===================================================================
+--- chromium-123.0.6312.46.orig/components/optimization_guide/core/model_quality/model_quality_log_entry.h
++++ chromium-123.0.6312.46/components/optimization_guide/core/model_quality/model_quality_log_entry.h
+@@ -29,7 +29,7 @@ class ModelQualityLogEntry {
+ }
+
+ template <typename FeatureType>
+- FeatureType::Quality* quality_data() {
++ typename FeatureType::Quality* quality_data() {
+ return FeatureType::GetLoggingData(*log_ai_data_request_)
+ ->mutable_quality_data();
+ }
+Index: chromium-123.0.6312.46/components/optimization_guide/core/tflite_model_executor.h
+===================================================================
+--- chromium-123.0.6312.46.orig/components/optimization_guide/core/tflite_model_executor.h
++++ chromium-123.0.6312.46/components/optimization_guide/core/tflite_model_executor.h
+@@ -242,7 +242,7 @@ class TFLiteModelExecutor : public Model
+ void SendForBatchExecution(
+ BatchExecutionCallback callback_on_complete,
+ base::TimeTicks start_time,
+- ModelExecutor<OutputType, InputType>::ConstRefInputVector inputs)
++ typename ModelExecutor<OutputType, InputType>::ConstRefInputVector inputs)
+ override {
+ DCHECK(execution_task_runner_->RunsTasksInCurrentSequence());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+@@ -264,7 +264,7 @@ class TFLiteModelExecutor : public Model
+ // Starts the synchronous execution of the model. Returns model outputs.
+ // Model needs to be loaded. Synchronous calls do not load or unload model.
+ std::vector<std::optional<OutputType>> SendForBatchExecutionSync(
+- ModelExecutor<OutputType, InputType>::ConstRefInputVector inputs)
++ typename ModelExecutor<OutputType, InputType>::ConstRefInputVector inputs)
+ override {
+ DCHECK(execution_task_runner_->RunsTasksInCurrentSequence());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+@@ -422,7 +422,7 @@ class TFLiteModelExecutor : public Model
+ // executes it on the model execution thread.
+ void LoadModelFileAndBatchExecute(
+ BatchExecutionCallback callback_on_complete,
+- ModelExecutor<OutputType, InputType>::ConstRefInputVector inputs) {
++ typename ModelExecutor<OutputType, InputType>::ConstRefInputVector inputs) {
+ DCHECK(execution_task_runner_->RunsTasksInCurrentSequence());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+
+@@ -439,7 +439,7 @@ class TFLiteModelExecutor : public Model
+
+ // Batch executes the loaded model for inputs.
+ void BatchExecuteLoadedModel(
+- ModelExecutor<OutputType, InputType>::ConstRefInputVector inputs,
++ typename ModelExecutor<OutputType, InputType>::ConstRefInputVector inputs,
+ std::vector<std::optional<OutputType>>* outputs) {
+ DCHECK(execution_task_runner_->RunsTasksInCurrentSequence());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+@@ -499,7 +499,7 @@ class TFLiteModelExecutor : public Model
+ // Unloads the model if needed.
+ void BatchExecuteLoadedModelAndRunCallback(
+ BatchExecutionCallback callback_on_complete,
+- ModelExecutor<OutputType, InputType>::ConstRefInputVector inputs,
++ typename ModelExecutor<OutputType, InputType>::ConstRefInputVector inputs,
+ ExecutionStatus execution_status) {
+ DCHECK(execution_task_runner_->RunsTasksInCurrentSequence());
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+Index: chromium-123.0.6312.46/mojo/public/cpp/bindings/array_traits.h
+===================================================================
+--- chromium-123.0.6312.46.orig/mojo/public/cpp/bindings/array_traits.h
++++ chromium-123.0.6312.46/mojo/public/cpp/bindings/array_traits.h
+@@ -90,7 +90,7 @@ template <typename Container>
+ { c[i] } -> std::same_as<typename Container::reference>;
+ }
+ struct ArrayTraits<Container> {
+- using Element = Container::value_type;
++ using Element = typename Container::value_type;
+
+ // vector-like containers have no built-in null.
+ static bool IsNull(const Container& c) { return false; }
+Index: chromium-123.0.6312.46/third_party/blink/renderer/bindings/core/v8/async_iterable.h
+===================================================================
+--- chromium-123.0.6312.46.orig/third_party/blink/renderer/bindings/core/v8/async_iterable.h
++++ chromium-123.0.6312.46/third_party/blink/renderer/bindings/core/v8/async_iterable.h
+@@ -245,7 +245,7 @@
+ private:
+ virtual IterationSource* CreateIterationSource(
+ ScriptState* script_state,
+- IterationSource::Kind kind,
++ typename IterationSource::Kind kind,
+ InitArgs... args,
+ ExceptionState& exception_state) = 0;
+ };
+@@ -291,7 +291,7 @@
+ private:
+ virtual IterationSource* CreateIterationSource(
+ ScriptState* script_state,
+- IterationSource::Kind kind,
++ typename IterationSource::Kind kind,
+ InitArgs... args,
+ ExceptionState& exception_state) = 0;
+ };
+Index: chromium-123.0.6312.46/third_party/blink/renderer/core/html/parser/html_document_parser_fastpath.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/third_party/blink/renderer/core/html/parser/html_document_parser_fastpath.cc
++++ chromium-123.0.6312.46/third_party/blink/renderer/core/html/parser/html_document_parser_fastpath.cc
+@@ -210,7 +210,7 @@ class HTMLFastPathParser {
+ using Span = base::span<const Char>;
+ using USpan = base::span<const UChar>;
+ // 32 matches that used by HTMLToken::Attribute.
+- typedef std::conditional<std::is_same_v<Char, UChar>,
++ typedef typename std::conditional<std::is_same_v<Char, UChar>,
+ UCharLiteralBuffer<32>,
+ LCharLiteralBuffer<32>>::type LiteralBufferType;
+ static_assert(std::is_same_v<Char, UChar> || std::is_same_v<Char, LChar>);
+Index: chromium-123.0.6312.46/base/functional/function_ref.h
+===================================================================
+--- chromium-123.0.6312.46.orig/base/functional/function_ref.h
++++ chromium-123.0.6312.46/base/functional/function_ref.h
+@@ -64,7 +64,7 @@ class FunctionRef;
+ template <typename R, typename... Args>
+ class FunctionRef<R(Args...)> {
+ template <typename Functor,
+- typename RunType = internal::FunctorTraits<Functor>::RunType>
++ typename RunType = typename internal::FunctorTraits<Functor>::RunType>
+ static constexpr bool kCompatibleFunctor =
+ std::convertible_to<internal::ExtractReturnType<RunType>, R> &&
+ std::same_as<internal::ExtractArgs<RunType>, internal::TypeList<Args...>>;
+Index: chromium-123.0.6312.46/base/containers/heap_array.h
+===================================================================
+--- chromium-123.0.6312.46.orig/base/containers/heap_array.h
++++ chromium-123.0.6312.46/base/containers/heap_array.h
+@@ -32,8 +32,8 @@
+ static_assert(!std::is_reference_v<T>,
+ "HeapArray cannot hold reference types");
+
+- using iterator = base::span<T>::iterator;
+- using const_iterator = base::span<const T>::iterator;
++ using iterator = typename base::span<T>::iterator;
++ using const_iterator = typename base::span<const T>::iterator;
+ // We don't put this default value in the template parameter list to allow the
+ // static_assert on is_reference_v to give a nicer error message.
+ using deleter_type = std::
+Index: chromium-123.0.6312.46/mojo/public/cpp/bindings/type_converter.h
+===================================================================
+--- chromium-123.0.6312.46.orig/mojo/public/cpp/bindings/type_converter.h
++++ chromium-123.0.6312.46/mojo/public/cpp/bindings/type_converter.h
+@@ -127,7 +127,7 @@ using VecValueType = typename Vec::value
+
+ template <typename Vec>
+ using VecPtrLikeUnderlyingValueType =
+- std::pointer_traits<VecValueType<Vec>>::element_type;
++ typename std::pointer_traits<VecValueType<Vec>>::element_type;
+
+ } // namespace internal
+
+Index: chromium-123.0.6312.46/third_party/blink/renderer/platform/wtf/hash_table.h
+===================================================================
+--- chromium-123.0.6312.46.orig/third_party/blink/renderer/platform/wtf/hash_table.h
++++ chromium-123.0.6312.46/third_party/blink/renderer/platform/wtf/hash_table.h
+@@ -2004,7 +2004,7 @@ struct HashTableConstIteratorAdapter {
+ static_assert(!IsTraceable<typename Traits::TraitType>::value);
+
+ using iterator_category = std::bidirectional_iterator_tag;
+- using value_type = HashTableType::ValueType;
++ using value_type = typename HashTableType::ValueType;
+ using difference_type = ptrdiff_t;
+ using pointer = value_type*;
+ using reference = value_type&;
+@@ -2056,7 +2056,7 @@ struct HashTableConstIteratorAdapter<
+
+ public:
+ using iterator_category = std::bidirectional_iterator_tag;
+- using value_type = HashTableType::ValueType;
++ using value_type = typename HashTableType::ValueType;
+ using difference_type = ptrdiff_t;
+ using pointer = value_type*;
+ using reference = value_type&;
+@@ -2110,7 +2110,7 @@ struct HashTableIteratorAdapter {
+ static_assert(!IsTraceable<typename Traits::TraitType>::value);
+
+ using iterator_category = std::bidirectional_iterator_tag;
+- using value_type = HashTableType::ValueType;
++ using value_type = typename HashTableType::ValueType;
+ using difference_type = ptrdiff_t;
+ using pointer = value_type*;
+ using reference = value_type&;
+@@ -2158,7 +2158,7 @@ struct HashTableIteratorAdapter<
+
+ public:
+ using iterator_category = std::bidirectional_iterator_tag;
+- using value_type = HashTableType::ValueType;
++ using value_type = typename HashTableType::ValueType;
+ using difference_type = ptrdiff_t;
+ using pointer = value_type*;
+ using reference = value_type&;
+Index: chromium-123.0.6312.46/base/types/fixed_array.h
+===================================================================
+--- chromium-123.0.6312.46.orig/base/types/fixed_array.h
++++ chromium-123.0.6312.46/base/types/fixed_array.h
+@@ -27,8 +27,8 @@ template <typename T,
+ class FixedArray : public absl::FixedArray<T, N, A> {
+ public:
+ using absl::FixedArray<T, N, A>::FixedArray;
+- explicit FixedArray(absl::FixedArray<T, N, A>::size_type n,
+- const absl::FixedArray<T, N, A>::allocator_type& a =
++ explicit FixedArray(typename absl::FixedArray<T, N, A>::size_type n,
++ const typename absl::FixedArray<T, N, A>::allocator_type& a =
+ typename absl::FixedArray<T, N, A>::allocator_type())
+ : FixedArray(n, T(), a) {}
+ };
+Index: chromium-123.0.6312.46/chrome/browser/web_applications/commands/internal/command_internal.h
+===================================================================
+--- chromium-123.0.6312.46.orig/chrome/browser/web_applications/commands/internal/command_internal.h
++++ chromium-123.0.6312.46/chrome/browser/web_applications/commands/internal/command_internal.h
+@@ -121,7 +121,7 @@ class CommandBase {
+ template <typename LockType>
+ class CommandWithLock : public CommandBase {
+ public:
+- using LockDescription = LockType::LockDescription;
++ using LockDescription = typename LockType::LockDescription;
+ explicit CommandWithLock(const std::string& name,
+ LockDescription initial_lock_request);
+
+Index: chromium-123.0.6312.46/chrome/browser/web_applications/commands/web_app_command.h
+===================================================================
+--- chromium-123.0.6312.46.orig/chrome/browser/web_applications/commands/web_app_command.h
++++ chromium-123.0.6312.46/chrome/browser/web_applications/commands/web_app_command.h
+@@ -106,7 +106,7 @@ class WebAppLockManager;
+ template <typename LockType, typename... CallbackArgs>
+ class WebAppCommand : public internal::CommandWithLock<LockType> {
+ public:
+- using LockDescription = LockType::LockDescription;
++ using LockDescription = typename LockType::LockDescription;
+ using CallbackType = base::OnceCallback<void(CallbackArgs...)>;
+ using ShutdownArgumentsTuple = std::tuple<std::decay_t<CallbackArgs>...>;
+
+Index: chromium-123.0.6312.46/chrome/browser/web_applications/web_app_command_scheduler.h
+===================================================================
+--- chromium-123.0.6312.46.orig/chrome/browser/web_applications/web_app_command_scheduler.h
++++ chromium-123.0.6312.46/chrome/browser/web_applications/web_app_command_scheduler.h
+@@ -363,7 +363,7 @@ class WebAppCommandScheduler {
+ // command system.
+ template <typename LockType>
+ void ScheduleCallback(const std::string& operation_name,
+- LockType::LockDescription lock_description,
++ typename LockType::LockDescription lock_description,
+ CallbackCommand<LockType, void> callback,
+ base::OnceClosure on_complete,
+ const base::Location& location = FROM_HERE) {
+@@ -381,7 +381,7 @@ class WebAppCommandScheduler {
+ typename CallbackReturnValue = std::decay_t<CompletionCallbackArg>>
+ void ScheduleCallbackWithResult(
+ const std::string& operation_name,
+- LockType::LockDescription lock_description,
++ typename LockType::LockDescription lock_description,
+ CallbackCommand<LockType, CallbackReturnValue> callback,
+ base::OnceCallback<void(CompletionCallbackArg)> on_complete,
+ CallbackReturnValue arg_for_shutdown,
+Index: chromium-123.0.6312.46/components/supervised_user/core/browser/proto_fetcher.h
+===================================================================
+--- chromium-123.0.6312.46.orig/components/supervised_user/core/browser/proto_fetcher.h
++++ chromium-123.0.6312.46/components/supervised_user/core/browser/proto_fetcher.h
+@@ -424,7 +424,7 @@ class RetryingFetcherImpl final : public
+ RetryingFetcherImpl(const RetryingFetcherImpl&) = delete;
+ RetryingFetcherImpl& operator=(const RetryingFetcherImpl&) = delete;
+
+- void Start(ProtoFetcher<Response>::Callback callback) override {
++ void Start(typename ProtoFetcher<Response>::Callback callback) override {
+ callback_ = std::move(callback);
+ Retry();
+ }
+@@ -469,7 +469,7 @@ class RetryingFetcherImpl final : public
+ }
+
+ // Client callback.
+- TypedProtoFetcher<Response>::Callback callback_;
++ typename TypedProtoFetcher<Response>::Callback callback_;
+
+ // Retry controls.
+ base::OneShotTimer timer_;
+@@ -490,7 +490,7 @@ class ParallelFetchManager {
+ // Deferred fetcher is required because it should be started after it is
+ // stored internally.
+ using Fetcher = ProtoFetcher<Response>;
+- using KeyType = base::IDMap<std::unique_ptr<Fetcher>>::KeyType;
++ using KeyType = typename base::IDMap<std::unique_ptr<Fetcher>>::KeyType;
+
+ public:
+ // Provides fresh instances of a deferred fetcher for each fetch.
+@@ -506,7 +506,7 @@ class ParallelFetchManager {
+
+ // Starts the fetch. Underlying fetcher is stored internally, and will be
+ // cleaned up after finish or when this manager is destroyed.
+- void Fetch(const Request& request, Fetcher::Callback callback) {
++ void Fetch(const Request& request, typename Fetcher::Callback callback) {
+ CHECK(callback) << "Use base::DoNothing() instead of empty callback.";
+ KeyType key = requests_in_flight_.Add(MakeFetcher(request));
+ requests_in_flight_.Lookup(key)->Start(
diff --git a/chromium-125-missing-header-files.patch b/chromium-125-missing-header-files.patch
new file mode 100644
index 0000000..4a60ac9
--- /dev/null
+++ b/chromium-125-missing-header-files.patch
@@ -0,0 +1,246 @@
+Index: chromium-123.0.6312.46/base/check_op.h
+===================================================================
+--- chromium-123.0.6312.46.orig/base/check_op.h
++++ chromium-123.0.6312.46/base/check_op.h
+@@ -5,6 +5,7 @@
+ #ifndef BASE_CHECK_OP_H_
+ #define BASE_CHECK_OP_H_
+
++#include <cstdint>
+ #include <cstddef>
+ #include <string>
+ #include <string_view>
+Index: chromium-123.0.6312.46/base/containers/flat_map.h
+===================================================================
+--- chromium-123.0.6312.46.orig/base/containers/flat_map.h
++++ chromium-123.0.6312.46/base/containers/flat_map.h
+@@ -5,6 +5,7 @@
+ #ifndef BASE_CONTAINERS_FLAT_MAP_H_
+ #define BASE_CONTAINERS_FLAT_MAP_H_
+
++#include <cstdint>
+ #include <functional>
+ #include <tuple>
+ #include <type_traits>
+Index: chromium-123.0.6312.46/chrome/browser/webauthn/authenticator_request_dialog_model.h
+===================================================================
+--- chromium-123.0.6312.46.orig/chrome/browser/webauthn/authenticator_request_dialog_model.h
++++ chromium-123.0.6312.46/chrome/browser/webauthn/authenticator_request_dialog_model.h
+@@ -10,6 +10,7 @@
+ #include <string>
+ #include <string_view>
+ #include <vector>
++#include <variant>
+
+ #include "base/containers/span.h"
+ #include "base/functional/callback_forward.h"
+Index: chromium-123.0.6312.46/components/feature_engagement/internal/never_event_storage_validator.h
+===================================================================
+--- chromium-123.0.6312.46.orig/components/feature_engagement/internal/never_event_storage_validator.h
++++ chromium-123.0.6312.46/components/feature_engagement/internal/never_event_storage_validator.h
+@@ -5,6 +5,7 @@
+ #ifndef COMPONENTS_FEATURE_ENGAGEMENT_INTERNAL_NEVER_EVENT_STORAGE_VALIDATOR_H_
+ #define COMPONENTS_FEATURE_ENGAGEMENT_INTERNAL_NEVER_EVENT_STORAGE_VALIDATOR_H_
+
++#include <cstdint>
+ #include <string>
+
+ #include "components/feature_engagement/internal/event_storage_validator.h"
+Index: chromium-123.0.6312.46/gin/time_clamper.h
+===================================================================
+--- chromium-123.0.6312.46.orig/gin/time_clamper.h
++++ chromium-123.0.6312.46/gin/time_clamper.h
+@@ -6,6 +6,7 @@
+ #define GIN_TIME_CLAMPER_H_
+
+ #include <algorithm>
++#include <cstdlib>
+
+ #include "base/rand_util.h"
+ #include "base/time/time.h"
+Index: chromium-123.0.6312.46/net/base/net_export.h
+===================================================================
+--- chromium-123.0.6312.46.orig/net/base/net_export.h
++++ chromium-123.0.6312.46/net/base/net_export.h
+@@ -5,6 +5,8 @@
+ #ifndef NET_BASE_NET_EXPORT_H_
+ #define NET_BASE_NET_EXPORT_H_
+
++#include <cstdint>
++
+ // Defines NET_EXPORT so that functionality implemented by the net module can
+ // be exported to consumers, and NET_EXPORT_PRIVATE that allows unit tests to
+ // access features not intended to be used directly by real consumers.
+Index: chromium-123.0.6312.46/third_party/abseil-cpp/absl/strings/string_view.h
+===================================================================
+--- chromium-123.0.6312.46.orig/third_party/abseil-cpp/absl/strings/string_view.h
++++ chromium-123.0.6312.46/third_party/abseil-cpp/absl/strings/string_view.h
+@@ -27,6 +27,7 @@
+ #ifndef ABSL_STRINGS_STRING_VIEW_H_
+ #define ABSL_STRINGS_STRING_VIEW_H_
+
++#include <cstdint>
+ #include <algorithm>
+ #include <cassert>
+ #include <cstddef>
+Index: chromium-123.0.6312.46/third_party/dawn/src/tint/lang/spirv/reader/ast_parser/namer.h
+===================================================================
+--- chromium-123.0.6312.46.orig/third_party/dawn/src/tint/lang/spirv/reader/ast_parser/namer.h
++++ chromium-123.0.6312.46/third_party/dawn/src/tint/lang/spirv/reader/ast_parser/namer.h
+@@ -28,6 +28,7 @@
+ #ifndef SRC_TINT_LANG_SPIRV_READER_AST_PARSER_NAMER_H_
+ #define SRC_TINT_LANG_SPIRV_READER_AST_PARSER_NAMER_H_
+
++#include <cstdint>
+ #include <string>
+ #include <unordered_map>
+ #include <vector>
+Index: chromium-123.0.6312.46/third_party/material_color_utilities/src/cpp/palettes/tones.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/third_party/material_color_utilities/src/cpp/palettes/tones.cc
++++ chromium-123.0.6312.46/third_party/material_color_utilities/src/cpp/palettes/tones.cc
+@@ -14,6 +14,7 @@
+ * limitations under the License.
+ */
+
++#include <cmath>
+ #include "cpp/palettes/tones.h"
+
+ #include <cmath>
+Index: chromium-123.0.6312.46/third_party/ruy/src/ruy/profiler/instrumentation.h
+===================================================================
+--- chromium-123.0.6312.46.orig/third_party/ruy/src/ruy/profiler/instrumentation.h
++++ chromium-123.0.6312.46/third_party/ruy/src/ruy/profiler/instrumentation.h
+@@ -17,6 +17,7 @@
+ #define RUY_RUY_PROFILER_INSTRUMENTATION_H_
+
+ #ifdef RUY_PROFILER
++#include <string>
+ #include <cstdio>
+ #include <mutex>
+ #include <vector>
+Index: chromium-123.0.6312.46/third_party/swiftshader/third_party/llvm-10.0/llvm/lib/Support/Unix/Signals.inc
+===================================================================
+--- chromium-123.0.6312.46.orig/third_party/swiftshader/third_party/llvm-10.0/llvm/lib/Support/Unix/Signals.inc
++++ chromium-123.0.6312.46/third_party/swiftshader/third_party/llvm-10.0/llvm/lib/Support/Unix/Signals.inc
+@@ -45,6 +45,7 @@
+ #include "llvm/Support/SaveAndRestore.h"
+ #include "llvm/Support/raw_ostream.h"
+ #include <algorithm>
++#include <cstdint>
+ #include <string>
+ #include <sysexits.h>
+ #ifdef HAVE_BACKTRACE
+Index: chromium-123.0.6312.46/third_party/tflite/src/tensorflow/lite/kernels/internal/spectrogram.h
+===================================================================
+--- chromium-123.0.6312.46.orig/third_party/tflite/src/tensorflow/lite/kernels/internal/spectrogram.h
++++ chromium-123.0.6312.46/third_party/tflite/src/tensorflow/lite/kernels/internal/spectrogram.h
+@@ -31,6 +31,7 @@ limitations under the License.
+ #ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_SPECTROGRAM_H_
+ #define TENSORFLOW_LITE_KERNELS_INTERNAL_SPECTROGRAM_H_
+
++#include <cstdint>
+ #include <complex>
+ #include <deque>
+ #include <vector>
+Index: chromium-123.0.6312.46/third_party/vulkan-deps/vulkan-validation-layers/src/layers/external/vma/vk_mem_alloc.h
+===================================================================
+--- chromium-123.0.6312.46.orig/third_party/vulkan-deps/vulkan-validation-layers/src/layers/external/vma/vk_mem_alloc.h
++++ chromium-123.0.6312.46/third_party/vulkan-deps/vulkan-validation-layers/src/layers/external/vma/vk_mem_alloc.h
+@@ -2884,6 +2884,7 @@ static void vma_aligned_free(void* VMA_N
+
+ // Define this macro to 1 to enable functions: vmaBuildStatsString, vmaFreeStatsString.
+ #if VMA_STATS_STRING_ENABLED
++#include <stdio.h>
+ static inline void VmaUint32ToStr(char* VMA_NOT_NULL outStr, size_t strLen, uint32_t num)
+ {
+ snprintf(outStr, strLen, "%u", static_cast<unsigned int>(num));
+Index: chromium-123.0.6312.46/third_party/webrtc/audio/utility/channel_mixer.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/third_party/webrtc/audio/utility/channel_mixer.cc
++++ chromium-123.0.6312.46/third_party/webrtc/audio/utility/channel_mixer.cc
+@@ -8,6 +8,8 @@
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
++#include <cstring>
++
+ #include "audio/utility/channel_mixer.h"
+
+ #include "audio/utility/channel_mixing_matrix.h"
+Index: chromium-123.0.6312.46/third_party/webrtc/modules/include/module_common_types_public.h
+===================================================================
+--- chromium-123.0.6312.46.orig/third_party/webrtc/modules/include/module_common_types_public.h
++++ chromium-123.0.6312.46/third_party/webrtc/modules/include/module_common_types_public.h
+@@ -11,6 +11,7 @@
+ #ifndef MODULES_INCLUDE_MODULE_COMMON_TYPES_PUBLIC_H_
+ #define MODULES_INCLUDE_MODULE_COMMON_TYPES_PUBLIC_H_
+
++#include <cstdint>
+ #include <limits>
+
+ #include "absl/types/optional.h"
+Index: chromium-123.0.6312.46/ui/gfx/linux/drm_util_linux.h
+===================================================================
+--- chromium-123.0.6312.46.orig/ui/gfx/linux/drm_util_linux.h
++++ chromium-123.0.6312.46/ui/gfx/linux/drm_util_linux.h
+@@ -9,6 +9,8 @@
+
+ #include "ui/gfx/buffer_types.h"
+
++#include <cstdint>
++
+ namespace ui {
+
+ int GetFourCCFormatFromBufferFormat(gfx::BufferFormat format);
+Index: chromium-123.0.6312.46/third_party/blink/renderer/platform/peerconnection/resolution_monitor.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/third_party/blink/renderer/platform/peerconnection/resolution_monitor.cc
++++ chromium-123.0.6312.46/third_party/blink/renderer/platform/peerconnection/resolution_monitor.cc
+@@ -6,6 +6,8 @@
+
+ #include <bitset>
+
++#include <bitset>
++
+ #include "base/containers/span.h"
+ #include "base/logging.h"
+ #include "base/memory/ptr_util.h"
+Index: chromium-123.0.6312.46/components/search_engines/util.h
+===================================================================
+--- chromium-123.0.6312.46.orig/components/search_engines/util.h
++++ chromium-123.0.6312.46/components/search_engines/util.h
+@@ -8,6 +8,7 @@
+ // This file contains utility functions for search engine functionality.
+
+ #include <memory>
++#include <optional>
+ #include <set>
+ #include <string>
+ #include <vector>
+Index: chromium-123.0.6312.46/content/common/service_worker/race_network_request_write_buffer_manager.h
+===================================================================
+--- chromium-123.0.6312.46.orig/content/common/service_worker/race_network_request_write_buffer_manager.h
++++ chromium-123.0.6312.46/content/common/service_worker/race_network_request_write_buffer_manager.h
+@@ -7,6 +7,8 @@
+
+ #include <optional>
+
++#include <optional>
++
+ #include "base/containers/span.h"
+ #include "content/common/content_export.h"
+ #include "mojo/public/cpp/system/data_pipe.h"
+Index: chromium-123.0.6312.46/third_party/blink/renderer/core/layout/hit_test_request.h
+===================================================================
+--- chromium-123.0.6312.46.orig/third_party/blink/renderer/core/layout/hit_test_request.h
++++ chromium-123.0.6312.46/third_party/blink/renderer/core/layout/hit_test_request.h
+@@ -25,6 +25,8 @@
+
+ #include <optional>
+
++#include <optional>
++
+ #include "base/functional/callback.h"
+ #include "third_party/blink/renderer/platform/heap/garbage_collected.h"
+ #include "third_party/blink/renderer/platform/heap/member.h"
diff --git a/chromium-125-mojo-bindings-include.patch b/chromium-125-mojo-bindings-include.patch
new file mode 100644
index 0000000..36f6cc2
--- /dev/null
+++ b/chromium-125-mojo-bindings-include.patch
@@ -0,0 +1,25 @@
+commit 39735a1167272326da5ff85e0096b52ca7f47d6c
+Author: Jose Dapena Paz <jdapena@igalia.com>
+Date: Tue Apr 16 14:36:36 2024 +0000
+
+ IWYU: missing include for std::optional usage in bindings_internal.h
+
+ Bug: 41455655
+ Change-Id: Id3e3ade6c8cc89a526462ea9ff6c8bc1dc93a375
+ Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5456954
+ Reviewed-by: Ken Rockot <rockot@google.com>
+ Commit-Queue: Ken Rockot <rockot@google.com>
+ Cr-Commit-Position: refs/heads/main@{#1288018}
+
+diff --git a/mojo/public/cpp/bindings/lib/bindings_internal.h b/mojo/public/cpp/bindings/lib/bindings_internal.h
+index 759ceaf7e641d..9f4202b6481b1 100644
+--- a/mojo/public/cpp/bindings/lib/bindings_internal.h
++++ b/mojo/public/cpp/bindings/lib/bindings_internal.h
+@@ -8,6 +8,7 @@
+ #include <stdint.h>
+
+ #include <functional>
++#include <optional>
+ #include <type_traits>
+ #include <utility>
+
diff --git a/chromium-125-ninja.patch b/chromium-125-ninja.patch
new file mode 100644
index 0000000..1f16ac1
--- /dev/null
+++ b/chromium-125-ninja.patch
@@ -0,0 +1,27 @@
+commit a976cb05b4024b7a6452d1541378d718cdfe33e6
+Author: Takuto Ikuta <tikuta@chromium.org>
+Date: Thu Apr 25 07:25:32 2024 +0000
+
+ [devtools] fix a missing build dependency to a generated file
+
+ Bug: 336911498
+ Change-Id: I6e6d3afaf33ace53a68271b70165b8c3ab596340
+ Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5487538
+ Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
+ Commit-Queue: Takuto Ikuta <tikuta@chromium.org>
+ Reviewed-by: Danil Somsikov <dsv@chromium.org>
+ Commit-Queue: Danil Somsikov <dsv@chromium.org>
+ Cr-Commit-Position: refs/heads/main@{#1292300}
+
+diff --git a/chrome/browser/devtools/BUILD.gn b/chrome/browser/devtools/BUILD.gn
+index f0c07cad8cfb4..053199e462f55 100644
+--- a/chrome/browser/devtools/BUILD.gn
++++ b/chrome/browser/devtools/BUILD.gn
+@@ -117,6 +117,7 @@ static_library("devtools") {
+ "//chrome/browser/autofill:autofill",
+ "//components/autofill/content/browser:browser",
+ "//components/autofill/core/browser:browser",
++ "//components/enterprise/buildflags",
+ "//components/paint_preview/buildflags:buildflags",
+ "//components/variations/service:service",
+ "//components/webapps/common:common",
diff --git a/chromium-125-no-vector-consts.patch b/chromium-125-no-vector-consts.patch
new file mode 100644
index 0000000..aaca8b9
--- /dev/null
+++ b/chromium-125-no-vector-consts.patch
@@ -0,0 +1,259 @@
+commit 0bed9a54baa5058e711a1f051a766f67e1842ec5
+Author: Jose Dapena Paz <jdapena@igalia.com>
+Date: Tue Apr 16 10:59:08 2024 +0000
+
+ Remove more instances of std::vector<const T>
+
+ Bug: 323708866
+ Change-Id: I50ef671f18f0d152ecccbf0f345f84db005c06d7
+ Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5440252
+ Reviewed-by: Yuzhu Shen <yzshen@chromium.org>
+ Reviewed-by: Vasilii Sukhanov <vasilii@chromium.org>
+ Commit-Queue: José Dapena Paz <jdapena@igalia.com>
+ Reviewed-by: Matthew Jones <mdjones@chromium.org>
+ Cr-Commit-Position: refs/heads/main@{#1287935}
+
+diff --git a/chrome/browser/sync/test/integration/product_specifications_helper.cc b/chrome/browser/sync/test/integration/product_specifications_helper.cc
+index d664b952801f8..3ed308b4b7ad8 100644
+--- a/chrome/browser/sync/test/integration/product_specifications_helper.cc
++++ b/chrome/browser/sync/test/integration/product_specifications_helper.cc
+@@ -41,9 +41,9 @@ bool ProductSpecificationsChecker::IsExitConditionSatisfied(std::ostream* os) {
+ bool ProductSpecificationsChecker::IsSpecificsAvailableAndEqual() {
+ for (const ProductSpecificationsSet& product_specifications_set :
+ service_->GetAllProductSpecifications()) {
+- std::vector<const GURL> specifics_urls;
++ std::vector<GURL> specifics_urls;
+ for (sync_pb::ComparisonData data : compare_specifics_->data()) {
+- specifics_urls.push_back(GURL(data.url()));
++ specifics_urls.emplace_back(data.url());
+ }
+ if (product_specifications_set.uuid().AsLowercaseString() ==
+ compare_specifics_->uuid() &&
+diff --git a/components/commerce/core/product_specifications/product_specifications_service.cc b/components/commerce/core/product_specifications/product_specifications_service.cc
+index eaa362dd46ea0..171ea09f0a6b3 100644
+--- a/components/commerce/core/product_specifications/product_specifications_service.cc
++++ b/components/commerce/core/product_specifications/product_specifications_service.cc
+@@ -24,11 +24,11 @@ ProductSpecificationsService::GetSyncControllerDelegate() {
+ return bridge_->change_processor()->GetControllerDelegate();
+ }
+
+-const std::vector<const ProductSpecificationsSet>
++const std::vector<ProductSpecificationsSet>
+ ProductSpecificationsService::GetAllProductSpecifications() {
+- std::vector<const ProductSpecificationsSet> product_specifications;
++ std::vector<ProductSpecificationsSet> product_specifications;
+ for (auto& entry : bridge_->entries()) {
+- std::vector<const GURL> urls;
++ std::vector<GURL> urls;
+ for (auto& data : entry.second.data()) {
+ urls.emplace_back(data.url());
+ }
+@@ -43,7 +43,7 @@ ProductSpecificationsService::GetAllProductSpecifications() {
+ const std::optional<const ProductSpecificationsSet>
+ ProductSpecificationsService::AddProductSpecificationsSet(
+ const std::string& name,
+- const std::vector<const GURL>& urls) {
++ const std::vector<GURL>& urls) {
+ // TODO(crbug.com/332545064) add for a product specification set being added.
+ std::optional<sync_pb::CompareSpecifics> specifics =
+ bridge_->AddProductSpecifications(name, urls);
+diff --git a/components/commerce/core/product_specifications/product_specifications_service.h b/components/commerce/core/product_specifications/product_specifications_service.h
+index 4afe013a0869f..0f84ae04fd228 100644
+--- a/components/commerce/core/product_specifications/product_specifications_service.h
++++ b/components/commerce/core/product_specifications/product_specifications_service.h
+@@ -26,14 +26,13 @@ class ProductSpecificationsService : public KeyedService {
+ base::WeakPtr<syncer::ModelTypeControllerDelegate>
+ GetSyncControllerDelegate();
+
+- const std::vector<const ProductSpecificationsSet>
+- GetAllProductSpecifications();
++ const std::vector<ProductSpecificationsSet> GetAllProductSpecifications();
+
+ // Add new product specifications set called |name| with product pages
+ // corresponding to |urls|.
+ const std::optional<const ProductSpecificationsSet>
+ AddProductSpecificationsSet(const std::string& name,
+- const std::vector<const GURL>& urls);
++ const std::vector<GURL>& urls);
+
+ // Deletes product specification set corresponding to identifier |uuid|.
+ void DeleteProductSpecificationsSet(const std::string& uuid);
+diff --git a/components/commerce/core/product_specifications/product_specifications_service_unittest.cc b/components/commerce/core/product_specifications/product_specifications_service_unittest.cc
+index 6e0072a5318e8..4087d7f19424a 100644
+--- a/components/commerce/core/product_specifications/product_specifications_service_unittest.cc
++++ b/components/commerce/core/product_specifications/product_specifications_service_unittest.cc
+@@ -82,9 +82,9 @@ void AddTestSpecifics(commerce::ProductSpecificationsSyncBridge* bridge) {
+ }
+
+ MATCHER_P(HasAllProductSpecs, compare_specifics, "") {
+- std::vector<const GURL> specifics_urls;
++ std::vector<GURL> specifics_urls;
+ for (const sync_pb::ComparisonData& data : compare_specifics.data()) {
+- specifics_urls.push_back(GURL(data.url()));
++ specifics_urls.emplace_back(data.url());
+ }
+ return arg.uuid().AsLowercaseString() == compare_specifics.uuid() &&
+ arg.creation_time() ==
+@@ -217,7 +217,7 @@ class ProductSpecificationsServiceTest : public testing::Test {
+ specifics.update_time_unix_epoch_micros()),
+ specifications.update_time());
+ EXPECT_EQ(specifics.name(), specifications.name());
+- std::vector<const GURL> urls;
++ std::vector<GURL> urls;
+ for (const sync_pb::ComparisonData& data : specifics.data()) {
+ urls.emplace_back(data.url());
+ }
+@@ -243,7 +243,7 @@ TEST_F(ProductSpecificationsServiceTest, TestGetProductSpecifications) {
+ for (const sync_pb::CompareSpecifics& specifics : kCompareSpecifics) {
+ bridge()->AddCompareSpecifics(specifics);
+ }
+- const std::vector<const ProductSpecificationsSet> specifications =
++ const std::vector<ProductSpecificationsSet> specifications =
+ service()->GetAllProductSpecifications();
+ EXPECT_EQ(2u, specifications.size());
+ for (uint64_t i = 0; i < specifications.size(); i++) {
+@@ -252,8 +252,8 @@ TEST_F(ProductSpecificationsServiceTest, TestGetProductSpecifications) {
+ }
+
+ TEST_F(ProductSpecificationsServiceTest, TestAddProductSpecificationsSuccess) {
+- std::vector<const GURL> expected_product_urls{GURL(kProductOneUrl),
+- GURL(kProductTwoUrl)};
++ std::vector<GURL> expected_product_urls{GURL(kProductOneUrl),
++ GURL(kProductTwoUrl)};
+ EXPECT_CALL(*observer(),
+ OnProductSpecificationsSetAdded(HasProductSpecsNameUrl(
+ kProductSpecsName, expected_product_urls)))
+diff --git a/components/commerce/core/product_specifications/product_specifications_set.cc b/components/commerce/core/product_specifications/product_specifications_set.cc
+index 7005b6c5b3448..408bfde664f2a 100644
+--- a/components/commerce/core/product_specifications/product_specifications_set.cc
++++ b/components/commerce/core/product_specifications/product_specifications_set.cc
+@@ -12,7 +12,7 @@ ProductSpecificationsSet::ProductSpecificationsSet(
+ const std::string& uuid,
+ const int64_t creation_time_usec_since_epoch,
+ const int64_t update_time_usec_since_epoch,
+- const std::vector<const GURL>& urls,
++ const std::vector<GURL>& urls,
+ const std::string& name)
+ : uuid_(base::Uuid::ParseLowercase(uuid)),
+ creation_time_(base::Time::FromMillisecondsSinceUnixEpoch(
+@@ -34,9 +34,9 @@ ProductSpecificationsSet::~ProductSpecificationsSet() = default;
+
+ ProductSpecificationsSet ProductSpecificationsSet::FromProto(
+ const sync_pb::CompareSpecifics& specifics) {
+- std::vector<const GURL> urls;
++ std::vector<GURL> urls;
+ for (const sync_pb::ComparisonData& data : specifics.data()) {
+- urls.push_back(GURL(data.url()));
++ urls.emplace_back(data.url());
+ }
+ return ProductSpecificationsSet(
+ specifics.uuid(), specifics.creation_time_unix_epoch_micros(),
+diff --git a/components/commerce/core/product_specifications/product_specifications_set.h b/components/commerce/core/product_specifications/product_specifications_set.h
+index d761fabafb702..18e3aa113120b 100644
+--- a/components/commerce/core/product_specifications/product_specifications_set.h
++++ b/components/commerce/core/product_specifications/product_specifications_set.h
+@@ -43,7 +43,7 @@ class ProductSpecificationsSet {
+ ProductSpecificationsSet(const std::string& uuid,
+ const int64_t creation_time_usec_since_epoch,
+ const int64_t update_time_usec_since_epoch,
+- const std::vector<const GURL>& urls,
++ const std::vector<GURL>& urls,
+ const std::string& name);
+
+ ProductSpecificationsSet(const ProductSpecificationsSet&);
+@@ -61,7 +61,7 @@ class ProductSpecificationsSet {
+ const base::Time& update_time() const { return update_time_; }
+
+ // Product urls for each item in the set
+- const std::vector<const GURL>& urls() const { return urls_; }
++ const std::vector<GURL>& urls() const { return urls_; }
+
+ // Name of the set
+ const std::string& name() const { return name_; }
+@@ -76,7 +76,7 @@ class ProductSpecificationsSet {
+ const base::Uuid uuid_;
+ const base::Time creation_time_;
+ const base::Time update_time_;
+- const std::vector<const GURL> urls_;
++ const std::vector<GURL> urls_;
+ const std::string name_;
+ };
+
+diff --git a/components/commerce/core/product_specifications/product_specifications_sync_bridge.cc b/components/commerce/core/product_specifications/product_specifications_sync_bridge.cc
+index 09c3fc5f5cede..40e1c4690aa49 100644
+--- a/components/commerce/core/product_specifications/product_specifications_sync_bridge.cc
++++ b/components/commerce/core/product_specifications/product_specifications_sync_bridge.cc
+@@ -131,7 +131,7 @@ void ProductSpecificationsSyncBridge::GetAllDataForDebugging(
+ const std::optional<sync_pb::CompareSpecifics>
+ ProductSpecificationsSyncBridge::AddProductSpecifications(
+ const std::string& name,
+- const std::vector<const GURL>& urls) {
++ const std::vector<GURL>& urls) {
+ if (!change_processor()->IsTrackingMetadata()) {
+ return std::nullopt;
+ }
+diff --git a/components/commerce/core/product_specifications/product_specifications_sync_bridge.h b/components/commerce/core/product_specifications/product_specifications_sync_bridge.h
+index 0988e7b91ea97..aa7b7a6ba24eb 100644
+--- a/components/commerce/core/product_specifications/product_specifications_sync_bridge.h
++++ b/components/commerce/core/product_specifications/product_specifications_sync_bridge.h
+@@ -64,7 +64,7 @@ class ProductSpecificationsSyncBridge : public syncer::ModelTypeSyncBridge {
+
+ virtual const std::optional<sync_pb::CompareSpecifics>
+ AddProductSpecifications(const std::string& name,
+- const std::vector<const GURL>& urls);
++ const std::vector<GURL>& urls);
+
+ void DeleteProductSpecificationsSet(const std::string& uuid);
+
+diff --git a/components/commerce/core/product_specifications/product_specifications_sync_bridge_unittest.cc b/components/commerce/core/product_specifications/product_specifications_sync_bridge_unittest.cc
+index 3525177044541..7d0409dfe715d 100644
+--- a/components/commerce/core/product_specifications/product_specifications_sync_bridge_unittest.cc
++++ b/components/commerce/core/product_specifications/product_specifications_sync_bridge_unittest.cc
+@@ -178,7 +178,7 @@ class ProductSpecificationsSyncBridgeTest : public testing::Test {
+
+ std::optional<sync_pb::CompareSpecifics> AddProductSpecifications(
+ const std::string& name,
+- const std::vector<const GURL> urls) {
++ const std::vector<GURL> urls) {
+ return bridge().AddProductSpecifications(name, urls);
+ }
+
+diff --git a/components/commerce/core/shopping_service.cc b/components/commerce/core/shopping_service.cc
+index 236a8befae286..ae17aea1053d0 100644
+--- a/components/commerce/core/shopping_service.cc
++++ b/components/commerce/core/shopping_service.cc
+@@ -1734,7 +1734,7 @@ void ShoppingService::GetProductIdentifierForUrl(
+ std::move(callback)));
+ }
+
+-const std::vector<const ProductSpecificationsSet>
++const std::vector<ProductSpecificationsSet>
+ ShoppingService::GetAllProductSpecificationSets() {
+ return product_specifications_service_->GetAllProductSpecifications();
+ }
+diff --git a/components/commerce/core/shopping_service.h b/components/commerce/core/shopping_service.h
+index 304e33d7c5260..5b6d9d2321281 100644
+--- a/components/commerce/core/shopping_service.h
++++ b/components/commerce/core/shopping_service.h
+@@ -624,7 +624,7 @@ class ShoppingService : public KeyedService,
+ UrlProductIdentifierTupleCallback callback);
+
+ // Return all ProductSpecificationsSets from ProductSpecificationsService.
+- virtual const std::vector<const ProductSpecificationsSet>
++ virtual const std::vector<ProductSpecificationsSet>
+ GetAllProductSpecificationSets();
+
+ // Updates the bookmark model used for sync (and shopping) if needed. Invoked
+diff --git a/mojo/public/cpp/base/proto_wrapper.cc b/mojo/public/cpp/base/proto_wrapper.cc
+index ad5b76632d76e..c5fa9f48a1a46 100644
+--- a/mojo/public/cpp/base/proto_wrapper.cc
++++ b/mojo/public/cpp/base/proto_wrapper.cc
+@@ -57,7 +57,7 @@ bool ProtoWrapper::DeserializeToMessage(
+ // Make an in-process copy here as protobuf is not designed to
+ // safely parse data that might be changing underneath it.
+ auto as_span = base::make_span(bytes_->data(), bytes_->size());
+- const std::vector<const uint8_t> copy(as_span.begin(), as_span.end());
++ const std::vector<uint8_t> copy(as_span.begin(), as_span.end());
+ return message.ParseFromArray(copy.data(), copy.size());
+ }
+ }
diff --git a/chromium-125-no_matching_constructor.patch b/chromium-125-no_matching_constructor.patch
new file mode 100644
index 0000000..d3469d8
--- /dev/null
+++ b/chromium-125-no_matching_constructor.patch
@@ -0,0 +1,1141 @@
+Index: chromium-123.0.6312.46/base/metrics/persistent_histogram_allocator.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/base/metrics/persistent_histogram_allocator.cc
++++ chromium-123.0.6312.46/base/metrics/persistent_histogram_allocator.cc
+@@ -220,13 +220,13 @@ PersistentSparseHistogramDataManager::Lo
+ // The sample-record could be for any sparse histogram. Add the reference
+ // to the appropriate collection for later use.
+ if (found_id == match_id) {
+- found_records.emplace_back(ref, value);
++ found_records.emplace_back() = {ref, value};
+ found = true;
+ } else {
+ std::vector<ReferenceAndSample>* samples =
+ GetSampleMapRecordsWhileLocked(found_id);
+ CHECK(samples);
+- samples->emplace_back(ref, value);
++ samples->emplace_back() = {ref, value};
+ }
+ }
+
+Index: chromium-123.0.6312.46/base/nix/mime_util_xdg.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/base/nix/mime_util_xdg.cc
++++ chromium-123.0.6312.46/base/nix/mime_util_xdg.cc
+@@ -56,7 +56,7 @@ void LoadAllMimeCacheFiles(MimeTypeMap&
+ for (const auto& path : GetXDGDataSearchLocations(env.get())) {
+ FilePath mime_cache = path.Append("mime/mime.cache");
+ if (GetFileInfo(mime_cache, &info) && ParseMimeTypes(mime_cache, map)) {
+- files.emplace_back(mime_cache, info.last_modified);
++ files.emplace_back() = {mime_cache, info.last_modified};
+ }
+ }
+ }
+Index: chromium-123.0.6312.46/base/trace_event/trace_log.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/base/trace_event/trace_log.cc
++++ chromium-123.0.6312.46/base/trace_event/trace_log.cc
+@@ -2198,8 +2198,8 @@ void TraceLog::SetTraceBufferForTesting(
+ #if BUILDFLAG(USE_PERFETTO_CLIENT_LIBRARY)
+ void TraceLog::OnSetup(const perfetto::DataSourceBase::SetupArgs& args) {
+ AutoLock lock(track_event_lock_);
+- track_event_sessions_.emplace_back(args.internal_instance_index, *args.config,
+- args.backend_type);
++ track_event_sessions_.emplace_back() = {args.internal_instance_index, *args.config,
++ args.backend_type};
+ }
+
+ void TraceLog::OnStart(const perfetto::DataSourceBase::StartArgs&) {
+Index: chromium-123.0.6312.46/chrome/browser/content_settings/one_time_permission_provider.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/chrome/browser/content_settings/one_time_permission_provider.cc
++++ chromium-123.0.6312.46/chrome/browser/content_settings/one_time_permission_provider.cc
+@@ -252,8 +252,8 @@ void OneTimePermissionProvider::OnSuspen
+
+ while (rule_iterator && rule_iterator->HasNext()) {
+ auto rule = rule_iterator->Next();
+- patterns_to_delete.emplace_back(setting_type, rule->primary_pattern,
+- rule->secondary_pattern);
++ patterns_to_delete.emplace_back() = {setting_type, rule->primary_pattern,
++ rule->secondary_pattern};
+ permissions::PermissionUmaUtil::RecordOneTimePermissionEvent(
+ setting_type,
+ permissions::OneTimePermissionEvent::EXPIRED_ON_SUSPEND);
+@@ -355,8 +355,8 @@ void OneTimePermissionProvider::DeleteEn
+ auto rule = rule_iterator->Next();
+ if (rule->primary_pattern.Matches(origin_gurl) &&
+ rule->secondary_pattern.Matches(origin_gurl)) {
+- patterns_to_delete.emplace_back(
+- content_setting_type, rule->primary_pattern, rule->secondary_pattern);
++ patterns_to_delete.emplace_back() = {
++ content_setting_type, rule->primary_pattern, rule->secondary_pattern};
+ permissions::PermissionUmaUtil::RecordOneTimePermissionEvent(
+ content_setting_type, trigger_event);
+ }
+Index: chromium-123.0.6312.46/chrome/browser/enterprise/profile_management/profile_management_navigation_throttle.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/chrome/browser/enterprise/profile_management/profile_management_navigation_throttle.cc
++++ chromium-123.0.6312.46/chrome/browser/enterprise/profile_management/profile_management_navigation_throttle.cc
+@@ -67,8 +67,8 @@ base::flat_map<std::string, SAMLProfileA
+ // TODO(crbug.com/1445072): Add actual domains with attribute names.
+ profile_attributes->insert(std::make_pair(
+ "supported.test",
+- SAMLProfileAttributes("placeholderName", "placeholderDomain",
+- "placeholderToken")));
++ SAMLProfileAttributes{"placeholderName", "placeholderDomain",
++ "placeholderToken"}));
+
+ // Extract domains and attributes from the command line switch.
+ const base::CommandLine& command_line =
+Index: chromium-123.0.6312.46/chrome/browser/ui/autofill/autofill_context_menu_manager.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/chrome/browser/ui/autofill/autofill_context_menu_manager.cc
++++ chromium-123.0.6312.46/chrome/browser/ui/autofill/autofill_context_menu_manager.cc
+@@ -277,8 +277,8 @@ void AutofillContextMenuManager::Execute
+ AutofillManager& manager) {
+ auto& driver = static_cast<ContentAutofillDriver&>(manager.driver());
+ driver.browser_events().RendererShouldTriggerSuggestions(
+- FieldGlobalId(driver.GetFrameToken(),
+- FieldRendererId(params_.field_renderer_id)),
++ FieldGlobalId{driver.GetFrameToken(),
++ FieldRendererId(params_.field_renderer_id)},
+ AutofillSuggestionTriggerSource::kManualFallbackPayments);
+ LogManualFallbackContextMenuEntryAccepted(
+ static_cast<BrowserAutofillManager&>(manager),
+Index: chromium-123.0.6312.46/chrome/browser/ui/omnibox/chrome_omnibox_client.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/chrome/browser/ui/omnibox/chrome_omnibox_client.cc
++++ chromium-123.0.6312.46/chrome/browser/ui/omnibox/chrome_omnibox_client.cc
+@@ -474,10 +474,10 @@ void ChromeOmniboxClient::OnAutocomplete
+ alternative_nav_match);
+
+ // Store the details necessary to open the omnibox match via browser commands.
+- location_bar_->set_navigation_params(LocationBar::NavigationParams(
++ location_bar_->set_navigation_params(LocationBar::NavigationParams{
+ destination_url, disposition, transition, match_selection_timestamp,
+ destination_url_entered_without_scheme,
+- destination_url_entered_with_http_scheme, match.extra_headers));
++ destination_url_entered_with_http_scheme, match.extra_headers});
+
+ if (browser_) {
+ auto navigation = chrome::OpenCurrentURL(browser_);
+Index: chromium-123.0.6312.46/chrome/browser/ui/views/permissions/embedded_permission_prompt_ask_view.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/chrome/browser/ui/views/permissions/embedded_permission_prompt_ask_view.cc
++++ chromium-123.0.6312.46/chrome/browser/ui/views/permissions/embedded_permission_prompt_ask_view.cc
+@@ -60,12 +60,12 @@ std::vector<EmbeddedPermissionPromptAskV
+ EmbeddedPermissionPromptAskView::GetButtonsConfiguration() const {
+ std::vector<ButtonConfiguration> buttons;
+ if (base::FeatureList::IsEnabled(permissions::features::kOneTimePermission)) {
+- buttons.emplace_back(
++ buttons.emplace_back() = {
+ l10n_util::GetStringUTF16(IDS_PERMISSION_ALLOW_THIS_TIME),
+- ButtonType::kAllowThisTime, ui::ButtonStyle::kTonal);
++ ButtonType::kAllowThisTime, ui::ButtonStyle::kTonal};
+ }
+- buttons.emplace_back(l10n_util::GetStringUTF16(IDS_PERMISSION_ALLOW),
+- ButtonType::kAllow, ui::ButtonStyle::kTonal, kAllowId);
++ buttons.emplace_back() = {l10n_util::GetStringUTF16(IDS_PERMISSION_ALLOW),
++ ButtonType::kAllow, ui::ButtonStyle::kTonal, kAllowId};
+ return buttons;
+ }
+
+Index: chromium-123.0.6312.46/chrome/browser/ui/views/permissions/embedded_permission_prompt_base_view.h
+===================================================================
+--- chromium-123.0.6312.46.orig/chrome/browser/ui/views/permissions/embedded_permission_prompt_base_view.h
++++ chromium-123.0.6312.46/chrome/browser/ui/views/permissions/embedded_permission_prompt_base_view.h
+@@ -87,6 +87,7 @@ class EmbeddedPermissionPromptBaseView :
+ struct RequestLineConfiguration {
+ const raw_ptr<const gfx::VectorIcon> icon;
+ std::u16string message;
++ RequestLineConfiguration(auto i, auto m) : icon(i), message(m) { }
+ };
+
+ struct ButtonConfiguration {
+Index: chromium-123.0.6312.46/chrome/browser/ui/views/permissions/embedded_permission_prompt_policy_view.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/chrome/browser/ui/views/permissions/embedded_permission_prompt_policy_view.cc
++++ chromium-123.0.6312.46/chrome/browser/ui/views/permissions/embedded_permission_prompt_policy_view.cc
+@@ -64,8 +64,8 @@ EmbeddedPermissionPromptPolicyView::GetR
+ std::vector<EmbeddedPermissionPromptPolicyView::ButtonConfiguration>
+ EmbeddedPermissionPromptPolicyView::GetButtonsConfiguration() const {
+ std::vector<ButtonConfiguration> buttons;
+- buttons.emplace_back(l10n_util::GetStringUTF16(IDS_EMBEDDED_PROMPT_OK_LABEL),
+- ButtonType::kPolicyOK, ui::ButtonStyle::kTonal);
++ buttons.emplace_back() = {l10n_util::GetStringUTF16(IDS_EMBEDDED_PROMPT_OK_LABEL),
++ ButtonType::kPolicyOK, ui::ButtonStyle::kTonal};
+ return buttons;
+ }
+
+Index: chromium-123.0.6312.46/chrome/browser/ui/views/permissions/embedded_permission_prompt_previously_denied_view.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/chrome/browser/ui/views/permissions/embedded_permission_prompt_previously_denied_view.cc
++++ chromium-123.0.6312.46/chrome/browser/ui/views/permissions/embedded_permission_prompt_previously_denied_view.cc
+@@ -79,17 +79,17 @@ EmbeddedPermissionPromptPreviouslyDenied
+ std::vector<EmbeddedPermissionPromptPreviouslyDeniedView::ButtonConfiguration>
+ EmbeddedPermissionPromptPreviouslyDeniedView::GetButtonsConfiguration() const {
+ std::vector<ButtonConfiguration> buttons;
+- buttons.emplace_back(
++ buttons.emplace_back() = {
+ l10n_util::GetStringUTF16(IDS_EMBEDDED_PROMPT_CONTINUE_NOT_ALLOWING),
+- ButtonType::kContinueNotAllowing, ui::ButtonStyle::kTonal);
++ ButtonType::kContinueNotAllowing, ui::ButtonStyle::kTonal};
+
+ if (base::FeatureList::IsEnabled(permissions::features::kOneTimePermission)) {
+- buttons.emplace_back(
++ buttons.emplace_back() = {
+ l10n_util::GetStringUTF16(IDS_PERMISSION_ALLOW_THIS_TIME),
+- ButtonType::kAllowThisTime, ui::ButtonStyle::kTonal, kAllowThisTimeId);
++ ButtonType::kAllowThisTime, ui::ButtonStyle::kTonal, kAllowThisTimeId};
+ } else {
+- buttons.emplace_back(l10n_util::GetStringUTF16(IDS_PERMISSION_ALLOW),
+- ButtonType::kAllow, ui::ButtonStyle::kTonal);
++ buttons.emplace_back() = {l10n_util::GetStringUTF16(IDS_PERMISSION_ALLOW),
++ ButtonType::kAllow, ui::ButtonStyle::kTonal};
+ }
+ return buttons;
+ }
+Index: chromium-123.0.6312.46/chrome/browser/ui/views/permissions/embedded_permission_prompt_previously_granted_view.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/chrome/browser/ui/views/permissions/embedded_permission_prompt_previously_granted_view.cc
++++ chromium-123.0.6312.46/chrome/browser/ui/views/permissions/embedded_permission_prompt_previously_granted_view.cc
+@@ -74,12 +74,12 @@ EmbeddedPermissionPromptPreviouslyGrante
+ std::vector<EmbeddedPermissionPromptPreviouslyGrantedView::ButtonConfiguration>
+ EmbeddedPermissionPromptPreviouslyGrantedView::GetButtonsConfiguration() const {
+ std::vector<ButtonConfiguration> buttons;
+- buttons.emplace_back(
++ buttons.emplace_back() = {
+ l10n_util::GetStringUTF16(IDS_EMBEDDED_PROMPT_CONTINUE_ALLOWING),
+- ButtonType::kContinueAllowing, ui::ButtonStyle::kTonal);
++ ButtonType::kContinueAllowing, ui::ButtonStyle::kTonal};
+
+- buttons.emplace_back(
++ buttons.emplace_back() = {
+ l10n_util::GetStringUTF16(IDS_EMBEDDED_PROMPT_STOP_ALLOWING),
+- ButtonType::kStopAllowing, ui::ButtonStyle::kTonal, kStopAllowingId);
++ ButtonType::kStopAllowing, ui::ButtonStyle::kTonal, kStopAllowingId};
+ return buttons;
+ }
+Index: chromium-123.0.6312.46/chrome/browser/ui/web_applications/sub_apps_service_impl.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/chrome/browser/ui/web_applications/sub_apps_service_impl.cc
++++ chromium-123.0.6312.46/chrome/browser/ui/web_applications/sub_apps_service_impl.cc
+@@ -107,7 +107,7 @@ AddOptionsFromMojo(
+ ConvertPathToUrl(sub_app->manifest_id_path, origin));
+ ASSIGN_OR_RETURN(GURL install_url,
+ ConvertPathToUrl(sub_app->install_url_path, origin));
+- sub_apps.emplace_back(std::move(manifest_id), std::move(install_url));
++ sub_apps.emplace_back() = {std::move(manifest_id), std::move(install_url)};
+ }
+ return sub_apps;
+ }
+@@ -439,7 +439,7 @@ void SubAppsServiceImpl::ScheduleSubAppI
+ base::BindOnce(
+ [](webapps::ManifestId manifest_id, const webapps::AppId& app_id,
+ webapps::InstallResultCode result_code) {
+- return SubAppInstallResult(manifest_id, app_id, result_code);
++ return SubAppInstallResult{manifest_id, app_id, result_code};
+ },
+ manifest_id)
+ .Then(concurrent.CreateCallback()),
+Index: chromium-123.0.6312.46/chrome/test/chromedriver/capabilities.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/chrome/test/chromedriver/capabilities.cc
++++ chromium-123.0.6312.46/chrome/test/chromedriver/capabilities.cc
+@@ -346,7 +346,7 @@ Status ParseMobileEmulation(const base::
+ "'version' field of type string");
+ }
+
+- brands.emplace_back(*brand, *version);
++ brands.emplace_back() = {*brand, *version};
+ }
+
+ client_hints.brands = std::move(brands);
+@@ -384,7 +384,7 @@ Status ParseMobileEmulation(const base::
+ "a 'version' field of type string");
+ }
+
+- full_version_list.emplace_back(*brand, *version);
++ full_version_list.emplace_back() = {*brand, *version};
+ }
+
+ client_hints.full_version_list = std::move(full_version_list);
+Index: chromium-123.0.6312.46/components/password_manager/core/browser/password_manager.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/components/password_manager/core/browser/password_manager.cc
++++ chromium-123.0.6312.46/components/password_manager/core/browser/password_manager.cc
+@@ -673,7 +673,7 @@ void PasswordManager::OnUserModifiedNonP
+ it->second.last_change = base::Time::Now();
+ } else {
+ possible_usernames_.Put(
+- PossibleUsernameFieldIdentifier(driver_id, renderer_id),
++ PossibleUsernameFieldIdentifier{driver_id, renderer_id},
+ PossibleUsernameData(GetSignonRealm(driver->GetLastCommittedURL()),
+ renderer_id, value, base::Time::Now(), driver_id,
+ autocomplete_attribute_has_username,
+Index: chromium-123.0.6312.46/components/performance_manager/worker_watcher.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/components/performance_manager/worker_watcher.cc
++++ chromium-123.0.6312.46/components/performance_manager/worker_watcher.cc
+@@ -239,7 +239,7 @@ void WorkerWatcher::OnWorkerCreated(
+ DCHECK(insertion_result.second);
+
+ absl::visit(
+- base::Overloaded(
++ base::Overloaded{
+ [&,
+ this](const content::GlobalRenderFrameHostId& render_frame_host_id) {
+ AddFrameClientConnection(insertion_result.first->second.get(),
+@@ -248,7 +248,7 @@ void WorkerWatcher::OnWorkerCreated(
+ [&, this](blink::DedicatedWorkerToken dedicated_worker_token) {
+ ConnectDedicatedWorkerClient(insertion_result.first->second.get(),
+ dedicated_worker_token);
+- }),
++ }},
+ creator);
+ }
+
+@@ -265,7 +265,7 @@ void WorkerWatcher::OnBeforeWorkerDestro
+ // First disconnect the creator's node from this worker node.
+
+ absl::visit(
+- base::Overloaded(
++ base::Overloaded{
+ [&,
+ this](const content::GlobalRenderFrameHostId& render_frame_host_id) {
+ RemoveFrameClientConnection(worker_node.get(),
+@@ -274,7 +274,7 @@ void WorkerWatcher::OnBeforeWorkerDestro
+ [&, this](blink::DedicatedWorkerToken dedicated_worker_token) {
+ DisconnectDedicatedWorkerClient(worker_node.get(),
+ dedicated_worker_token);
+- }),
++ }},
+ creator);
+
+ // Disconnect all child workers before destroying the node.
+@@ -446,7 +446,7 @@ void WorkerWatcher::OnControlleeAdded(
+ const std::string& client_uuid,
+ const content::ServiceWorkerClientInfo& client_info) {
+ absl::visit(
+- base::Overloaded(
++ base::Overloaded{
+ [&, this](content::GlobalRenderFrameHostId render_frame_host_id) {
+ // For window clients, it is necessary to wait until the navigation
+ // has committed to a RenderFrameHost.
+@@ -484,7 +484,7 @@ void WorkerWatcher::OnControlleeAdded(
+ ConnectSharedWorkerClient(service_worker_node,
+ shared_worker_token);
+ }
+- }),
++ }},
+ client_info);
+ }
+
+@@ -524,7 +524,7 @@ void WorkerWatcher::OnControlleeRemoved(
+ return;
+
+ absl::visit(
+- base::Overloaded(
++ base::Overloaded{
+ [&, this](content::GlobalRenderFrameHostId render_frame_host_id) {
+ RemoveFrameClientConnection(worker_node, render_frame_host_id);
+ },
+@@ -534,7 +534,7 @@ void WorkerWatcher::OnControlleeRemoved(
+ },
+ [&, this](blink::SharedWorkerToken shared_worker_token) {
+ DisconnectSharedWorkerClient(worker_node, shared_worker_token);
+- }),
++ }},
+ client);
+ }
+
+@@ -810,7 +810,7 @@ void WorkerWatcher::ConnectAllServiceWor
+
+ for (const auto& kv : it->second) {
+ absl::visit(
+- base::Overloaded(
++ base::Overloaded{
+ [&, this](content::GlobalRenderFrameHostId render_frame_host_id) {
+ AddFrameClientConnection(service_worker_node,
+ render_frame_host_id);
+@@ -822,7 +822,7 @@ void WorkerWatcher::ConnectAllServiceWor
+ [&, this](blink::SharedWorkerToken shared_worker_token) {
+ ConnectSharedWorkerClient(service_worker_node,
+ shared_worker_token);
+- }),
++ }},
+ kv.second);
+ }
+ }
+@@ -837,7 +837,7 @@ void WorkerWatcher::DisconnectAllService
+
+ for (const auto& kv : it->second) {
+ absl::visit(
+- base::Overloaded(
++ base::Overloaded{
+ [&, this](
+ const content::GlobalRenderFrameHostId& render_frame_host_id) {
+ RemoveFrameClientConnection(service_worker_node,
+@@ -851,7 +851,7 @@ void WorkerWatcher::DisconnectAllService
+ [&, this](const blink::SharedWorkerToken& shared_worker_token) {
+ DisconnectSharedWorkerClient(service_worker_node,
+ shared_worker_token);
+- }),
++ }},
+ kv.second);
+ }
+ }
+Index: chromium-123.0.6312.46/components/viz/service/display_embedder/skia_output_surface_impl_on_gpu.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/components/viz/service/display_embedder/skia_output_surface_impl_on_gpu.cc
++++ chromium-123.0.6312.46/components/viz/service/display_embedder/skia_output_surface_impl_on_gpu.cc
+@@ -1701,7 +1701,7 @@ void SkiaOutputSurfaceImplOnGpu::CopyOut
+
+ // Issue readbacks from the surfaces:
+ for (size_t i = 0; i < CopyOutputResult::kNV12MaxPlanes; ++i) {
+- SkISize size(plane_surfaces[i]->width(), plane_surfaces[i]->height());
++ SkISize size{plane_surfaces[i]->width(), plane_surfaces[i]->height()};
+ SkImageInfo dst_info = SkImageInfo::Make(
+ size, (i == 0) ? kAlpha_8_SkColorType : kR8G8_unorm_SkColorType,
+ kUnpremul_SkAlphaType);
+Index: chromium-123.0.6312.46/content/browser/download/save_package.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/content/browser/download/save_package.cc
++++ chromium-123.0.6312.46/content/browser/download/save_package.cc
+@@ -803,8 +803,8 @@ void SavePackage::Finish() {
+ if (download_) {
+ std::vector<download::DownloadSaveItemData::ItemInfo> files;
+ for (auto& item : saved_success_items_) {
+- files.emplace_back(item.second->full_path(), item.second->url(),
+- item.second->referrer().url);
++ files.emplace_back() = {item.second->full_path(), item.second->url(),
++ item.second->referrer().url};
+ }
+ download::DownloadSaveItemData::AttachItemData(download_, std::move(files));
+ }
+Index: chromium-123.0.6312.46/content/browser/first_party_sets/first_party_set_parser.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/content/browser/first_party_sets/first_party_set_parser.cc
++++ chromium-123.0.6312.46/content/browser/first_party_sets/first_party_set_parser.cc
+@@ -773,7 +773,7 @@ FirstPartySetParser::ParseSetsFromEnterp
+ context.GetPolicySetsFromList(
+ policy.FindList(kFirstPartySetPolicyAdditionsField),
+ PolicySetType::kAddition));
+- return ParsedPolicySetLists(std::move(replacements), std::move(additions));
++ return ParsedPolicySetLists{std::move(replacements), std::move(additions)};
+ }();
+
+ context.PostProcessSetLists(set_lists);
+Index: chromium-123.0.6312.46/content/browser/interest_group/header_direct_from_seller_signals.h
+===================================================================
+--- chromium-123.0.6312.46.orig/content/browser/interest_group/header_direct_from_seller_signals.h
++++ chromium-123.0.6312.46/content/browser/interest_group/header_direct_from_seller_signals.h
+@@ -133,6 +133,7 @@ class CONTENT_EXPORT HeaderDirectFromSel
+
+ // The Ad-Auction-Signals response served by `origin`.
+ std::string response_json;
++ UnprocessedResponse(auto u, auto s) : origin(u), response_json(s) { }
+ };
+
+ // Information from ParseAndFind() calls used by ParseAndFindCompleted.
+Index: chromium-123.0.6312.46/content/browser/interest_group/interest_group_storage.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/content/browser/interest_group/interest_group_storage.cc
++++ chromium-123.0.6312.46/content/browser/interest_group/interest_group_storage.cc
+@@ -3284,9 +3284,9 @@ std::optional<DebugReportCooldown> DoGet
+ return std::nullopt;
+ }
+
+- return DebugReportCooldown(cooldown_debugging_only_report.ColumnTime(0),
++ return DebugReportCooldown{cooldown_debugging_only_report.ColumnTime(0),
+ static_cast<DebugReportCooldownType>(
+- cooldown_debugging_only_report.ColumnInt(1)));
++ cooldown_debugging_only_report.ColumnInt(1))};
+ }
+
+ void DoGetDebugReportCooldowns(
+@@ -3406,10 +3406,10 @@ DoGetKAnonymityData(sql::Database& db,
+
+ std::vector<StorageInterestGroup::KAnonymityData> k_anon_data;
+ while (interest_group_kanon_query.Step()) {
+- k_anon_data.emplace_back(
++ k_anon_data.emplace_back() = {
+ /*key=*/interest_group_kanon_query.ColumnString(0),
+ /*is_k_anonymous=*/interest_group_kanon_query.ColumnBool(1),
+- /*last_updated=*/interest_group_kanon_query.ColumnTime(2));
++ /*last_updated=*/interest_group_kanon_query.ColumnTime(2)};
+ }
+ if (!interest_group_kanon_query.Succeeded()) {
+ return std::nullopt;
+Index: chromium-123.0.6312.46/content/browser/renderer_host/render_frame_host_impl.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/content/browser/renderer_host/render_frame_host_impl.cc
++++ chromium-123.0.6312.46/content/browser/renderer_host/render_frame_host_impl.cc
+@@ -8796,7 +8796,7 @@
+ for (const blink::FencedFrame::ReportingDestination& destination :
+ destinations) {
+ SendFencedFrameReportingBeaconInternal(
+- DestinationEnumEvent(event_type, event_data, cross_origin_exposed),
++ DestinationEnumEvent{event_type, event_data, cross_origin_exposed},
+ destination);
+ }
+ }
+@@ -8827,7 +8827,7 @@
+ }
+
+ SendFencedFrameReportingBeaconInternal(
+- DestinationURLEvent(destination_url, cross_origin_exposed),
++ DestinationURLEvent{destination_url, cross_origin_exposed},
+ blink::FencedFrame::ReportingDestination::kBuyer);
+ }
+
+@@ -8851,7 +8851,7 @@ void RenderFrameHostImpl::MaybeSendFence
+ data = info->data;
+ }
+ initiator_rfh->SendFencedFrameReportingBeaconInternal(
+- AutomaticBeaconEvent(event_type, data), destination,
++ AutomaticBeaconEvent{event_type, data}, destination,
+ navigation_request.GetNavigationId());
+ }
+ } else {
+@@ -8862,7 +8862,7 @@ void RenderFrameHostImpl::MaybeSendFence
+ for (blink::FencedFrame::ReportingDestination destination :
+ info->destinations) {
+ initiator_rfh->SendFencedFrameReportingBeaconInternal(
+- AutomaticBeaconEvent(event_type, info->data), destination,
++ AutomaticBeaconEvent{event_type, info->data}, destination,
+ navigation_request.GetNavigationId());
+ }
+ }
+Index: chromium-123.0.6312.46/content/browser/service_worker/service_worker_container_host.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/content/browser/service_worker/service_worker_container_host.cc
++++ chromium-123.0.6312.46/content/browser/service_worker/service_worker_container_host.cc
+@@ -881,7 +881,7 @@ ServiceWorkerContainerHost::GetClientTyp
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ DCHECK(client_info_);
+ return absl::visit(
+- base::Overloaded(
++ base::Overloaded{
+ [](GlobalRenderFrameHostId render_frame_host_id) {
+ return blink::mojom::ServiceWorkerClientType::kWindow;
+ },
+@@ -890,7 +890,7 @@ ServiceWorkerContainerHost::GetClientTyp
+ },
+ [](blink::SharedWorkerToken shared_worker_token) {
+ return blink::mojom::ServiceWorkerClientType::kSharedWorker;
+- }),
++ }},
+ *client_info_);
+ }
+
+Index: chromium-123.0.6312.46/content/browser/service_worker/service_worker_main_resource_loader_interceptor.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/content/browser/service_worker/service_worker_main_resource_loader_interceptor.cc
++++ chromium-123.0.6312.46/content/browser/service_worker/service_worker_main_resource_loader_interceptor.cc
+@@ -361,10 +361,10 @@ ServiceWorkerMainResourceLoaderIntercept
+ }
+ auto* storage_partition = process->GetStoragePartition();
+
+- return absl::visit(base::Overloaded([&, this](auto token) {
++ return absl::visit(base::Overloaded{[&, this](auto token) {
+ return GetStorageKeyFromWorkerHost(storage_partition,
+ token, origin);
+- }),
++ }},
+ *worker_token_);
+ }
+
+Index: chromium-123.0.6312.46/content/browser/worker_host/dedicated_worker_host.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/content/browser/worker_host/dedicated_worker_host.cc
++++ chromium-123.0.6312.46/content/browser/worker_host/dedicated_worker_host.cc
+@@ -255,7 +255,7 @@ void DedicatedWorkerHost::StartScriptLoa
+ RenderFrameHostImpl* creator_render_frame_host = nullptr;
+ DedicatedWorkerHost* creator_worker = nullptr;
+
+- absl::visit(base::Overloaded(
++ absl::visit(base::Overloaded{
+ [&](const GlobalRenderFrameHostId& render_frame_host_id) {
+ creator_render_frame_host =
+ RenderFrameHostImpl::FromID(render_frame_host_id);
+@@ -263,7 +263,7 @@ void DedicatedWorkerHost::StartScriptLoa
+ [&](blink::DedicatedWorkerToken dedicated_worker_token) {
+ creator_worker = service_->GetDedicatedWorkerHostFromToken(
+ dedicated_worker_token);
+- }),
++ }},
+ creator_);
+
+ if (!creator_render_frame_host && !creator_worker) {
+Index: chromium-123.0.6312.46/net/dns/host_resolver_cache.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/net/dns/host_resolver_cache.cc
++++ chromium-123.0.6312.46/net/dns/host_resolver_cache.cc
+@@ -368,7 +368,7 @@ void HostResolverCache::Set(
+
+ std::string domain_name = result->domain_name();
+ entries_.emplace(
+- Key(std::move(domain_name), network_anonymization_key),
++ Key{std::move(domain_name), network_anonymization_key},
+ Entry(std::move(result), source, secure, staleness_generation));
+
+ if (entries_.size() > max_entries_) {
+Index: chromium-123.0.6312.46/third_party/blink/renderer/platform/fonts/font_palette.h
+===================================================================
+--- chromium-123.0.6312.46.orig/third_party/blink/renderer/platform/fonts/font_palette.h
++++ chromium-123.0.6312.46/third_party/blink/renderer/platform/fonts/font_palette.h
+@@ -96,7 +96,7 @@ class PLATFORM_EXPORT FontPalette : publ
+ Color::ColorSpace color_interpolation_space,
+ std::optional<Color::HueInterpolationMethod> hue_interpolation_method) {
+ return base::AdoptRef(new FontPalette(
+- start, end, NonNormalizedPercentages(start_percentage, end_percentage),
++ start, end, NonNormalizedPercentages{start_percentage, end_percentage},
+ normalized_percentage, alpha_multiplier, color_interpolation_space,
+ hue_interpolation_method));
+ }
+@@ -170,7 +170,7 @@ class PLATFORM_EXPORT FontPalette : publ
+ double normalized_percentage) {
+ double end_percentage = normalized_percentage * 100.0;
+ double start_percentage = 100.0 - end_percentage;
+- return NonNormalizedPercentages(start_percentage, end_percentage);
++ return NonNormalizedPercentages{start_percentage, end_percentage};
+ }
+
+ double GetAlphaMultiplier() const {
+Index: chromium-123.0.6312.46/third_party/blink/renderer/platform/fonts/palette_interpolation.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/third_party/blink/renderer/platform/fonts/palette_interpolation.cc
++++ chromium-123.0.6312.46/third_party/blink/renderer/platform/fonts/palette_interpolation.cc
+@@ -31,7 +31,7 @@ Vector<FontPalette::FontPaletteOverride>
+ color_interpolation_space, hue_interpolation_method, start_color,
+ end_color, percentage, alpha_multiplier);
+
+- FontPalette::FontPaletteOverride result_color_record(i, result_color);
++ FontPalette::FontPaletteOverride result_color_record{static_cast<uint16_t>(i), result_color};
+ result_color_records.push_back(result_color_record);
+ }
+ return result_color_records;
+Index: chromium-123.0.6312.46/third_party/pdfium/core/fpdfapi/render/cpdf_renderstatus.cpp
+===================================================================
+--- chromium-123.0.6312.46.orig/third_party/pdfium/core/fpdfapi/render/cpdf_renderstatus.cpp
++++ chromium-123.0.6312.46/third_party/pdfium/core/fpdfapi/render/cpdf_renderstatus.cpp
+@@ -507,7 +507,7 @@ void CPDF_RenderStatus::ProcessClipPath(
+ } else {
+ m_pDevice->SetClip_PathFill(
+ *pPath, &mtObj2Device,
+- CFX_FillRenderOptions(ClipPath.GetClipType(i)));
++ CFX_FillRenderOptions{ClipPath.GetClipType(i)});
+ }
+ }
+
+Index: chromium-123.0.6312.46/ui/base/wayland/color_manager_util.h
+===================================================================
+--- chromium-123.0.6312.46.orig/ui/base/wayland/color_manager_util.h
++++ chromium-123.0.6312.46/ui/base/wayland/color_manager_util.h
+@@ -52,53 +52,53 @@ constexpr auto kChromaticityMap = base::
+ zcr_color_manager_v1_chromaticity_names,
+ PrimaryVersion>(
+ {{ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_BT601_525_LINE,
+- PrimaryVersion(gfx::ColorSpace::PrimaryID::SMPTE170M,
+- kDefaultSinceVersion)},
++ PrimaryVersion{gfx::ColorSpace::PrimaryID::SMPTE170M,
++ kDefaultSinceVersion}},
+ {ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_BT601_625_LINE,
+- PrimaryVersion(gfx::ColorSpace::PrimaryID::BT470BG,
+- kDefaultSinceVersion)},
++ PrimaryVersion{gfx::ColorSpace::PrimaryID::BT470BG,
++ kDefaultSinceVersion}},
+ {ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_SMPTE170M,
+- PrimaryVersion(gfx::ColorSpace::PrimaryID::SMPTE170M,
+- kDefaultSinceVersion)},
++ PrimaryVersion{gfx::ColorSpace::PrimaryID::SMPTE170M,
++ kDefaultSinceVersion}},
+ {ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_BT709,
+- PrimaryVersion(gfx::ColorSpace::PrimaryID::BT709, kDefaultSinceVersion)},
++ PrimaryVersion{gfx::ColorSpace::PrimaryID::BT709, kDefaultSinceVersion}},
+ {ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_BT2020,
+- PrimaryVersion(gfx::ColorSpace::PrimaryID::BT2020, kDefaultSinceVersion)},
++ PrimaryVersion{gfx::ColorSpace::PrimaryID::BT2020, kDefaultSinceVersion}},
+ {ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_SRGB,
+- PrimaryVersion(gfx::ColorSpace::PrimaryID::BT709, kDefaultSinceVersion)},
++ PrimaryVersion{gfx::ColorSpace::PrimaryID::BT709, kDefaultSinceVersion}},
+ {ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_DISPLAYP3,
+- PrimaryVersion(gfx::ColorSpace::PrimaryID::P3, kDefaultSinceVersion)},
++ PrimaryVersion{gfx::ColorSpace::PrimaryID::P3, kDefaultSinceVersion}},
+ {ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_ADOBERGB,
+- PrimaryVersion(gfx::ColorSpace::PrimaryID::ADOBE_RGB,
+- kDefaultSinceVersion)},
++ PrimaryVersion{gfx::ColorSpace::PrimaryID::ADOBE_RGB,
++ kDefaultSinceVersion}},
+ {ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_WIDE_GAMUT_COLOR_SPIN,
+- PrimaryVersion(
++ PrimaryVersion{
+ gfx::ColorSpace::PrimaryID::WIDE_GAMUT_COLOR_SPIN,
+- ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_WIDE_GAMUT_COLOR_SPIN_SINCE_VERSION)},
++ ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_WIDE_GAMUT_COLOR_SPIN_SINCE_VERSION}},
+ {ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_BT470M,
+- PrimaryVersion(
++ PrimaryVersion{
+ gfx::ColorSpace::PrimaryID::BT470M,
+- ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_BT470M_SINCE_VERSION)},
++ ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_BT470M_SINCE_VERSION}},
+ {ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_SMPTE240M,
+- PrimaryVersion(
++ PrimaryVersion{
+ gfx::ColorSpace::PrimaryID::SMPTE240M,
+- ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_SMPTE240M_SINCE_VERSION)},
++ ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_SMPTE240M_SINCE_VERSION}},
+ {ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_XYZ_D50,
+- PrimaryVersion(
++ PrimaryVersion{
+ gfx::ColorSpace::PrimaryID::XYZ_D50,
+- ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_XYZ_D50_SINCE_VERSION)},
++ ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_XYZ_D50_SINCE_VERSION}},
+ {ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_SMPTEST428_1,
+- PrimaryVersion(
++ PrimaryVersion{
+ gfx::ColorSpace::PrimaryID::SMPTEST428_1,
+- ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_SMPTEST428_1_SINCE_VERSION)},
++ ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_SMPTEST428_1_SINCE_VERSION}},
+ {ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_SMPTEST431_2,
+- PrimaryVersion(
++ PrimaryVersion{
+ gfx::ColorSpace::PrimaryID::SMPTEST431_2,
+- ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_SMPTEST431_2_SINCE_VERSION)},
++ ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_SMPTEST431_2_SINCE_VERSION}},
+ {ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_FILM,
+- PrimaryVersion(
++ PrimaryVersion{
+ gfx::ColorSpace::PrimaryID::FILM,
+- ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_FILM_SINCE_VERSION)}});
++ ZCR_COLOR_MANAGER_V1_CHROMATICITY_NAMES_FILM_SINCE_VERSION}}});
+
+ // A map from the zcr_color_manager_v1 eotf_names enum values
+ // representing well-known EOTFs, to their equivalent TransferIDs.
+@@ -107,68 +107,68 @@ constexpr auto kEotfMap = base::MakeFixe
+ zcr_color_manager_v1_eotf_names,
+ TransferVersion>({
+ {ZCR_COLOR_MANAGER_V1_EOTF_NAMES_LINEAR,
+- TransferVersion(gfx::ColorSpace::TransferID::LINEAR,
+- kDefaultSinceVersion)},
++ TransferVersion{gfx::ColorSpace::TransferID::LINEAR,
++ kDefaultSinceVersion}},
+ {ZCR_COLOR_MANAGER_V1_EOTF_NAMES_SRGB,
+- TransferVersion(gfx::ColorSpace::TransferID::SRGB, kDefaultSinceVersion)},
++ TransferVersion{gfx::ColorSpace::TransferID::SRGB, kDefaultSinceVersion}},
+ {ZCR_COLOR_MANAGER_V1_EOTF_NAMES_SRGB_HDR,
+- TransferVersion(gfx::ColorSpace::TransferID::SRGB_HDR,
+- ZCR_COLOR_MANAGER_V1_EOTF_NAMES_SRGB_HDR_SINCE_VERSION)},
++ TransferVersion{gfx::ColorSpace::TransferID::SRGB_HDR,
++ ZCR_COLOR_MANAGER_V1_EOTF_NAMES_SRGB_HDR_SINCE_VERSION}},
+ {ZCR_COLOR_MANAGER_V1_EOTF_NAMES_BT709,
+- TransferVersion(gfx::ColorSpace::TransferID::BT709,
+- ZCR_COLOR_MANAGER_V1_EOTF_NAMES_BT709_SINCE_VERSION)},
++ TransferVersion{gfx::ColorSpace::TransferID::BT709,
++ ZCR_COLOR_MANAGER_V1_EOTF_NAMES_BT709_SINCE_VERSION}},
+ {ZCR_COLOR_MANAGER_V1_EOTF_NAMES_BT2087,
+- TransferVersion(gfx::ColorSpace::TransferID::GAMMA24,
+- kDefaultSinceVersion)},
++ TransferVersion{gfx::ColorSpace::TransferID::GAMMA24,
++ kDefaultSinceVersion}},
+ {ZCR_COLOR_MANAGER_V1_EOTF_NAMES_ADOBERGB,
+ // This is ever so slightly inaccurate. The number ought to be
+ // 2.19921875f, not 2.2
+- TransferVersion(gfx::ColorSpace::TransferID::GAMMA22,
+- kDefaultSinceVersion)},
++ TransferVersion{gfx::ColorSpace::TransferID::GAMMA22,
++ kDefaultSinceVersion}},
+ {ZCR_COLOR_MANAGER_V1_EOTF_NAMES_PQ,
+- TransferVersion(gfx::ColorSpace::TransferID::PQ, kDefaultSinceVersion)},
++ TransferVersion{gfx::ColorSpace::TransferID::PQ, kDefaultSinceVersion}},
+ {ZCR_COLOR_MANAGER_V1_EOTF_NAMES_HLG,
+- TransferVersion(gfx::ColorSpace::TransferID::HLG,
+- ZCR_COLOR_MANAGER_V1_EOTF_NAMES_HLG_SINCE_VERSION)},
++ TransferVersion{gfx::ColorSpace::TransferID::HLG,
++ ZCR_COLOR_MANAGER_V1_EOTF_NAMES_HLG_SINCE_VERSION}},
+ {ZCR_COLOR_MANAGER_V1_EOTF_NAMES_SMPTE170M,
+- TransferVersion(gfx::ColorSpace::TransferID::SMPTE170M,
+- ZCR_COLOR_MANAGER_V1_EOTF_NAMES_SMPTE170M_SINCE_VERSION)},
++ TransferVersion{gfx::ColorSpace::TransferID::SMPTE170M,
++ ZCR_COLOR_MANAGER_V1_EOTF_NAMES_SMPTE170M_SINCE_VERSION}},
+ {ZCR_COLOR_MANAGER_V1_EOTF_NAMES_SMPTE240M,
+- TransferVersion(gfx::ColorSpace::TransferID::SMPTE240M,
+- ZCR_COLOR_MANAGER_V1_EOTF_NAMES_SMPTE240M_SINCE_VERSION)},
++ TransferVersion{gfx::ColorSpace::TransferID::SMPTE240M,
++ ZCR_COLOR_MANAGER_V1_EOTF_NAMES_SMPTE240M_SINCE_VERSION}},
+ {ZCR_COLOR_MANAGER_V1_EOTF_NAMES_SMPTEST428_1,
+- TransferVersion(
++ TransferVersion{
+ gfx::ColorSpace::TransferID::SMPTEST428_1,
+- ZCR_COLOR_MANAGER_V1_EOTF_NAMES_SMPTEST428_1_SINCE_VERSION)},
++ ZCR_COLOR_MANAGER_V1_EOTF_NAMES_SMPTEST428_1_SINCE_VERSION}},
+ {ZCR_COLOR_MANAGER_V1_EOTF_NAMES_LOG,
+- TransferVersion(gfx::ColorSpace::TransferID::LOG,
+- ZCR_COLOR_MANAGER_V1_EOTF_NAMES_LOG_SINCE_VERSION)},
++ TransferVersion{gfx::ColorSpace::TransferID::LOG,
++ ZCR_COLOR_MANAGER_V1_EOTF_NAMES_LOG_SINCE_VERSION}},
+ {ZCR_COLOR_MANAGER_V1_EOTF_NAMES_LOG_SQRT,
+- TransferVersion(gfx::ColorSpace::TransferID::LOG_SQRT,
+- ZCR_COLOR_MANAGER_V1_EOTF_NAMES_LOG_SQRT_SINCE_VERSION)},
++ TransferVersion{gfx::ColorSpace::TransferID::LOG_SQRT,
++ ZCR_COLOR_MANAGER_V1_EOTF_NAMES_LOG_SQRT_SINCE_VERSION}},
+ {ZCR_COLOR_MANAGER_V1_EOTF_NAMES_IEC61966_2_4,
+- TransferVersion(
++ TransferVersion{
+ gfx::ColorSpace::TransferID::IEC61966_2_4,
+- ZCR_COLOR_MANAGER_V1_EOTF_NAMES_IEC61966_2_4_SINCE_VERSION)},
++ ZCR_COLOR_MANAGER_V1_EOTF_NAMES_IEC61966_2_4_SINCE_VERSION}},
+ {ZCR_COLOR_MANAGER_V1_EOTF_NAMES_BT1361_ECG,
+- TransferVersion(gfx::ColorSpace::TransferID::BT1361_ECG,
+- ZCR_COLOR_MANAGER_V1_EOTF_NAMES_BT1361_ECG_SINCE_VERSION)},
++ TransferVersion{gfx::ColorSpace::TransferID::BT1361_ECG,
++ ZCR_COLOR_MANAGER_V1_EOTF_NAMES_BT1361_ECG_SINCE_VERSION}},
+ {ZCR_COLOR_MANAGER_V1_EOTF_NAMES_BT2020_10,
+- TransferVersion(gfx::ColorSpace::TransferID::BT2020_10,
+- ZCR_COLOR_MANAGER_V1_EOTF_NAMES_BT2020_10_SINCE_VERSION)},
++ TransferVersion{gfx::ColorSpace::TransferID::BT2020_10,
++ ZCR_COLOR_MANAGER_V1_EOTF_NAMES_BT2020_10_SINCE_VERSION}},
+ {ZCR_COLOR_MANAGER_V1_EOTF_NAMES_BT2020_12,
+- TransferVersion(gfx::ColorSpace::TransferID::BT2020_12,
+- ZCR_COLOR_MANAGER_V1_EOTF_NAMES_BT2020_12_SINCE_VERSION)},
++ TransferVersion{gfx::ColorSpace::TransferID::BT2020_12,
++ ZCR_COLOR_MANAGER_V1_EOTF_NAMES_BT2020_12_SINCE_VERSION}},
+ {ZCR_COLOR_MANAGER_V1_EOTF_NAMES_SCRGB_LINEAR_80_NITS,
+- TransferVersion(
++ TransferVersion{
+ gfx::ColorSpace::TransferID::SCRGB_LINEAR_80_NITS,
+- ZCR_COLOR_MANAGER_V1_EOTF_NAMES_SCRGB_LINEAR_80_NITS_SINCE_VERSION)},
++ ZCR_COLOR_MANAGER_V1_EOTF_NAMES_SCRGB_LINEAR_80_NITS_SINCE_VERSION}},
+ {ZCR_COLOR_MANAGER_V1_EOTF_NAMES_GAMMA18,
+- TransferVersion(gfx::ColorSpace::TransferID::GAMMA18,
+- ZCR_COLOR_MANAGER_V1_EOTF_NAMES_GAMMA18_SINCE_VERSION)},
++ TransferVersion{gfx::ColorSpace::TransferID::GAMMA18,
++ ZCR_COLOR_MANAGER_V1_EOTF_NAMES_GAMMA18_SINCE_VERSION}},
+ {ZCR_COLOR_MANAGER_V1_EOTF_NAMES_GAMMA28,
+- TransferVersion(gfx::ColorSpace::TransferID::GAMMA28,
+- ZCR_COLOR_MANAGER_V1_EOTF_NAMES_GAMMA28_SINCE_VERSION)},
++ TransferVersion{gfx::ColorSpace::TransferID::GAMMA28,
++ ZCR_COLOR_MANAGER_V1_EOTF_NAMES_GAMMA28_SINCE_VERSION}},
+ });
+
+ // A map from the SDR zcr_color_manager_v1 eotf_names enum values
+@@ -177,18 +177,18 @@ constexpr auto kEotfMap = base::MakeFixe
+ constexpr auto kTransferMap =
+ base::MakeFixedFlatMap<zcr_color_manager_v1_eotf_names, TransferFnVersion>({
+ {ZCR_COLOR_MANAGER_V1_EOTF_NAMES_LINEAR,
+- TransferFnVersion(SkNamedTransferFn::kLinear, kDefaultSinceVersion)},
++ TransferFnVersion{SkNamedTransferFn::kLinear, kDefaultSinceVersion}},
+ {ZCR_COLOR_MANAGER_V1_EOTF_NAMES_SRGB,
+- TransferFnVersion(SkNamedTransferFnExt::kSRGB, kDefaultSinceVersion)},
++ TransferFnVersion{SkNamedTransferFnExt::kSRGB, kDefaultSinceVersion}},
+ {ZCR_COLOR_MANAGER_V1_EOTF_NAMES_BT709,
+- TransferFnVersion(
++ TransferFnVersion{
+ SkNamedTransferFnExt::kRec709,
+- ZCR_COLOR_MANAGER_V1_EOTF_NAMES_BT709_SINCE_VERSION)},
++ ZCR_COLOR_MANAGER_V1_EOTF_NAMES_BT709_SINCE_VERSION}},
+ {ZCR_COLOR_MANAGER_V1_EOTF_NAMES_BT2087,
+- TransferFnVersion(gamma24, kDefaultSinceVersion)},
++ TransferFnVersion{gamma24, kDefaultSinceVersion}},
+ {ZCR_COLOR_MANAGER_V1_EOTF_NAMES_ADOBERGB,
+- TransferFnVersion(SkNamedTransferFnExt::kA98RGB,
+- kDefaultSinceVersion)},
++ TransferFnVersion{SkNamedTransferFnExt::kA98RGB,
++ kDefaultSinceVersion}},
+ });
+
+ // A map from the HDR zcr_color_manager_v1 eotf_names enum values
+@@ -197,70 +197,70 @@ constexpr auto kTransferMap =
+ constexpr auto kHDRTransferMap =
+ base::MakeFixedFlatMap<zcr_color_manager_v1_eotf_names, TransferFnVersion>(
+ {{ZCR_COLOR_MANAGER_V1_EOTF_NAMES_LINEAR,
+- TransferFnVersion(SkNamedTransferFn::kLinear, kDefaultSinceVersion)},
++ TransferFnVersion{SkNamedTransferFn::kLinear, kDefaultSinceVersion}},
+ {ZCR_COLOR_MANAGER_V1_EOTF_NAMES_SRGB_HDR,
+- TransferFnVersion(
++ TransferFnVersion{
+ SkNamedTransferFnExt::kSRGB,
+- ZCR_COLOR_MANAGER_V1_EOTF_NAMES_SRGB_HDR_SINCE_VERSION)},
++ ZCR_COLOR_MANAGER_V1_EOTF_NAMES_SRGB_HDR_SINCE_VERSION}},
+ {ZCR_COLOR_MANAGER_V1_EOTF_NAMES_PQ,
+- TransferFnVersion(SkNamedTransferFn::kPQ, kDefaultSinceVersion)},
++ TransferFnVersion{SkNamedTransferFn::kPQ, kDefaultSinceVersion}},
+ {ZCR_COLOR_MANAGER_V1_EOTF_NAMES_HLG,
+- TransferFnVersion(SkNamedTransferFn::kHLG,
+- ZCR_COLOR_MANAGER_V1_EOTF_NAMES_HLG_SINCE_VERSION)},
++ TransferFnVersion{SkNamedTransferFn::kHLG,
++ ZCR_COLOR_MANAGER_V1_EOTF_NAMES_HLG_SINCE_VERSION}},
+ {ZCR_COLOR_MANAGER_V1_EOTF_NAMES_EXTENDEDSRGB10,
+- TransferFnVersion(
++ TransferFnVersion{
+ SkNamedTransferFnExt::kSRGBExtended1023Over510,
+- ZCR_COLOR_MANAGER_V1_EOTF_NAMES_EXTENDEDSRGB10_SINCE_VERSION)}});
++ ZCR_COLOR_MANAGER_V1_EOTF_NAMES_EXTENDEDSRGB10_SINCE_VERSION}}});
+
+ // A map from zcr_color_manager_v1 matrix_names enum values to
+ // gfx::ColorSpace::MatrixIDs.
+ constexpr auto kMatrixMap =
+ base::MakeFixedFlatMap<zcr_color_manager_v1_matrix_names, MatrixVersion>(
+ {{ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_RGB,
+- MatrixVersion(gfx::ColorSpace::MatrixID::RGB, kDefaultSinceVersion)},
++ MatrixVersion{gfx::ColorSpace::MatrixID::RGB, kDefaultSinceVersion}},
+ {ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_BT709,
+- MatrixVersion(gfx::ColorSpace::MatrixID::BT709,
+- kDefaultSinceVersion)},
++ MatrixVersion{gfx::ColorSpace::MatrixID::BT709,
++ kDefaultSinceVersion}},
+ {ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_BT470BG,
+- MatrixVersion(
++ MatrixVersion{
+ gfx::ColorSpace::MatrixID::BT470BG,
+- ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_BT470BG_SINCE_VERSION)},
++ ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_BT470BG_SINCE_VERSION}},
+ {ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_BT2020_NCL,
+- MatrixVersion(gfx::ColorSpace::MatrixID::BT2020_NCL,
+- kDefaultSinceVersion)},
++ MatrixVersion{gfx::ColorSpace::MatrixID::BT2020_NCL,
++ kDefaultSinceVersion}},
+ {ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_BT2020_CL,
+- MatrixVersion(gfx::ColorSpace::MatrixID::BT2020_CL,
+- kDefaultSinceVersion)},
++ MatrixVersion{gfx::ColorSpace::MatrixID::BT2020_CL,
++ kDefaultSinceVersion}},
+ {ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_FCC,
+- MatrixVersion(gfx::ColorSpace::MatrixID::FCC, kDefaultSinceVersion)},
++ MatrixVersion{gfx::ColorSpace::MatrixID::FCC, kDefaultSinceVersion}},
+ {ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_YCOCG,
+- MatrixVersion(gfx::ColorSpace::MatrixID::YCOCG,
+- ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_YCOCG_SINCE_VERSION)},
++ MatrixVersion{gfx::ColorSpace::MatrixID::YCOCG,
++ ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_YCOCG_SINCE_VERSION}},
+ {ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_YDZDX,
+- MatrixVersion(gfx::ColorSpace::MatrixID::YDZDX,
+- ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_YDZDX_SINCE_VERSION)},
++ MatrixVersion{gfx::ColorSpace::MatrixID::YDZDX,
++ ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_YDZDX_SINCE_VERSION}},
+ {ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_GBR,
+- MatrixVersion(gfx::ColorSpace::MatrixID::GBR,
+- ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_GBR_SINCE_VERSION)},
++ MatrixVersion{gfx::ColorSpace::MatrixID::GBR,
++ ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_GBR_SINCE_VERSION}},
+ {ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_SMPTE170M,
+- MatrixVersion(gfx::ColorSpace::MatrixID::SMPTE170M,
+- kDefaultSinceVersion)},
++ MatrixVersion{gfx::ColorSpace::MatrixID::SMPTE170M,
++ kDefaultSinceVersion}},
+ {ZCR_COLOR_MANAGER_V1_MATRIX_NAMES_SMPTE240M,
+- MatrixVersion(gfx::ColorSpace::MatrixID::SMPTE240M,
+- kDefaultSinceVersion)}});
++ MatrixVersion{gfx::ColorSpace::MatrixID::SMPTE240M,
++ kDefaultSinceVersion}}});
+
+ // A map from zcr_color_manager_v1 range_names enum values to
+ // gfx::ColorSpace::RangeIDs.
+ constexpr auto kRangeMap =
+ base::MakeFixedFlatMap<zcr_color_manager_v1_range_names, RangeVersion>(
+ {{ZCR_COLOR_MANAGER_V1_RANGE_NAMES_LIMITED,
+- RangeVersion(gfx::ColorSpace::RangeID::LIMITED,
+- kDefaultSinceVersion)},
++ RangeVersion{gfx::ColorSpace::RangeID::LIMITED,
++ kDefaultSinceVersion}},
+ {ZCR_COLOR_MANAGER_V1_RANGE_NAMES_FULL,
+- RangeVersion(gfx::ColorSpace::RangeID::FULL, kDefaultSinceVersion)},
++ RangeVersion{gfx::ColorSpace::RangeID::FULL, kDefaultSinceVersion}},
+ {ZCR_COLOR_MANAGER_V1_RANGE_NAMES_DERIVED,
+- RangeVersion(gfx::ColorSpace::RangeID::DERIVED,
+- kDefaultSinceVersion)}});
++ RangeVersion{gfx::ColorSpace::RangeID::DERIVED,
++ kDefaultSinceVersion}}});
+
+ zcr_color_manager_v1_chromaticity_names ToColorManagerChromaticity(
+ gfx::ColorSpace::PrimaryID primaryID,
+@@ -283,4 +283,4 @@ zcr_color_manager_v1_eotf_names ToColorM
+
+ } // namespace ui::wayland
+
+-#endif // UI_BASE_WAYLAND_COLOR_MANAGER_UTIL_H_
+\ No newline at end of file
++#endif // UI_BASE_WAYLAND_COLOR_MANAGER_UTIL_H_
+Index: chromium-123.0.6312.46/ui/gtk/gtk_ui.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/ui/gtk/gtk_ui.cc
++++ chromium-123.0.6312.46/ui/gtk/gtk_ui.cc
+@@ -1001,11 +1001,11 @@ display::DisplayConfig GtkUi::GetDisplay
+ GdkRectangle geometry;
+ gdk_monitor_get_geometry(monitor, &geometry);
+ int monitor_scale = std::max(1, gdk_monitor_get_scale_factor(monitor));
+- config.display_geometries.emplace_back(
++ config.display_geometries.emplace_back() = {
+ gfx::Rect(monitor_scale * geometry.x, monitor_scale * geometry.y,
+ monitor_scale * geometry.width,
+ monitor_scale * geometry.height),
+- monitor_scale * font_scale);
++ static_cast<float>(monitor_scale * font_scale)};
+ }
+ return config;
+ }
+Index: chromium-123.0.6312.46/components/memory_pressure/unnecessary_discard_monitor.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/components/memory_pressure/unnecessary_discard_monitor.cc
++++ chromium-123.0.6312.46/components/memory_pressure/unnecessary_discard_monitor.cc
+@@ -92,8 +92,8 @@ void UnnecessaryDiscardMonitor::OnDiscar
+ DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
+ if (current_reclaim_event_) {
+ // Cache this kill event along with the time it took place.
+- current_reclaim_event_kills_.emplace_back(memory_freed_kb,
+- discard_complete_time);
++ current_reclaim_event_kills_.emplace_back() = {memory_freed_kb,
++ discard_complete_time};
+ }
+ }
+
+Index: chromium-123.0.6312.46/components/autofill/core/browser/webdata/addresses/address_autofill_table.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/components/autofill/core/browser/webdata/addresses/address_autofill_table.cc
++++ chromium-123.0.6312.46/components/autofill/core/browser/webdata/addresses/address_autofill_table.cc
+@@ -635,10 +635,10 @@ std::unique_ptr<AutofillProfile> Address
+ }
+
+ base::span<const uint8_t> observations_data = s.ColumnBlob(3);
+- field_type_values.emplace_back(
++ field_type_values.emplace_back() = {
+ type, s.ColumnString16(1), s.ColumnInt(2),
+ std::vector<uint8_t>(observations_data.begin(),
+- observations_data.end()));
++ observations_data.end())};
+
+ if (type == ADDRESS_HOME_COUNTRY) {
+ country_code = base::UTF16ToUTF8(s.ColumnString16(1));
+Index: chromium-123.0.6312.46/components/autofill/core/browser/webdata/addresses/contact_info_sync_util.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/components/autofill/core/browser/webdata/addresses/contact_info_sync_util.cc
++++ chromium-123.0.6312.46/components/autofill/core/browser/webdata/addresses/contact_info_sync_util.cc
+@@ -169,9 +169,9 @@ class ContactInfoProfileSetter {
+ CHECK(observations.empty());
+ for (const sync_pb::ContactInfoSpecifics::Observation& proto_observation :
+ metadata.observations()) {
+- observations.emplace_back(proto_observation.type(),
++ observations.emplace_back() = {static_cast<std::underlying_type_t<ProfileTokenQuality::ObservationType>>(proto_observation.type()),
+ ProfileTokenQuality::FormSignatureHash(
+- proto_observation.form_hash()));
++ proto_observation.form_hash())};
+ }
+ }
+ }
+Index: chromium-123.0.6312.46/content/browser/fenced_frame/fenced_frame_config.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/content/browser/fenced_frame/fenced_frame_config.cc
++++ chromium-123.0.6312.46/content/browser/fenced_frame/fenced_frame_config.cc
+@@ -402,7 +402,7 @@ void FencedFrameProperties::UpdateParent
+ feature, allow_list.AllowedOrigins(), allow_list.SelfIfMatches(),
+ allow_list.MatchesAll(), allow_list.MatchesOpaqueSrc());
+ }
+- parent_permissions_info_.emplace(parsed_policies, parent_origin);
++ parent_permissions_info_.emplace() = {parsed_policies, parent_origin};
+ }
+
+ } // namespace content
+Index: chromium-123.0.6312.46/chrome/browser/ui/safety_hub/menu_notification_service.h
+===================================================================
+--- chromium-123.0.6312.46.orig/chrome/browser/ui/safety_hub/menu_notification_service.h
++++ chromium-123.0.6312.46/chrome/browser/ui/safety_hub/menu_notification_service.h
+@@ -24,6 +24,7 @@ struct MenuNotificationEntry {
+ int command = 0;
+ std::u16string label;
+ safety_hub::SafetyHubModuleType module;
++ MenuNotificationEntry(auto c, auto l, auto m) : command(c), label(l), module(m) { }
+ };
+
+ namespace {
+Index: chromium-123.0.6312.46/chrome/browser/ui/views/tabs/tab_style_views.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/chrome/browser/ui/views/tabs/tab_style_views.cc
++++ chromium-123.0.6312.46/chrome/browser/ui/views/tabs/tab_style_views.cc
+@@ -1214,10 +1214,10 @@ SkPath ChromeRefresh2023TabStyleViews::G
+
+ // Radii are clockwise from top left.
+ const SkVector radii[4] = {
+- SkVector(top_content_corner_radius, top_content_corner_radius),
+- SkVector(top_content_corner_radius, top_content_corner_radius),
+- SkVector(bottom_content_corner_radius, bottom_content_corner_radius),
+- SkVector(bottom_content_corner_radius, bottom_content_corner_radius)};
++ SkVector{top_content_corner_radius, top_content_corner_radius},
++ SkVector{top_content_corner_radius, top_content_corner_radius},
++ SkVector{bottom_content_corner_radius, bottom_content_corner_radius},
++ SkVector{bottom_content_corner_radius, bottom_content_corner_radius}};
+ SkRRect rrect;
+ rrect.setRectRadii(SkRect::MakeLTRB(left, top, right, bottom), radii);
+ SkPath path;
+Index: chromium-123.0.6312.46/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc
++++ chromium-123.0.6312.46/chrome/browser/file_system_access/chrome_file_system_access_permission_context.cc
+@@ -386,7 +386,7 @@ bool ShouldBlockAccessToPath(const base:
+ DCHECK(block.path);
+ blocked_path = base::FilePath(block.path);
+ }
+- rules.emplace_back(blocked_path, block.type);
++ rules.emplace_back() = {blocked_path, block.type};
+ }
+
+ base::FilePath nearest_ancestor;
+@@ -1578,11 +1578,11 @@ void ChromeFileSystemAccessPermissionCon
+ // profile's directory, assuming the profile dir is a child of the user data
+ // dir.
+ std::vector<BlockPathRule> extra_rules;
+- extra_rules.emplace_back(profile_->GetPath().DirName(), kBlockAllChildren);
++ extra_rules.emplace_back() = {profile_->GetPath().DirName(), kBlockAllChildren};
+ if (g_browser_process->profile_manager()) {
+- extra_rules.emplace_back(
++ extra_rules.emplace_back() = {
+ g_browser_process->profile_manager()->user_data_dir(),
+- kBlockAllChildren);
++ kBlockAllChildren};
+ }
+
+ base::ThreadPool::PostTaskAndReplyWithResult(
+Index: chromium-123.0.6312.46/chrome/browser/performance_manager/mechanisms/page_discarder.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/chrome/browser/performance_manager/mechanisms/page_discarder.cc
++++ chromium-123.0.6312.46/chrome/browser/performance_manager/mechanisms/page_discarder.cc
+@@ -53,7 +53,7 @@ std::vector<PageDiscarder::DiscardEvent>
+ if (lifecycle_unit->DiscardTab(
+ discard_reason,
+ /*memory_footprint_estimate=*/proxy.second)) {
+- discard_events.emplace_back(base::TimeTicks::Now(), proxy.second);
++ discard_events.emplace_back() = {base::TimeTicks::Now(), proxy.second};
+ }
+ }
+ return discard_events;
+Index: chromium-123.0.6312.46/extensions/browser/service_worker/service_worker_task_queue.h
+===================================================================
+--- chromium-123.0.6312.46.orig/extensions/browser/service_worker/service_worker_task_queue.h
++++ chromium-123.0.6312.46/extensions/browser/service_worker/service_worker_task_queue.h
+@@ -204,6 +204,7 @@ class ServiceWorkerTaskQueue : public Ke
+ raw_ptr<content::BrowserContext> browser_context;
+ base::UnguessableToken token;
+
++ SequencedContextId(auto e, auto b, auto t) : extension_id(e), browser_context(b), token(t) { }
+ bool operator<(const SequencedContextId& rhs) const {
+ return std::tie(extension_id, browser_context, token) <
+ std::tie(rhs.extension_id, rhs.browser_context, rhs.token);
+Index: chromium-123.0.6312.46/chrome/browser/renderer_context_menu/render_view_context_menu.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/chrome/browser/renderer_context_menu/render_view_context_menu.cc
++++ chromium-123.0.6312.46/chrome/browser/renderer_context_menu/render_view_context_menu.cc
+@@ -4043,10 +4043,10 @@
+ autofill::LocalFrameToken frame_token = driver->GetFrameToken();
+ client->GetManager().OpenCompose(
+ *driver,
+- autofill::FormGlobalId(
+- frame_token, autofill::FormRendererId(params_.form_renderer_id)),
+- autofill::FieldGlobalId(
+- frame_token, autofill::FieldRendererId(params_.field_renderer_id)),
++ autofill::FormGlobalId{
++ frame_token, autofill::FormRendererId(params_.form_renderer_id)},
++ autofill::FieldGlobalId{
++ frame_token, autofill::FieldRendererId(params_.field_renderer_id)},
+ compose::ComposeManagerImpl::UiEntryPoint::kContextMenu);
+ GetBrowser()->window()->NotifyPromoFeatureUsed(
+ compose::features::kEnableCompose);
diff --git a/chromium-125-tabstrip-include.patch b/chromium-125-tabstrip-include.patch
new file mode 100644
index 0000000..44c7ea1
--- /dev/null
+++ b/chromium-125-tabstrip-include.patch
@@ -0,0 +1,26 @@
+commit 2958f58a84ebaacce716929f1cc4ba4a8076daee
+Author: Ivan Murashov <ivan.murashov@lge.com>
+Date: Wed May 15 19:30:45 2024 +0000
+
+ IWYU: Add missing include for std::variant usage in tab_strip_model.h
+
+ Bug: 41455655
+ Change-Id: I1b028ee1340f0697f147b5d0bfef3c916e1a5729
+ Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5537958
+ Reviewed-by: Vasilii Sukhanov <vasilii@chromium.org>
+ Reviewed-by: Dana Fried <dfried@chromium.org>
+ Commit-Queue: Ivan Murashov <ivan.murashov@lge.com>
+ Cr-Commit-Position: refs/heads/main@{#1301505}
+
+diff --git a/chrome/browser/ui/tabs/tab_strip_model.h b/chrome/browser/ui/tabs/tab_strip_model.h
+index 735c379a8cd1d..6711d565101ab 100644
+--- a/chrome/browser/ui/tabs/tab_strip_model.h
++++ b/chrome/browser/ui/tabs/tab_strip_model.h
+@@ -12,6 +12,7 @@
+ #include <memory>
+ #include <optional>
+ #include <string>
++#include <variant>
+ #include <vector>
+
+ #include "base/containers/span.h"
diff --git a/chromium-125-vulkan-include.patch b/chromium-125-vulkan-include.patch
new file mode 100644
index 0000000..1ab6e23
--- /dev/null
+++ b/chromium-125-vulkan-include.patch
@@ -0,0 +1,16 @@
+commit bbd4b7752f0a9e5f486fa55c9f2b80071ef99d01
+Author: lauren n. liberda <lauren@selfisekai.rocks>
+Date: Thu Apr 25 04:24:47 2024 +0200
+
+ iwyu: missing #include <memory> for std::unique_ptr
+
+--- a/third_party/vulkan-deps/vulkan-utility-libraries/src/include/vulkan/utility/vk_small_containers.hpp
++++ b/third_party/vulkan-deps/vulkan-utility-libraries/src/include/vulkan/utility/vk_small_containers.hpp
+@@ -9,6 +9,7 @@
+ #pragma once
+
+ #include <cassert>
++#include <memory>
+ #include <unordered_map>
+ #include <unordered_set>
+
diff --git a/chromium-91-java-only-allowed-in-android-builds.patch b/chromium-91-java-only-allowed-in-android-builds.patch
new file mode 100644
index 0000000..58d9369
--- /dev/null
+++ b/chromium-91-java-only-allowed-in-android-builds.patch
@@ -0,0 +1,16 @@
+References: https://bugs.chromium.org/p/chromium/issues/detail?id=1192875
+
+Index: chromium-91.0.4472.57/third_party/closure_compiler/compiler.py
+===================================================================
+--- chromium-91.0.4472.57.orig/third_party/closure_compiler/compiler.py
++++ chromium-91.0.4472.57/third_party/closure_compiler/compiler.py
+@@ -13,8 +13,7 @@ import subprocess
+
+
+ _CURRENT_DIR = os.path.join(os.path.dirname(__file__))
+-_JAVA_PATH = os.path.join(_CURRENT_DIR, "..", "jdk", "current", "bin", "java")
+-assert os.path.isfile(_JAVA_PATH), "java only allowed in android builds"
++_JAVA_PATH = "java"
+
+ class Compiler(object):
+ """Runs the Closure compiler on given source files to typecheck them
diff --git a/chromium-93-ffmpeg-4.4.patch b/chromium-93-ffmpeg-4.4.patch
new file mode 100644
index 0000000..9755ca8
--- /dev/null
+++ b/chromium-93-ffmpeg-4.4.patch
@@ -0,0 +1,67 @@
+From: 52c3e9c0f140a8742034e107fb0f371c0d73bf1d Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Marek=20Beh=C3=BAn?= <kabel@kernel.org>
+Date: Sun, 12 Sep 2021 04:20:11 +0200
+Subject: [PATCH] chromium-93: fix building with system-ffmpeg
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The version of ffmpeg bundled in Chromium changed ABI a little, which
+affected the code in that the type of the last parameter of
+av_packet_get_side_data() is now size_t instead of int.
+
+This causes Chromium to fail to build with system-ffmpeg if the system
+ffmpeg's version does not yet have this ABI change.
+
+Fix the code to be able to compile with older ffmpeg as well.
+
+Signed-off-by: Marek Behún <kabel@kernel.org>
+---
+ media/filters/audio_decoder_unittest.cc | 4 ++++
+ media/filters/ffmpeg_demuxer.cc | 16 ++++++++++++++++
+ 2 files changed, 20 insertions(+)
+
+Index: chromium-119.0.6045.21/media/filters/audio_decoder_unittest.cc
+===================================================================
+--- chromium-119.0.6045.21.orig/media/filters/audio_decoder_unittest.cc
++++ chromium-119.0.6045.21/media/filters/audio_decoder_unittest.cc
+@@ -108,7 +108,11 @@ void SetDiscardPadding(AVPacket* packet,
+ }
+
+ // If the timestamp is positive, try to use FFmpeg's discard data.
++#if LIBAVUTIL_VERSION_MAJOR < 57
++ int skip_samples_size = 0;
++#else
+ size_t skip_samples_size = 0;
++#endif
+ const uint32_t* skip_samples_ptr =
+ reinterpret_cast<const uint32_t*>(av_packet_get_side_data(
+ packet, AV_PKT_DATA_SKIP_SAMPLES, &skip_samples_size));
+Index: chromium-119.0.6045.21/media/filters/ffmpeg_demuxer.cc
+===================================================================
+--- chromium-119.0.6045.21.orig/media/filters/ffmpeg_demuxer.cc
++++ chromium-119.0.6045.21/media/filters/ffmpeg_demuxer.cc
+@@ -390,7 +390,11 @@ void FFmpegDemuxerStream::EnqueuePacket(
+
+ scoped_refptr<DecoderBuffer> buffer;
+
++#if LIBAVUTIL_VERSION_MAJOR < 57
++ int side_data_size = 0;
++#else
+ size_t side_data_size = 0;
++#endif
+ uint8_t* side_data = av_packet_get_side_data(
+ packet.get(), AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL, &side_data_size);
+
+@@ -453,7 +457,11 @@ void FFmpegDemuxerStream::EnqueuePacket(
+ packet->size - data_offset);
+ }
+
++#if LIBAVUTIL_VERSION_MAJOR < 57
++ int skip_samples_size = 0;
++#else
+ size_t skip_samples_size = 0;
++#endif
+ const uint32_t* skip_samples_ptr =
+ reinterpret_cast<const uint32_t*>(av_packet_get_side_data(
+ packet.get(), AV_PKT_DATA_SKIP_SAMPLES, &skip_samples_size));
diff --git a/chromium-disable-GlobalMediaControlsCastStartStop.patch b/chromium-disable-GlobalMediaControlsCastStartStop.patch
new file mode 100644
index 0000000..16c0cec
--- /dev/null
+++ b/chromium-disable-GlobalMediaControlsCastStartStop.patch
@@ -0,0 +1,13 @@
+Index: chromium-123.0.6312.46/chrome/browser/media/router/media_router_feature.cc
+===================================================================
+--- chromium-123.0.6312.46.orig/chrome/browser/media/router/media_router_feature.cc
++++ chromium-123.0.6312.46/chrome/browser/media/router/media_router_feature.cc
+@@ -59,7 +59,7 @@ BASE_FEATURE(kFallbackToAudioTabMirrorin
+ #if BUILDFLAG(IS_CHROMEOS)
+ base::FEATURE_DISABLED_BY_DEFAULT);
+ #else
+- base::FEATURE_ENABLED_BY_DEFAULT);
++ base::FEATURE_DISABLED_BY_DEFAULT);
+ #endif // BUILDFLAG(IS_CHROMEOS)
+
+ BASE_FEATURE(kCastMirroringPlayoutDelay,
diff --git a/chromium-disable-parallel-gold.patch b/chromium-disable-parallel-gold.patch
new file mode 100644
index 0000000..d25912d
--- /dev/null
+++ b/chromium-disable-parallel-gold.patch
@@ -0,0 +1,13 @@
+diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
+index 01d97a360..a9a721403 100644
+--- a/build/config/compiler/BUILD.gn
++++ b/build/config/compiler/BUILD.gn
+@@ -415,8 +415,6 @@ config("compiler") {
+ # https://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/281527606915bb36
+ # Only apply this to the target linker, since the host
+ # linker might not be gold, but isn't used much anyway.
+- "-Wl,--threads",
+- "-Wl,--thread-count=4",
+ ]
+ }
+
diff --git a/chromium-libusb_interrupt_event_handler.patch b/chromium-libusb_interrupt_event_handler.patch
new file mode 100644
index 0000000..0def4a3
--- /dev/null
+++ b/chromium-libusb_interrupt_event_handler.patch
@@ -0,0 +1,15 @@
+diff -up chromium-48.0.2564.116/services/device/usb/usb_context.cc.modern-libusbx chromium-48.0.2564.116/device/usb/usb_context.cc
+--- chromium-48.0.2564.116/services/device/usb/usb_context.cc.modern-libusbx 2016-02-24 10:21:10.534996028 -0500
++++ chromium-48.0.2564.116/services/device/usb/usb_context.cc 2016-02-24 10:22:28.270499864 -0500
+@@ -57,7 +57,11 @@ void UsbContext::UsbEventHandler::Run()
+
+ void UsbContext::UsbEventHandler::Stop() {
+ base::subtle::Release_Store(&running_, 0);
++#ifdef LIBUSB_API_VERSION >= 0x01000105
++ libusb_interrupt_event_handler(context_);
++#else
+ libusb_interrupt_handle_event(context_);
++#endif
+ }
+
+ UsbContext::UsbContext(PlatformUsbContext context) : context_(context) {
diff --git a/chromium-master-prefs-path.patch b/chromium-master-prefs-path.patch
new file mode 100644
index 0000000..f9e6b07
--- /dev/null
+++ b/chromium-master-prefs-path.patch
@@ -0,0 +1,16 @@
+Index: chromium-115.0.5790.32/chrome/browser/first_run/first_run_internal_linux.cc
+===================================================================
+--- chromium-115.0.5790.32.orig/chrome/browser/first_run/first_run_internal_linux.cc
++++ chromium-115.0.5790.32/chrome/browser/first_run/first_run_internal_linux.cc
+@@ -21,10 +21,7 @@ bool IsOrganicFirstRun() {
+ base::FilePath InitialPrefsPath() {
+ // The standard location of the initial prefs is next to the chrome binary.
+ base::FilePath dir_exe;
+- if (!base::PathService::Get(base::DIR_EXE, &dir_exe)) {
+- return base::FilePath();
+- }
+-
++ dir_exe = base::FilePath("/etc/chromium");
+ return installer::InitialPreferences::Path(dir_exe);
+ }
+
diff --git a/chromium-norar.patch b/chromium-norar.patch
new file mode 100644
index 0000000..1b25f5d
--- /dev/null
+++ b/chromium-norar.patch
@@ -0,0 +1,107 @@
+diff -up chromium-122.0.6261.29/chrome/browser/safe_browsing/download_protection/file_analyzer.cc.nounrar chromium-122.0.6261.29/chrome/browser/safe_browsing/download_protection/file_analyzer.cc
+--- chromium-122.0.6261.29/chrome/browser/safe_browsing/download_protection/file_analyzer.cc.nounrar 2024-02-07 19:49:25.000000000 +0100
++++ chromium-122.0.6261.29/chrome/browser/safe_browsing/download_protection/file_analyzer.cc 2024-02-11 18:55:29.964450604 +0100
+@@ -79,8 +79,6 @@ void FileAnalyzer::Start(const base::Fil
+
+ if (inspection_type == DownloadFileType::ZIP) {
+ StartExtractZipFeatures();
+- } else if (inspection_type == DownloadFileType::RAR) {
+- StartExtractRarFeatures();
+ #if BUILDFLAG(IS_MAC)
+ } else if (inspection_type == DownloadFileType::DMG) {
+ StartExtractDmgFeatures();
+diff -up chromium-122.0.6261.29/chrome/common/safe_browsing/BUILD.gn.nounrar chromium-122.0.6261.29/chrome/common/safe_browsing/BUILD.gn
+--- chromium-122.0.6261.29/chrome/common/safe_browsing/BUILD.gn.nounrar 2024-02-07 19:49:27.000000000 +0100
++++ chromium-122.0.6261.29/chrome/common/safe_browsing/BUILD.gn 2024-02-11 18:55:29.965450629 +0100
+@@ -143,7 +143,6 @@ source_set("safe_browsing") {
+ "//components/safe_browsing/content/common:file_type_policies",
+ "//components/safe_browsing/core/common",
+ "//third_party/lzma_sdk/google:seven_zip_reader",
+- "//third_party/unrar:unrar",
+ ]
+
+ public_deps = [
+diff -up chromium-122.0.6261.29/chrome/services/file_util/safe_archive_analyzer.cc.nounrar chromium-122.0.6261.29/chrome/services/file_util/safe_archive_analyzer.cc
+--- chromium-122.0.6261.29/chrome/services/file_util/safe_archive_analyzer.cc.nounrar 2024-02-07 19:49:27.000000000 +0100
++++ chromium-122.0.6261.29/chrome/services/file_util/safe_archive_analyzer.cc 2024-02-11 23:49:25.061324007 +0100
+@@ -74,6 +74,7 @@ void SafeArchiveAnalyzer::AnalyzeRarFile
+ const std::optional<std::string>& password,
+ mojo::PendingRemote<chrome::mojom::TemporaryFileGetter> temp_file_getter,
+ AnalyzeRarFileCallback callback) {
++#if 0
+ DCHECK(rar_file.IsValid());
+ temp_file_getter_.Bind(std::move(temp_file_getter));
+ callback_ = std::move(callback);
+@@ -90,6 +91,9 @@ void SafeArchiveAnalyzer::AnalyzeRarFile
+ /*password=*/password,
+ std::move(analysis_finished_callback),
+ std::move(temp_file_getter_callback), &results_);
++#else
++ NOTREACHED();
++#endif
+ }
+
+ void SafeArchiveAnalyzer::AnalyzeSevenZipFile(
+diff -up chromium-122.0.6261.29/chrome/services/file_util/safe_archive_analyzer.h.nounrar chromium-122.0.6261.29/chrome/services/file_util/safe_archive_analyzer.h
+--- chromium-122.0.6261.29/chrome/services/file_util/safe_archive_analyzer.h.nounrar 2024-02-07 19:49:27.000000000 +0100
++++ chromium-122.0.6261.29/chrome/services/file_util/safe_archive_analyzer.h 2024-02-11 18:55:29.966450653 +0100
+@@ -9,7 +9,6 @@
+
+ #include "chrome/common/safe_browsing/archive_analyzer_results.h"
+ #include "chrome/services/file_util/public/mojom/safe_archive_analyzer.mojom.h"
+-#include "chrome/utility/safe_browsing/rar_analyzer.h"
+ #include "chrome/utility/safe_browsing/seven_zip_analyzer.h"
+ #include "chrome/utility/safe_browsing/zip_analyzer.h"
+ #include "mojo/public/cpp/bindings/remote.h"
+@@ -67,7 +66,6 @@ class SafeArchiveAnalyzer : public chrom
+ void Timeout();
+
+ safe_browsing::ZipAnalyzer zip_analyzer_;
+- safe_browsing::RarAnalyzer rar_analyzer_;
+ safe_browsing::SevenZipAnalyzer seven_zip_analyzer_;
+ #if BUILDFLAG(IS_MAC)
+ safe_browsing::dmg::DMGAnalyzer dmg_analyzer_;
+Index: chromium-118.0.5993.18/chrome/utility/safe_browsing/BUILD.gn
+===================================================================
+--- chromium-118.0.5993.18.orig/chrome/utility/safe_browsing/BUILD.gn
++++ chromium-118.0.5993.18/chrome/utility/safe_browsing/BUILD.gn
+@@ -31,8 +31,6 @@ source_set("safe_browsing") {
+ sources = [
+ "archive_analyzer.cc",
+ "archive_analyzer.h",
+- "rar_analyzer.cc",
+- "rar_analyzer.h",
+ "seven_zip_analyzer.cc",
+ "seven_zip_analyzer.h",
+ "zip_analyzer.cc",
+@@ -55,7 +53,6 @@ source_set("safe_browsing") {
+ "//components/safe_browsing/content/common:file_type_policies",
+ "//components/safe_browsing/core/common",
+ "//third_party/lzma_sdk/google:seven_zip_reader",
+- "//third_party/unrar:unrar",
+ "//third_party/zlib",
+ ]
+
+Index: chromium-118.0.5993.18/chrome/utility/safe_browsing/archive_analyzer.cc
+===================================================================
+--- chromium-118.0.5993.18.orig/chrome/utility/safe_browsing/archive_analyzer.cc
++++ chromium-118.0.5993.18/chrome/utility/safe_browsing/archive_analyzer.cc
+@@ -8,7 +8,6 @@
+ #include "build/build_config.h"
+ #include "build/buildflag.h"
+ #include "chrome/common/safe_browsing/archive_analyzer_results.h"
+-#include "chrome/utility/safe_browsing/rar_analyzer.h"
+ #include "chrome/utility/safe_browsing/seven_zip_analyzer.h"
+ #include "chrome/utility/safe_browsing/zip_analyzer.h"
+ #include "components/safe_browsing/content/common/proto/download_file_types.pb.h"
+@@ -23,9 +22,7 @@ namespace safe_browsing {
+ // static
+ std::unique_ptr<ArchiveAnalyzer> ArchiveAnalyzer::CreateForArchiveType(
+ DownloadFileType_InspectionType file_type) {
+- if (file_type == DownloadFileType::RAR) {
+- return std::make_unique<RarAnalyzer>();
+- } else if (file_type == DownloadFileType::ZIP) {
++ if (file_type == DownloadFileType::ZIP) {
+ return std::make_unique<ZipAnalyzer>();
+ } else if (file_type == DownloadFileType::SEVEN_ZIP) {
+ return std::make_unique<SevenZipAnalyzer>();
diff --git a/chromium-prop-codecs.patch b/chromium-prop-codecs.patch
new file mode 100644
index 0000000..09e2119
--- /dev/null
+++ b/chromium-prop-codecs.patch
@@ -0,0 +1,17 @@
+Index: chromium-106.0.5249.91/media/BUILD.gn
+===================================================================
+--- chromium-106.0.5249.91.orig/media/BUILD.gn
++++ chromium-106.0.5249.91/media/BUILD.gn
+@@ -64,12 +64,6 @@ buildflag_header("media_buildflags") {
+ }
+ }
+
+-if (proprietary_codecs && media_use_ffmpeg) {
+- assert(
+- ffmpeg_branding != "Chromium",
+- "proprietary codecs and ffmpeg_branding set to Chromium are incompatible")
+-}
+-
+ # Common configuration for targets in the media directory; these must not be
+ # exported since things like USE_NEON and USE_CRAS have different meanings
+ # elsewhere in the code base.
diff --git a/chromium-symbolic.svg b/chromium-symbolic.svg
new file mode 100644
index 0000000..1b47e00
--- /dev/null
+++ b/chromium-symbolic.svg
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg version="1.1" id="svg44" width="511.98489" height="511.98489" viewBox="0 0 511.98489 511.98489" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
+ <defs id="defs18">
+ <linearGradient xlink:href="#linearGradient4975" id="linearGradient4633" gradientUnits="userSpaceOnUse" gradientTransform="matrix(231.62575,0,0,231.62472,111.11013,159.99363)" x2="0.5565635" x1="0.46521288" y1="-0.67390651" y2="0.81129867"/>
+ <linearGradient id="linearGradient4975">
+ <stop style="stop-color:#1972e7" offset="0" id="stop4971"/>
+ <stop style="stop-color:#1969d5" offset="1" id="stop4973"/>
+ </linearGradient>
+ <linearGradient xlink:href="#3" id="linearGradient1331" x1="101.74381" y1="33.726189" x2="101.59915" y2="135.466" gradientUnits="userSpaceOnUse" gradientTransform="matrix(3.7794235,0,0,3.7794067,0.00151555,0.00377865)"/>
+ <linearGradient id="3" x2="1" gradientTransform="matrix(61.286,0,0,61.286,29.399,42.333)" gradientUnits="userSpaceOnUse">
+ <stop offset="0" id="stop1397" style="stop-color:#afccfb"/>
+ <stop offset="1" id="stop1399" style="stop-color:#8bb5f8"/>
+ </linearGradient>
+ <linearGradient xlink:href="#1" id="linearGradient2962" gradientUnits="userSpaceOnUse" gradientTransform="matrix(94.931559,164.42687,-164.4276,94.931137,97.555991,173.61083)" x2="1.7695541" x1="0.018202547" y1="-0.51170158" y2="0.4994337"/>
+ <linearGradient id="1" x2="1" gradientTransform="matrix(25.118,43.506,-43.506,25.118,25.812,45.935)" gradientUnits="userSpaceOnUse">
+ <stop offset="0" id="stop3122" style="stop-color:#659cf6"/>
+ <stop offset="1" id="stop3124" style="stop-color:#4285f4"/>
+ </linearGradient>
+ <linearGradient xlink:href="#2" id="linearGradient2688" x1="67.452377" y1="40.320694" x2="67.733002" y2="95.25" gradientUnits="userSpaceOnUse" gradientTransform="matrix(3.7794235,0,0,3.7794067,0.00150043,0.00377865)"/>
+ <linearGradient id="2">
+ <stop style="stop-color:#3680f0" offset="0" id="stop2682"/>
+ <stop style="stop-color:#2678ec" offset="1" id="stop2684"/>
+ </linearGradient>
+ </defs>
+ <path d="m 255.99319,255.99433 110.85049,63.99671 -110.85049,191.99385 c 141.38068,0 255.9917,-114.61051 255.9917,-255.99056 0,-46.64165 -12.53559,-90.3316 -34.33115,-127.99716 h -221.6632 z" id="path34-4" style="fill:url(#linearGradient1331)"/>
+ <path d="M 255.99054,0 C 161.2404,0 78.576848,51.513314 34.31224,128.0274 l 110.82781,191.96363 110.85049,-63.9967 V 127.99717 h 221.6632 C 433.38157,51.501975 350.72936,0 255.99054,0 Z" id="path36-1" style="fill:url(#linearGradient4633)"/>
+ <path d="m 0.00151177,255.99433 c 0,141.38005 114.60723823,255.99056 255.99168823,255.99056 L 366.84368,319.99103 255.9932,255.99433 145.14271,319.99103 34.314897,128.0274 C 12.531434,165.68239 0,209.35646 0,255.99056" id="path38-7" style="fill:url(#linearGradient2962)"/>
+ <path d="m 383.99094,255.99433 c 0,70.69003 -57.30741,127.99717 -127.99775,127.99717 -70.69034,0 -127.99773,-57.30714 -127.99773,-127.99717 0,-70.69002 57.30739,-127.99716 127.99773,-127.99716 70.69034,0 127.99775,57.30714 127.99775,127.99716" fill="#ffffff" id="path40"/>
+ <path d="m 359.99158,255.99433 c 0,57.43565 -46.56249,103.99794 -103.99839,103.99794 -57.4359,0 -103.9984,-46.56229 -103.9984,-103.99794 0,-57.43564 46.5625,-103.99793 103.9984,-103.99793 57.4359,0 103.99839,46.56229 103.99839,103.99793" id="path42-5" style="fill:url(#linearGradient2688)"/>
+</svg>
diff --git a/chromium.spec b/chromium.spec
new file mode 100644
index 0000000..751c2a0
--- /dev/null
+++ b/chromium.spec
@@ -0,0 +1,942 @@
+# No API key!
+%global api_key %nil
+
+%define outputdir out
+%define __provides_exclude ^lib.*\\.so.*$
+
+%bcond_without clang
+%bcond_with lto
+%bcond_with gtk4
+%bcond_without qt
+%ifarch x86_64
+%bcond_without swiftshader
+%endif
+%bcond_with system_harfbuzz
+%bcond_with system_freetype
+%bcond_with arm_bti
+%bcond_with system_icu
+%bcond_without pipewire
+%bcond_without system_ffmpeg
+%bcond_with system_zlib
+%bcond_with system_vpx
+%bcond_with system_avif
+%bcond_with system_re2
+%bcond_with system_webp
+%bcond_with system_zstd
+
+# Enable esbuild
+%global esbuild 1
+# When will gn fix this?
+# https://bugs.chromium.org/p/gn/issues/detail?id=360
+%global bootstrap 0
+
+Name: chromium
+Version: 125.0.6422.141
+Release: 1
+Summary: A WebKit (Blink) powered web browser.
+Url: http://www.chromium.org/Home
+License: BSD-3-Clause AND LGPL-2.1-or-later
+
+# Use chromium-latest.py to generate clean tarball from released build tarballs, found here:
+# https://commondatastorage.googleapis.com/chromium-browser-official/chromium-%%{version}.tar.xz
+Source0: chromium-%{version}.tar.xz
+Source1: master_preferences
+Source2: chrome-wrapper
+Source3: chromium-symbolic.svg
+Source4: INSTALL.sh
+
+# esbuild binary
+%if 0%{?esbuild}
+Source101: esbuild.tar.gz
+%endif
+
+Patch0: chromium-libusb_interrupt_event_handler.patch
+Patch2: chromium-master-prefs-path.patch
+Patch3: fix_building_widevinecdm_with_chromium.patch
+Patch6: gcc-enable-lto.patch
+# Do not use unrar code, it is non-free
+Patch7: chromium-norar.patch
+Patch9: system-libdrm.patch
+Patch10: chromium-disable-parallel-gold.patch
+# other distro patchset
+Patch15: chromium-125-compiler.patch
+Patch40: chromium-91-java-only-allowed-in-android-builds.patch
+Patch62: chromium-93-ffmpeg-4.4.patch
+#Patch68: chromium-94-ffmpeg-roll.patch
+Patch98: chromium-102-regex_pattern-array.patch
+Patch202: chromium-prop-codecs.patch
+Patch203: chromium-106-ffmpeg-duration.patch
+Patch205: chromium-disable-GlobalMediaControlsCastStartStop.patch
+Patch224: chromium-115-compiler-SkColor4f.patch
+Patch240: chromium-117-string-convert.patch
+Patch244: chromium-117-system-zstd.patch
+Patch248: chromium-119-assert.patch
+Patch250: chromium-120-emplace.patch
+Patch254: chromium-125-emplace-struct.patch
+Patch256: chromium-120-make_unique-struct.patch
+Patch258: chromium-121-nullptr_t-without-namespace-std.patch
+Patch261: chromium-121-rust-clang_lib.patch
+Patch311: chromium-125-disable-FFmpegAllowLists.patch
+Patch316: chromium-125-missing-header-files.patch
+Patch317: chromium-125-no_matching_constructor.patch
+Patch322: chromium-125-lp155-typename.patch
+Patch324: chromium-122-workaround_clang_bug-structured_binding.patch
+Patch326: chromium-123-stats-collector.patch
+# error: no matching constructor for initialization of 'XMLDocumentParserScope'
+# Please enable this patch if you build on openEuler version smaller than 24.03
+#Patch336: chromium-124-system-libxml.patch
+Patch337: chromium-123-missing-QtGui.patch
+Patch340: chromium-125-appservice-include.patch
+Patch341: chromium-125-lens-include.patch
+Patch342: chromium-125-mojo-bindings-include.patch
+Patch343: chromium-125-no-vector-consts.patch
+Patch345: chromium-125-vulkan-include.patch
+Patch346: chromium-125-tabstrip-include.patch
+Patch347: chromium-125-ninja.patch
+Patch350: chromium-125-debian-bad-font-gc0000.patch
+Patch351: chromium-125-debian-bad-font-gc000.patch
+Patch352: chromium-125-debian-bad-font-gc00.patch
+Patch353: chromium-125-debian-bad-font-gc0.patch
+Patch354: chromium-125-debian-bad-font-gc11.patch
+Patch355: chromium-125-debian-bad-font-gc1.patch
+Patch356: chromium-125-debian-bad-font-gc2.patch
+Patch357: chromium-125-debian-bad-font-gc3.patch
+
+# error: unknown type name 'size_t'
+Patch358: chromium-124-size_t.patch
+# webui_contents_wrapper.h:189:9: error: static assertion expression is not an integral constant expression
+Patch359: chromium-125-assert.patch
+
+# Disable swiftshader on aarch64
+# ld.lld: error: undefined symbol: llvm::MCSymbolizer::~MCSymbolizer()
+# >>> referenced by AArch64ExternalSymbolizer.cpp
+# >>> obj/third_party/swiftshader/third_party/llvm-16.0/swiftshader_llvm_aarch64/AArch64ExternalSymbolizer.o:(llvm::AArch64ExternalSymbolizer::~AArch64ExternalSymbolizer())
+# >>> referenced by AArch64ExternalSymbolizer.cpp
+# >>> obj/third_party/swiftshader/third_party/llvm-16.0/swiftshader_llvm_aarch64/AArch64ExternalSymbolizer.o:(vtable for llvm::AArch64ExternalSymbolizer)
+#
+# ld.lld: error: undefined symbol: llvm::MCExternalSymbolizer::tryAddingPcLoadReferenceComment(llvm::raw_ostream&, long, unsigned long)
+# >>> referenced by AArch64ExternalSymbolizer.cpp
+# >>> obj/third_party/swiftshader/third_party/llvm-16.0/swiftshader_llvm_aarch64/AArch64ExternalSymbolizer.o:(vtable for llvm::AArch64ExternalSymbolizer)
+%ifarch aarch64
+Patch360: swiftshader.patch
+Patch361: swiftshader-2.patch
+%endif
+
+# RISC-V Support
+Patch1000: riscv-build.patch
+Patch1001: riscv-sandbox.patch
+Patch1002: riscv-dav1d.patch
+Patch1003: riscv-swiftshader.patch
+Patch1005: riscv-cpuinfo.patch
+
+BuildRequires: SDL-devel
+BuildRequires: bison
+BuildRequires: cups-devel
+BuildRequires: desktop-file-utils
+BuildRequires: elfutils
+BuildRequires: flex
+BuildRequires: git
+%if ! %{bootstrap}
+BuildRequires: gn
+%else
+BuildRequires: libstdc++-static
+%endif
+BuildRequires: gperf
+BuildRequires: hicolor-icon-theme
+BuildRequires: golang
+# Java used during build
+BuildRequires: java-17-openjdk-headless
+BuildRequires: libcap-devel
+BuildRequires: libgcrypt-devel
+BuildRequires: gsm-devel
+BuildRequires: libjpeg-turbo-devel
+BuildRequires: libpng-devel
+BuildRequires: nasm
+BuildRequires: ncurses-devel
+BuildRequires: ninja-build >= 1.7.2
+BuildRequires: nodejs >= 8.0
+BuildRequires: pam-devel
+BuildRequires: pkgconfig
+BuildRequires: python3
+BuildRequires: python3-setuptools
+BuildRequires: python3-six
+BuildRequires: snappy-devel
+BuildRequires: util-linux
+BuildRequires: perl(Switch)
+BuildRequires: pkgconfig(alsa)
+BuildRequires: pkgconfig(bzip2)
+BuildRequires: pkgconfig(cairo) >= 1.6
+BuildRequires: pkgconfig(dbus-1)
+BuildRequires: pkgconfig(dri)
+BuildRequires: pkgconfig(expat)
+BuildRequires: pkgconfig(flac++)
+BuildRequires: pkgconfig(gbm)
+BuildRequires: pkgconfig(glib-2.0)
+BuildRequires: pkgconfig(hunspell)
+BuildRequires: pkgconfig(imlib2)
+BuildRequires: pkgconfig(jack)
+BuildRequires: pkgconfig(kadm-client)
+BuildRequires: pkgconfig(kdb)
+BuildRequires: pkgconfig(krb5)
+BuildRequires: pkgconfig(libcrypto)
+BuildRequires: pkgconfig(libcurl)
+BuildRequires: pkgconfig(libdrm)
+BuildRequires: pkgconfig(libelf)
+BuildRequires: pkgconfig(libevdev)
+BuildRequires: pkgconfig(libevent)
+BuildRequires: pkgconfig(libexif)
+BuildRequires: pkgconfig(libffi)
+BuildRequires: pkgconfig(libpci)
+BuildRequires: pkgconfig(libpulse)
+BuildRequires: pkgconfig(libssl)
+BuildRequires: pkgconfig(libudev)
+BuildRequires: pkgconfig(libusb-1.0)
+BuildRequires: pkgconfig(libva)
+%if %{with system_webp}
+BuildRequires: pkgconfig(libwebp) >= 0.4.0
+%endif
+%if %{with system_zstd}
+BuildRequires: pkgconfig(libzstd)
+%endif
+BuildRequires: pkgconfig(libxml-2.0) >= 2.9.5
+BuildRequires: pkgconfig(libxslt)
+BuildRequires: pkgconfig(minizip)
+BuildRequires: pkgconfig(nspr) >= 4.9.5
+BuildRequires: pkgconfig(nss) >= 3.26
+BuildRequires: pkgconfig(ogg)
+BuildRequires: pkgconfig(openssl)
+BuildRequires: pkgconfig(opus) >= 1.3.1
+BuildRequires: pkgconfig(python3)
+BuildRequires: pkgconfig(slang)
+BuildRequires: pkgconfig(sqlite3)
+BuildRequires: pkgconfig(theora) >= 1.1
+BuildRequires: pkgconfig(vdpau)
+BuildRequires: pkgconfig(vorbis)
+BuildRequires: pkgconfig(wayland-client)
+BuildRequires: pkgconfig(wayland-cursor)
+BuildRequires: pkgconfig(wayland-scanner)
+BuildRequires: pkgconfig(wayland-server)
+BuildRequires: pkgconfig(x11)
+BuildRequires: pkgconfig(xcb-dri3)
+BuildRequires: pkgconfig(xcb-proto)
+BuildRequires: pkgconfig(xcomposite)
+BuildRequires: pkgconfig(xcursor)
+BuildRequires: pkgconfig(xdamage)
+BuildRequires: pkgconfig(xext)
+BuildRequires: pkgconfig(xfixes)
+BuildRequires: pkgconfig(xi)
+BuildRequires: pkgconfig(xkbcommon) >= 1.0.0
+BuildRequires: pkgconfig(xrandr)
+BuildRequires: pkgconfig(xrender)
+BuildRequires: pkgconfig(xscrnsaver)
+BuildRequires: pkgconfig(xshmfence)
+BuildRequires: pkgconfig(xt)
+BuildRequires: pkgconfig(xtst)
+BuildRequires: cargo
+BuildRequires: rust
+Requires: xdg-utils
+Recommends: google-noto-emoji-fonts
+
+Conflicts: chromium-browser
+Provides: %{name}-suid-helper = %{version}
+Provides: chromium-browser = %{version}
+Obsoletes: %{name}-suid-helper < %{version}
+Obsoletes: chromium-browser < %{version}
+
+ExclusiveArch: x86_64 aarch64 riscv64
+
+%if %{with pipewire}
+BuildRequires: pkgconfig(libpipewire-0.3)
+BuildRequires: pkgconfig(libspa-0.2)
+%endif
+%if %{with system_harfbuzz}
+BuildRequires: pkgconfig(harfbuzz) > 2.3.0
+%endif
+%if %{with system_icu}
+BuildRequires: pkgconfig(icu-i18n) >= 67.0
+%endif
+%if %{with system_vpx}
+BuildRequires: pkgconfig(vpx)
+%endif
+%if %{with system_freetype}
+BuildRequires: pkgconfig(freetype2)
+%endif
+%if %{with system_zlib}
+BuildRequires: pkgconfig(zlib)
+%endif
+%if %{with gtk4}
+BuildRequires: pkgconfig(atk-bridge-2.0)
+BuildRequires: pkgconfig(gtk4)
+%else
+BuildRequires: pkgconfig(gtk+-3.0)
+%endif
+%if %{with qt}
+BuildRequires: pkgconfig(Qt5Core)
+BuildRequires: pkgconfig(Qt5Widgets)
+%endif
+%if %{with system_ffmpeg}
+BuildRequires: pkgconfig(libavcodec)
+BuildRequires: pkgconfig(libavfilter)
+BuildRequires: pkgconfig(libavformat) >= 58
+BuildRequires: pkgconfig(libavutil)
+%endif
+%if %{with system_avif}
+#BuildRequires: pkgconfig(libavif)
+#BuildRequires: pkgconfig(libyuv)
+%endif
+%if %{with system_re2}
+BuildRequires: pkgconfig(re2) >= 11
+%endif
+%if %{with clang}
+BuildRequires: clang llvm lld
+BuildRequires: libstdc++-devel libstdc++-static
+BuildRequires: compiler-rt
+%endif
+%if %{without clang}
+BuildRequires: gcc
+BuildRequires: gcc-c++
+%endif
+
+%description
+Chromium is an open-source web browser, powered by WebKit (Blink).
+
+%package -n chromedriver
+Summary: WebDriver for Google Chrome/Chromium
+Requires: %{name} = %{version}
+
+%description -n chromedriver
+WebDriver is an open source tool for automated testing of webapps across many
+browsers. It provides capabilities for navigating to web pages, user input,
+JavaScript execution, and more. ChromeDriver is a standalone server which
+implements WebDriver's wire protocol for Chromium. It is being developed by
+members of the Chromium and WebDriver teams.
+
+%prep
+# download source0
+cd %{_sourcedir}
+rm -f %{SOURCE0}
+wget -q https://user-repo.openeuler.openatom.cn/lfs-tar/chromium/chromium-%{version}.tar.xz
+cd -
+
+#%{__cat} %{SOURCE101} %{SOURCE102} %{SOURCE103} %{SOURCE104} %{SOURCE105} > %{SOURCE0}
+
+%setup -q -n chromium-%{version}
+
+%autopatch -p1
+
+# Change shebang in all relevant files in this directory and all subdirectories
+# See `man find` for how the `-exec command {} +` syntax works
+find -type f \( -iname "*.py" \) -exec sed -i '1s=^#! */usr/bin/\(python\|env python\)[23]\?=#!%{__python3}=' {} +
+
+# Hard code extra version
+sed -i 's/getenv("CHROME_VERSION_EXTRA")/"openEuler Project"/' chrome/common/channel_info_posix.cc
+
+%build
+rm third_party/devtools-frontend/src/third_party/esbuild/esbuild
+tar -xf %{SOURCE101}
+pushd esbuild
+gflags="-mod=vendor -gcflags=all='-N -l'"
+GO_FLAGS="${gflags}" make
+cp -a esbuild ../third_party/devtools-frontend/src/third_party/esbuild/esbuild
+popd
+
+#correct path for nodejs binary
+mkdir -p third_party/node/linux/node-linux-x64/bin
+ln -s %{_bindir}/node third_party/node/linux/node-linux-x64/bin/node
+
+# Get rid of the pre-built eu-strip binary, it is x86_64 and of mysterious origin
+rm -rf buildtools/third_party/eu-strip/bin/eu-strip
+# Replace it with a symlink to copy
+ln -s %{_bindir}/eu-strip buildtools/third_party/eu-strip/bin/eu-strip
+
+# need for error: the option `Z` is only accepted on the nightly compiler
+export RUSTC_BOOTSTRAP=1
+
+# set rustc version
+rustc_version="$(rustc --version | cut -d' ' -f2)"
+
+export RUSTFLAGS
+
+# python3
+mkdir -p $HOME/bin
+export PYTHON=python3
+ln -sfn %{_bindir}/$PYTHON $HOME/bin/python
+export PATH="$HOME/bin/:$PATH"
+
+# use alternative wrapper
+rm chrome/installer/linux/common/wrapper
+cp %{SOURCE2} chrome/installer/linux/common/wrapper
+
+# set clang version
+#global clang_maj_ver %%(clang --version | sed -n 's/clang version //p' | cut -d. -f1)
+#if %{?clang_maj_ver} >= 17
+# This is for >= 24.03 LTS, return example: 17
+clang_version="$(clang --version | sed -n 's/clang version //p' | cut -d. -f1)"
+#else
+# This is for < 24.03 LTS, return example: 17.0.6
+#clang_version="$(clang --version | awk '/clang version/{print $3}')"
+#endif
+clang_base_path="$(clang --version | grep InstalledDir | cut -d' ' -f2 | sed 's#/bin##')"
+
+# Remove bundled libs
+keeplibs=(
+ base/third_party/cityhash
+ base/third_party/double_conversion
+ base/third_party/dynamic_annotations
+ base/third_party/icu
+ base/third_party/nspr
+ base/third_party/superfasthash
+ base/third_party/symbolize
+ base/third_party/valgrind
+ base/third_party/xdg_user_dirs
+ buildtools/third_party/eu-strip
+ buildtools/third_party/libc++
+ buildtools/third_party/libc++abi
+ buildtools/third_party/libunwind
+ chrome/third_party/mozilla_security_manager
+ courgette/third_party
+ net/third_party/mozilla_security_manager
+ net/third_party/nss
+ net/third_party/quic
+ net/third_party/uri_template
+ third_party/abseil-cpp
+ third_party/angle
+ third_party/angle/src/common/third_party/xxhash
+ third_party/angle/src/third_party/ceval
+ third_party/angle/src/third_party/libXNVCtrl
+ third_party/angle/src/third_party/volk
+ third_party/anonymous_tokens
+ third_party/apple_apsl
+ third_party/axe-core
+ third_party/bidimapper
+ third_party/blink
+ third_party/boringssl
+ third_party/boringssl/src/third_party/fiat
+ third_party/breakpad
+ third_party/breakpad/breakpad/src/third_party/curl
+ third_party/brotli
+ third_party/catapult
+ third_party/catapult/common/py_vulcanize/third_party/rcssmin
+ third_party/catapult/common/py_vulcanize/third_party/rjsmin
+ third_party/catapult/third_party/beautifulsoup4
+ third_party/catapult/third_party/html5lib-1.1/
+ third_party/catapult/third_party/html5lib-python
+ third_party/catapult/third_party/polymer
+ third_party/catapult/third_party/six
+ third_party/catapult/tracing/third_party/d3
+ third_party/catapult/tracing/third_party/gl-matrix
+ third_party/catapult/tracing/third_party/jpeg-js
+ third_party/catapult/tracing/third_party/jszip
+ third_party/catapult/tracing/third_party/mannwhitneyu
+ third_party/catapult/tracing/third_party/oboe
+ third_party/catapult/tracing/third_party/pako
+ third_party/ced
+ third_party/cld_3
+ third_party/closure_compiler
+ third_party/content_analysis_sdk
+ third_party/cpuinfo
+ third_party/crashpad
+ third_party/crashpad/crashpad/third_party/lss
+ third_party/crashpad/crashpad/third_party/zlib
+ third_party/crc32c
+ third_party/cros_system_api
+ third_party/d3
+ third_party/dav1d
+ third_party/dawn
+ third_party/dawn/third_party
+ third_party/depot_tools
+ third_party/devscripts
+ third_party/devtools-frontend
+ third_party/devtools-frontend/src/front_end/third_party
+ third_party/devtools-frontend/src/front_end/third_party/acorn
+ third_party/devtools-frontend/src/front_end/third_party/axe-core
+ third_party/devtools-frontend/src/front_end/third_party/chromium
+ third_party/devtools-frontend/src/front_end/third_party/codemirror
+ third_party/devtools-frontend/src/front_end/third_party/diff
+ third_party/devtools-frontend/src/front_end/third_party/i18n
+ third_party/devtools-frontend/src/front_end/third_party/intl-messageformat
+ third_party/devtools-frontend/src/front_end/third_party/lighthouse
+ third_party/devtools-frontend/src/front_end/third_party/lodash-isequal
+ third_party/devtools-frontend/src/front_end/third_party/marked
+ third_party/devtools-frontend/src/front_end/third_party/puppeteer
+ third_party/devtools-frontend/src/front_end/third_party/puppeteer/package/lib/esm/third_party/mitt
+ third_party/devtools-frontend/src/front_end/third_party/puppeteer/package/lib/esm/third_party/rxjs
+ third_party/devtools-frontend/src/front_end/third_party/wasmparser
+ third_party/devtools-frontend/src/third_party
+ third_party/distributed_point_functions
+ third_party/dom_distiller_js
+ third_party/eigen3
+ third_party/emoji-segmenter
+ third_party/farmhash
+ third_party/fdlibm
+ third_party/fft2d
+ third_party/flatbuffers
+ third_party/fp16
+ third_party/fusejs/dist
+ third_party/fxdiv
+ third_party/gemmlowp
+ third_party/google_input_tools
+ third_party/google_input_tools/third_party/closure_library
+ third_party/google_input_tools/third_party/closure_library/third_party/closure
+ third_party/googletest
+ third_party/highway
+ third_party/hunspell
+ third_party/iccjpeg
+ third_party/inspector_protocol
+ third_party/ipcz
+ third_party/jinja2
+ third_party/jsoncpp
+ third_party/jstemplate
+ third_party/khronos
+ third_party/lens_server_proto
+ third_party/leveldatabase
+ third_party/libaddressinput
+ third_party/libaom
+ third_party/libaom/source/libaom/third_party/fastfeat
+ third_party/libaom/source/libaom/third_party/SVT-AV1
+ third_party/libaom/source/libaom/third_party/vector
+ third_party/libaom/source/libaom/third_party/x86inc
+ third_party/libgav1
+ third_party/libjingle
+ third_party/libphonenumber
+ third_party/libsecret
+ third_party/libsrtp
+ third_party/libsync
+ third_party/libudev
+ third_party/liburlpattern
+ third_party/libva_protected_content
+ third_party/libwebm
+ third_party/libx11/src
+ third_party/libxcb-keysyms/keysyms
+ third_party/libxml/chromium
+ third_party/libzip
+ third_party/lit
+ third_party/lottie
+ third_party/lss
+ third_party/lzma_sdk
+ third_party/mako
+ third_party/maldoca
+ third_party/maldoca/src/third_party
+ third_party/markupsafe
+ third_party/material_color_utilities
+ third_party/mesa
+ third_party/metrics_proto
+ third_party/minigbm
+ third_party/modp_b64
+ third_party/nasm
+ third_party/nearby
+ third_party/node
+ third_party/omnibox_proto
+ third_party/one_euro_filter
+ third_party/openscreen
+ third_party/openscreen/src/third_party/tinycbor/src/src
+ third_party/ots
+ third_party/pdfium
+ third_party/pdfium/third_party/agg23
+ third_party/pdfium/third_party/bigint
+ third_party/pdfium/third_party/freetype
+ third_party/pdfium/third_party/lcms
+ third_party/pdfium/third_party/libopenjpeg
+ third_party/pdfium/third_party/libtiff
+ third_party/perfetto
+ third_party/perfetto/protos/third_party/chromium
+ third_party/pffft
+ third_party/ply
+ third_party/polymer
+ third_party/private-join-and-compute
+ third_party/private_membership
+ third_party/protobuf
+ third_party/pthreadpool
+ third_party/puffin
+ third_party/pyjson5
+ third_party/pyyaml
+ third_party/qcms
+ third_party/rnnoise
+ third_party/rust
+ third_party/ruy
+ third_party/s2cellid
+ third_party/securemessage
+ third_party/selenium-atoms
+ third_party/shell-encryption
+ third_party/simplejson
+ third_party/skia
+ third_party/skia/include/third_party/vulkan/
+ third_party/skia/third_party/vulkan
+ third_party/smhasher
+ third_party/sqlite
+ third_party/swiftshader
+ third_party/swiftshader/third_party/astc-encoder
+ third_party/swiftshader/third_party/llvm-10.0
+ third_party/swiftshader/third_party/llvm-16.0
+ third_party/swiftshader/third_party/llvm-subzero
+ third_party/swiftshader/third_party/marl
+ third_party/swiftshader/third_party/SPIRV-Headers
+ third_party/swiftshader/third_party/SPIRV-Tools
+ third_party/swiftshader/third_party/subzero
+ third_party/tensorflow_models
+ third_party/tensorflow-text
+ third_party/tflite
+ third_party/tflite/src/third_party/eigen3
+ third_party/tflite/src/third_party/fft2d
+ third_party/tflite/src/third_party/xla/third_party/tsl
+ third_party/tflite/src/third_party/xla/xla/tsl/util
+ third_party/ukey2
+ third_party/utf
+ third_party/vulkan
+ third_party/wayland
+ third_party/webdriver
+ third_party/webgpu-cts
+ third_party/webrtc
+ third_party/webrtc/common_audio/third_party/ooura
+ third_party/webrtc/common_audio/third_party/spl_sqrt_floor
+ third_party/webrtc/modules/third_party/fft
+ third_party/webrtc/modules/third_party/g711
+ third_party/webrtc/modules/third_party/g722
+ third_party/webrtc/rtc_base/third_party/base64
+ third_party/webrtc/rtc_base/third_party/sigslot
+ third_party/widevine
+ third_party/woff2
+ third_party/wuffs
+ third_party/x11proto
+ third_party/xcbproto
+ third_party/xnnpack
+ third_party/zlib/google
+ third_party/zxcvbn-cpp
+ url/third_party/mozilla
+ v8/src/third_party/siphash
+ v8/src/third_party/utf8-decoder
+ v8/src/third_party/valgrind
+ v8/third_party/glibc
+ v8/third_party/inspector_protocol
+ v8/third_party/v8/builtins
+ v8/third_party/v8/codegen
+)
+
+%if ! %{with system_harfbuzz}
+keeplibs+=( third_party/harfbuzz-ng )
+%endif
+%if ! %{with system_freetype}
+keeplibs+=( third_party/freetype )
+%endif
+%if ! %{with system_icu}
+keeplibs+=( third_party/icu )
+%endif
+%if ! %{with system_ffmpeg}
+keeplibs+=( third_party/ffmpeg )
+%endif
+%if ! %{with system_zlib}
+keeplibs+=( third_party/zlib )
+%endif
+%if ! %{with system_vpx}
+keeplibs+=(
+ third_party/libvpx
+ third_party/libvpx/source/libvpx/third_party/x86inc
+)
+%endif
+%if !%{with system_avif}
+keeplibs+=( third_party/libyuv )
+keeplibs+=( third_party/libavif )
+%endif
+%if !%{with system_webp} || !%{with system_avif}
+keeplibs+=( third_party/libwebp )
+%endif
+keeplibs+=(
+ third_party/speech-dispatcher
+ third_party/usb_ids
+ third_party/xdg-utils
+)
+%if ! %{with system_re2}
+keeplibs+=( third_party/re2 )
+%endif
+%if ! %{with system_zlib}
+keeplibs+=( third_party/zlib )
+%endif
+keeplibs+=( third_party/lit )
+keeplibs+=( third_party/rust/chromium_crates_io )
+keeplibs+=( third_party/rust/cxx )
+%if ! %{with system_zstd}
+keeplibs+=( third_party/zstd )
+%endif
+build/linux/unbundle/remove_bundled_libraries.py "${keeplibs[@]}" --do-remove
+
+# GN sets lto on its own and we need just ldflag options, not cflags
+%define _lto_cflags %{nil}
+%undefine _debugsource_packages
+%if %{with clang}
+export CC=clang
+export CXX=clang++
+export AR=llvm-ar
+export NM=llvm-nm
+export RANLIB=llvm-ranlib
+%else
+export CC=gcc
+export CXX=g++
+export AR=ar
+export NM=nm
+export RANLIB=ranlib
+%endif
+
+# REDUCE DEBUG as it gets TOO large
+ARCH_FLAGS="`echo %{optflags} | sed -e 's/^-g / /g' -e 's/ -g / /g' -e 's/ -g$//g'`"
+export CXXFLAGS="${ARCH_FLAGS} -Wno-return-type"
+# extra flags to reduce warnings that aren't very useful
+export CXXFLAGS="${CXXFLAGS} -Wno-pedantic -Wno-unused-result -Wno-unused-function -Wno-unused-variable -Wno-deprecated-declarations"
+# ignore warnings for minor mistakes that are too common
+export CXXFLAGS="${CXXFLAGS} -Wno-return-type -Wno-parentheses -Wno-misleading-indentation"
+# ignore warnings that are not supported well until gcc 8
+# ignore warnings due to gcc bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84055)
+export CXXFLAGS="${CXXFLAGS} -Wno-attributes -Wno-ignored-attributes"
+# ingore new gcc 8 warnings that aren't yet handled upstream
+export CXXFLAGS="${CXXFLAGS} -Wno-address -Wno-dangling-else -D_GNU_SOURCE"
+export CXXFLAGS=${CXXFLAGS/-Wp,-D_GLIBCXX_ASSERTIONS}
+# for wayland
+export CXXFLAGS="${CXXFLAGS} -I/usr/include/wayland -I/usr/include/libxkbcommon -I/usr/include/opus"
+%if %{with clang}
+export LDFLAGS="${LDFLAGS} -Wl,--build-id=sha1"
+export CXXFLAGS="${CXXFLAGS} -Wno-unused-command-line-argument -Wno-unknown-warning-option"
+%endif
+%ifarch aarch64
+%if %{without clang}
+export CXXFLAGS="${CXXFLAGS} -flax-vector-conversions -fno-omit-frame-pointer"
+%else
+export CXXFLAGS="${CXXFLAGS} -flax-vector-conversions=all"
+%endif
+%endif
+%if %{without clang}
+export CXXFLAGS="${CXXFLAGS} -Wno-unused-but-set-variable -Wno-packed-not-aligned"
+%endif
+export CFLAGS="${CXXFLAGS}"
+%if %{without clang}
+export CXXFLAGS="${CXXFLAGS} -Wno-subobject-linkage -Wno-class-memaccess"
+%endif
+export CXXFLAGS="${CXXFLAGS} -Wno-invalid-offsetof -fpermissive"
+%if %{with lto} && %{without clang}
+# reduce the threads for linking even more due to LTO eating ton of memory
+_link_threads=$(((%{jobs} - 2)))
+test "$_link_threads" -le 0 && _link_threads=1
+export LDFLAGS="-flto=$_link_threads --param lto-max-streaming-parallelism=1"
+%endif
+
+# Set system libraries to be used
+gn_system_libraries=(
+ flac
+ fontconfig
+ libdrm
+ libevent
+ libjpeg
+ libpng
+ libxslt
+ libusb
+ libxml
+ opus
+ snappy
+)
+%if %{with system_harfbuzz}
+gn_system_libraries+=( harfbuzz-ng )
+%endif
+%if %{with system_freetype}
+gn_system_libraries+=( freetype )
+%endif
+%if %{with system_icu}
+gn_system_libraries+=( icu )
+%endif
+%if %{with system_vpx}
+gn_system_libraries+=( libvpx )
+%endif
+%if %{with system_ffmpeg}
+gn_system_libraries+=( ffmpeg )
+%endif
+%if %{with system_re2}
+gn_system_libraries+=( re2 )
+%endif
+%if %{with system_webp}
+gn_system_libraries+=( libwebp )
+%endif
+%if %{with system_zlib}
+gn_system_libraries+=( zlib )
+%endif
+%if %{with system_zstd}
+gn_system_libraries+=( zstd )
+%endif
+build/linux/unbundle/replace_gn_files.py --system-libraries ${gn_system_libraries[@]}
+
+# Configuration for GN
+# Available options: out/Release/gn args --list out/Release/
+gn_conf=""
+gn_conf+=" custom_toolchain=\"//build/toolchain/linux/unbundle:default\""
+gn_conf+=" host_toolchain=\"//build/toolchain/linux/unbundle:default\""
+gn_conf+=" use_custom_libcxx=false"
+%ifarch x86_64
+gn_conf+=" host_cpu=\"x64\""
+%endif
+%ifarch riscv64
+gn_conf+=" host_cpu=\"riscv64\""
+%endif
+gn_conf+=" is_debug=false"
+gn_conf+=" dcheck_always_on=false"
+gn_conf+=" enable_nacl=false"
+%if %{with swiftshader}
+gn_conf+=" use_swiftshader_with_subzero=true"
+%endif
+%ifarch aarch64
+gn_conf+=" enable_swiftshader=false"
+gn_conf+=" dawn_use_swiftshader=false"
+%endif
+gn_conf+=" is_component_ffmpeg=true"
+gn_conf+=" use_cups=true"
+gn_conf+=" use_aura=true"
+gn_conf+=" symbol_level=1"
+gn_conf+=" blink_symbol_level=0"
+gn_conf+=" use_kerberos=true"
+gn_conf+=" enable_vr=false"
+gn_conf+=" optimize_webui=false"
+gn_conf+=" enable_reading_list=false"
+gn_conf+=" use_pulseaudio=true link_pulseaudio=true"
+gn_conf+=" is_component_build=false"
+gn_conf+=" use_sysroot=false"
+gn_conf+=" fatal_linker_warnings=false"
+gn_conf+=" use_allocator_shim=true"
+gn_conf+=" use_partition_alloc=true"
+gn_conf+=" disable_fieldtrial_testing_config=true"
+gn_conf+=" use_gnome_keyring=false"
+gn_conf+=" use_unofficial_version_number=false"
+%ifnarch riscv64
+gn_conf+=" use_vaapi=true"
+%endif
+gn_conf+=" use_sysroot=false"
+gn_conf+=" treat_warnings_as_errors=false"
+gn_conf+=" enable_widevine=false"
+gn_conf+=" use_dbus=true"
+gn_conf+=" media_use_openh264=false"
+gn_conf+=" rtc_use_h264=false"
+gn_conf+=" use_v8_context_snapshot=true"
+gn_conf+=" v8_use_external_startup_data=true"
+%if %{with gtk4}
+gn_conf+=" gtk_version=4"
+%endif
+%if %{without qt}
+gn_conf+=" use_qt=false"
+%else
+gn_conf+=" moc_qt5_path=\"%{_libdir}/qt5/bin\""
+%endif
+# See dependency logic in third_party/BUILD.gn
+%if %{with system_harfbuzz}
+gn_conf+=" use_system_harfbuzz=true"
+%endif
+%if %{with system_freetype}
+gn_conf+=" use_system_freetype=true"
+%endif
+gn_conf+=" enable_hangout_services_extension=true"
+gn_conf+=" enable_vulkan=true"
+%if %{with pipewire}
+gn_conf+=" rtc_use_pipewire=true rtc_link_pipewire=true"
+%endif
+%if %{with clang}
+gn_conf+=" is_clang=true clang_version=\"$clang_version\" clang_base_path=\"$clang_base_path\" clang_use_chrome_plugins=false"
+%if %{with lto} && %{with clang}
+gn_conf+=" use_thin_lto=true"
+%endif
+gn_conf+=" use_lld=true"
+%else
+gn_conf+=" is_clang=false"
+%ifnarch riscv64 aarch64
+gn_conf+=" use_gold=true"
+%endif
+%endif
+%if %{with lto} && %{without clang}
+gn_conf+=" gcc_lto=true"
+%endif
+%if %{with system_icu}
+gn_conf+=" icu_use_data_file=false"
+%endif
+gn_conf+=" rust_sysroot_absolute=\"%{_prefix}\""
+gn_conf+=" rustc_version=\"$rustc_version\""
+
+# The proprietary codecs just force the chromium to say they can use it and
+# offload the actual computation to the ffmpeg, otherwise the chromium
+# won't be able to load the codec even if the library can handle it
+gn_conf+=" proprietary_codecs=true"
+gn_conf+=" ffmpeg_branding=\"Chrome\""
+
+%ifarch aarch64
+gn_conf+=" host_cpu=\"arm64\""
+%if %{with arm_bti}
+gn_conf+=" arm_control_flow_integrity=\"standard\""
+%else
+gn_conf+=" arm_control_flow_integrity=\"none\""
+%endif
+%endif
+
+gn_conf+=" google_api_key=\"%{api_key}\""
+
+gn_conf+=" use_system_libffi=true"
+
+
+%if %{bootstrap}
+tools/gn/bootstrap/bootstrap.py --gn-gen-args="${gn_conf}"
+%else
+mkdir -p %{outputdir} && cp -a %{_bindir}/gn %{outputdir}/
+%endif
+
+# GN does not support passing cflags:
+# https://bugs.chromium.org/p/chromium/issues/detail?id=642016
+%{outputdir}/gn gen --args="${gn_conf}" %{outputdir}
+
+%{!?njobs:%global njobs %{_smp_build_ncpus}}
+ninja -v -j%njobs -C %{outputdir} chrome chromedriver
+
+%install
+bash %{SOURCE4} -s %{buildroot} -l %{_libdir} %{!?with_system_icu:-i true} -o %{outputdir}
+# chromedriver
+cp -a %{outputdir}/chromedriver.unstripped %{buildroot}%{_libdir}/chromium/chromedriver
+ln -s %{_libdir}/chromium/chromedriver %{buildroot}%{_bindir}/chromedriver
+# link to browser plugin path.
+mkdir -p %{buildroot}%{_libdir}/browser-plugins
+ln -s %{_libdir}/browser-plugins %{buildroot}%{_libdir}/chromium/plugins
+# Install the master_preferences file
+mkdir -p %{buildroot}%{_sysconfdir}/chromium
+install -m 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/chromium
+# Compat link
+ln -s %{_bindir}/chromium-browser %{buildroot}%{_bindir}/chromium
+# Policy dirs
+mkdir -p %{buildroot}%{_sysconfdir}/chromium/policies
+mkdir %{buildroot}%{_sysconfdir}/chromium/policies/managed
+mkdir %{buildroot}%{_sysconfdir}/chromium/policies/recommended
+chmod -w %{buildroot}%{_sysconfdir}/chromium/policies/managed
+mkdir -p %{buildroot}%{_datadir}/chromium/extensions
+mkdir -p %{buildroot}%{_sysconfdir}/chromium/native-messaging-hosts
+# SVG
+install -Dm 0644 %{SOURCE3} %{buildroot}%{_datadir}/icons/hicolor/symbolic/apps/chromium-browser.svg
+
+%files
+%license LICENSE
+%doc AUTHORS
+%{_datadir}/chromium
+%dir %{_sysconfdir}/chromium
+%dir %{_sysconfdir}/chromium/policies
+%dir %{_sysconfdir}/chromium/policies/managed
+%dir %{_sysconfdir}/chromium/policies/recommended
+%dir %{_sysconfdir}/chromium/native-messaging-hosts
+%config %{_sysconfdir}/chromium/master_preferences
+%{_libdir}/chromium
+%{_datadir}/applications/*.desktop
+%{_datadir}/metainfo/chromium-browser.appdata.xml
+%{_datadir}/icons/hicolor
+%exclude %{_libdir}/chromium/chromedriver
+%{_bindir}/chromium-browser
+%{_bindir}/chromium
+%{_mandir}/man1/chromium-browser.1*
+
+%files -n chromedriver
+%{_libdir}/chromium/chromedriver
+%{_bindir}/chromedriver
+
+%changelog
+* Tue Jul 02 2024 misaka0251 <liuxin@iscas.ac.cn> - 125.0.6422.141-1
+- Upgrade to version 125
+
+* Wed Mar 06 2024 misaka00251 <liuxin@iscas.ac.cn> - 119.0.6045.159-1
+- Upgrade to version 119
+
+* Wed Dec 30 2020 Jeffery.Gao <gaojianxing@huawei.com> - 87.0.4280.88-1
+- Package init
diff --git a/fix_building_widevinecdm_with_chromium.patch b/fix_building_widevinecdm_with_chromium.patch
new file mode 100644
index 0000000..24f3d5e
--- /dev/null
+++ b/fix_building_widevinecdm_with_chromium.patch
@@ -0,0 +1,11 @@
+Index: chromium-79.0.3941.4/third_party/widevine/cdm/widevine_cdm_version.h
+===================================================================
+--- chromium-79.0.3941.4.orig/third_party/widevine/cdm/widevine_cdm_version.h
++++ chromium-79.0.3941.4/third_party/widevine/cdm/widevine_cdm_version.h
+@@ -11,5 +11,6 @@
+ // If the Widevine CDM is available define the following:
+ // - WIDEVINE_CDM_VERSION_STRING (with the version of the CDM that's available
+ // as a string, e.g., "1.0.123.456").
++#define WIDEVINE_CDM_VERSION_STRING "unknown"
+
+ #endif // WIDEVINE_CDM_VERSION_H_
diff --git a/gcc-enable-lto.patch b/gcc-enable-lto.patch
new file mode 100644
index 0000000..cdfdf45
--- /dev/null
+++ b/gcc-enable-lto.patch
@@ -0,0 +1,70 @@
+Index: chromium-120.0.6099.18/build/config/BUILDCONFIG.gn
+===================================================================
+--- chromium-120.0.6099.18.orig/build/config/BUILDCONFIG.gn
++++ chromium-120.0.6099.18/build/config/BUILDCONFIG.gn
+@@ -135,6 +135,8 @@ declare_args() {
+ # set "is_official_build" to true for any build intended to ship to end-users.
+ is_official_build = false
+
++ gcc_lto = false
++
+ # Set to true when compiling with the Clang compiler.
+ is_clang = current_os != "linux" ||
+ (current_cpu != "s390x" && current_cpu != "s390" &&
+@@ -354,6 +356,12 @@ default_compiler_configs = [
+ "//build/config/sanitizers:default_sanitizer_flags",
+ ]
+
++if (gcc_lto) {
++ default_compiler_configs += [
++ "//build/config/compiler:gcc_lto",
++ ]
++}
++
+ if (is_win) {
+ default_compiler_configs += [
+ "//build/config/win:default_cfg_compiler",
+Index: chromium-120.0.6099.18/build/config/compiler/BUILD.gn
+===================================================================
+--- chromium-120.0.6099.18.orig/build/config/compiler/BUILD.gn
++++ chromium-120.0.6099.18/build/config/compiler/BUILD.gn
+@@ -2342,6 +2342,10 @@ if (is_win) {
+ common_optimize_on_cflags += [ "-fno-math-errno" ]
+ }
+
++config("gcc_lto") {
++ cflags = [ "-flto" ]
++}
++
+ config("default_stack_frames") {
+ if (!is_win) {
+ if (enable_frame_pointers) {
+Index: chromium-120.0.6099.18/sandbox/linux/BUILD.gn
+===================================================================
+--- chromium-120.0.6099.18.orig/sandbox/linux/BUILD.gn
++++ chromium-120.0.6099.18/sandbox/linux/BUILD.gn
+@@ -253,6 +253,9 @@ component("seccomp_bpf") {
+ "//build:chromeos_buildflags",
+ "//sandbox:sandbox_buildflags",
+ ]
++ if (gcc_lto) {
++ configs -= [ "//build/config/compiler:gcc_lto" ]
++ }
+
+ if (is_android) {
+ sources += [
+Index: chromium-120.0.6099.18/base/BUILD.gn
+===================================================================
+--- chromium-120.0.6099.18.orig/base/BUILD.gn
++++ chromium-120.0.6099.18/base/BUILD.gn
+@@ -3830,6 +3830,10 @@ test("base_unittests") {
+ }
+ }
+
++ if (gcc_lto) {
++ configs -= [ "//build/config/compiler:gcc_lto" ]
++ }
++
+ if (use_partition_alloc) {
+ sources += [
+ "allocator/partition_allocator/src/partition_alloc/address_pool_manager_unittest.cc",
diff --git a/master_preferences b/master_preferences
new file mode 100644
index 0000000..fb74807
--- /dev/null
+++ b/master_preferences
@@ -0,0 +1,30 @@
+{
+ "homepage": "https://www.openeuler.org/",
+ "homepage_is_newtabpage": false,
+ "distribution": {
+ "skip_first_run_ui": true,
+ "alternate_shortcut_text": false,
+ "oem_bubble": true,
+ "chrome_shortcut_icon_index": 0,
+ "create_all_shortcuts": true,
+ "show_welcome_page": true,
+ "system_level": false,
+ "verbose_logging": false,
+ "make_chrome_default": false,
+ "make_chrome_default_for_user": false
+ },
+ "download": {
+ "extensions_to_open": "ymp"
+ },
+ "browser": {
+ "show_home_button": true,
+ "check_default_browser": false,
+ "custom_chrome_frame": true
+ },
+ "bookmark_bar": {
+ "show_on_all_tabs": true
+ },
+ "first_run_tabs": [
+ "https://www.openeuler.org/"
+ ]
+ }
diff --git a/riscv-build.patch b/riscv-build.patch
new file mode 100644
index 0000000..2139861
--- /dev/null
+++ b/riscv-build.patch
@@ -0,0 +1,13 @@
+Index: chromium-122.0.6261.111/build/config/rust.gni
+===================================================================
+--- chromium-122.0.6261.111.orig/build/config/rust.gni
++++ chromium-122.0.6261.111/build/config/rust.gni
+@@ -214,6 +214,8 @@ if (is_linux || is_chromeos) {
+ } else {
+ rust_abi_target = "arm-unknown-linux-gnueabi" + float_suffix
+ }
++ } else if (current_cpu == "riscv64") {
++ rust_abi_target = "riscv64gc-unknown-linux-gnu"
+ } else {
+ # Best guess for other future platforms.
+ rust_abi_target = current_cpu + "-unknown-linux-gnu"
diff --git a/riscv-cpuinfo.patch b/riscv-cpuinfo.patch
new file mode 100644
index 0000000..0509ae2
--- /dev/null
+++ b/riscv-cpuinfo.patch
@@ -0,0 +1,32 @@
+Index: chromium-124.0.6367.201/third_party/cpuinfo/BUILD.gn
+===================================================================
+--- chromium-124.0.6367.201.orig/third_party/cpuinfo/BUILD.gn
++++ chromium-124.0.6367.201/third_party/cpuinfo/BUILD.gn
+@@ -123,6 +123,12 @@ source_set("cpu_specific") {
+ ]
+ }
+
++ if (current_cpu == "riscv64") {
++ sources = [
++ "src/src/riscv/uarch.c",
++ ]
++ }
++
+ # Because "init.c" is reused again, but only has sources in the corresponding
+ # build config.
+ deps = [ ":x86_cache" ]
+@@ -209,6 +215,14 @@ source_set("cpu_and_os_specific") {
+ }
+ }
+
++ if (is_linux && current_cpu == "riscv64") {
++ sources = [
++ "src/src/riscv/linux/init.c",
++ "src/src/riscv/linux/riscv-hw.c",
++ "src/src/riscv/linux/riscv-isa.c",
++ ]
++ }
++
+ if (is_android && (current_cpu == "x86" || current_cpu == "x64")) {
+ sources = [
+ "src/src/x86/linux/cpuinfo.c",
diff --git a/riscv-dav1d.patch b/riscv-dav1d.patch
new file mode 100644
index 0000000..e20413d
--- /dev/null
+++ b/riscv-dav1d.patch
@@ -0,0 +1,53 @@
+Index: chromium-113.0.5672.92/third_party/dav1d/config/linux/riscv64/config.h
+===================================================================
+--- /dev/null
++++ chromium-113.0.5672.92/third_party/dav1d/config/linux/riscv64/config.h
+@@ -0,0 +1,48 @@
++/*
++ * Autogenerated by the Meson build system.
++ * Do not edit, your changes will be lost.
++ */
++
++#pragma once
++
++#define ARCH_AARCH64 0
++
++#define ARCH_ARM 0
++
++#define ARCH_PPC64LE 0
++
++#define ARCH_X86 0
++
++#define ARCH_X86_32 0
++
++#define ARCH_X86_64 0
++
++#define CONFIG_16BPC 1
++
++#define CONFIG_8BPC 1
++
++// #define CONFIG_LOG 1 -- Logging is controlled by Chromium
++
++#define ENDIANNESS_BIG 0
++
++#define HAVE_ASM 0
++
++#define HAVE_AS_FUNC 0
++
++#define HAVE_C11_GENERIC 1
++
++#define HAVE_CLOCK_GETTIME 1
++
++#define HAVE_DLSYM 1
++
++#define HAVE_GETAUXVAL 1
++
++#define HAVE_POSIX_MEMALIGN 1
++
++// #define HAVE_PTHREAD_GETAFFINITY_NP 1 -- Controlled by Chomium
++
++// #define HAVE_PTHREAD_SETAFFINITY_NP 1 -- Controlled by Chomium
++
++#define HAVE_UNISTD_H 1
++
++#define TRIM_DSP_FUNCTIONS 1
diff --git a/riscv-sandbox.patch b/riscv-sandbox.patch
new file mode 100644
index 0000000..a73aa9d
--- /dev/null
+++ b/riscv-sandbox.patch
@@ -0,0 +1,2043 @@
+Index: chromium-122.0.6261.128/sandbox/features.gni
+===================================================================
+--- chromium-122.0.6261.128.orig/sandbox/features.gni
++++ chromium-122.0.6261.128/sandbox/features.gni
+@@ -9,7 +9,8 @@
+ use_seccomp_bpf = (is_linux || is_chromeos || is_android) &&
+ (current_cpu == "x86" || current_cpu == "x64" ||
+ current_cpu == "arm" || current_cpu == "arm64" ||
+- current_cpu == "mipsel" || current_cpu == "mips64el")
++ current_cpu == "mipsel" || current_cpu == "mips64el" ||
++ current_cpu == "riscv64")
+
+ # SSBD (Speculative Store Bypass Disable) is a mitigation of Spectre Variant 4.
+ # As Spectre Variant 4 can be mitigated by site isolation, opt-out SSBD on site
+Index: chromium-122.0.6261.128/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
+===================================================================
+--- chromium-122.0.6261.128.orig/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
++++ chromium-122.0.6261.128/sandbox/linux/bpf_dsl/linux_syscall_ranges.h
+@@ -56,6 +56,13 @@
+ #define MAX_PUBLIC_SYSCALL __NR_syscalls
+ #define MAX_SYSCALL MAX_PUBLIC_SYSCALL
+
++#elif defined(__riscv)
++
++#include <asm/unistd.h>
++#define MIN_SYSCALL 0u
++#define MAX_PUBLIC_SYSCALL __NR_syscalls
++#define MAX_SYSCALL MAX_PUBLIC_SYSCALL
++
+ #else
+ #error "Unsupported architecture"
+ #endif
+Index: chromium-122.0.6261.128/sandbox/linux/bpf_dsl/seccomp_macros.h
+===================================================================
+--- chromium-122.0.6261.128.orig/sandbox/linux/bpf_dsl/seccomp_macros.h
++++ chromium-122.0.6261.128/sandbox/linux/bpf_dsl/seccomp_macros.h
+@@ -343,6 +343,48 @@ struct regs_struct {
+ #define SECCOMP_PT_PARM4(_regs) (_regs).regs[3]
+ #define SECCOMP_PT_PARM5(_regs) (_regs).regs[4]
+ #define SECCOMP_PT_PARM6(_regs) (_regs).regs[5]
++
++#elif defined(__riscv)
++struct regs_struct {
++ unsigned long regs[32];
++};
++
++#define SECCOMP_ARCH AUDIT_ARCH_RISCV64
++
++#define SECCOMP_REG(_ctx, _reg) ((_ctx)->uc_mcontext.__gregs[_reg])
++
++#define SECCOMP_RESULT(_ctx) SECCOMP_REG(_ctx, REG_A0)
++#define SECCOMP_SYSCALL(_ctx) SECCOMP_REG(_ctx, REG_A0+7)
++#define SECCOMP_IP(_ctx) (_ctx)->uc_mcontext.__gregs[REG_PC]
++#define SECCOMP_PARM1(_ctx) SECCOMP_REG(_ctx, REG_A0)
++#define SECCOMP_PARM2(_ctx) SECCOMP_REG(_ctx, REG_A0+1)
++#define SECCOMP_PARM3(_ctx) SECCOMP_REG(_ctx, REG_A0+2)
++#define SECCOMP_PARM4(_ctx) SECCOMP_REG(_ctx, REG_A0+3)
++#define SECCOMP_PARM5(_ctx) SECCOMP_REG(_ctx, REG_A0+4)
++#define SECCOMP_PARM6(_ctx) SECCOMP_REG(_ctx, REG_A0+5)
++#define SECCOMP_PARM7(_ctx) SECCOMP_REG(_ctx, REG_A0+6)
++
++#define SECCOMP_NR_IDX (offsetof(struct arch_seccomp_data, nr))
++#define SECCOMP_ARCH_IDX (offsetof(struct arch_seccomp_data, arch))
++#define SECCOMP_IP_MSB_IDX \
++ (offsetof(struct arch_seccomp_data, instruction_pointer) + 4)
++#define SECCOMP_IP_LSB_IDX \
++ (offsetof(struct arch_seccomp_data, instruction_pointer) + 0)
++#define SECCOMP_ARG_MSB_IDX(nr) \
++ (offsetof(struct arch_seccomp_data, args) + 8 * (nr) + 4)
++#define SECCOMP_ARG_LSB_IDX(nr) \
++ (offsetof(struct arch_seccomp_data, args) + 8 * (nr) + 0)
++
++#define SECCOMP_PT_RESULT(_regs) (_regs).regs[REG_A0]
++#define SECCOMP_PT_SYSCALL(_regs) (_regs).regs[REG_A0+7]
++#define SECCOMP_PT_IP(_regs) (_regs).regs[REG_PC]
++#define SECCOMP_PT_PARM1(_regs) (_regs).regs[REG_A0]
++#define SECCOMP_PT_PARM2(_regs) (_regs).regs[REG_A0+1]
++#define SECCOMP_PT_PARM3(_regs) (_regs).regs[REG_A0+2]
++#define SECCOMP_PT_PARM4(_regs) (_regs).regs[REG_A0+3]
++#define SECCOMP_PT_PARM5(_regs) (_regs).regs[REG_A0+4]
++#define SECCOMP_PT_PARM6(_regs) (_regs).regs[REG_A0+5]
++#define SECCOMP_PT_PARM7(_regs) (_regs).regs[REG_A0+6]
+ #else
+ #error Unsupported target platform
+
+Index: chromium-122.0.6261.128/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
+===================================================================
+--- chromium-122.0.6261.128.orig/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
++++ chromium-122.0.6261.128/sandbox/linux/seccomp-bpf-helpers/baseline_policy.cc
+@@ -60,6 +60,9 @@ bool IsBaselinePolicyAllowed(int sysno)
+ #if defined(__mips__)
+ SyscallSets::IsMipsPrivate(sysno) ||
+ #endif
++#if defined(__riscv)
++ SyscallSets::IsRiscvPrivate(sysno) ||
++#endif
+ SyscallSets::IsAllowedOperationOnFd(sysno);
+ // clang-format on
+ }
+@@ -193,7 +196,7 @@ ResultExpr EvaluateSyscallImpl(int fs_de
+ return RestrictFcntlCommands();
+ #endif
+
+-#if !defined(__aarch64__)
++#if !defined(__aarch64__) && !defined(__riscv)
+ // fork() is never used as a system call (clone() is used instead), but we
+ // have seen it in fallback code on Android.
+ if (sysno == __NR_fork) {
+@@ -255,7 +258,7 @@ ResultExpr EvaluateSyscallImpl(int fs_de
+ }
+
+ #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
+- defined(__aarch64__)
++ defined(__aarch64__) || defined(__riscv)
+ if (sysno == __NR_mmap)
+ return RestrictMmapFlags();
+ #endif
+@@ -276,7 +279,7 @@ ResultExpr EvaluateSyscallImpl(int fs_de
+ return RestrictPrctl();
+
+ #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
+- defined(__aarch64__)
++ defined(__aarch64__) || defined(__riscv)
+ if (sysno == __NR_socketpair) {
+ // Only allow AF_UNIX, PF_UNIX. Crash if anything else is seen.
+ static_assert(AF_UNIX == PF_UNIX,
+@@ -366,7 +369,7 @@ ResultExpr EvaluateSyscallImpl(int fs_de
+ // Allow creating pipes, but don't allow weird flags to pipe2().
+ // O_NOTIFICATION_PIPE (== O_EXCL) can be used to create
+ // "notification pipes", which are rarely used.
+-#if !defined(__aarch64__)
++#if !defined(__aarch64__) && !defined(__riscv)
+ if (sysno == __NR_pipe) {
+ return Allow();
+ }
+Index: chromium-122.0.6261.128/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
+===================================================================
+--- chromium-122.0.6261.128.orig/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
++++ chromium-122.0.6261.128/sandbox/linux/seccomp-bpf-helpers/syscall_parameters_restrictions.cc
+@@ -37,6 +37,7 @@
+
+ #if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS_LACROS)) && \
+ !defined(__arm__) && !defined(__aarch64__) && \
++ !defined(__riscv) && \
+ !defined(PTRACE_GET_THREAD_AREA)
+ // Also include asm/ptrace-abi.h since ptrace.h in older libc (for instance
+ // the one in Ubuntu 16.04 LTS) is missing PTRACE_GET_THREAD_AREA.
+@@ -463,8 +464,10 @@ ResultExpr RestrictPtrace() {
+ #endif
+ return Switch(request)
+ .Cases({
+-#if !defined(__aarch64__)
++#if !defined(__aarch64__) && !defined(__riscv)
+ PTRACE_GETREGS, PTRACE_GETFPREGS, PTRACE_GET_THREAD_AREA,
++#endif
++#if !defined(__aarch64__)
+ PTRACE_GETREGSET,
+ #endif
+ #if defined(__arm__)
+Index: chromium-122.0.6261.128/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
+===================================================================
+--- chromium-122.0.6261.128.orig/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
++++ chromium-122.0.6261.128/sandbox/linux/seccomp-bpf-helpers/syscall_sets.cc
+@@ -103,7 +103,7 @@ bool SyscallSets::IsUmask(int sysno) {
+ // Both EPERM and ENOENT are valid errno unless otherwise noted in comment.
+ bool SyscallSets::IsFileSystem(int sysno) {
+ switch (sysno) {
+-#if !defined(__aarch64__)
++#if !defined(__aarch64__) && !defined(__riscv)
+ case __NR_access: // EPERM not a valid errno.
+ case __NR_chmod:
+ case __NR_chown:
+@@ -136,7 +136,7 @@ bool SyscallSets::IsFileSystem(int sysno
+ case __NR_faccessat2:
+ case __NR_fchmodat:
+ case __NR_fchownat: // Should be called chownat ?
+-#if defined(__x86_64__) || defined(__aarch64__)
++#if defined(__x86_64__) || defined(__aarch64__) || defined(__riscv)
+ case __NR_newfstatat: // fstatat(). EPERM not a valid errno.
+ #elif defined(__i386__) || defined(__arm__) || \
+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
+@@ -241,7 +241,7 @@ bool SyscallSets::IsAllowedFileSystemAcc
+ case __NR_oldfstat:
+ #endif
+ #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
+- defined(__aarch64__)
++ defined(__aarch64__) || defined(__riscv)
+ case __NR_sync_file_range: // EPERM not a valid errno.
+ #elif defined(__arm__)
+ case __NR_arm_sync_file_range: // EPERM not a valid errno.
+@@ -260,7 +260,7 @@ bool SyscallSets::IsDeniedFileSystemAcce
+ #if defined(__i386__) || defined(__arm__)
+ case __NR_fchown32:
+ #endif
+-#if !defined(__aarch64__)
++#if !defined(__aarch64__) && !defined(__riscv)
+ case __NR_getdents: // EPERM not a valid errno.
+ #endif
+ case __NR_getdents64: // EPERM not a valid errno.
+@@ -339,7 +339,7 @@ bool SyscallSets::IsProcessPrivilegeChan
+ bool SyscallSets::IsProcessGroupOrSession(int sysno) {
+ switch (sysno) {
+ case __NR_setpgid:
+-#if !defined(__aarch64__)
++#if !defined(__aarch64__) && !defined(__riscv)
+ case __NR_getpgrp:
+ #endif
+ case __NR_setsid:
+@@ -373,7 +373,7 @@ bool SyscallSets::IsAllowedSignalHandlin
+ case __NR_rt_sigqueueinfo:
+ case __NR_rt_sigsuspend:
+ case __NR_rt_tgsigqueueinfo:
+-#if !defined(__aarch64__)
++#if !defined(__aarch64__) && !defined(__riscv)
+ case __NR_signalfd:
+ #endif
+ case __NR_signalfd4:
+@@ -397,12 +397,12 @@ bool SyscallSets::IsAllowedOperationOnFd
+ switch (sysno) {
+ case __NR_close:
+ case __NR_dup:
+-#if !defined(__aarch64__)
++#if !defined(__aarch64__) && !defined(__riscv)
+ case __NR_dup2:
+ #endif
+ case __NR_dup3:
+ #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
+- defined(__aarch64__)
++ defined(__aarch64__) || defined(__riscv)
+ case __NR_shutdown:
+ #endif
+ return true;
+@@ -441,7 +441,7 @@ bool SyscallSets::IsAllowedProcessStartO
+ return true;
+ case __NR_clone: // Should be parameter-restricted.
+ case __NR_setns: // Privileged.
+-#if !defined(__aarch64__)
++#if !defined(__aarch64__) && !defined(__riscv)
+ case __NR_fork:
+ #endif
+ #if defined(__i386__) || defined(__x86_64__)
+@@ -452,7 +452,7 @@ bool SyscallSets::IsAllowedProcessStartO
+ #endif
+ case __NR_set_tid_address:
+ case __NR_unshare:
+-#if !defined(__mips__) && !defined(__aarch64__)
++#if !defined(__mips__) && !defined(__aarch64__) && !defined(__riscv)
+ case __NR_vfork:
+ #endif
+ default:
+@@ -477,7 +477,7 @@ bool SyscallSets::IsAllowedFutex(int sys
+
+ bool SyscallSets::IsAllowedEpoll(int sysno) {
+ switch (sysno) {
+-#if !defined(__aarch64__)
++#if !defined(__aarch64__) && !defined(__riscv)
+ case __NR_epoll_create:
+ case __NR_epoll_wait:
+ #endif
+@@ -499,7 +499,7 @@ bool SyscallSets::IsAllowedEpoll(int sys
+ bool SyscallSets::IsDeniedGetOrModifySocket(int sysno) {
+ switch (sysno) {
+ #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
+- defined(__aarch64__)
++ defined(__aarch64__) || defined(__riscv)
+ case __NR_accept:
+ case __NR_accept4:
+ case __NR_bind:
+@@ -553,7 +553,7 @@ bool SyscallSets::IsAllowedAddressSpaceA
+ case __NR_mincore:
+ case __NR_mlockall:
+ #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
+- defined(__aarch64__)
++ defined(__aarch64__) || defined(__riscv)
+ case __NR_mmap:
+ #endif
+ #if defined(__i386__) || defined(__arm__) || \
+@@ -586,7 +586,7 @@ bool SyscallSets::IsAllowedGeneralIo(int
+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
+ case __NR__llseek:
+ #endif
+-#if !defined(__aarch64__)
++#if !defined(__aarch64__) && !defined(__riscv)
+ case __NR_poll:
+ #endif
+ case __NR_ppoll:
+@@ -607,7 +607,7 @@ bool SyscallSets::IsAllowedGeneralIo(int
+ case __NR_recv:
+ #endif
+ #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
+- defined(__aarch64__)
++ defined(__aarch64__) || defined(__riscv)
+ case __NR_recvfrom: // Could specify source.
+ case __NR_recvmsg: // Could specify source.
+ #endif
+@@ -622,7 +622,7 @@ bool SyscallSets::IsAllowedGeneralIo(int
+ case __NR_send:
+ #endif
+ #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
+- defined(__aarch64__)
++ defined(__aarch64__) || defined(__riscv)
+ case __NR_sendmsg: // Could specify destination.
+ case __NR_sendto: // Could specify destination.
+ #endif
+@@ -671,7 +671,7 @@ bool SyscallSets::IsSeccomp(int sysno) {
+ bool SyscallSets::IsAllowedBasicScheduler(int sysno) {
+ switch (sysno) {
+ case __NR_sched_yield:
+-#if !defined(__aarch64__)
++#if !defined(__aarch64__) && !defined(__riscv)
+ case __NR_pause:
+ #endif
+ case __NR_nanosleep:
+@@ -755,7 +755,7 @@ bool SyscallSets::IsNuma(int sysno) {
+ case __NR_getcpu:
+ case __NR_mbind:
+ #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
+- defined(__aarch64__)
++ defined(__aarch64__) || defined(__riscv)
+ case __NR_migrate_pages:
+ #endif
+ case __NR_move_pages:
+@@ -790,7 +790,7 @@ bool SyscallSets::IsGlobalProcessEnviron
+ switch (sysno) {
+ case __NR_acct: // Privileged.
+ #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
+- defined(__aarch64__)
++ defined(__aarch64__) || defined(__riscv)
+ case __NR_getrlimit:
+ #endif
+ #if defined(__i386__) || defined(__arm__)
+@@ -825,7 +825,7 @@ bool SyscallSets::IsDebug(int sysno) {
+
+ bool SyscallSets::IsGlobalSystemStatus(int sysno) {
+ switch (sysno) {
+-#if !defined(__aarch64__)
++#if !defined(__aarch64__) && !defined(__riscv)
+ case __NR__sysctl:
+ case __NR_sysfs:
+ #endif
+@@ -843,7 +843,7 @@ bool SyscallSets::IsGlobalSystemStatus(i
+
+ bool SyscallSets::IsEventFd(int sysno) {
+ switch (sysno) {
+-#if !defined(__aarch64__)
++#if !defined(__aarch64__) && !defined(__riscv)
+ case __NR_eventfd:
+ #endif
+ case __NR_eventfd2:
+@@ -895,6 +895,7 @@ bool SyscallSets::IsKeyManagement(int sy
+ }
+
+ #if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) || \
++ defined(__riscv) || \
+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
+ bool SyscallSets::IsSystemVSemaphores(int sysno) {
+ switch (sysno) {
+@@ -914,7 +915,7 @@ bool SyscallSets::IsSystemVSemaphores(in
+ #endif
+
+ #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
+- defined(__aarch64__) || \
++ defined(__aarch64__) || defined(__riscv) || \
+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
+ // These give a lot of ambient authority and bypass the setuid sandbox.
+ bool SyscallSets::IsSystemVSharedMemory(int sysno) {
+@@ -931,6 +932,7 @@ bool SyscallSets::IsSystemVSharedMemory(
+ #endif
+
+ #if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) || \
++ defined(__riscv) || \
+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
+ bool SyscallSets::IsSystemVMessageQueue(int sysno) {
+ switch (sysno) {
+@@ -962,6 +964,7 @@ bool SyscallSets::IsSystemVIpc(int sysno
+
+ bool SyscallSets::IsAnySystemV(int sysno) {
+ #if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) || \
++ defined(__riscv) || \
+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
+ return IsSystemVMessageQueue(sysno) || IsSystemVSemaphores(sysno) ||
+ IsSystemVSharedMemory(sysno);
+@@ -999,7 +1002,7 @@ bool SyscallSets::IsAdvancedScheduler(in
+ bool SyscallSets::IsInotify(int sysno) {
+ switch (sysno) {
+ case __NR_inotify_add_watch:
+-#if !defined(__aarch64__)
++#if !defined(__aarch64__) && !defined(__riscv)
+ case __NR_inotify_init:
+ #endif
+ case __NR_inotify_init1:
+@@ -1134,7 +1137,7 @@ bool SyscallSets::IsMisc(int sysno) {
+ #if defined(__x86_64__)
+ case __NR_tuxcall:
+ #endif
+-#if !defined(__aarch64__)
++#if !defined(__aarch64__) && !defined(__riscv)
+ case __NR_vserver:
+ #endif
+ return true;
+@@ -1193,6 +1196,18 @@ bool SyscallSets::IsMipsMisc(int sysno)
+ }
+ #endif // defined(__mips__)
+
++#if defined(__riscv)
++bool SyscallSets::IsRiscvPrivate(int sysno) {
++ switch (sysno) {
++ case __NR_riscv_hwprobe:
++ case __NR_riscv_flush_icache:
++ return true;
++ default:
++ return false;
++ }
++}
++#endif // defined(__riscv)
++
+ bool SyscallSets::IsGoogle3Threading(int sysno) {
+ switch (sysno) {
+ case __NR_getitimer:
+Index: chromium-122.0.6261.128/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
+===================================================================
+--- chromium-122.0.6261.128.orig/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
++++ chromium-122.0.6261.128/sandbox/linux/seccomp-bpf-helpers/syscall_sets.h
+@@ -52,7 +52,7 @@ class SANDBOX_EXPORT SyscallSets {
+ #endif
+
+ #if defined(__x86_64__) || defined(__arm__) || defined(__mips__) || \
+- defined(__aarch64__)
++ defined(__aarch64__) || defined(__riscv)
+ static bool IsNetworkSocketInformation(int sysno);
+ #endif
+
+@@ -79,18 +79,21 @@ class SANDBOX_EXPORT SyscallSets {
+ static bool IsAsyncIo(int sysno);
+ static bool IsKeyManagement(int sysno);
+ #if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) || \
+- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
++ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS)) || \
++ defined(__riscv)
+ static bool IsSystemVSemaphores(int sysno);
+ #endif
+ #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
+ defined(__aarch64__) || \
+- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
++ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS)) || \
++ defined(__riscv)
+ // These give a lot of ambient authority and bypass the setuid sandbox.
+ static bool IsSystemVSharedMemory(int sysno);
+ #endif
+
+ #if defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) || \
+- (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS))
++ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_64_BITS)) || \
++ defined(__riscv)
+ static bool IsSystemVMessageQueue(int sysno);
+ #endif
+
+@@ -117,6 +120,9 @@ class SANDBOX_EXPORT SyscallSets {
+ static bool IsMipsPrivate(int sysno);
+ static bool IsMipsMisc(int sysno);
+ #endif // defined(__mips__)
++#if defined(__riscv)
++ static bool IsRiscvPrivate(int sysno);
++#endif
+ static bool IsGoogle3Threading(int sysno);
+ };
+
+Index: chromium-122.0.6261.128/sandbox/linux/seccomp-bpf/syscall.cc
+===================================================================
+--- chromium-122.0.6261.128.orig/sandbox/linux/seccomp-bpf/syscall.cc
++++ chromium-122.0.6261.128/sandbox/linux/seccomp-bpf/syscall.cc
+@@ -18,7 +18,7 @@ namespace sandbox {
+ namespace {
+
+ #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM_FAMILY) || \
+- defined(ARCH_CPU_MIPS_FAMILY)
++ defined(ARCH_CPU_MIPS_FAMILY) || defined(ARCH_CPU_RISCV_FAMILY)
+ // Number that's not currently used by any Linux kernel ABIs.
+ const int kInvalidSyscallNumber = 0x351d3;
+ #else
+@@ -308,6 +308,28 @@ asm(// We need to be able to tell the ke
+ "2:ret\n"
+ ".cfi_endproc\n"
+ ".size SyscallAsm, .-SyscallAsm\n"
++#elif defined(__riscv)
++ ".text\n"
++ ".align 2\n"
++ ".type SyscallAsm, %function\n"
++ "SyscallAsm:\n"
++ ".cfi_startproc\n"
++ "bgez a0,1f\n"
++ "lla a0,2f\n"
++ "j 2f\n"
++ "1:mv a7, a0\n"
++ "ld a0, (a1)\n"
++ "ld a2, 16(a1)\n"
++ "ld a3, 24(a1)\n"
++ "ld a4, 32(a1)\n"
++ "ld a5, 40(a1)\n"
++ "ld a6, 48(a1)\n"
++ "ld a1, 8(a1)\n"
++ // Enter the kernel
++ "scall\n"
++ "2:ret\n"
++ ".cfi_endproc\n"
++ ".size SyscallAsm, .-SyscallAsm\n"
+ #endif
+ ); // asm
+
+@@ -319,6 +341,10 @@ intptr_t SyscallAsm(intptr_t nr, const i
+ extern "C" {
+ intptr_t SyscallAsm(intptr_t nr, const intptr_t args[8]);
+ }
++#elif defined(__riscv)
++extern "C" {
++intptr_t SyscallAsm(intptr_t nr, const intptr_t args[7]);
++}
+ #endif
+
+ } // namespace
+@@ -351,6 +377,10 @@ intptr_t Syscall::Call(int nr,
+ // where that makes sense.
+ #if defined(__mips__)
+ const intptr_t args[8] = {p0, p1, p2, p3, p4, p5, p6, p7};
++#elif defined(__riscv)
++ DCHECK_EQ(p7, 0) << " Support for syscalls with more than seven arguments "
++ "not added for this architecture";
++ const intptr_t args[7] = {p0, p1, p2, p3, p4, p5, p6};
+ #else
+ DCHECK_EQ(p6, 0) << " Support for syscalls with more than six arguments not "
+ "added for this architecture";
+@@ -425,6 +455,8 @@ intptr_t Syscall::Call(int nr,
+ ret = inout;
+ }
+
++#elif defined(__riscv)
++ intptr_t ret = SyscallAsm(nr, args);
+ #else
+ #error "Unimplemented architecture"
+ #endif
+Index: chromium-122.0.6261.128/sandbox/linux/services/credentials.cc
+===================================================================
+--- chromium-122.0.6261.128.orig/sandbox/linux/services/credentials.cc
++++ chromium-122.0.6261.128/sandbox/linux/services/credentials.cc
+@@ -80,7 +80,7 @@ bool ChrootToSafeEmptyDir() {
+ pid_t pid = -1;
+ alignas(16) char stack_buf[PTHREAD_STACK_MIN];
+ #if defined(ARCH_CPU_X86_FAMILY) || defined(ARCH_CPU_ARM_FAMILY) || \
+- defined(ARCH_CPU_MIPS_FAMILY)
++ defined(ARCH_CPU_MIPS_FAMILY) || defined(ARCH_CPU_RISCV_FAMILY)
+ // The stack grows downward.
+ void* stack = stack_buf + sizeof(stack_buf);
+ #else
+Index: chromium-122.0.6261.128/sandbox/linux/services/syscall_wrappers.cc
+===================================================================
+--- chromium-122.0.6261.128.orig/sandbox/linux/services/syscall_wrappers.cc
++++ chromium-122.0.6261.128/sandbox/linux/services/syscall_wrappers.cc
+@@ -61,7 +61,7 @@ long sys_clone(unsigned long flags,
+ #if defined(ARCH_CPU_X86_64)
+ return syscall(__NR_clone, flags, child_stack, ptid, ctid, tls);
+ #elif defined(ARCH_CPU_X86) || defined(ARCH_CPU_ARM_FAMILY) || \
+- defined(ARCH_CPU_MIPS_FAMILY)
++ defined(ARCH_CPU_MIPS_FAMILY) || defined(ARCH_CPU_RISCV_FAMILY)
+ // CONFIG_CLONE_BACKWARDS defined.
+ return syscall(__NR_clone, flags, child_stack, ptid, tls, ctid);
+ #endif
+Index: chromium-122.0.6261.128/sandbox/linux/syscall_broker/broker_process.cc
+===================================================================
+--- chromium-122.0.6261.128.orig/sandbox/linux/syscall_broker/broker_process.cc
++++ chromium-122.0.6261.128/sandbox/linux/syscall_broker/broker_process.cc
+@@ -122,44 +122,46 @@ bool BrokerProcess::IsSyscallBrokerable(
+ // and are default disabled in Android. So, we should refuse to broker them
+ // to be consistent with the platform's restrictions.
+ switch (sysno) {
+-#if !defined(__aarch64__) && !BUILDFLAG(IS_ANDROID)
++#if !defined(__aarch64__) && !BUILDFLAG(IS_ANDROID) && !defined(__riscv)
+ case __NR_access:
+ #endif
+ case __NR_faccessat:
+ case __NR_faccessat2:
+ return !fast_check || policy_->allowed_command_set.test(COMMAND_ACCESS);
+
+-#if !defined(__aarch64__) && !BUILDFLAG(IS_ANDROID)
++#if !defined(__aarch64__) && !BUILDFLAG(IS_ANDROID) && !defined(__riscv)
+ case __NR_mkdir:
+ #endif
+ case __NR_mkdirat:
+ return !fast_check || policy_->allowed_command_set.test(COMMAND_MKDIR);
+
+-#if !defined(__aarch64__) && !BUILDFLAG(IS_ANDROID)
++#if !defined(__aarch64__) && !BUILDFLAG(IS_ANDROID) && !defined(__riscv)
+ case __NR_open:
+ #endif
+ case __NR_openat:
+ return !fast_check || policy_->allowed_command_set.test(COMMAND_OPEN);
+
+-#if !defined(__aarch64__) && !BUILDFLAG(IS_ANDROID)
++#if !defined(__aarch64__) && !BUILDFLAG(IS_ANDROID) && !defined(__riscv)
+ case __NR_readlink:
+ #endif
+ case __NR_readlinkat:
+ return !fast_check || policy_->allowed_command_set.test(COMMAND_READLINK);
+
+-#if !defined(__aarch64__) && !BUILDFLAG(IS_ANDROID)
++#if !defined(__aarch64__) && !BUILDFLAG(IS_ANDROID) && !defined(__riscv)
+ case __NR_rename:
+ #endif
++#ifdef __NR_renameat
+ case __NR_renameat:
++#endif
+ case __NR_renameat2:
+ return !fast_check || policy_->allowed_command_set.test(COMMAND_RENAME);
+
+-#if !defined(__aarch64__) && !BUILDFLAG(IS_ANDROID)
++#if !defined(__aarch64__) && !BUILDFLAG(IS_ANDROID) && !defined(__riscv)
+ case __NR_rmdir:
+ return !fast_check || policy_->allowed_command_set.test(COMMAND_RMDIR);
+ #endif
+
+-#if !defined(__aarch64__) && !BUILDFLAG(IS_ANDROID)
++#if !defined(__aarch64__) && !BUILDFLAG(IS_ANDROID) && !defined(__riscv)
+ case __NR_stat:
+ case __NR_lstat:
+ #endif
+@@ -169,7 +171,7 @@ bool BrokerProcess::IsSyscallBrokerable(
+ #if defined(__NR_fstatat64)
+ case __NR_fstatat64:
+ #endif
+-#if defined(__x86_64__) || defined(__aarch64__)
++#if defined(__x86_64__) || defined(__aarch64__) || defined(__riscv)
+ case __NR_newfstatat:
+ #endif
+ return !fast_check || policy_->allowed_command_set.test(COMMAND_STAT);
+@@ -184,7 +186,7 @@ bool BrokerProcess::IsSyscallBrokerable(
+ return !fast_check || policy_->allowed_command_set.test(COMMAND_STAT);
+ #endif
+
+-#if !defined(__aarch64__) && !BUILDFLAG(IS_ANDROID)
++#if !defined(__aarch64__) && !BUILDFLAG(IS_ANDROID) && !defined(__riscv)
+ case __NR_unlink:
+ return !fast_check || policy_->allowed_command_set.test(COMMAND_UNLINK);
+ #endif
+Index: chromium-122.0.6261.128/sandbox/linux/system_headers/linux_seccomp.h
+===================================================================
+--- chromium-122.0.6261.128.orig/sandbox/linux/system_headers/linux_seccomp.h
++++ chromium-122.0.6261.128/sandbox/linux/system_headers/linux_seccomp.h
+@@ -39,6 +39,10 @@
+ #define EM_AARCH64 183
+ #endif
+
++#ifndef EM_RISCV
++#define EM_RISCV 243
++#endif
++
+ #ifndef __AUDIT_ARCH_64BIT
+ #define __AUDIT_ARCH_64BIT 0x80000000
+ #endif
+@@ -71,6 +75,10 @@
+ #define AUDIT_ARCH_AARCH64 (EM_AARCH64 | __AUDIT_ARCH_64BIT | __AUDIT_ARCH_LE)
+ #endif
+
++#ifndef AUDIT_ARCH_RISCV64
++#define AUDIT_ARCH_RISCV64 (EM_RISCV|__AUDIT_ARCH_64BIT|__AUDIT_ARCH_LE)
++#endif
++
+ // For prctl.h
+ #ifndef PR_SET_SECCOMP
+ #define PR_SET_SECCOMP 22
+Index: chromium-122.0.6261.128/sandbox/linux/system_headers/linux_signal.h
+===================================================================
+--- chromium-122.0.6261.128.orig/sandbox/linux/system_headers/linux_signal.h
++++ chromium-122.0.6261.128/sandbox/linux/system_headers/linux_signal.h
+@@ -13,7 +13,7 @@
+ // (not undefined, but defined different values and in different memory
+ // layouts). So, fill the gap here.
+ #if defined(__i386__) || defined(__x86_64__) || defined(__arm__) || \
+- defined(__aarch64__)
++ defined(__aarch64__) || defined(__riscv)
+
+ #define LINUX_SIGHUP 1
+ #define LINUX_SIGINT 2
+Index: chromium-122.0.6261.128/sandbox/linux/system_headers/linux_stat.h
+===================================================================
+--- chromium-122.0.6261.128.orig/sandbox/linux/system_headers/linux_stat.h
++++ chromium-122.0.6261.128/sandbox/linux/system_headers/linux_stat.h
+@@ -150,7 +150,7 @@ struct kernel_stat {
+ int st_blocks;
+ int st_pad4[14];
+ };
+-#elif defined(__aarch64__)
++#elif defined(__aarch64__) || defined(__riscv)
+ struct kernel_stat {
+ unsigned long st_dev;
+ unsigned long st_ino;
+Index: chromium-122.0.6261.128/sandbox/linux/system_headers/linux_syscalls.h
+===================================================================
+--- chromium-122.0.6261.128.orig/sandbox/linux/system_headers/linux_syscalls.h
++++ chromium-122.0.6261.128/sandbox/linux/system_headers/linux_syscalls.h
+@@ -35,5 +35,9 @@
+ #include "sandbox/linux/system_headers/arm64_linux_syscalls.h"
+ #endif
+
++#if defined(__riscv) && __riscv_xlen == 64
++#include "sandbox/linux/system_headers/riscv64_linux_syscalls.h"
++#endif
++
+ #endif // SANDBOX_LINUX_SYSTEM_HEADERS_LINUX_SYSCALLS_H_
+
+Index: chromium-122.0.6261.128/sandbox/linux/system_headers/riscv64_linux_syscalls.h
+===================================================================
+--- /dev/null
++++ chromium-122.0.6261.128/sandbox/linux/system_headers/riscv64_linux_syscalls.h
+@@ -0,0 +1,1226 @@
++// Copyright 2014 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef SANDBOX_LINUX_SYSTEM_HEADERS_RISCV64_LINUX_SYSCALLS_H_
++#define SANDBOX_LINUX_SYSTEM_HEADERS_RISCV64_LINUX_SYSCALLS_H_
++
++#include <asm-generic/unistd.h>
++
++#if !defined(__NR_io_setup)
++#define __NR_io_setup 0
++#endif
++
++#if !defined(__NR_io_destroy)
++#define __NR_io_destroy 1
++#endif
++
++#if !defined(__NR_io_submit)
++#define __NR_io_submit 2
++#endif
++
++#if !defined(__NR_io_cancel)
++#define __NR_io_cancel 3
++#endif
++
++#if !defined(__NR_io_getevents)
++#define __NR_io_getevents 4
++#endif
++
++#if !defined(__NR_setxattr)
++#define __NR_setxattr 5
++#endif
++
++#if !defined(__NR_lsetxattr)
++#define __NR_lsetxattr 6
++#endif
++
++#if !defined(__NR_fsetxattr)
++#define __NR_fsetxattr 7
++#endif
++
++#if !defined(__NR_getxattr)
++#define __NR_getxattr 8
++#endif
++
++#if !defined(__NR_lgetxattr)
++#define __NR_lgetxattr 9
++#endif
++
++#if !defined(__NR_fgetxattr)
++#define __NR_fgetxattr 10
++#endif
++
++#if !defined(__NR_listxattr)
++#define __NR_listxattr 11
++#endif
++
++#if !defined(__NR_llistxattr)
++#define __NR_llistxattr 12
++#endif
++
++#if !defined(__NR_flistxattr)
++#define __NR_flistxattr 13
++#endif
++
++#if !defined(__NR_removexattr)
++#define __NR_removexattr 14
++#endif
++
++#if !defined(__NR_lremovexattr)
++#define __NR_lremovexattr 15
++#endif
++
++#if !defined(__NR_fremovexattr)
++#define __NR_fremovexattr 16
++#endif
++
++#if !defined(__NR_getcwd)
++#define __NR_getcwd 17
++#endif
++
++#if !defined(__NR_lookup_dcookie)
++#define __NR_lookup_dcookie 18
++#endif
++
++#if !defined(__NR_eventfd2)
++#define __NR_eventfd2 19
++#endif
++
++#if !defined(__NR_epoll_create1)
++#define __NR_epoll_create1 20
++#endif
++
++#if !defined(__NR_epoll_ctl)
++#define __NR_epoll_ctl 21
++#endif
++
++#if !defined(__NR_epoll_pwait)
++#define __NR_epoll_pwait 22
++#endif
++
++#if !defined(__NR_dup)
++#define __NR_dup 23
++#endif
++
++#if !defined(__NR_dup3)
++#define __NR_dup3 24
++#endif
++
++#if !defined(__NR_fcntl)
++#define __NR_fcntl 25
++#endif
++
++#if !defined(__NR_inotify_init1)
++#define __NR_inotify_init1 26
++#endif
++
++#if !defined(__NR_inotify_add_watch)
++#define __NR_inotify_add_watch 27
++#endif
++
++#if !defined(__NR_inotify_rm_watch)
++#define __NR_inotify_rm_watch 28
++#endif
++
++#if !defined(__NR_ioctl)
++#define __NR_ioctl 29
++#endif
++
++#if !defined(__NR_ioprio_set)
++#define __NR_ioprio_set 30
++#endif
++
++#if !defined(__NR_ioprio_get)
++#define __NR_ioprio_get 31
++#endif
++
++#if !defined(__NR_flock)
++#define __NR_flock 32
++#endif
++
++#if !defined(__NR_mknodat)
++#define __NR_mknodat 33
++#endif
++
++#if !defined(__NR_mkdirat)
++#define __NR_mkdirat 34
++#endif
++
++#if !defined(__NR_unlinkat)
++#define __NR_unlinkat 35
++#endif
++
++#if !defined(__NR_symlinkat)
++#define __NR_symlinkat 36
++#endif
++
++#if !defined(__NR_linkat)
++#define __NR_linkat 37
++#endif
++
++#if !defined(__NR_renameat)
++#define __NR_renameat 38
++#endif
++
++#if !defined(__NR_umount2)
++#define __NR_umount2 39
++#endif
++
++#if !defined(__NR_mount)
++#define __NR_mount 40
++#endif
++
++#if !defined(__NR_pivot_root)
++#define __NR_pivot_root 41
++#endif
++
++#if !defined(__NR_nfsservctl)
++#define __NR_nfsservctl 42
++#endif
++
++#if !defined(__NR_statfs)
++#define __NR_statfs 43
++#endif
++
++#if !defined(__NR_fstatfs)
++#define __NR_fstatfs 44
++#endif
++
++#if !defined(__NR_truncate)
++#define __NR_truncate 45
++#endif
++
++#if !defined(__NR_ftruncate)
++#define __NR_ftruncate 46
++#endif
++
++#if !defined(__NR_fallocate)
++#define __NR_fallocate 47
++#endif
++
++#if !defined(__NR_faccessat)
++#define __NR_faccessat 48
++#endif
++
++#if !defined(__NR_chdir)
++#define __NR_chdir 49
++#endif
++
++#if !defined(__NR_fchdir)
++#define __NR_fchdir 50
++#endif
++
++#if !defined(__NR_chroot)
++#define __NR_chroot 51
++#endif
++
++#if !defined(__NR_fchmod)
++#define __NR_fchmod 52
++#endif
++
++#if !defined(__NR_fchmodat)
++#define __NR_fchmodat 53
++#endif
++
++#if !defined(__NR_fchownat)
++#define __NR_fchownat 54
++#endif
++
++#if !defined(__NR_fchown)
++#define __NR_fchown 55
++#endif
++
++#if !defined(__NR_openat)
++#define __NR_openat 56
++#endif
++
++#if !defined(__NR_close)
++#define __NR_close 57
++#endif
++
++#if !defined(__NR_vhangup)
++#define __NR_vhangup 58
++#endif
++
++#if !defined(__NR_pipe2)
++#define __NR_pipe2 59
++#endif
++
++#if !defined(__NR_quotactl)
++#define __NR_quotactl 60
++#endif
++
++#if !defined(__NR_getdents64)
++#define __NR_getdents64 61
++#endif
++
++#if !defined(__NR_lseek)
++#define __NR_lseek 62
++#endif
++
++#if !defined(__NR_read)
++#define __NR_read 63
++#endif
++
++#if !defined(__NR_write)
++#define __NR_write 64
++#endif
++
++#if !defined(__NR_readv)
++#define __NR_readv 65
++#endif
++
++#if !defined(__NR_writev)
++#define __NR_writev 66
++#endif
++
++#if !defined(__NR_pread64)
++#define __NR_pread64 67
++#endif
++
++#if !defined(__NR_pwrite64)
++#define __NR_pwrite64 68
++#endif
++
++#if !defined(__NR_preadv)
++#define __NR_preadv 69
++#endif
++
++#if !defined(__NR_pwritev)
++#define __NR_pwritev 70
++#endif
++
++#if !defined(__NR_sendfile)
++#define __NR_sendfile 71
++#endif
++
++#if !defined(__NR_pselect6)
++#define __NR_pselect6 72
++#endif
++
++#if !defined(__NR_ppoll)
++#define __NR_ppoll 73
++#endif
++
++#if !defined(__NR_signalfd4)
++#define __NR_signalfd4 74
++#endif
++
++#if !defined(__NR_vmsplice)
++#define __NR_vmsplice 75
++#endif
++
++#if !defined(__NR_splice)
++#define __NR_splice 76
++#endif
++
++#if !defined(__NR_tee)
++#define __NR_tee 77
++#endif
++
++#if !defined(__NR_readlinkat)
++#define __NR_readlinkat 78
++#endif
++
++#if !defined(__NR_newfstatat)
++#define __NR_newfstatat 79
++#endif
++
++#if !defined(__NR_fstat)
++#define __NR_fstat 80
++#endif
++
++#if !defined(__NR_sync)
++#define __NR_sync 81
++#endif
++
++#if !defined(__NR_fsync)
++#define __NR_fsync 82
++#endif
++
++#if !defined(__NR_fdatasync)
++#define __NR_fdatasync 83
++#endif
++
++#if !defined(__NR_sync_file_range)
++#define __NR_sync_file_range 84
++#endif
++
++#if !defined(__NR_timerfd_create)
++#define __NR_timerfd_create 85
++#endif
++
++#if !defined(__NR_timerfd_settime)
++#define __NR_timerfd_settime 86
++#endif
++
++#if !defined(__NR_timerfd_gettime)
++#define __NR_timerfd_gettime 87
++#endif
++
++#if !defined(__NR_utimensat)
++#define __NR_utimensat 88
++#endif
++
++#if !defined(__NR_acct)
++#define __NR_acct 89
++#endif
++
++#if !defined(__NR_capget)
++#define __NR_capget 90
++#endif
++
++#if !defined(__NR_capset)
++#define __NR_capset 91
++#endif
++
++#if !defined(__NR_personality)
++#define __NR_personality 92
++#endif
++
++#if !defined(__NR_exit)
++#define __NR_exit 93
++#endif
++
++#if !defined(__NR_exit_group)
++#define __NR_exit_group 94
++#endif
++
++#if !defined(__NR_waitid)
++#define __NR_waitid 95
++#endif
++
++#if !defined(__NR_set_tid_address)
++#define __NR_set_tid_address 96
++#endif
++
++#if !defined(__NR_unshare)
++#define __NR_unshare 97
++#endif
++
++#if !defined(__NR_futex)
++#define __NR_futex 98
++#endif
++
++#if !defined(__NR_set_robust_list)
++#define __NR_set_robust_list 99
++#endif
++
++#if !defined(__NR_get_robust_list)
++#define __NR_get_robust_list 100
++#endif
++
++#if !defined(__NR_nanosleep)
++#define __NR_nanosleep 101
++#endif
++
++#if !defined(__NR_getitimer)
++#define __NR_getitimer 102
++#endif
++
++#if !defined(__NR_setitimer)
++#define __NR_setitimer 103
++#endif
++
++#if !defined(__NR_kexec_load)
++#define __NR_kexec_load 104
++#endif
++
++#if !defined(__NR_init_module)
++#define __NR_init_module 105
++#endif
++
++#if !defined(__NR_delete_module)
++#define __NR_delete_module 106
++#endif
++
++#if !defined(__NR_timer_create)
++#define __NR_timer_create 107
++#endif
++
++#if !defined(__NR_timer_gettime)
++#define __NR_timer_gettime 108
++#endif
++
++#if !defined(__NR_timer_getoverrun)
++#define __NR_timer_getoverrun 109
++#endif
++
++#if !defined(__NR_timer_settime)
++#define __NR_timer_settime 110
++#endif
++
++#if !defined(__NR_timer_delete)
++#define __NR_timer_delete 111
++#endif
++
++#if !defined(__NR_clock_settime)
++#define __NR_clock_settime 112
++#endif
++
++#if !defined(__NR_clock_gettime)
++#define __NR_clock_gettime 113
++#endif
++
++#if !defined(__NR_clock_getres)
++#define __NR_clock_getres 114
++#endif
++
++#if !defined(__NR_clock_nanosleep)
++#define __NR_clock_nanosleep 115
++#endif
++
++#if !defined(__NR_syslog)
++#define __NR_syslog 116
++#endif
++
++#if !defined(__NR_ptrace)
++#define __NR_ptrace 117
++#endif
++
++#if !defined(__NR_sched_setparam)
++#define __NR_sched_setparam 118
++#endif
++
++#if !defined(__NR_sched_setscheduler)
++#define __NR_sched_setscheduler 119
++#endif
++
++#if !defined(__NR_sched_getscheduler)
++#define __NR_sched_getscheduler 120
++#endif
++
++#if !defined(__NR_sched_getparam)
++#define __NR_sched_getparam 121
++#endif
++
++#if !defined(__NR_sched_setaffinity)
++#define __NR_sched_setaffinity 122
++#endif
++
++#if !defined(__NR_sched_getaffinity)
++#define __NR_sched_getaffinity 123
++#endif
++
++#if !defined(__NR_sched_yield)
++#define __NR_sched_yield 124
++#endif
++
++#if !defined(__NR_sched_get_priority_max)
++#define __NR_sched_get_priority_max 125
++#endif
++
++#if !defined(__NR_sched_get_priority_min)
++#define __NR_sched_get_priority_min 126
++#endif
++
++#if !defined(__NR_sched_rr_get_interval)
++#define __NR_sched_rr_get_interval 127
++#endif
++
++#if !defined(__NR_restart_syscall)
++#define __NR_restart_syscall 128
++#endif
++
++#if !defined(__NR_kill)
++#define __NR_kill 129
++#endif
++
++#if !defined(__NR_tkill)
++#define __NR_tkill 130
++#endif
++
++#if !defined(__NR_tgkill)
++#define __NR_tgkill 131
++#endif
++
++#if !defined(__NR_sigaltstack)
++#define __NR_sigaltstack 132
++#endif
++
++#if !defined(__NR_rt_sigsuspend)
++#define __NR_rt_sigsuspend 133
++#endif
++
++#if !defined(__NR_rt_sigaction)
++#define __NR_rt_sigaction 134
++#endif
++
++#if !defined(__NR_rt_sigprocmask)
++#define __NR_rt_sigprocmask 135
++#endif
++
++#if !defined(__NR_rt_sigpending)
++#define __NR_rt_sigpending 136
++#endif
++
++#if !defined(__NR_rt_sigtimedwait)
++#define __NR_rt_sigtimedwait 137
++#endif
++
++#if !defined(__NR_rt_sigqueueinfo)
++#define __NR_rt_sigqueueinfo 138
++#endif
++
++#if !defined(__NR_rt_sigreturn)
++#define __NR_rt_sigreturn 139
++#endif
++
++#if !defined(__NR_setpriority)
++#define __NR_setpriority 140
++#endif
++
++#if !defined(__NR_getpriority)
++#define __NR_getpriority 141
++#endif
++
++#if !defined(__NR_reboot)
++#define __NR_reboot 142
++#endif
++
++#if !defined(__NR_setregid)
++#define __NR_setregid 143
++#endif
++
++#if !defined(__NR_setgid)
++#define __NR_setgid 144
++#endif
++
++#if !defined(__NR_setreuid)
++#define __NR_setreuid 145
++#endif
++
++#if !defined(__NR_setuid)
++#define __NR_setuid 146
++#endif
++
++#if !defined(__NR_setresuid)
++#define __NR_setresuid 147
++#endif
++
++#if !defined(__NR_getresuid)
++#define __NR_getresuid 148
++#endif
++
++#if !defined(__NR_setresgid)
++#define __NR_setresgid 149
++#endif
++
++#if !defined(__NR_getresgid)
++#define __NR_getresgid 150
++#endif
++
++#if !defined(__NR_setfsuid)
++#define __NR_setfsuid 151
++#endif
++
++#if !defined(__NR_setfsgid)
++#define __NR_setfsgid 152
++#endif
++
++#if !defined(__NR_times)
++#define __NR_times 153
++#endif
++
++#if !defined(__NR_setpgid)
++#define __NR_setpgid 154
++#endif
++
++#if !defined(__NR_getpgid)
++#define __NR_getpgid 155
++#endif
++
++#if !defined(__NR_getsid)
++#define __NR_getsid 156
++#endif
++
++#if !defined(__NR_setsid)
++#define __NR_setsid 157
++#endif
++
++#if !defined(__NR_getgroups)
++#define __NR_getgroups 158
++#endif
++
++#if !defined(__NR_setgroups)
++#define __NR_setgroups 159
++#endif
++
++#if !defined(__NR_uname)
++#define __NR_uname 160
++#endif
++
++#if !defined(__NR_sethostname)
++#define __NR_sethostname 161
++#endif
++
++#if !defined(__NR_setdomainname)
++#define __NR_setdomainname 162
++#endif
++
++#if !defined(__NR_getrlimit)
++#define __NR_getrlimit 163
++#endif
++
++#if !defined(__NR_setrlimit)
++#define __NR_setrlimit 164
++#endif
++
++#if !defined(__NR_getrusage)
++#define __NR_getrusage 165
++#endif
++
++#if !defined(__NR_umask)
++#define __NR_umask 166
++#endif
++
++#if !defined(__NR_prctl)
++#define __NR_prctl 167
++#endif
++
++#if !defined(__NR_getcpu)
++#define __NR_getcpu 168
++#endif
++
++#if !defined(__NR_gettimeofday)
++#define __NR_gettimeofday 169
++#endif
++
++#if !defined(__NR_settimeofday)
++#define __NR_settimeofday 170
++#endif
++
++#if !defined(__NR_adjtimex)
++#define __NR_adjtimex 171
++#endif
++
++#if !defined(__NR_getpid)
++#define __NR_getpid 172
++#endif
++
++#if !defined(__NR_getppid)
++#define __NR_getppid 173
++#endif
++
++#if !defined(__NR_getuid)
++#define __NR_getuid 174
++#endif
++
++#if !defined(__NR_geteuid)
++#define __NR_geteuid 175
++#endif
++
++#if !defined(__NR_getgid)
++#define __NR_getgid 176
++#endif
++
++#if !defined(__NR_getegid)
++#define __NR_getegid 177
++#endif
++
++#if !defined(__NR_gettid)
++#define __NR_gettid 178
++#endif
++
++#if !defined(__NR_sysinfo)
++#define __NR_sysinfo 179
++#endif
++
++#if !defined(__NR_mq_open)
++#define __NR_mq_open 180
++#endif
++
++#if !defined(__NR_mq_unlink)
++#define __NR_mq_unlink 181
++#endif
++
++#if !defined(__NR_mq_timedsend)
++#define __NR_mq_timedsend 182
++#endif
++
++#if !defined(__NR_mq_timedreceive)
++#define __NR_mq_timedreceive 183
++#endif
++
++#if !defined(__NR_mq_notify)
++#define __NR_mq_notify 184
++#endif
++
++#if !defined(__NR_mq_getsetattr)
++#define __NR_mq_getsetattr 185
++#endif
++
++#if !defined(__NR_msgget)
++#define __NR_msgget 186
++#endif
++
++#if !defined(__NR_msgctl)
++#define __NR_msgctl 187
++#endif
++
++#if !defined(__NR_msgrcv)
++#define __NR_msgrcv 188
++#endif
++
++#if !defined(__NR_msgsnd)
++#define __NR_msgsnd 189
++#endif
++
++#if !defined(__NR_semget)
++#define __NR_semget 190
++#endif
++
++#if !defined(__NR_semctl)
++#define __NR_semctl 191
++#endif
++
++#if !defined(__NR_semtimedop)
++#define __NR_semtimedop 192
++#endif
++
++#if !defined(__NR_semop)
++#define __NR_semop 193
++#endif
++
++#if !defined(__NR_shmget)
++#define __NR_shmget 194
++#endif
++
++#if !defined(__NR_shmctl)
++#define __NR_shmctl 195
++#endif
++
++#if !defined(__NR_shmat)
++#define __NR_shmat 196
++#endif
++
++#if !defined(__NR_shmdt)
++#define __NR_shmdt 197
++#endif
++
++#if !defined(__NR_socket)
++#define __NR_socket 198
++#endif
++
++#if !defined(__NR_socketpair)
++#define __NR_socketpair 199
++#endif
++
++#if !defined(__NR_bind)
++#define __NR_bind 200
++#endif
++
++#if !defined(__NR_listen)
++#define __NR_listen 201
++#endif
++
++#if !defined(__NR_accept)
++#define __NR_accept 202
++#endif
++
++#if !defined(__NR_connect)
++#define __NR_connect 203
++#endif
++
++#if !defined(__NR_getsockname)
++#define __NR_getsockname 204
++#endif
++
++#if !defined(__NR_getpeername)
++#define __NR_getpeername 205
++#endif
++
++#if !defined(__NR_sendto)
++#define __NR_sendto 206
++#endif
++
++#if !defined(__NR_recvfrom)
++#define __NR_recvfrom 207
++#endif
++
++#if !defined(__NR_setsockopt)
++#define __NR_setsockopt 208
++#endif
++
++#if !defined(__NR_getsockopt)
++#define __NR_getsockopt 209
++#endif
++
++#if !defined(__NR_shutdown)
++#define __NR_shutdown 210
++#endif
++
++#if !defined(__NR_sendmsg)
++#define __NR_sendmsg 211
++#endif
++
++#if !defined(__NR_recvmsg)
++#define __NR_recvmsg 212
++#endif
++
++#if !defined(__NR_readahead)
++#define __NR_readahead 213
++#endif
++
++#if !defined(__NR_brk)
++#define __NR_brk 214
++#endif
++
++#if !defined(__NR_munmap)
++#define __NR_munmap 215
++#endif
++
++#if !defined(__NR_mremap)
++#define __NR_mremap 216
++#endif
++
++#if !defined(__NR_add_key)
++#define __NR_add_key 217
++#endif
++
++#if !defined(__NR_request_key)
++#define __NR_request_key 218
++#endif
++
++#if !defined(__NR_keyctl)
++#define __NR_keyctl 219
++#endif
++
++#if !defined(__NR_clone)
++#define __NR_clone 220
++#endif
++
++#if !defined(__NR_execve)
++#define __NR_execve 221
++#endif
++
++#if !defined(__NR_mmap)
++#define __NR_mmap 222
++#endif
++
++#if !defined(__NR_fadvise64)
++#define __NR_fadvise64 223
++#endif
++
++#if !defined(__NR_swapon)
++#define __NR_swapon 224
++#endif
++
++#if !defined(__NR_swapoff)
++#define __NR_swapoff 225
++#endif
++
++#if !defined(__NR_mprotect)
++#define __NR_mprotect 226
++#endif
++
++#if !defined(__NR_msync)
++#define __NR_msync 227
++#endif
++
++#if !defined(__NR_mlock)
++#define __NR_mlock 228
++#endif
++
++#if !defined(__NR_munlock)
++#define __NR_munlock 229
++#endif
++
++#if !defined(__NR_mlockall)
++#define __NR_mlockall 230
++#endif
++
++#if !defined(__NR_munlockall)
++#define __NR_munlockall 231
++#endif
++
++#if !defined(__NR_mincore)
++#define __NR_mincore 232
++#endif
++
++#if !defined(__NR_madvise)
++#define __NR_madvise 233
++#endif
++
++#if !defined(__NR_remap_file_pages)
++#define __NR_remap_file_pages 234
++#endif
++
++#if !defined(__NR_mbind)
++#define __NR_mbind 235
++#endif
++
++#if !defined(__NR_get_mempolicy)
++#define __NR_get_mempolicy 236
++#endif
++
++#if !defined(__NR_set_mempolicy)
++#define __NR_set_mempolicy 237
++#endif
++
++#if !defined(__NR_migrate_pages)
++#define __NR_migrate_pages 238
++#endif
++
++#if !defined(__NR_move_pages)
++#define __NR_move_pages 239
++#endif
++
++#if !defined(__NR_rt_tgsigqueueinfo)
++#define __NR_rt_tgsigqueueinfo 240
++#endif
++
++#if !defined(__NR_perf_event_open)
++#define __NR_perf_event_open 241
++#endif
++
++#if !defined(__NR_accept4)
++#define __NR_accept4 242
++#endif
++
++#if !defined(__NR_recvmmsg)
++#define __NR_recvmmsg 243
++#endif
++
++#if !defined(__NR_riscv_hwprobe)
++#define __NR_riscv_hwprobe 258
++#endif
++
++#if !defined(__NR_riscv_flush_icache)
++#define __NR_riscv_flush_icache 259
++#endif
++
++#if !defined(__NR_wait4)
++#define __NR_wait4 260
++#endif
++
++#if !defined(__NR_prlimit64)
++#define __NR_prlimit64 261
++#endif
++
++#if !defined(__NR_fanotify_init)
++#define __NR_fanotify_init 262
++#endif
++
++#if !defined(__NR_fanotify_mark)
++#define __NR_fanotify_mark 263
++#endif
++
++#if !defined(__NR_name_to_handle_at)
++#define __NR_name_to_handle_at 264
++#endif
++
++#if !defined(__NR_open_by_handle_at)
++#define __NR_open_by_handle_at 265
++#endif
++
++#if !defined(__NR_clock_adjtime)
++#define __NR_clock_adjtime 266
++#endif
++
++#if !defined(__NR_syncfs)
++#define __NR_syncfs 267
++#endif
++
++#if !defined(__NR_setns)
++#define __NR_setns 268
++#endif
++
++#if !defined(__NR_sendmmsg)
++#define __NR_sendmmsg 269
++#endif
++
++#if !defined(__NR_process_vm_readv)
++#define __NR_process_vm_readv 270
++#endif
++
++#if !defined(__NR_process_vm_writev)
++#define __NR_process_vm_writev 271
++#endif
++
++#if !defined(__NR_kcmp)
++#define __NR_kcmp 272
++#endif
++
++#if !defined(__NR_finit_module)
++#define __NR_finit_module 273
++#endif
++
++#if !defined(__NR_sched_setattr)
++#define __NR_sched_setattr 274
++#endif
++
++#if !defined(__NR_sched_getattr)
++#define __NR_sched_getattr 275
++#endif
++
++#if !defined(__NR_renameat2)
++#define __NR_renameat2 276
++#endif
++
++#if !defined(__NR_seccomp)
++#define __NR_seccomp 277
++#endif
++
++#if !defined(__NR_getrandom)
++#define __NR_getrandom 278
++#endif
++
++#if !defined(__NR_memfd_create)
++#define __NR_memfd_create 279
++#endif
++
++#if !defined(__NR_bpf)
++#define __NR_bpf 280
++#endif
++
++#if !defined(__NR_execveat)
++#define __NR_execveat 281
++#endif
++
++#if !defined(__NR_userfaultfd)
++#define __NR_userfaultfd 282
++#endif
++
++#if !defined(__NR_membarrier)
++#define __NR_membarrier 283
++#endif
++
++#if !defined(__NR_mlock2)
++#define __NR_mlock2 284
++#endif
++
++#if !defined(__NR_copy_file_range)
++#define __NR_copy_file_range 285
++#endif
++
++#if !defined(__NR_preadv2)
++#define __NR_preadv2 286
++#endif
++
++#if !defined(__NR_pwritev2)
++#define __NR_pwritev2 287
++#endif
++
++#if !defined(__NR_pkey_mprotect)
++#define __NR_pkey_mprotect 288
++#endif
++
++#if !defined(__NR_pkey_alloc)
++#define __NR_pkey_alloc 289
++#endif
++
++#if !defined(__NR_pkey_free)
++#define __NR_pkey_free 290
++#endif
++
++#if !defined(__NR_statx)
++#define __NR_statx 291
++#endif
++
++#if !defined(__NR_io_pgetevents)
++#define __NR_io_pgetevents 292
++#endif
++
++#if !defined(__NR_rseq)
++#define __NR_rseq 293
++#endif
++
++#if !defined(__NR_kexec_file_load)
++#define __NR_kexec_file_load 294
++#endif
++
++#if !defined(__NR_pidfd_send_signal)
++#define __NR_pidfd_send_signal 424
++#endif
++
++#if !defined(__NR_io_uring_setup)
++#define __NR_io_uring_setup 425
++#endif
++
++#if !defined(__NR_io_uring_enter)
++#define __NR_io_uring_enter 426
++#endif
++
++#if !defined(__NR_io_uring_register)
++#define __NR_io_uring_register 427
++#endif
++
++#if !defined(__NR_open_tree)
++#define __NR_open_tree 428
++#endif
++
++#if !defined(__NR_move_mount)
++#define __NR_move_mount 429
++#endif
++
++#if !defined(__NR_fsopen)
++#define __NR_fsopen 430
++#endif
++
++#if !defined(__NR_fsconfig)
++#define __NR_fsconfig 431
++#endif
++
++#if !defined(__NR_fsmount)
++#define __NR_fsmount 432
++#endif
++
++#if !defined(__NR_fspick)
++#define __NR_fspick 433
++#endif
++
++#if !defined(__NR_pidfd_open)
++#define __NR_pidfd_open 434
++#endif
++
++#if !defined(__NR_clone3)
++#define __NR_clone3 435
++#endif
++
++#if !defined(__NR_close_range)
++#define __NR_close_range 436
++#endif
++
++#if !defined(__NR_openat2)
++#define __NR_openat2 437
++#endif
++
++#if !defined(__NR_pidfd_getfd)
++#define __NR_pidfd_getfd 438
++#endif
++
++#if !defined(__NR_faccessat2)
++#define __NR_faccessat2 439
++#endif
++
++#if !defined(__NR_process_madvise)
++#define __NR_process_madvise 440
++#endif
++
++#if !defined(__NR_epoll_pwait2)
++#define __NR_epoll_pwait2 441
++#endif
++
++#if !defined(__NR_mount_setattr)
++#define __NR_mount_setattr 442
++#endif
++
++#if !defined(__NR_quotactl_path)
++#define __NR_quotactl_path 443
++#endif
++
++#if !defined(__NR_landlock_create_ruleset)
++#define __NR_landlock_create_ruleset 444
++#endif
++
++#if !defined(__NR_landlock_add_rule)
++#define __NR_landlock_add_rule 445
++#endif
++
++#if !defined(__NR_landlock_restrict_self)
++#define __NR_landlock_restrict_self 446
++#endif
++
++#endif // SANDBOX_LINUX_SYSTEM_HEADERS_RISCV64_LINUX_SYSCALLS_H_
+Index: chromium-122.0.6261.128/sandbox/policy/linux/bpf_cdm_policy_linux.cc
+===================================================================
+--- chromium-122.0.6261.128.orig/sandbox/policy/linux/bpf_cdm_policy_linux.cc
++++ chromium-122.0.6261.128/sandbox/policy/linux/bpf_cdm_policy_linux.cc
+@@ -33,7 +33,7 @@ ResultExpr CdmProcessPolicy::EvaluateSys
+ case __NR_ftruncate:
+ case __NR_fallocate:
+ #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
+- defined(__aarch64__)
++ defined(__aarch64__) || defined(__riscv)
+ case __NR_getrlimit:
+ #endif
+ #if defined(__i386__) || defined(__arm__)
+Index: chromium-122.0.6261.128/sandbox/policy/linux/bpf_cros_amd_gpu_policy_linux.cc
+===================================================================
+--- chromium-122.0.6261.128.orig/sandbox/policy/linux/bpf_cros_amd_gpu_policy_linux.cc
++++ chromium-122.0.6261.128/sandbox/policy/linux/bpf_cros_amd_gpu_policy_linux.cc
+@@ -38,7 +38,7 @@ ResultExpr CrosAmdGpuProcessPolicy::Eval
+ case __NR_sched_setscheduler:
+ case __NR_sysinfo:
+ case __NR_uname:
+-#if !defined(__aarch64__)
++#if !defined(__aarch64__) && !defined(__riscv)
+ case __NR_readlink:
+ case __NR_stat:
+ #endif
+Index: chromium-122.0.6261.128/sandbox/policy/linux/bpf_gpu_policy_linux.cc
+===================================================================
+--- chromium-122.0.6261.128.orig/sandbox/policy/linux/bpf_gpu_policy_linux.cc
++++ chromium-122.0.6261.128/sandbox/policy/linux/bpf_gpu_policy_linux.cc
+@@ -73,7 +73,7 @@ ResultExpr GpuProcessPolicy::EvaluateSys
+ (defined(ARCH_CPU_MIPS_FAMILY) && defined(ARCH_CPU_32_BITS))
+ case __NR_ftruncate64:
+ #endif
+-#if !defined(__aarch64__)
++#if !defined(__aarch64__) && !defined(__riscv)
+ case __NR_getdents:
+ #endif
+ case __NR_getdents64:
+Index: chromium-122.0.6261.128/sandbox/policy/linux/bpf_network_policy_linux.cc
+===================================================================
+--- chromium-122.0.6261.128.orig/sandbox/policy/linux/bpf_network_policy_linux.cc
++++ chromium-122.0.6261.128/sandbox/policy/linux/bpf_network_policy_linux.cc
+@@ -255,7 +255,7 @@ ResultExpr NetworkProcessPolicy::Evaluat
+ case __NR_fdatasync:
+ case __NR_fsync:
+ case __NR_mremap:
+-#if !defined(__aarch64__)
++#if !defined(__aarch64__) && !defined(__riscv)
+ case __NR_getdents:
+ #endif
+ case __NR_getdents64:
+Index: chromium-122.0.6261.128/sandbox/policy/linux/bpf_print_compositor_policy_linux.cc
+===================================================================
+--- chromium-122.0.6261.128.orig/sandbox/policy/linux/bpf_print_compositor_policy_linux.cc
++++ chromium-122.0.6261.128/sandbox/policy/linux/bpf_print_compositor_policy_linux.cc
+@@ -33,7 +33,7 @@ ResultExpr PrintCompositorProcessPolicy:
+ case __NR_fdatasync:
+ case __NR_fsync:
+ #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
+- defined(__aarch64__)
++ defined(__aarch64__) || defined (__riscv)
+ case __NR_getrlimit:
+ #endif
+ #if defined(__i386__) || defined(__arm__)
+Index: chromium-122.0.6261.128/sandbox/policy/linux/bpf_renderer_policy_linux.cc
+===================================================================
+--- chromium-122.0.6261.128.orig/sandbox/policy/linux/bpf_renderer_policy_linux.cc
++++ chromium-122.0.6261.128/sandbox/policy/linux/bpf_renderer_policy_linux.cc
+@@ -82,7 +82,7 @@ ResultExpr RendererProcessPolicy::Evalua
+ case __NR_ftruncate64:
+ #endif
+ #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
+- defined(__aarch64__)
++ defined(__aarch64__) || defined(__riscv)
+ case __NR_getrlimit:
+ case __NR_setrlimit:
+ // We allow setrlimit to dynamically adjust the address space limit as
+Index: chromium-122.0.6261.128/sandbox/policy/linux/bpf_service_policy_linux.cc
+===================================================================
+--- chromium-122.0.6261.128.orig/sandbox/policy/linux/bpf_service_policy_linux.cc
++++ chromium-122.0.6261.128/sandbox/policy/linux/bpf_service_policy_linux.cc
+@@ -26,7 +26,7 @@ ResultExpr ServiceProcessPolicy::Evaluat
+ return RestrictIoctl();
+ // Allow the system calls below.
+ #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
+- defined(__aarch64__)
++ defined(__aarch64__) || defined(__riscv)
+ case __NR_getrlimit:
+ #endif
+ #if defined(__i386__) || defined(__arm__)
+Index: chromium-122.0.6261.128/sandbox/policy/linux/bpf_utility_policy_linux.cc
+===================================================================
+--- chromium-122.0.6261.128.orig/sandbox/policy/linux/bpf_utility_policy_linux.cc
++++ chromium-122.0.6261.128/sandbox/policy/linux/bpf_utility_policy_linux.cc
+@@ -34,7 +34,7 @@ ResultExpr UtilityProcessPolicy::Evaluat
+ case __NR_fdatasync:
+ case __NR_fsync:
+ #if defined(__i386__) || defined(__x86_64__) || defined(__mips__) || \
+- defined(__aarch64__)
++ defined(__aarch64__) || defined(__riscv)
+ case __NR_getrlimit:
+ #endif
+ #if defined(__i386__) || defined(__arm__)
diff --git a/riscv-swiftshader.patch b/riscv-swiftshader.patch
new file mode 100644
index 0000000..712e9d2
--- /dev/null
+++ b/riscv-swiftshader.patch
@@ -0,0 +1,25 @@
+Index: chromium-122.0.6261.111/third_party/swiftshader/src/Reactor/BUILD.gn
+===================================================================
+--- chromium-122.0.6261.111.orig/third_party/swiftshader/src/Reactor/BUILD.gn
++++ chromium-122.0.6261.111/third_party/swiftshader/src/Reactor/BUILD.gn
+@@ -307,7 +307,7 @@ if (supports_subzero) {
+
+ if (supports_llvm) {
+ swiftshader_source_set("swiftshader_llvm_reactor") {
+- llvm_dir = "../../third_party/llvm-10.0"
++ llvm_dir = "../../third_party/llvm-16.0"
+
+ deps = [
+ ":swiftshader_reactor_base",
+Index: chromium-122.0.6261.111/third_party/swiftshader/third_party/llvm-16.0/BUILD.gn
+===================================================================
+--- chromium-122.0.6261.111.orig/third_party/swiftshader/third_party/llvm-16.0/BUILD.gn
++++ chromium-122.0.6261.111/third_party/swiftshader/third_party/llvm-16.0/BUILD.gn
+@@ -773,6 +773,7 @@ swiftshader_llvm_source_set("swiftshader
+ "llvm/lib/MC/MCContext.cpp",
+ "llvm/lib/MC/MCDXContainerStreamer.cpp",
+ "llvm/lib/MC/MCDXContainerWriter.cpp",
++ "llvm/lib/MC/MCDisassembler/MCDisassembler.cpp",
+ "llvm/lib/MC/MCDisassembler/MCRelocationInfo.cpp",
+ "llvm/lib/MC/MCDwarf.cpp",
+ "llvm/lib/MC/MCELFObjectTargetWriter.cpp",
diff --git a/sources b/sources
new file mode 100644
index 0000000..23aee3e
--- /dev/null
+++ b/sources
@@ -0,0 +1,2 @@
+d41d8cd98f00b204e9800998ecf8427e chromium-125.0.6422.141.tar.xz
+894e63358d872de8161e0c5d99e4f051 esbuild.tar.gz
diff --git a/system-libdrm.patch b/system-libdrm.patch
new file mode 100644
index 0000000..1712411
--- /dev/null
+++ b/system-libdrm.patch
@@ -0,0 +1,42 @@
+Index: chromium-114.0.5735.90/build/linux/unbundle/libdrm.gn
+===================================================================
+--- chromium-114.0.5735.90.orig/build/linux/unbundle/libdrm.gn
++++ chromium-114.0.5735.90/build/linux/unbundle/libdrm.gn
+@@ -11,7 +11,10 @@ pkg_config("system_libdrm") {
+
+ shim_headers("libdrm_shim") {
+ root_path = "src/include"
+- headers = [ "drm.h" ]
++ headers = [
++ "drm.h",
++ "drm_fourcc.h",
++ ]
+ }
+
+ source_set("libdrm") {
+Index: chromium-114.0.5735.90/ui/ozone/platform/drm/gpu/hardware_display_controller.cc
+===================================================================
+--- chromium-114.0.5735.90.orig/ui/ozone/platform/drm/gpu/hardware_display_controller.cc
++++ chromium-114.0.5735.90/ui/ozone/platform/drm/gpu/hardware_display_controller.cc
+@@ -18,7 +18,7 @@
+ #include "base/metrics/histogram_macros.h"
+ #include "base/ranges/algorithm.h"
+ #include "base/trace_event/typed_macros.h"
+-#include "third_party/libdrm/src/include/drm/drm_fourcc.h"
++#include <drm_fourcc.h>
+ #include "third_party/perfetto/include/perfetto/tracing/traced_value.h"
+ #include "third_party/skia/include/core/SkCanvas.h"
+ #include "third_party/skia/include/core/SkImage.h"
+Index: chromium-114.0.5735.90/media/gpu/chromeos/video_decoder_pipeline_unittest.cc
+===================================================================
+--- chromium-114.0.5735.90.orig/media/gpu/chromeos/video_decoder_pipeline_unittest.cc
++++ chromium-114.0.5735.90/media/gpu/chromeos/video_decoder_pipeline_unittest.cc
+@@ -25,7 +25,7 @@
+ #include "media/gpu/chromeos/dmabuf_video_frame_pool.h"
+ #include "testing/gmock/include/gmock/gmock.h"
+ #include "testing/gtest/include/gtest/gtest.h"
+-#include "third_party/libdrm/src/include/drm/drm_fourcc.h"
++#include <drm_fourcc.h>
+
+ #if BUILDFLAG(IS_CHROMEOS_ASH)
+ // gn check does not account for BUILDFLAG(), so including this header will