Add origin trial support for Container Timing [chromium/src : main]

0 views
Skip to first unread message

José Dapena Paz (Gerrit)

unread,
Feb 6, 2026, 3:46:23 AM (6 days ago) Feb 6
to chromium...@chromium.org, kinuko...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, jmedle...@chromium.org, speed-metrics...@chromium.org, core-timi...@chromium.org, blink-...@chromium.org, blink-rev...@chromium.org

José Dapena Paz has uploaded the change for review

Commit message

Add origin trial support for Container Timing

This enables Container Timing to be controlled via origin trials by
adding origin_trial_feature_name to runtime_enabled_features.json5.

This means the generated method ContainerTimingEnabled now receives the
ExecutionContext parameter, so updated all the checks to get
per-context feature enablement with origin trials.
Bug: 382422286
Change-Id: I446338b7f2d5995ce356cc696f4e5c2d859d8b91

Change diff


Change information

Files:
  • M third_party/blink/renderer/core/dom/element.cc
  • M third_party/blink/renderer/core/html/html_element.cc
  • M third_party/blink/renderer/core/paint/timing/image_element_timing.cc
  • M third_party/blink/renderer/core/paint/timing/text_element_timing.cc
  • M third_party/blink/renderer/core/timing/window_performance.cc
  • M third_party/blink/renderer/platform/runtime_enabled_features.json5
Change size: S
Delta: 6 files changed, 25 insertions(+), 19 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I446338b7f2d5995ce356cc696f4e5c2d859d8b91
Gerrit-Change-Number: 7548784
Gerrit-PatchSet: 1
Gerrit-Owner: José Dapena Paz <jda...@igalia.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Michal Mocny (Gerrit)

unread,
Feb 6, 2026, 9:07:36 AM (6 days ago) Feb 6
to José Dapena Paz, Stephen Chenney, Dominic Farolino, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
Attention needed from Dominic Farolino, José Dapena Paz and Stephen Chenney

Michal Mocny voted and added 2 comments

Votes added by Michal Mocny

Code-Review+1

2 comments

Patchset-level comments
File-level comment, Patchset 1 (Latest):
Michal Mocny . resolved

Change looks fine to me!

Question though, I saw Jason email blink-dev about ready for developer testing. Just confirming that you know this is not the same as origin trial and that you need to move to OT step next?

