Clear image map entry on node disposal or off from the layout [chromium/src : main]

0 views
Skip to first unread message

Seokho Song (Gerrit)

unread,
Apr 2, 2026, 10:10:47 PM (12 days ago) Apr 2
to Florin Malita, AyeAye, chrom...@appspot.gserviceaccount.com, Manuel Rego, Ian Kilpatrick, Chromium LUCI CQ, Menard, Alexis, chromium...@chromium.org, Dirk Schulze, Olga Gerchikov, Stephen Chenney, blink-revie...@chromium.org, blink-revie...@chromium.org, blink-re...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, kinuko...@chromium.org, zol...@webkit.org
Attention needed from Florin Malita, Ian Kilpatrick and Stephen Chenney

Seokho Song added 1 comment

File third_party/blink/renderer/core/dom/node.cc
Line 350, Patchset 13:void Node::DisposeNode() {
Ian Kilpatrick . unresolved

Please run this against speedometer3 - this may affect benchmark performance if done with a pre-finalizer.

Seokho Song

In Speedometer3, with the exception of `TodoMVC-jQuery`, the other metrics appear unchanged. The `TodoMVC-jQuery` case is roughly 5ms slower (e.g., 182.594ms -> 187.396ms). Please check [the pinpoint results](https://pinpoint-dot-chromeperf.appspot.com/job/1132f46b090000).

However, test cases that handle edge-cases are significantly slower, and the regressions are surprisingly platform-specific:

* Mac: `fast/overflow/lots-of-sibling-inline-boxes.html` regressed from 2.3s to 13s.

* Linux: `external/wpt/html/select/options-length-too-large.html` regressed from 57s to 72s.

I think this could cause serious performance issues.

To address this, I've modified the approach. I changed it to use a prefinalizer for the `NodeImages` class (which is hold from the rare data) to avoid overhead of creating and invoking prefinalizers for every single node.
Open in Gerrit

Related details

Attention is currently required from:
  • Florin Malita
  • Ian Kilpatrick
  • Stephen Chenney
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ib3c0764d55a698a9adcdca2fce18c56a9642b07a
Gerrit-Change-Number: 7692355
Gerrit-PatchSet: 25
Gerrit-Owner: Seokho Song <seo...@chromium.org>
Gerrit-Reviewer: Florin Malita <fma...@chromium.org>
Gerrit-Reviewer: Seokho Song <seo...@chromium.org>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Ian Kilpatrick <ikilp...@chromium.org>
Gerrit-CC: Manuel Rego <re...@igalia.com>
Gerrit-CC: Menard, Alexis <alexis...@intel.com>
Gerrit-CC: Olga Gerchikov <gerc...@microsoft.com>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Ian Kilpatrick <ikilp...@chromium.org>
Gerrit-Attention: Florin Malita <fma...@chromium.org>
Gerrit-Comment-Date: Fri, 03 Apr 2026 02:10:12 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Ian Kilpatrick <ikilp...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Florin Malita (Gerrit)

unread,
Apr 6, 2026, 12:32:41 PM (8 days ago) Apr 6
to Seokho Song, Ian Kilpatrick, AyeAye, chrom...@appspot.gserviceaccount.com, Manuel Rego, Chromium LUCI CQ, Menard, Alexis, chromium...@chromium.org, Dirk Schulze, Olga Gerchikov, Stephen Chenney, blink-revie...@chromium.org, blink-revie...@chromium.org, blink-re...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, kinuko...@chromium.org, zol...@webkit.org
Attention needed from Ian Kilpatrick, Seokho Song and Stephen Chenney

Florin Malita added 4 comments

Patchset-level comments
File-level comment, Patchset 26 (Latest):
Florin Malita . resolved

At a high level, it seems we are adding a lot of complexity to support this feature. Specifically, the spec part that requires us to track data for normal images maybe should be revisited.

Ian's suggestion to use existing animation mechanisms if possible makes a lot of sense. I'm not familiar with the specifics and can't offer actionable advice on that front though.

File third_party/blink/renderer/core/dom/node_images.cc
Line 17, Patchset 26 (Latest): }
Florin Malita . unresolved

What about invalidated weakptrs, should we clean them up at some point?

File third_party/blink/renderer/core/paint/box_painter_base.cc
Line 971, Patchset 26 (Latest): BindRepeating(
Florin Malita . unresolved

I think `BindRepeating` performs some allocations, so I'm kinda wary of doing this on every paint.

Naively, do we need a callback at all? Can't `PaintImageForCurrentFrameWithInfo` execute the steps directly?

File third_party/blink/renderer/platform/graphics/image.h
Line 391, Patchset 26 (Latest): base::WeakPtrFactory<Image> weak_factory_{this};
Florin Malita . unresolved

`Image`s are `ThreadSafeRefCounted`, which means we can drop them from any thread (background decoding, worker threads, main thread, etc).

`WeakPtr`s OTOH are [thread-bound](https://source.chromium.org/chromium/chromium/src/+/main:base/memory/weak_ptr.h;drc=d1a2bfde021c2bc6500bd2ef11b4e7e786840149;l=50), and expected to be dereferenced and invalidated from a single/stable thread.

IIUC we can't mix them safely.

Open in Gerrit

Related details

Attention is currently required from:
  • Ian Kilpatrick
  • Seokho Song
  • Stephen Chenney
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ib3c0764d55a698a9adcdca2fce18c56a9642b07a
Gerrit-Change-Number: 7692355
Gerrit-PatchSet: 26
Gerrit-Owner: Seokho Song <seo...@chromium.org>
Gerrit-Reviewer: Florin Malita <fma...@chromium.org>
Gerrit-Reviewer: Ian Kilpatrick <ikilp...@chromium.org>
Gerrit-Reviewer: Seokho Song <seo...@chromium.org>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Manuel Rego <re...@igalia.com>
Gerrit-CC: Menard, Alexis <alexis...@intel.com>
Gerrit-CC: Olga Gerchikov <gerc...@microsoft.com>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Ian Kilpatrick <ikilp...@chromium.org>
Gerrit-Attention: Seokho Song <seo...@chromium.org>
Gerrit-Comment-Date: Mon, 06 Apr 2026 16:32:30 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Seokho Song (Gerrit)

unread,
Apr 7, 2026, 3:14:50 AM (7 days ago) Apr 7
to Ian Kilpatrick, Florin Malita, AyeAye, chrom...@appspot.gserviceaccount.com, Manuel Rego, Chromium LUCI CQ, Menard, Alexis, chromium...@chromium.org, Dirk Schulze, Olga Gerchikov, Stephen Chenney, blink-revie...@chromium.org, blink-revie...@chromium.org, blink-re...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, kinuko...@chromium.org, zol...@webkit.org
Attention needed from Florin Malita, Ian Kilpatrick and Stephen Chenney

Seokho Song added 5 comments

Patchset-level comments
Florin Malita . resolved

At a high level, it seems we are adding a lot of complexity to support this feature. Specifically, the spec part that requires us to track data for normal images maybe should be revisited.

Ian's suggestion to use existing animation mechanisms if possible makes a lot of sense. I'm not familiar with the specifics and can't offer actionable advice on that front though.

Seokho Song

Integrating this into an existing module (like `core/animations`, perhaps?) sounds good, but it seems like a very large project since image animations are fully managed by the cc layer. Therefore, I think this should be a long-term goal.

The spec part is quite minimal, as we mainly just need to consider what happens if a running or paused image goes back to layout. These behaviors are adopted from other specs like CSS Animations. However, we need to think about whether we can fully adopt their approach. FYI, Ian also filed an issue with the CSSWG: [https://github.com/w3c/csswg-drafts/issues/13745](https://github.com/w3c/csswg-drafts/issues/13745)

File third_party/blink/renderer/core/dom/node_images.cc
Line 17, Patchset 26: }
Florin Malita . resolved

What about invalidated weakptrs, should we clean them up at some point?

Seokho Song

I think this has been resolve since we don't use WeakPtr. Marking as done

File third_party/blink/renderer/core/paint/box_painter_base.cc
Line 971, Patchset 26: BindRepeating(
Florin Malita . resolved

I think `BindRepeating` performs some allocations, so I'm kinda wary of doing this on every paint.

Naively, do we need a callback at all? Can't `PaintImageForCurrentFrameWithInfo` execute the steps directly?

Seokho Song

I initially thought we should only register the node once it is added to `image_animation_map_`. Since using `dom/node` inside `platform/graphics` is not allowed, I used a callback approach. However, I realized this is the same as checking for its existence in the node_images collection. Therefore, I removed the callback and handled it in place. PTAL.

File third_party/blink/renderer/platform/graphics/image.h
Line 391, Patchset 26: base::WeakPtrFactory<Image> weak_factory_{this};
Florin Malita . unresolved

`Image`s are `ThreadSafeRefCounted`, which means we can drop them from any thread (background decoding, worker threads, main thread, etc).

`WeakPtr`s OTOH are [thread-bound](https://source.chromium.org/chromium/chromium/src/+/main:base/memory/weak_ptr.h;drc=d1a2bfde021c2bc6500bd2ef11b4e7e786840149;l=50), and expected to be dereferenced and invalidated from a single/stable thread.

IIUC we can't mix them safely.

Seokho Song

I considered using `scoped_refptr<>`, but I was worried that holding a strong reference might keep the image alive longer than necessary (e.g., when the image for a node changes). To avoid that, I tried to find a weaker approach.

I think we can use `ImageResourceContent` instead. Since it is garbage-collected, we can safely reference it using a `WeakMember`. PTAL :)

File third_party/blink/renderer/platform/graphics/image_node_animation_info.h
Line 8, Patchset 27 (Parent):#include "base/notreached.h"
Seokho Song . resolved

Unnecessary include. I think it has been accidentally added..

Open in Gerrit

Related details

Attention is currently required from:
  • Florin Malita
  • Ian Kilpatrick
  • Stephen Chenney
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ib3c0764d55a698a9adcdca2fce18c56a9642b07a
Gerrit-Change-Number: 7692355
Gerrit-PatchSet: 27
Gerrit-Owner: Seokho Song <seo...@chromium.org>
Gerrit-Reviewer: Florin Malita <fma...@chromium.org>
Gerrit-Reviewer: Ian Kilpatrick <ikilp...@chromium.org>
Gerrit-Reviewer: Seokho Song <seo...@chromium.org>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Manuel Rego <re...@igalia.com>
Gerrit-CC: Menard, Alexis <alexis...@intel.com>
Gerrit-CC: Olga Gerchikov <gerc...@microsoft.com>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Ian Kilpatrick <ikilp...@chromium.org>
Gerrit-Attention: Florin Malita <fma...@chromium.org>
Gerrit-Comment-Date: Tue, 07 Apr 2026 07:14:18 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Florin Malita <fma...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Ian Kilpatrick (Gerrit)

unread,
Apr 13, 2026, 1:07:12 PM (23 hours ago) Apr 13
to Seokho Song, Florin Malita, android-bu...@system.gserviceaccount.com, chrom...@appspot.gserviceaccount.com, Manuel Rego, chromiu...@luci-project-accounts.iam.gserviceaccount.com, Menard, Alexis, chromium...@chromium.org, Dirk Schulze, Olga Gerchikov, Stephen Chenney, blink-revie...@chromium.org, blink-revie...@chromium.org, blink-re...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, kinuko...@chromium.org, zol...@webkit.org
Attention needed from Florin Malita, Seokho Song and Stephen Chenney

Ian Kilpatrick added 2 comments

File third_party/blink/renderer/core/dom/element.cc
Line 4728, Patchset 28 (Latest): CancelImageAnimations();
Ian Kilpatrick . unresolved

I suspect feature should be more integrated to the existing web animations infrastructure - rather that re-building peicemeal. Can you investigate doing this after this patch?

Have you spoken to Florian about this yet?

File third_party/blink/renderer/core/dom/node.cc
Line 350, Patchset 13:void Node::DisposeNode() {
Ian Kilpatrick . unresolved

Please run this against speedometer3 - this may affect benchmark performance if done with a pre-finalizer.

Seokho Song

In Speedometer3, with the exception of `TodoMVC-jQuery`, the other metrics appear unchanged. The `TodoMVC-jQuery` case is roughly 5ms slower (e.g., 182.594ms -> 187.396ms). Please check [the pinpoint results](https://pinpoint-dot-chromeperf.appspot.com/job/1132f46b090000).

However, test cases that handle edge-cases are significantly slower, and the regressions are surprisingly platform-specific:

* Mac: `fast/overflow/lots-of-sibling-inline-boxes.html` regressed from 2.3s to 13s.

* Linux: `external/wpt/html/select/options-length-too-large.html` regressed from 57s to 72s.

I think this could cause serious performance issues.

To address this, I've modified the approach. I changed it to use a prefinalizer for the `NodeImages` class (which is hold from the rare data) to avoid overhead of creating and invoking prefinalizers for every single node.
Ian Kilpatrick

For speedometer you need to run 150 iterations to get statistical results.

Open in Gerrit

Related details

Attention is currently required from:
  • Florin Malita
  • Seokho Song
  • Stephen Chenney
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ib3c0764d55a698a9adcdca2fce18c56a9642b07a
Gerrit-Change-Number: 7692355
Gerrit-PatchSet: 28
Gerrit-Owner: Seokho Song <seo...@chromium.org>
Gerrit-Reviewer: Florin Malita <fma...@chromium.org>
Gerrit-Reviewer: Ian Kilpatrick <ikilp...@chromium.org>
Gerrit-Reviewer: Seokho Song <seo...@chromium.org>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Manuel Rego <re...@igalia.com>
Gerrit-CC: Menard, Alexis <alexis...@intel.com>
Gerrit-CC: Olga Gerchikov <gerc...@microsoft.com>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Florin Malita <fma...@chromium.org>
Gerrit-Attention: Seokho Song <seo...@chromium.org>
Gerrit-Comment-Date: Mon, 13 Apr 2026 17:07:03 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Ian Kilpatrick <ikilp...@chromium.org>
Comment-In-Reply-To: Seokho Song <seo...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

chromeperf@appspot.gserviceaccount.com (Gerrit)

unread,
4:31 AM (7 hours ago) 4:31 AM
to Seokho Song, Ian Kilpatrick, Florin Malita, android-bu...@system.gserviceaccount.com, Manuel Rego, chromiu...@luci-project-accounts.iam.gserviceaccount.com, Menard, Alexis, chromium...@chromium.org, Dirk Schulze, Olga Gerchikov, Stephen Chenney, blink-revie...@chromium.org, blink-revie...@chromium.org, blink-re...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, kinuko...@chromium.org, zol...@webkit.org
Attention needed from Florin Malita, Seokho Song and Stephen Chenney

Message from chrom...@appspot.gserviceaccount.com

📍 Job linux-perf/speedometer3 complete.

See results at: https://pinpoint-dot-chromeperf.appspot.com/job/1495f49e890000

Open in Gerrit

Related details

Attention is currently required from:
  • Florin Malita
  • Seokho Song
  • Stephen Chenney
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Ib3c0764d55a698a9adcdca2fce18c56a9642b07a
Gerrit-Change-Number: 7692355
Gerrit-PatchSet: 29
Gerrit-Owner: Seokho Song <seo...@chromium.org>
Gerrit-Reviewer: Florin Malita <fma...@chromium.org>
Gerrit-Reviewer: Ian Kilpatrick <ikilp...@chromium.org>
Gerrit-Reviewer: Seokho Song <seo...@chromium.org>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Manuel Rego <re...@igalia.com>
Gerrit-CC: Menard, Alexis <alexis...@intel.com>
Gerrit-CC: Olga Gerchikov <gerc...@microsoft.com>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Florin Malita <fma...@chromium.org>
Gerrit-Attention: Seokho Song <seo...@chromium.org>
Gerrit-Comment-Date: Tue, 14 Apr 2026 08:31:19 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Seokho Song (Gerrit)

unread,
4:43 AM (7 hours ago) 4:43 AM
to Ian Kilpatrick, Florin Malita, android-bu...@system.gserviceaccount.com, chrom...@appspot.gserviceaccount.com, Manuel Rego, chromiu...@luci-project-accounts.iam.gserviceaccount.com, Menard, Alexis, chromium...@chromium.org, Dirk Schulze, Olga Gerchikov, Stephen Chenney, blink-revie...@chromium.org, blink-revie...@chromium.org, blink-re...@chromium.org, blink-revi...@chromium.org, blink-rev...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, drott+bl...@chromium.org, fmalit...@chromium.org, fserb...@chromium.org, kinuko...@chromium.org, zol...@webkit.org
Attention needed from Florin Malita and Stephen Chenney

Seokho Song added 2 comments

File third_party/blink/renderer/core/dom/element.cc
Line 4728, Patchset 28: CancelImageAnimations();
Ian Kilpatrick . resolved

I suspect feature should be more integrated to the existing web animations infrastructure - rather that re-building peicemeal. Can you investigate doing this after this patch?

Have you spoken to Florian about this yet?

File third_party/blink/renderer/core/dom/node.cc
Line 350, Patchset 13:void Node::DisposeNode() {
Ian Kilpatrick . resolved

Please run this against speedometer3 - this may affect benchmark performance if done with a pre-finalizer.

Seokho Song

In Speedometer3, with the exception of `TodoMVC-jQuery`, the other metrics appear unchanged. The `TodoMVC-jQuery` case is roughly 5ms slower (e.g., 182.594ms -> 187.396ms). Please check [the pinpoint results](https://pinpoint-dot-chromeperf.appspot.com/job/1132f46b090000).

However, test cases that handle edge-cases are significantly slower, and the regressions are surprisingly platform-specific:

* Mac: `fast/overflow/lots-of-sibling-inline-boxes.html` regressed from 2.3s to 13s.

* Linux: `external/wpt/html/select/options-length-too-large.html` regressed from 57s to 72s.

I think this could cause serious performance issues.

To address this, I've modified the approach. I changed it to use a prefinalizer for the `NodeImages` class (which is hold from the rare data) to avoid overhead of creating and invoking prefinalizers for every single node.
Ian Kilpatrick

For speedometer you need to run 150 iterations to get statistical results.

Seokho Song

Acknowledged

Open in Gerrit

Related details

Attention is currently required from:
  • Florin Malita
  • Stephen Chenney
Gerrit-Comment-Date: Tue, 14 Apr 2026 08:42:51 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages