diff --git a/Cr122-ffmpeg-new-channel-layout.patch b/Cr122-ffmpeg-new-channel-layout.patch index 4b450d6..da6bebf 100644 --- a/Cr122-ffmpeg-new-channel-layout.patch +++ b/Cr122-ffmpeg-new-channel-layout.patch @@ -178,7 +178,7 @@ index 3c97e4a6cf4c7..a55e4ab51d5b3 100644 - smpte_st_2086.luminance_min = av_q2d(mdcv->min_luminance); - } - -- // TODO(crbug.com/40268540): Consider rejecting metadata that +- // TODO(https://crbug.com/1446302): Consider rejecting metadata that - // does not specify all values. - if (mdcv->has_primaries || mdcv->has_luminance) { - hdr_metadata.smpte_st_2086 = smpte_st_2086; @@ -221,7 +221,7 @@ index 3c97e4a6cf4c7..a55e4ab51d5b3 100644 + smpte_st_2086.luminance_min = av_q2d(mdcv->min_luminance); + } + -+ // TODO(crbug.com/40268540): Consider rejecting metadata that ++ // TODO(https://crbug.com/1446302): Consider rejecting metadata that + // does not specify all values. + if (mdcv->has_primaries || mdcv->has_luminance) { + hdr_metadata.smpte_st_2086 = smpte_st_2086; diff --git a/INSTALL.sh b/INSTALL.sh index d7469bd..bcf52d7 100644 --- a/INSTALL.sh +++ b/INSTALL.sh @@ -12,8 +12,8 @@ done SHLIB_PERMS="755" PROGNAME="chrome" PACKAGE="chromium-browser" -MENUNAME="Chromium Web Browser" -CHANNEL="stable" +MENUNAME="Chromium Web Browser (Beta)" +CHANNEL="beta" INSTALLDIR="${LIBDIR}/chromium" install -m 755 -d \ diff --git a/chrome-wrapper b/chrome-wrapper index 22772d9..b57024a 100644 --- a/chrome-wrapper +++ b/chrome-wrapper @@ -13,7 +13,7 @@ HERE="`dirname "$CHROME_WRAPPER"`" # 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="@@CHANNEL@@" +export CHROME_VERSION_EXTRA="beta" # We don't want bug-buddy intercepting our crashes. http://crbug.com/24120 export GNOME_DISABLE_CRASH_DIALOG=SET_BY_GOOGLE_CHROME diff --git a/chromium-115-compiler-SkColor4f.patch b/chromium-115-compiler-SkColor4f.patch new file mode 100644 index 0000000..583f74b --- /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-system-zstd.patch b/chromium-117-system-zstd.patch new file mode 100644 index 0000000..2bb746d --- /dev/null +++ b/chromium-117-system-zstd.patch @@ -0,0 +1,47 @@ +From ae3ae3711784865bdc38bf119a6182a7b8dae91c Mon Sep 17 00:00:00 2001 +From: Matt Jolly +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-120-emplace.patch b/chromium-120-emplace.patch new file mode 100644 index 0000000..1f32676 --- /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 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 + // 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 + 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 + subpixel_order = static_cast(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 + 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 + 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 + 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 + 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 + 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 + } + } + 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 + } + } + 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 + } + 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 + } + } + 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 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 ReadEventclock_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-121-nullptr_t-without-namespace-std.patch b/chromium-121-nullptr_t-without-namespace-std.patch new file mode 100644 index 0000000..ffffa44 --- /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-122-workaround_clang_bug-structured_binding.patch b/chromium-122-workaround_clang_bug-structured_binding.patch new file mode 100644 index 0000000..f7018af --- /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 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-stats-collector.patch b/chromium-123-stats-collector.patch new file mode 100644 index 0000000..1bf86a1 --- /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 + #include + +-#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-125-appservice-include.patch b/chromium-125-appservice-include.patch new file mode 100644 index 0000000..85731ca --- /dev/null +++ b/chromium-125-appservice-include.patch @@ -0,0 +1,26 @@ +commit 54c4f460f35e0a4003aa4dd01007188ff00295cc +Author: Jose Dapena Paz +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 + Commit-Queue: José Dapena Paz + 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 ++ + #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-compiler.patch b/chromium-125-compiler.patch index af78e76..6f104ef 100644 --- a/chromium-125-compiler.patch +++ b/chromium-125-compiler.patch @@ -7,11 +7,11 @@ Subject: [PATCH] Disable various compiler configs build/config/compiler/BUILD.gn | 134 +++++---------------------------- 1 file changed, 17 insertions(+), 117 deletions(-) -Index: chromium-126.0.6478.8/build/config/compiler/BUILD.gn +Index: chromium-120.0.6099.35/build/config/compiler/BUILD.gn =================================================================== ---- chromium-126.0.6478.8.orig/build/config/compiler/BUILD.gn -+++ chromium-126.0.6478.8/build/config/compiler/BUILD.gn -@@ -305,9 +305,7 @@ config("compiler") { +--- 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. @@ -21,11 +21,11 @@ Index: chromium-126.0.6478.8/build/config/compiler/BUILD.gn ":compiler_codegen", ":compiler_deterministic", ] -@@ -554,55 +554,6 @@ config("compiler") { +@@ -591,55 +589,6 @@ config("compiler") { ldflags += [ "-Wl,-z,keep-text-section-prefix" ] } -- if (is_clang && !is_nacl) { +- if (is_clang && !is_nacl && current_os != "zos") { - cflags += [ "-fcrash-diagnostics-dir=" + clang_diagnostic_dir ] - if (save_reproducers_on_lld_crash && use_lld) { - ldflags += [ @@ -48,9 +48,9 @@ Index: chromium-126.0.6478.8/build/config/compiler/BUILD.gn - } - } - -- # TODO(crbug.com/40283598): This causes binary size growth and potentially +- # TODO(crbug.com/1488374): This causes binary size growth and potentially - # other problems. -- # TODO(crbug.com/40284925): This isn't supported by Cronet's mainline llvm version. +- # 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 += [ @@ -66,7 +66,7 @@ Index: chromium-126.0.6478.8/build/config/compiler/BUILD.gn - } - } - -- # TODO(crbug.com/40192287): Investigate why/if this should be needed. +- # TODO(crbug.com/1235145): Investigate why/if this should be needed. - if (is_win) { - cflags += [ "/clang:-ffp-contract=off" ] - } else { @@ -77,7 +77,7 @@ Index: chromium-126.0.6478.8/build/config/compiler/BUILD.gn # C11/C++11 compiler flags setup. # --------------------------- if (is_linux || is_chromeos || is_android || (is_nacl && is_clang) || -@@ -1538,52 +1489,6 @@ config("compiler_deterministic") { +@@ -1488,46 +1488,6 @@ } } @@ -100,13 +100,7 @@ Index: chromium-126.0.6478.8/build/config/compiler/BUILD.gn - # -ffile-compilation-dir is an alias for both -fdebug-compilation-dir= - # and -fcoverage-compilation-dir=. - cflags += [ "-ffile-compilation-dir=." ] -- -- # Convert absolute paths to relative paths. Expands to, for example: -- # -file-prefix-map /path/to/chromium/src=../.. -- swiftflags += [ -- "-file-prefix-map", -- rebase_path("//.", "") + "=" + rebase_path("//.", root_build_dir), -- ] +- swiftflags += [ "-file-compilation-dir=." ] - } - if (!is_win) { - # We don't use clang -cc1as on Windows (yet? https://crbug.com/762167) @@ -130,13 +124,12 @@ Index: chromium-126.0.6478.8/build/config/compiler/BUILD.gn # 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. -@@ -1602,28 +1507,6 @@ config("compiler_deterministic") { +@@ -1572,27 +1481,6 @@ config("compiler_deterministic") { } } -config("clang_revision") { -- if (is_clang && clang_base_path == default_clang_base_path && -- current_os != "zos") { +- if (is_clang && clang_base_path == default_clang_base_path) { - update_args = [ - "--print-revision", - "--verify-version=$clang_version", @@ -159,7 +152,7 @@ Index: chromium-126.0.6478.8/build/config/compiler/BUILD.gn config("rustc_revision") { if (rustc_revision != "") { # Similar to the above config, this is here so that all files get recompiled -@@ -1983,10 +1871,6 @@ config("chromium_code") { +@@ -1959,10 +1847,6 @@ config("chromium_code") { } } else { cflags = [ "-Wall" ] @@ -170,7 +163,7 @@ Index: chromium-126.0.6478.8/build/config/compiler/BUILD.gn # In Chromium code, we define __STDC_foo_MACROS in order to get the # C99 macros on Mac and Linux. -@@ -1995,24 +1879,6 @@ config("chromium_code") { +@@ -1971,24 +1855,6 @@ config("chromium_code") { "__STDC_FORMAT_MACROS", ] @@ -195,7 +188,7 @@ Index: chromium-126.0.6478.8/build/config/compiler/BUILD.gn if (is_apple) { cflags_objc = [ "-Wimplicit-retain-self" ] cflags_objcc = [ "-Wimplicit-retain-self" ] -@@ -2442,7 +2325,8 @@ config("default_stack_frames") { +@@ -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 @@ -203,9 +196,9 @@ Index: chromium-126.0.6478.8/build/config/compiler/BUILD.gn +config("optimize") { } +config("xoptimize") { if (is_win) { - # clang-cl's /O2 corresponds to clang's -O3, and really want -O2 for - # consistency with the other platforms. -@@ -2450,7 +2317,8 @@ config("optimize") { + cflags = [ "/O2" ] + common_optimize_on_cflags + +@@ -2430,7 +2297,8 @@ config("optimize") { } # Turn off optimizations. @@ -215,7 +208,7 @@ Index: chromium-126.0.6478.8/build/config/compiler/BUILD.gn if (is_win) { cflags = [ "/Od", # Disable optimization. -@@ -2490,7 +2358,8 @@ config("no_optimize") { +@@ -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. @@ -225,9 +218,9 @@ Index: chromium-126.0.6478.8/build/config/compiler/BUILD.gn if (is_nacl && is_nacl_irt) { # The NaCl IRT is a special case and always wants its own config. # Various components do: -@@ -2523,7 +2392,8 @@ config("optimize_max") { +@@ -2503,7 +2372,8 @@ config("optimize_max") { # - # TODO(crbug.com/41259697) - rework how all of these configs are related + # 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") { } @@ -235,7 +228,7 @@ Index: chromium-126.0.6478.8/build/config/compiler/BUILD.gn if (is_nacl && is_nacl_irt) { # The NaCl IRT is a special case and always wants its own config. # Various components do: -@@ -2552,7 +2422,8 @@ config("optimize_speed") { +@@ -2529,7 +2399,8 @@ config("optimize_speed") { } } @@ -245,7 +238,7 @@ Index: chromium-126.0.6478.8/build/config/compiler/BUILD.gn cflags = [ "-O1" ] + common_optimize_on_cflags rustflags = [ "-Copt-level=1" ] ldflags = common_optimize_on_ldflags -@@ -2685,7 +2556,8 @@ config("win_pdbaltpath") { +@@ -2662,7 +2533,8 @@ config("win_pdbaltpath") { } # Full symbols. @@ -253,9 +246,9 @@ Index: chromium-126.0.6478.8/build/config/compiler/BUILD.gn +config("symbols") { } +config("xsymbols") { rustflags = [] - configs = [] if (is_win) { -@@ -2835,7 +2707,8 @@ config("symbols") { + 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. @@ -265,7 +258,7 @@ Index: chromium-126.0.6478.8/build/config/compiler/BUILD.gn rustflags = [] if (is_win) { # Functions, files, and line tables only. -@@ -2920,7 +2793,8 @@ config("minimal_symbols") { +@@ -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. diff --git a/chromium-125-debian-bad-font-gc0.patch b/chromium-125-debian-bad-font-gc0.patch new file mode 100644 index 0000000..e140e68 --- /dev/null +++ b/chromium-125-debian-bad-font-gc0.patch @@ -0,0 +1,250 @@ +Revert the following commit: + +commit 886c849ee96e3026d28d7615cdd5af9628a2e5c8 +Author: Ian Kilpatrick +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 + Commit-Queue: Ian Kilpatrick + 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 { + public: +- CSSFontFace(FontFace* font_face, HeapVector&& ranges) +- : ranges_(MakeGarbageCollected(std::move(ranges))), ++ CSSFontFace(FontFace* font_face, Vector& 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 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 ranges_; + HeapHashSet> segmented_font_faces_; + HeapDeque> sources_; +- Member ranges_; + Member 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 ranges; ++ Vector ranges; + if (const auto* range_list = To(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(font_face, std::move(ranges)); ++ return MakeGarbageCollected(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 { + 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 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 font_data_; +- Member range_set_; ++ scoped_refptr 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 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, + 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 vertical_data_; +- Member range_set_; ++ scoped_refptr 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 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&& ranges) +- : ranges_(std::move(ranges)) { ++UnicodeRangeSet::UnicodeRangeSet(const Vector& 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 { ++class PLATFORM_EXPORT UnicodeRangeSet : public RefCounted { ++ USING_FAST_MALLOC(UnicodeRangeSet); ++ + public: +- explicit UnicodeRangeSet(HeapVector&&); ++ explicit UnicodeRangeSet(const Vector&); + 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 +- ranges_; // If empty, represents the whole code space. ++ Vector 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..f6a96eb --- /dev/null +++ b/chromium-125-debian-bad-font-gc00.patch @@ -0,0 +1,159 @@ +Revert the following commit: + +commit 59daae50fc3c47f7a8dbcc828446fdaa9f8c12c4 +Author: Ian Kilpatrick +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 + Reviewed-by: Dominik Röttsches + 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 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 { +@@ -137,6 +138,8 @@ class PLATFORM_EXPORT FontPlatformData + + SkFont CreateSkFont(const FontDescription* = nullptr) const; + ++ scoped_refptr 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 { +- public: +- explicit OpenTypeVerticalData(sk_sp); ++ : public RefCounted { ++ USING_FAST_MALLOC(OpenTypeVerticalData); + +- void Trace(Visitor*) const {} ++ public: ++ static scoped_refptr CreateUnscaled( ++ sk_sp 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); ++ + void LoadMetrics(sk_sp); + 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(font_data); +- OpenTypeVerticalData* vertical_data = hb_font_data->VerticalData(); ++ scoped_refptr 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(font_data); +- OpenTypeVerticalData* vertical_data = hb_font_data->VerticalData(); ++ scoped_refptr 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 VerticalData() { + if (!vertical_data_) { + DCHECK_NE(ascent_fallback_, kInvalidFallbackMetricsValue); + DCHECK_NE(height_fallback_, kInvalidFallbackMetricsValue); + DCHECK_NE(size_per_unit_, kInvalidFallbackMetricsValue); + + vertical_data_ = +- MakeGarbageCollected(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 unscaled_font_; +@@ -100,7 +97,7 @@ struct HarfBuzzFontData final : public G + SpaceGlyphInOpenTypeTables space_in_gsub_ = + SpaceGlyphInOpenTypeTables::kUnknown; + +- Member vertical_data_; ++ scoped_refptr vertical_data_; + Member 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..b2df4eb --- /dev/null +++ b/chromium-125-debian-bad-font-gc000.patch @@ -0,0 +1,107 @@ +Revert the following commit: + +commit 5ffa0446f51e34d06dc0539810a8a5d35ec9e3fc +Author: Ian Kilpatrick +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 + Commit-Queue: Ian Kilpatrick + 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( + 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, + WeakMember, + 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> 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..1ef302e --- /dev/null +++ b/chromium-125-debian-bad-font-gc0000.patch @@ -0,0 +1,425 @@ +Revert the following commit: + + +commit cc6c0b2a9e1dbc96f3ebed713dc71960a29dc4f1 +Author: Ian Kilpatrick +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 + > > Reviewed-by: Dominik Röttsches + > > 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 + > Commit-Queue: Taiyo Mizuhashi + > Owners-Override: Taiyo Mizuhashi + > 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 + Bot-Commit: Rubber Stamper + 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(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 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(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(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 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 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); ++ void AppendFamily(AtomicString family_name, Type family_type); + scoped_refptr 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 Create( +- const AtomicString& family_name, +- Type family_type, +- scoped_refptr next = nullptr) { +- return base::AdoptRef( +- new SharedFontFamily(family_name, family_type, std::move(next))); ++ static scoped_refptr Create() { ++ return base::AdoptRef(new SharedFontFamily); + } + + private: +- SharedFontFamily(const AtomicString& family_name, +- Type family_type, +- scoped_refptr 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 family) { ++ next_ = std::move(family); ++} ++ + inline scoped_refptr 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 arial = SharedFontFamily::Create( +- font_family_names::kArial, FontFamily::Type::kFamilyName); +- scoped_refptr helvetica = SharedFontFamily::Create( +- font_family_names::kHelvetica, FontFamily::Type::kFamilyName, arial); +- scoped_refptr 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 helvetica_neue = SharedFontFamily::Create(); ++ helvetica_neue->SetFamily(font_family_names::kHelveticaNeue, ++ FontFamily::Type::kFamilyName); ++ scoped_refptr helvetica = SharedFontFamily::Create(); ++ helvetica->SetFamily(font_family_names::kHelvetica, ++ FontFamily::Type::kFamilyName); ++ scoped_refptr 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..eedd777 --- /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 +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 + Reviewed-by: Dominik Röttsches + 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 custom_platform_data_; ++ scoped_refptr 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 font_selector_; + + // |nullptr| if font is not loaded or failed to decode. +- Member custom_font_data_; ++ scoped_refptr 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 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 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 font_data_; ++ scoped_refptr 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 return_typeface = base_typeface_; +@@ -304,7 +304,7 @@ String FontCustomPlatformData::FamilyNam + localized_string.fString.size()); + } + +-FontCustomPlatformData* FontCustomPlatformData::Create( ++scoped_refptr 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(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 { ++ : public RefCounted { ++ USING_FAST_MALLOC(FontCustomPlatformData); ++ + public: +- static FontCustomPlatformData* Create(SharedBuffer*, +- String& ots_parse_message); +- FontCustomPlatformData(sk_sp, size_t data_size); ++ static scoped_refptr 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, size_t data_size); + sk_sp 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 font_buffer = SharedBuffer::Create(data, size); + String ots_parse_message; +- FontCustomPlatformData* font_custom_platform_data = ++ scoped_refptr 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 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 custom_platform_data_; ++ scoped_refptr 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..9eb422e --- /dev/null +++ b/chromium-125-debian-bad-font-gc11.patch @@ -0,0 +1,420 @@ +Revert the following commit: + +commit 2eefeabb12fb7e92f2508116a5ed959c57659be1 +Author: Ian Kilpatrick +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 + Commit-Queue: Ian Kilpatrick + 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& global_context_harfbuzz_font_cache = ++ Get().harfbuzz_font_cache_; ++ if (!global_context_harfbuzz_font_cache) { ++ global_context_harfbuzz_font_cache = std::make_unique(); ++ } ++ 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 harfbuzz_font_cache_; + std::unique_ptr font_unique_name_lookup_; + base::HashingLRUCache typeface_digest_cache_; + base::HashingLRUCache +--- 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 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 CreateF + return face; + } + +-namespace { +- +-HarfBuzzFontData* CreateHarfBuzzFontData(hb_face_t* face, +- SkTypeface* typeface) { ++static scoped_refptr CreateHbFontCacheEntry( ++ hb_face_t* face, ++ SkTypeface* typeface) { + hb::unique_ptr 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(unscaled_font); ++ scoped_refptr 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 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 platform_data_; +- Member 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(font)), ++ hb_font_data_(std::make_unique()) {} ++ ++HbFontCacheEntry::~HbFontCacheEntry() = default; ++ ++scoped_refptr 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 ++#include ++ ++#include + + 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 { ++ USING_FAST_MALLOC(HbFontCacheEntry); ++ ++ public: ++ static scoped_refptr 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_; ++ std::unique_ptr 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, +- IntWithZeroKeyHashTraits> +- font_map_; ++ using HbFontDataMap = HashMap, ++ IntWithZeroKeyHashTraits>; ++ ++ 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 { ++struct HarfBuzzFontData final { ++ USING_FAST_MALLOC(HarfBuzzFontData); ++ + public: +- explicit HarfBuzzFontData(hb_font_t* unscaled_font) +- : unscaled_font_(hb::unique_ptr(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 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..eac23ab --- /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 >, WTF::KeyValuePairExtractor, WTF::HashMapValueTraits, WTF::HashTraits > >, WTF::HashTraits, 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(heap::base::Stack*, void*, void const*) () +--Type 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 +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 + Reviewed-by: Dominik Röttsches + Commit-Queue: Ian Kilpatrick + 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 BinaryDataFontFaceSource::CreateFontData( + const FontDescription& font_description, + const FontSelectionCapabilities& font_selection_capabilities) { +- return MakeGarbageCollected( ++ 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::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 CreateFontData( ++ const FontDescription&, ++ const FontSelectionCapabilities&) override; + + scoped_refptr 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 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 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 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 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 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 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 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 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 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 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>; ++ void PruneOldestIfNeeded(); ++ using FontDataTable = HashMap>; ++ using FontCacheKeyAgeList = LinkedHashSet; + + 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 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 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 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 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 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 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 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 resulting_font_data) override; + + void ReportFontLookupByUniqueNameOnly( + const AtomicString& name, + const FontDescription& font_description, +- const SimpleFontData* resulting_font_data, ++ scoped_refptr 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 resulting_font_data) override; + + void ReportLastResortFallbackFontLookup( + const FontDescription& font_description, +- const SimpleFontData* resulting_font_data) override; ++ scoped_refptr 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(capabilities); ++} ++ + CSSSegmentedFontFace::CSSSegmentedFontFace( + FontSelectionCapabilities font_selection_capabilities) + : font_selection_capabilities_(font_selection_capabilities), ++ font_data_table_(kFontDataTableMaxSize), + font_faces_(MakeGarbageCollected()), + 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 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 cached_font_data = it->second; + if (cached_font_data && cached_font_data->NumFaces()) { + return cached_font_data; + } + } + +- SegmentedFontData* created_font_data = +- MakeGarbageCollected(); ++ scoped_refptr 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 face_font_data = + font_face->CssFontFace()->GetFontData(requested_font_description)) { + DCHECK(!face_font_data->IsSegmented()); +- created_font_data->AppendFace(MakeGarbageCollected( +- 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 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 { + 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 GetFontData(const FontDescription&); + + bool CheckFont(UChar32) const; + void Match(const String&, HeapVector>*) const; +@@ -112,11 +113,12 @@ class CSSSegmentedFontFace final + void Trace(Visitor*) const; + + private: ++ void PruneTable(); + bool IsValid() const; + + FontSelectionCapabilities font_selection_capabilities_; + +- HeapHashMap> ++ base::HashingLRUCache> + 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( +- 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 ++LocalFontFaceSource::CreateLoadingFallbackFontData( + const FontDescription& font_description) { + FontCachePurgePreventer font_cache_purge_preventer; +- const SimpleFontData* temporary_font = +- FontCache::Get().GetLastResortFallbackFont(font_description); ++ scoped_refptr temporary_font = ++ FontCache::Get().GetLastResortFallbackFont(font_description, ++ kDoNotRetain); + if (!temporary_font) { + NOTREACHED(); + return nullptr; + } +- CSSCustomFontData* css_font_data = MakeGarbageCollected( +- this, CSSCustomFontData::kVisibleFallback); +- return MakeGarbageCollected(&temporary_font->PlatformData(), +- css_font_data); ++ scoped_refptr css_font_data = ++ CSSCustomFontData::Create(this, CSSCustomFontData::kVisibleFallback); ++ return SimpleFontData::Create(temporary_font->PlatformData(), css_font_data); + } + +-const SimpleFontData* LocalFontFaceSource::CreateFontData( ++scoped_refptr 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 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 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 CreateLoadingFallbackFontData( ++ const FontDescription&); + + private: +- const SimpleFontData* CreateFontData( ++ scoped_refptr 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 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 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 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( ++ 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::Create()); + } + +-const SimpleFontData* RemoteFontFaceSource::CreateLoadingFallbackFontData( ++scoped_refptr ++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 temporary_font = ++ FontCache::Get().GetLastResortFallbackFont(font_description, ++ kDoNotRetain); + if (!temporary_font) { + DUMP_WILL_BE_NOTREACHED_NORETURN(); + return nullptr; + } +- CSSCustomFontData* css_font_data = MakeGarbageCollected( ++ scoped_refptr css_font_data = CSSCustomFontData::Create( + this, period_ == kBlockPeriod ? CSSCustomFontData::kInvisibleFallback + : CSSCustomFontData::kVisibleFallback); +- return MakeGarbageCollected(&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 CreateFontData( + const FontDescription&, + const FontSelectionCapabilities&) override; +- const SimpleFontData* CreateLoadingFallbackFontData(const FontDescription&); ++ scoped_refptr 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 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 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> FilterD + } + + void CollectPlatformFontsFromRunFontDataList( +- const HeapVector& run_font_data_list, ++ const Vector& run_font_data_list, + HashMap, std::pair>* 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 run_font_data_list; +- ClearCollectionScope clear_scope(&run_font_data_list); ++ Vector 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> fallback_fonts; +- ClearCollectionScope clear_scope(&fallback_fonts); ++ HashSet 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 Adjus + primary_font_data->GetFontMetrics().FixedAscent(font_baseline); + const LayoutUnit primary_descent = line_height - primary_ascent; + ++ DCHECK(IsMainThread()); ++ DEFINE_STATIC_LOCAL(Vector, 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 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 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 run_fonts; +- ClearCollectionScope clear_scope(&run_fonts); ++ Vector 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> fallback_font_data; +- ClearCollectionScope clear_scope(&fallback_font_data); ++ HashSet 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 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 FontCache::CreateLocal + return nullptr; + } + +-const SimpleFontData* FontCache::PlatformFallbackFontForCharacter( ++scoped_refptr 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 { ++class PLATFORM_EXPORT CustomFontData : public RefCounted { + public: +- CustomFontData() = default; ++ static scoped_refptr 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 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 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 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 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 + + #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 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 GetFontData( + const FontDescription&, + const AtomicString&, +- AlternateFontName = AlternateFontName::kAllowAlternate); +- const SimpleFontData* GetLastResortFallbackFont(const FontDescription&); ++ AlternateFontName = AlternateFontName::kAllowAlternate, ++ ShouldRetain = kRetain); ++ scoped_refptr 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 GetFallbackFamilyNameFromHardcodedChoices( + const FontDescription&, + UChar32 codepoint, + FontFallbackPriority fallback_priority); + +- const SimpleFontData* GetDWriteFallbackFamily( ++ scoped_refptr 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 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 SimpleFontData* PlatformFallbackFontForCharacter( ++ scoped_refptr 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 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 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> font_cache_clients_; +- FontPlatformDataCache font_platform_data_cache_; ++ std::unique_ptr font_platform_data_cache_; + HeapHashMap, + FallbackListCompositeKeyTraits> + fallback_list_shaper_cache_; + +- FontDataCache font_data_cache_; ++ std::unique_ptr font_data_cache_; + + Member 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( +- 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 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 { ++class PLATFORM_EXPORT FontData : public RefCounted { + 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::Create() { ++ return std::make_unique(); ++} ++ ++scoped_refptr 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( +- platform_data, nullptr, subpixel_ascent_descent); ++ Cache::iterator result = cache_.find(platform_data); ++ if (result == cache_.end()) { ++ std::pair, 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 is_purging_auto_reset(&is_purging_, true); ++ ++ Vector, 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& 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 { + 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 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 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, +- WeakMember, +- FontDataCacheKeyHashTraits> +- cache_; ++ bool PurgeLeastRecentlyUsed(int count); ++ ++ typedef HashMap, unsigned>, ++ FontDataCacheKeyHashTraits> ++ Cache; ++ ++ Cache cache_; ++ LinkedHashSet> 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 { ++ : public RefCounted { + public: + explicit FontDataForRangeSet( +- const SimpleFontData* font_data = nullptr, ++ scoped_refptr font_data = nullptr, + scoped_refptr 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 font_data_; ++ scoped_refptr font_data_; + scoped_refptr range_set_; + }; + ++class PLATFORM_EXPORT FontDataForRangeSetFromCache ++ : public FontDataForRangeSet { ++ public: ++ explicit FontDataForRangeSetFromCache( ++ scoped_refptr font_data, ++ scoped_refptr 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 FontFallbackIterator::UniqueOrNext( ++ scoped_refptr candidate, + const Vector& 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 FontFallbackIterator::Next( + const Vector& hint_list) { + if (fallback_stage_ == kOutOfLuck) +- return MakeGarbageCollected(); ++ 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( +- FallbackPriorityFont(hint_list[0])); ++ scoped_refptr 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 system_font = UniqueSystemFontForHintList(hint_list); + if (system_font) { + // Fallback fonts are not retained in the FontDataCache. +- return UniqueOrNext( +- MakeGarbageCollected(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 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(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 non_segmented = + const_cast(To(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(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 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 FontFallbackIterator::FallbackPriorityFont( ++ UChar32 hint) { ++ scoped_refptr 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 FontFallbackIterator::UniqueSystemFontForHintList( + const Vector& 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 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& hint_list); ++ scoped_refptr Next(const Vector& 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& hint_list); ++ scoped_refptr UniqueOrNext( ++ scoped_refptr candidate, ++ const Vector& hint_list); + +- const SimpleFontData* FallbackPriorityFont(UChar32 hint); +- const SimpleFontData* UniqueSystemFontForHintList( ++ scoped_refptr FallbackPriorityFont(UChar32 hint); ++ scoped_refptr UniqueSystemFontForHintList( + const Vector& 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 unique_font_data_for_range_sets_returned_; +- FontDataForRangeSet* first_candidate_ = nullptr; +- HeapVector> tracked_loading_range_sets_; ++ scoped_refptr first_candidate_; ++ Vector> 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(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 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 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(result)); ++ DynamicTo(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 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 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 GetFontData(const FontDescription&); + + const SimpleFontData* DeterminePrimarySimpleFontData(const FontDescription&); + const SimpleFontData* DeterminePrimarySimpleFontDataCore( +@@ -124,8 +125,8 @@ class PLATFORM_EXPORT FontFallbackList + + bool ComputeCanShapeWordByWord(const FontDescription&); + +- HeapVector, 1> font_list_; +- Member cached_primary_simple_font_data_ = nullptr; ++ Vector, 1> font_list_; ++ const SimpleFontData* cached_primary_simple_font_data_ = nullptr; + const Member 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(this, UniqueID()); ++ harfbuzz_face_ = ++ HarfBuzzFace::Create(const_cast(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 { ++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 harfbuzz_face_; ++ mutable scoped_refptr 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::Create() { ++ return std::make_unique(); ++} ++ + FontPlatformDataCache::FontPlatformDataCache() + : font_size_limit_(std::nextafter( + (static_cast(std::numeric_limits::max()) - 2.f) / + static_cast(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 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(*result)); + return result; + } + + return nullptr; + } + ++size_t FontPlatformDataCache::ByteSize() const { ++ return map_.size() * sizeof(std::unique_ptr); ++} ++ ++void FontPlatformDataCache::Clear() { ++ map_.clear(); ++} ++ ++void FontPlatformDataCache::Purge(const FontDataCache& font_data_cache) { ++ Vector 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 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> map_; ++ HashMap> 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 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 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 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 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 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 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( ++ auto font_data = std::make_unique( + 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 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 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(*substitute_platform_data); ++ std::unique_ptr 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 Create() { ++ return base::AdoptRef(new SegmentedFontData); + } + +- void AppendFace(FontDataForRangeSet* font_data_for_range_set) { ++ void AppendFace(scoped_refptr 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 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, 1> faces_; ++ Vector, 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 CachingWordShaper::Indivi + total_width); + } + +-HeapVector CachingWordShaper::GetRunFontData( ++Vector 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 IndividualCharacterAdvances(const TextRun&); + +- HeapVector GetRunFontData(const TextRun&) const; ++ Vector 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 CreateFace( +- const FontPlatformData* platform_data) { ++static hb::unique_ptr CreateFace(FontPlatformData* platform_data) { + hb::unique_ptr face; + + sk_sp typeface = sk_ref_sp(platform_data->Typeface()); +@@ -475,9 +469,8 @@ static scoped_refptr 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 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 +@@ -53,15 +52,19 @@ + // |HarfBuzzFace| is a thread specific data associated to |FontPlatformData|, + // hold by |HarfBuzzFontCache|. + class PLATFORM_EXPORT HarfBuzzFace final +- : public GarbageCollected { ++ : public RefCounted { ++ USING_FAST_MALLOC(HarfBuzzFace); ++ + public: +- HarfBuzzFace(const FontPlatformData* platform_data, uint64_t); ++ static scoped_refptr 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 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 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 deprecated_ink_bounds_; +- Vector runs_; +- Vector character_position_; +- UntracedMember primary_font_; ++ UntracedMember member; ++ Vector 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 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* font_data) const { ++void ShapeResult::GetRunFontData(Vector* 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(primary_font_.Get(), 0, 0, Direction()); ++ MakeGarbageCollected(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 { + public: +- ShapeResult(const SimpleFontData*, ++ ShapeResult(scoped_refptr, + 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(other.primary_font_.Get(), 0, 0, ++ return MakeGarbageCollected(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 font_data_; ++ SimpleFontData* font_data_; + wtf_size_t glyph_count_; + }; +- void GetRunFontData(HeapVector* font_data) const; ++ void GetRunFontData(Vector* 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 character_position_; +- Member primary_font_; ++ scoped_refptr 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 ShapeResultBuffer::GetRunFontData() const { +- HeapVector font_data; ++Vector ShapeResultBuffer::GetRunFontData() const { ++ Vector 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 GetRunFontData() const; ++ Vector 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( +- 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( +- 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 font_data_; ++ scoped_refptr 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 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::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 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( +- 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* font_data) const { ++ Vector* 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(part.end() - part.begin())})); + } + } + + void ShapeResultView::FallbackFonts( +- HeapHashSet>* fallback) const { ++ HashSet* 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>* fallback) const; ++ void FallbackFonts(HashSet* 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*) const; ++ scoped_refptr PrimaryFont() const { ++ return primary_font_; ++ } ++ void GetRunFontData(Vector*) 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 parts_; +- Member const primary_font_; ++ scoped_refptr 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 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 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::SmallCapsFontData( + const FontDescription& font_description) const { +- if (!small_caps_) { +- small_caps_ = ++ if (!derived_font_data_) ++ derived_font_data_ = std::make_unique(); ++ 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::EmphasisMarkFontData( + const FontDescription& font_description) const { +- if (!emphasis_mark_) { +- emphasis_mark_ = ++ if (!derived_font_data_) ++ derived_font_data_ = std::make_unique(); ++ 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::CreateScaledFontData( + const FontDescription& font_description, + float scale_factor) const { + const float scaled_size = + lroundf(font_description.ComputedSize() * scale_factor); +- return MakeGarbageCollected( +- MakeGarbageCollected(*platform_data_, scaled_size), +- IsCustomFont() ? MakeGarbageCollected() : nullptr); ++ return SimpleFontData::Create( ++ FontPlatformData(platform_data_, scaled_size), ++ IsCustomFont() ? CustomFontData::Create() : nullptr); + } + +-SimpleFontData* SimpleFontData::MetricsOverriddenFontData( ++scoped_refptr SimpleFontData::MetricsOverriddenFontData( + const FontMetricsOverride& metrics_override) const { +- return MakeGarbageCollected( +- 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 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& 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* 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 Create( ++ const FontPlatformData& platform_data, ++ scoped_refptr 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 SmallCapsFontData(const FontDescription&) const; ++ scoped_refptr EmphasisMarkFontData( ++ const FontDescription&) const; ++ scoped_refptr 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 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 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 platform_data_; ++ const FontPlatformData platform_data_; + const SkFont font_; + + Glyph space_glyph_ = 0; + float space_width_ = 0; + Glyph zero_glyph_ = 0; + +- mutable Member small_caps_; +- mutable Member 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 small_caps; ++ scoped_refptr emphasis_mark; ++ }; ++ ++ mutable std::unique_ptr derived_font_data_; + +- Member custom_font_data_; ++ const scoped_refptr 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 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(*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 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 FontCache::CreateTypeface( +@@ -238,7 +239,7 @@ sk_sp FontCache::CreateTypef + } + + #if !BUILDFLAG(IS_WIN) +-const FontPlatformData* FontCache::CreateFontPlatformData( ++std::unique_ptr 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( +- typeface, name, font_size, synthetic_bold, synthetic_italic, +- font_description.TextRendering(), resolved_font_features, +- font_description.Orientation()); ++ std::unique_ptr font_platform_data = ++ std::make_unique( ++ 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 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( +- platform_data, MakeGarbageCollected()); ++ 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 resulting_font_data) override {} + void ReportFontLookupByUniqueNameOnly( + const AtomicString& name, + const FontDescription& font_description, +- const SimpleFontData* resulting_font_data, ++ scoped_refptr 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 resulting_font_data) override {} + void ReportLastResortFallbackFontLookup( + const FontDescription& font_description, +- const SimpleFontData* resulting_font_data) override {} ++ scoped_refptr 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 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 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 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..f6726ae --- /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 +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 + Commit-Queue: Ian Kilpatrick + 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-emplace-struct.patch b/chromium-125-emplace-struct.patch new file mode 100644 index 0000000..273169c --- /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 { + 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 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 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..c695843 --- /dev/null +++ b/chromium-125-lens-include.patch @@ -0,0 +1,25 @@ +commit 251c365ea2c268a475f91c9913fabba6b41e2b6b +Author: Jose Dapena Paz +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 + Commit-Queue: José Dapena Paz + 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 + #include + + #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..5916362 --- /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* Fin + template >::element_type> ++ typename std::pointer_traits>::element_type> + constexpr const MappedElementType* FindPtrOrNull(const Map& map, + const Key& key) { + auto it = map.find(key); +@@ -60,7 +60,7 @@ + template >::element_type> ++ typename std::pointer_traits>::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 + struct ParamCanBeBound { + private: +- using UnwrappedParam = BindArgument::template ForwardedAs< ++ using UnwrappedParam = typename BindArgument::template ForwardedAs< + Unwrapped>::template ToParamWithType; +- using ParamStorage = BindArgument::template ToParamWithType< ++ using ParamStorage = typename BindArgument::template ToParamWithType< + Param>::template StoredAs; +- using BoundStorage = ++ using BoundStorage = typename + BindArgument::template BoundAs::template StoredAs; + + template +-SortedItems::const_iterator GetLastIter(const SortedItems& cache) { ++typename SortedItems::const_iterator GetLastIter(const SortedItems& cache) { + CHECK(!cache.empty()); + auto it = cache.end(); + return std::prev(it); +@@ -1090,9 +1090,9 @@ bool DownloadBubbleUpdateService::CacheM + } + + template +-SortedItems::iterator ++typename SortedItems::iterator + DownloadBubbleUpdateService::CacheManager::RemoveItemFromCacheByIter( +- SortedItems::iterator iter, ++ typename SortedItems::iterator iter, + SortedItems& cache, + IterMap& 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(request_metadata); ++ static_cast(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 +- 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::ConstRefInputVector inputs) ++ typename ModelExecutor::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> SendForBatchExecutionSync( +- ModelExecutor::ConstRefInputVector inputs) ++ typename ModelExecutor::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::ConstRefInputVector inputs) { ++ typename ModelExecutor::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::ConstRefInputVector inputs, ++ typename ModelExecutor::ConstRefInputVector inputs, + std::vector>* 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::ConstRefInputVector inputs, ++ typename ModelExecutor::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 + { c[i] } -> std::same_as; + } + struct ArrayTraits { +- 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; + using USpan = base::span; + // 32 matches that used by HTMLToken::Attribute. +- typedef std::conditional, ++ typedef typename std::conditional, + UCharLiteralBuffer<32>, + LCharLiteralBuffer<32>>::type LiteralBufferType; + static_assert(std::is_same_v || std::is_same_v); +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 + class FunctionRef { + template ::RunType> ++ typename RunType = typename internal::FunctorTraits::RunType> + static constexpr bool kCompatibleFunctor = + std::convertible_to, R> && + std::same_as, internal::TypeList>; +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, + "HeapArray cannot hold reference types"); + +- using iterator = base::span::iterator; +- using const_iterator = base::span::iterator; ++ using iterator = typename base::span::iterator; ++ using const_iterator = typename base::span::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 + using VecPtrLikeUnderlyingValueType = +- std::pointer_traits>::element_type; ++ typename std::pointer_traits>::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::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::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 { + public: + using absl::FixedArray::FixedArray; +- explicit FixedArray(absl::FixedArray::size_type n, +- const absl::FixedArray::allocator_type& a = ++ explicit FixedArray(typename absl::FixedArray::size_type n, ++ const typename absl::FixedArray::allocator_type& a = + typename absl::FixedArray::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 + 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 + class WebAppCommand : public internal::CommandWithLock { + public: +- using LockDescription = LockType::LockDescription; ++ using LockDescription = typename LockType::LockDescription; + using CallbackType = base::OnceCallback; + using ShutdownArgumentsTuple = std::tuple...>; + +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 + void ScheduleCallback(const std::string& operation_name, +- LockType::LockDescription lock_description, ++ typename LockType::LockDescription lock_description, + CallbackCommand callback, + base::OnceClosure on_complete, + const base::Location& location = FROM_HERE) { +@@ -381,7 +381,7 @@ class WebAppCommandScheduler { + typename CallbackReturnValue = std::decay_t> + void ScheduleCallbackWithResult( + const std::string& operation_name, +- LockType::LockDescription lock_description, ++ typename LockType::LockDescription lock_description, + CallbackCommand callback, + base::OnceCallback 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::Callback callback) override { ++ void Start(typename ProtoFetcher::Callback callback) override { + callback_ = std::move(callback); + Retry(); + } +@@ -469,7 +469,7 @@ class RetryingFetcherImpl final : public + } + + // Client callback. +- TypedProtoFetcher::Callback callback_; ++ typename TypedProtoFetcher::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; +- using KeyType = base::IDMap>::KeyType; ++ using KeyType = typename base::IDMap>::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..05c4766 --- /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 + #include + #include + #include +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 + #include + #include + #include +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 + #include + #include ++#include + + #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 + #include + + #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 ++#include + + #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 ++ + // 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 + #include + #include + #include +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 + #include + #include + #include +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 + #include "cpp/palettes/tones.h" + + #include +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 + #include + #include + #include +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 ++#include + #include + #include + #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 + #include + #include + #include +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 + static inline void VmaUint32ToStr(char* VMA_NOT_NULL outStr, size_t strLen, uint32_t num) + { + snprintf(outStr, strLen, "%u", static_cast(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 ++ + #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 + #include + + #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 ++ + 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 + ++#include ++ + #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 ++#include + #include + #include + #include +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 + ++#include ++ + #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 + ++#include ++ + #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..546e7c2 --- /dev/null +++ b/chromium-125-mojo-bindings-include.patch @@ -0,0 +1,25 @@ +commit 39735a1167272326da5ff85e0096b52ca7f47d6c +Author: Jose Dapena Paz +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 + Commit-Queue: Ken Rockot + 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 + + #include ++#include + #include + #include + diff --git a/chromium-125-ninja.patch b/chromium-125-ninja.patch new file mode 100644 index 0000000..5032472 --- /dev/null +++ b/chromium-125-ninja.patch @@ -0,0 +1,27 @@ +commit a976cb05b4024b7a6452d1541378d718cdfe33e6 +Author: Takuto Ikuta +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 + Commit-Queue: Takuto Ikuta + Reviewed-by: Danil Somsikov + Commit-Queue: Danil Somsikov + 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..32d9400 --- /dev/null +++ b/chromium-125-no-vector-consts.patch @@ -0,0 +1,259 @@ +commit 0bed9a54baa5058e711a1f051a766f67e1842ec5 +Author: Jose Dapena Paz +Date: Tue Apr 16 10:59:08 2024 +0000 + + Remove more instances of std::vector + + Bug: 323708866 + Change-Id: I50ef671f18f0d152ecccbf0f345f84db005c06d7 + Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5440252 + Reviewed-by: Yuzhu Shen + Reviewed-by: Vasilii Sukhanov + Commit-Queue: José Dapena Paz + Reviewed-by: Matthew Jones + 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 specifics_urls; ++ std::vector 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 std::vector + ProductSpecificationsService::GetAllProductSpecifications() { +- std::vector product_specifications; ++ std::vector product_specifications; + for (auto& entry : bridge_->entries()) { +- std::vector urls; ++ std::vector urls; + for (auto& data : entry.second.data()) { + urls.emplace_back(data.url()); + } +@@ -43,7 +43,7 @@ ProductSpecificationsService::GetAllProductSpecifications() { + const std::optional + ProductSpecificationsService::AddProductSpecificationsSet( + const std::string& name, +- const std::vector& urls) { ++ const std::vector& urls) { + // TODO(crbug.com/332545064) add for a product specification set being added. + std::optional 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 + GetSyncControllerDelegate(); + +- const std::vector +- GetAllProductSpecifications(); ++ const std::vector GetAllProductSpecifications(); + + // Add new product specifications set called |name| with product pages + // corresponding to |urls|. + const std::optional + AddProductSpecificationsSet(const std::string& name, +- const std::vector& urls); ++ const std::vector& 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 specifics_urls; ++ std::vector 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 urls; ++ std::vector 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 specifications = ++ const std::vector 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 expected_product_urls{GURL(kProductOneUrl), +- GURL(kProductTwoUrl)}; ++ std::vector 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& urls, ++ const std::vector& 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 urls; ++ std::vector 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& urls, ++ const std::vector& 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& urls() const { return urls_; } ++ const std::vector& 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 urls_; ++ const std::vector 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 + ProductSpecificationsSyncBridge::AddProductSpecifications( + const std::string& name, +- const std::vector& urls) { ++ const std::vector& 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 + AddProductSpecifications(const std::string& name, +- const std::vector& urls); ++ const std::vector& 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 AddProductSpecifications( + const std::string& name, +- const std::vector urls) { ++ const std::vector 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 std::vector + 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 ++ virtual const std::vector + 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 copy(as_span.begin(), as_span.end()); ++ const std::vector 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..909dd11 --- /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* 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_mapinsert(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(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(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 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 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::GetButtonsConfiguration() const { + std::vector 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::GetButtonsConfiguration() const { + std::vector 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::GetButtonsConfiguration() const { + std::vector 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 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 DoGet + return std::nullopt; + } + +- return DebugReportCooldown(cooldown_debugging_only_report.ColumnTime(0), ++ return DebugReportCooldown{cooldown_debugging_only_report.ColumnTime(0), + static_cast( +- cooldown_debugging_only_report.ColumnInt(1))); ++ cooldown_debugging_only_report.ColumnInt(1))}; + } + + void DoGetDebugReportCooldowns( +@@ -3406,10 +3406,10 @@ DoGetKAnonymityData(sql::Database& db, + + std::vector 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 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 + color_interpolation_space, hue_interpolation_method, start_color, + end_color, percentage, alpha_multiplier); + +- FontPalette::FontPaletteOverride result_color_record(i, result_color); ++ FontPalette::FontPaletteOverride result_color_record{static_cast(i), result_color}; + result_color_records.push_back(result_color_record); + } + return result_color_records; +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_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_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_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_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(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 Address + } + + base::span observations_data = s.ColumnBlob(3); +- field_type_values.emplace_back( ++ field_type_values.emplace_back() = { + type, s.ColumnString16(1), s.ColumnInt(2), + std::vector(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>(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 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 + 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 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..731e78b --- /dev/null +++ b/chromium-125-tabstrip-include.patch @@ -0,0 +1,26 @@ +commit 2958f58a84ebaacce716929f1cc4ba4a8076daee +Author: Ivan Murashov +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 + Reviewed-by: Dana Fried + Commit-Queue: Ivan Murashov + 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 + #include + #include ++#include + #include + + #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..3ce543a --- /dev/null +++ b/chromium-125-vulkan-include.patch @@ -0,0 +1,16 @@ +commit bbd4b7752f0a9e5f486fa55c9f2b80071ef99d01 +Author: lauren n. liberda +Date: Thu Apr 25 04:24:47 2024 +0200 + + iwyu: missing #include 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 ++#include + #include + #include + diff --git a/chromium-125.0.6422.60.tar.xz b/chromium-125.0.6422.60.tar.xz new file mode 100644 index 0000000..b246c30 --- /dev/null +++ b/chromium-125.0.6422.60.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:93f5850101225945d7ec80959b38460e6a63777055bf2d9e893860c33cb60080 +size 3453234996 diff --git a/chromium-127-clang17-traitors.patch b/chromium-127-clang17-traitors.patch deleted file mode 100644 index f736fc7..0000000 --- a/chromium-127-clang17-traitors.patch +++ /dev/null @@ -1,285 +0,0 @@ -author: Andres Salomon - -Work around the following: - -In file included from ../../mojo/public/cpp/bindings/lib/native_s:32 -truct_serialization.cc:5: -In file included from ../../mojo/public/cpp/bindings/lib/native_struct_serialization.h:13: -In file included from ../../base/check_op.h:9: -In file included from /usr/bin/../include/c++/v1/string:545: -In file included from /usr/bin/../include/c++/v1/__functional/hash.h:24: -In file included from /usr/bin/../include/c++/v1/__utility/pair.h:16: -In file included from /usr/bin/../include/c++/v1/__fwd/get.h:16: -In file included from /usr/bin/../include/c++/v1/__fwd/subrange.h:20: -In file included from /usr/bin/../include/c++/v1/__iterator/concepts.h:34: -/usr/bin/../include/c++/v1/__memory/pointer_traits.h:118:22: error: implicit instantiation of undefined template 'std::__pointer_traits_element_type' - typedef typename __pointer_traits_element_type::type element_type; - ^ -../../base/types/to_address.h:32:40: note: in instantiation of template class 'std::pointer_traits' requested here - requires requires(const P& p) { std::pointer_traits

::to_address(p); } || - ^ -../../base/types/to_address.h:32:35: note: in instantiation of requirement here -../../mojo/public/cpp/bindings/lib/native_struct_serialization.cc requires requires(const P& p) { std::pointer_traits

::to_address(p); } || - ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -../../base/types/to_address.h:32:12: note: while substituting template arguments into constraint expression here - requires requires(const P& p) { std::pointer_traits

::to_address(p); } || - ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -../../mojo/public/cpp/bindings/type_converter.h:103:26: note: while checking constraint satisfaction for template 'to_address' required here - { mojo::ConvertTo(base::to_address(obj)) } -> std::same_as; - ^~~~ - - -This turns out to be a clang-16 bug, fixed in clang-18: -https://github.com/llvm/llvm-project/issues/67449 - -This is just the pointer_traits.h header from libc++-18-dev, -with a minor tweak to get things building. - ---- /dev/null -+++ b/__memory/pointer_traits.h -@@ -0,0 +1,245 @@ -+// -*- C++ -*- -+//===----------------------------------------------------------------------===// -+// -+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -+// See https://llvm.org/LICENSE.txt for license information. -+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -+// -+//===----------------------------------------------------------------------===// -+ -+#ifndef _LIBCPP___MEMORY_POINTER_TRAITS_H -+#define _LIBCPP___MEMORY_POINTER_TRAITS_H -+ -+#include <__config> -+#include <__memory/addressof.h> -+#include <__type_traits/conditional.h> -+#include <__type_traits/conjunction.h> -+#include <__type_traits/decay.h> -+#include <__type_traits/is_class.h> -+#include <__type_traits/is_function.h> -+#include <__type_traits/is_void.h> -+#include <__type_traits/void_t.h> -+#include <__utility/declval.h> -+#include -+ -+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -+# pragma GCC system_header -+#endif -+ -+_LIBCPP_BEGIN_NAMESPACE_STD -+ -+template -+struct __has_element_type : false_type {}; -+ -+template -+struct __has_element_type<_Tp, __void_t > : true_type {}; -+ -+template ::value> -+struct __pointer_traits_element_type {}; -+ -+template -+struct __pointer_traits_element_type<_Ptr, true> { -+ typedef _LIBCPP_NODEBUG typename _Ptr::element_type type; -+}; -+ -+template