(also I'm glad to see Bas from Mozilla experimenting with this!!)

Cheers.

File third_party/blink/renderer/core/paint/timing/image_element_timing.cc
Line 55, Patchset 1 (Latest): if (!RuntimeEnabledFeatures::ContainerTimingEnabled(execution_context)) {
Michal Mocny . resolved

Drive by comment: It looks to me like this gets called quite often? With each image paint we check if it is needed for container timing and before checking attributes we check for this flag. Later, after measuring, we check again. Etc etc. This happens for all users, even when the feature is off, I think.

I wonder if you could instead have a ContainerTiming class that only initialized if the flag is enabled, and otherwise would always be nullptr and a simple check from all paint operations?

(Soft navigation heuristics follows that pattern)

---

I'll leave this resolved since its unrelated to this patch but consider investigating if this is needed. I don't know what the cost of frequent flag checks is...

Open in Gerrit

Related details

Attention is currently required from:
  • Dominic Farolino
  • José Dapena Paz
  • Stephen Chenney
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement 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: I446338b7f2d5995ce356cc696f4e5c2d859d8b91
    Gerrit-Change-Number: 7548784
    Gerrit-PatchSet: 1
    Gerrit-Owner: José Dapena Paz <jda...@igalia.com>
    Gerrit-Reviewer: Dominic Farolino <d...@chromium.org>
    Gerrit-Reviewer: José Dapena Paz <jda...@igalia.com>
    Gerrit-Reviewer: Michal Mocny <mmo...@chromium.org>
    Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
    Gerrit-Attention: José Dapena Paz <jda...@igalia.com>
    Gerrit-Attention: Stephen Chenney <sche...@chromium.org>
    Gerrit-Attention: Dominic Farolino <d...@chromium.org>
    Gerrit-Comment-Date: Fri, 06 Feb 2026 14:07:28 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Stephen Chenney (Gerrit)

    unread,
    Feb 6, 2026, 10:41:03 AM (6 days ago) Feb 6
    to José Dapena Paz, Michal Mocny, Dominic Farolino, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
    Attention needed from Dominic Farolino and José Dapena Paz

    Stephen Chenney added 1 comment

    File third_party/blink/renderer/core/paint/timing/image_element_timing.cc
    Line 55, Patchset 1 (Latest): if (!RuntimeEnabledFeatures::ContainerTimingEnabled(execution_context)) {
    Michal Mocny . resolved

    Drive by comment: It looks to me like this gets called quite often? With each image paint we check if it is needed for container timing and before checking attributes we check for this flag. Later, after measuring, we check again. Etc etc. This happens for all users, even when the feature is off, I think.

    I wonder if you could instead have a ContainerTiming class that only initialized if the flag is enabled, and otherwise would always be nullptr and a simple check from all paint operations?

    (Soft navigation heuristics follows that pattern)

    ---

    I'll leave this resolved since its unrelated to this patch but consider investigating if this is needed. I don't know what the cost of frequent flag checks is...

    Stephen Chenney

    Runtime flag checks are kinda expensive, but we do many of them in style/layout/paint and they tend to rotate in and out, so the net effect on performance is sort of a constant overhead justified by the benefits.

    It is why feature flag removal is an important thing to stay on top of.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Dominic Farolino
    • José Dapena Paz
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement 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: I446338b7f2d5995ce356cc696f4e5c2d859d8b91
    Gerrit-Change-Number: 7548784
    Gerrit-PatchSet: 1
    Gerrit-Owner: José Dapena Paz <jda...@igalia.com>
    Gerrit-Reviewer: Dominic Farolino <d...@chromium.org>
    Gerrit-Reviewer: José Dapena Paz <jda...@igalia.com>
    Gerrit-Reviewer: Michal Mocny <mmo...@chromium.org>
    Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
    Gerrit-Attention: José Dapena Paz <jda...@igalia.com>
    Gerrit-Attention: Dominic Farolino <d...@chromium.org>
    Gerrit-Comment-Date: Fri, 06 Feb 2026 15:40:52 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Michal Mocny <mmo...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Dominic Farolino (Gerrit)

    unread,
    Feb 6, 2026, 2:36:19 PM (5 days ago) Feb 6
    to José Dapena Paz, Michal Mocny, Stephen Chenney, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
    Attention needed from José Dapena Paz

    Dominic Farolino voted Code-Review+1

    Code-Review+1
    Open in Gerrit

    Related details

    Attention is currently required from:
    • José Dapena Paz
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement 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: I446338b7f2d5995ce356cc696f4e5c2d859d8b91
    Gerrit-Change-Number: 7548784
    Gerrit-PatchSet: 1
    Gerrit-Owner: José Dapena Paz <jda...@igalia.com>
    Gerrit-Reviewer: Dominic Farolino <d...@chromium.org>
    Gerrit-Reviewer: José Dapena Paz <jda...@igalia.com>
    Gerrit-Reviewer: Michal Mocny <mmo...@chromium.org>
    Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
    Gerrit-Attention: José Dapena Paz <jda...@igalia.com>
    Gerrit-Comment-Date: Fri, 06 Feb 2026 19:36:13 +0000
    Gerrit-HasComments: No
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    open
    diffy

    José Dapena Paz (Gerrit)

    unread,
    Feb 10, 2026, 10:54:15 AM (yesterday) Feb 10
    to Dominic Farolino, Michal Mocny, Stephen Chenney, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
    Attention needed from Michal Mocny and Stephen Chenney

    José Dapena Paz added 2 comments

    Patchset-level comments
    Michal Mocny . resolved

    Change looks fine to me!

    Question though, I saw Jason email blink-dev about ready for developer testing. Just confirming that you know this is not the same as origin trial and that you need to move to OT step next?

    (also I'm glad to see Bas from Mozilla experimenting with this!!)

    Cheers.

    José Dapena Paz

    Yes, origin trial is something we want to do, and we are moving towards that. But dev trial was ready to announce. Thanks anyway for pointing out. The processes here are somehwo confusing

    File third_party/blink/renderer/core/paint/timing/image_element_timing.cc
    Line 55, Patchset 1 (Latest): if (!RuntimeEnabledFeatures::ContainerTimingEnabled(execution_context)) {
    Michal Mocny . unresolved

    Drive by comment: It looks to me like this gets called quite often? With each image paint we check if it is needed for container timing and before checking attributes we check for this flag. Later, after measuring, we check again. Etc etc. This happens for all users, even when the feature is off, I think.

    I wonder if you could instead have a ContainerTiming class that only initialized if the flag is enabled, and otherwise would always be nullptr and a simple check from all paint operations?

    (Soft navigation heuristics follows that pattern)

    ---

    I'll leave this resolved since its unrelated to this patch but consider investigating if this is needed. I don't know what the cost of frequent flag checks is...

    Stephen Chenney

    Runtime flag checks are kinda expensive, but we do many of them in style/layout/paint and they tend to rotate in and out, so the net effect on performance is sort of a constant overhead justified by the benefits.

    It is why feature flag removal is an important thing to stay on top of.

    José Dapena Paz

    I will cache the value in WindowPerformance (that can be accessed both from TextElementTiming and ImageElementTiming) to just calculate the value once. This should simplify the checks.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michal Mocny
    • Stephen Chenney
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      • requirement 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: I446338b7f2d5995ce356cc696f4e5c2d859d8b91
      Gerrit-Change-Number: 7548784
      Gerrit-PatchSet: 1
      Gerrit-Owner: José Dapena Paz <jda...@igalia.com>
      Gerrit-Reviewer: Dominic Farolino <d...@chromium.org>
      Gerrit-Reviewer: José Dapena Paz <jda...@igalia.com>
      Gerrit-Reviewer: Michal Mocny <mmo...@chromium.org>
      Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
      Gerrit-Attention: Stephen Chenney <sche...@chromium.org>
      Gerrit-Attention: Michal Mocny <mmo...@chromium.org>
      Gerrit-Comment-Date: Tue, 10 Feb 2026 15:53:59 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Stephen Chenney <sche...@chromium.org>
      Comment-In-Reply-To: Michal Mocny <mmo...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      José Dapena Paz (Gerrit)

      unread,
      Feb 10, 2026, 3:14:29 PM (yesterday) Feb 10
      to Dominic Farolino, Michal Mocny, Stephen Chenney, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
      Attention needed from Dominic Farolino, Michal Mocny and Stephen Chenney

      José Dapena Paz added 1 comment

      File third_party/blink/renderer/core/paint/timing/image_element_timing.cc
      Line 55, Patchset 1: if (!RuntimeEnabledFeatures::ContainerTimingEnabled(execution_context)) {
      Michal Mocny . resolved

      Drive by comment: It looks to me like this gets called quite often? With each image paint we check if it is needed for container timing and before checking attributes we check for this flag. Later, after measuring, we check again. Etc etc. This happens for all users, even when the feature is off, I think.

      I wonder if you could instead have a ContainerTiming class that only initialized if the flag is enabled, and otherwise would always be nullptr and a simple check from all paint operations?

      (Soft navigation heuristics follows that pattern)

      ---

      I'll leave this resolved since its unrelated to this patch but consider investigating if this is needed. I don't know what the cost of frequent flag checks is...

      Stephen Chenney

      Runtime flag checks are kinda expensive, but we do many of them in style/layout/paint and they tend to rotate in and out, so the net effect on performance is sort of a constant overhead justified by the benefits.

      It is why feature flag removal is an important thing to stay on top of.

      José Dapena Paz

      I will cache the value in WindowPerformance (that can be accessed both from TextElementTiming and ImageElementTiming) to just calculate the value once. This should simplify the checks.

      José Dapena Paz

      Done

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Dominic Farolino
      • Michal Mocny
      • Stephen Chenney
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • 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: I446338b7f2d5995ce356cc696f4e5c2d859d8b91
      Gerrit-Change-Number: 7548784
      Gerrit-PatchSet: 2
      Gerrit-Owner: José Dapena Paz <jda...@igalia.com>
      Gerrit-Reviewer: Dominic Farolino <d...@chromium.org>
      Gerrit-Reviewer: José Dapena Paz <jda...@igalia.com>
      Gerrit-Reviewer: Michal Mocny <mmo...@chromium.org>
      Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
      Gerrit-Attention: Dominic Farolino <d...@chromium.org>
      Gerrit-Attention: Stephen Chenney <sche...@chromium.org>
      Gerrit-Attention: Michal Mocny <mmo...@chromium.org>
      Gerrit-Comment-Date: Tue, 10 Feb 2026 20:14:18 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: José Dapena Paz <jda...@igalia.com>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Michal Mocny (Gerrit)

      unread,
      9:29 AM (14 hours ago) 9:29 AM
      to José Dapena Paz, Dominic Farolino, Stephen Chenney, Chromium LUCI CQ, chromium...@chromium.org, blink-re...@chromium.org, blink-rev...@chromium.org, blink-rev...@chromium.org, blink-...@chromium.org, core-timi...@chromium.org, jmedle...@chromium.org, kinuko...@chromium.org, speed-metrics...@chromium.org
      Attention needed from Dominic Farolino, José Dapena Paz and Stephen Chenney

      Michal Mocny voted and added 1 comment

      Votes added by Michal Mocny

      Code-Review+1

      1 comment

      Patchset-level comments
      File-level comment, Patchset 2 (Latest):
      Michal Mocny . resolved

      thanks for the change to add caching.

      One followup you might want to test: Origin Trials can be dynamically enabled by injecting <meta> tags during load, and this is often the easiest way for 3p scripts to participate in an OT. If you check the flag too early, and cache it, this disables the ability to dynamically enable the feature in the middle of a load.

      On the other hand, starting to track element timing with the feature disabled and then switching to enabled might lead to broken states...

      In a perfect world you would cache the value like you do here, but ensure that you dont check the value of the element timing feature flag too early, giving scripts enough time to inject (at least all scripts in <head>).

      In practice, I think as long as you dont check the flag value until the first performance observer or paint, I think thats fine-- but a common footgun people get into is there are a lot of scripts that automatically read the list of `PerformanceObserver.supportedEntryTypes` and getting that list will sometimes automatically read feature flags and leave them in a cached state!

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Dominic Farolino
      • José Dapena Paz
      • Stephen Chenney
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement 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: I446338b7f2d5995ce356cc696f4e5c2d859d8b91
      Gerrit-Change-Number: 7548784
      Gerrit-PatchSet: 2
      Gerrit-Owner: José Dapena Paz <jda...@igalia.com>
      Gerrit-Reviewer: Dominic Farolino <d...@chromium.org>
      Gerrit-Reviewer: José Dapena Paz <jda...@igalia.com>
      Gerrit-Reviewer: Michal Mocny <mmo...@chromium.org>
      Gerrit-Reviewer: Stephen Chenney <sche...@chromium.org>
      Gerrit-Attention: José Dapena Paz <jda...@igalia.com>
      Gerrit-Attention: Dominic Farolino <d...@chromium.org>
      Gerrit-Attention: Stephen Chenney <sche...@chromium.org>
      Gerrit-Comment-Date: Wed, 11 Feb 2026 14:29:04 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages