Evict BFCached pages with SharedWorker when the last client navigates away [chromium/src : main]

0 views
Skip to first unread message

Anna Sato (Gerrit)

unread,
Sep 4, 2025, 12:39:51 AMSep 4
to Fergal Daly, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
Attention needed from Fergal Daly

Anna Sato voted and added 1 comment

Votes added by Anna Sato

Commit-Queue+1

1 comment

Patchset-level comments
File-level comment, Patchset 3 (Latest):
Anna Sato . resolved

This CL evicts clients with `kSharedWorker` reason when the worker has no active clients, and also adds/modifies some WPTs. PTAL?

Open in Gerrit

Related details

Attention is currently required from:
  • Fergal Daly
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
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: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
Gerrit-Change-Number: 6914636
Gerrit-PatchSet: 3
Gerrit-Owner: Anna Sato <anna...@chromium.org>
Gerrit-Reviewer: Anna Sato <anna...@chromium.org>
Gerrit-Reviewer: Fergal Daly <fer...@chromium.org>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-Attention: Fergal Daly <fer...@chromium.org>
Gerrit-Comment-Date: Thu, 04 Sep 2025 04:39:25 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Fergal Daly (Gerrit)

unread,
Sep 5, 2025, 6:00:38 AMSep 5
to Anna Sato, Chromium LUCI CQ, Fergal Daly, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
Attention needed from Anna Sato

Fergal Daly added 5 comments

File content/browser/worker_host/shared_worker_host.h
Line 167, Patchset 3 (Latest): bool EvictBFCachedClientsIfLastActive(
Fergal Daly . unresolved

Please add a comment describing this method.

File content/browser/worker_host/shared_worker_host.cc
Line 983, Patchset 3 (Latest): if (info.render_frame_host_id == client_rfh_id) {
continue;
}
Fergal Daly . unresolved

probably don't need this since it will no have `IsInBackForwardCache()`.

File content/browser/worker_host/shared_worker_service_impl.h
Line 108, Patchset 3 (Latest): bool EvictBFCachedClientsIfLastActive(
Fergal Daly . unresolved

Please add a comment describing this method.

File third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/back-forward-cache/eligibility/shared-worker-active-client.html
Line 1, Patchset 3 (Latest):<!doctype html>
Fergal Daly . unresolved

Is there any reason for this to be a html test instead of a JS test? If no, please make this and any other new tests JS tests.

File tools/metrics/histograms/metadata/navigation/enums.xml
Line 231, Patchset 3 (Latest): <int value="72" label="kSharedWorkerMessage"/>
Fergal Daly . unresolved

why change this? These are more textual descriptions.

Open in Gerrit

Related details

Attention is currently required from:
  • Anna Sato
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
    Gerrit-Change-Number: 6914636
    Gerrit-PatchSet: 3
    Gerrit-Owner: Anna Sato <anna...@chromium.org>
    Gerrit-Reviewer: Anna Sato <anna...@chromium.org>
    Gerrit-Reviewer: Fergal Daly <fer...@chromium.org>
    Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
    Gerrit-Attention: Anna Sato <anna...@chromium.org>
    Gerrit-Comment-Date: Fri, 05 Sep 2025 10:00:07 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Anna Sato (Gerrit)

    unread,
    Sep 9, 2025, 4:17:02 AMSep 9
    to Yoshisato Yanagisawa, Chromium LUCI CQ, Fergal Daly, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
    Attention needed from Fergal Daly and Yoshisato Yanagisawa

    Anna Sato added 6 comments

    Patchset-level comments
    File-level comment, Patchset 9 (Latest):
    Anna Sato . resolved

    Thanks fergal for the review! Added yanagisawa-san for shared worker part, PTAL?

    File content/browser/worker_host/shared_worker_host.h
    Line 167, Patchset 3: bool EvictBFCachedClientsIfLastActive(
    Fergal Daly . resolved

    Please add a comment describing this method.

    Anna Sato

    Added a comment.

    File content/browser/worker_host/shared_worker_host.cc
    Line 983, Patchset 3: if (info.render_frame_host_id == client_rfh_id) {
    continue;
    }
    Fergal Daly . unresolved

    probably don't need this since it will no have `IsInBackForwardCache()`.

    Anna Sato

    This `continue` is needed to avoid the `else` below. Without it, the function would check the client against itself and return `false` saying there are active clients.

    File content/browser/worker_host/shared_worker_service_impl.h
    Line 108, Patchset 3: bool EvictBFCachedClientsIfLastActive(
    Fergal Daly . resolved

    Please add a comment describing this method.

    Anna Sato

    Added a comment.

    File third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/back-forward-cache/eligibility/shared-worker-active-client.html
    Line 1, Patchset 3:<!doctype html>
    Fergal Daly . resolved

    Is there any reason for this to be a html test instead of a JS test? If no, please make this and any other new tests JS tests.

    Anna Sato

    Made new tests JS.

    File tools/metrics/histograms/metadata/navigation/enums.xml
    Line 231, Patchset 3: <int value="72" label="kSharedWorkerMessage"/>
    Fergal Daly . resolved

    why change this? These are more textual descriptions.

    Anna Sato

    Fixed. Should've check before the review, sorry.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Fergal Daly
    • Yoshisato Yanagisawa
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
    Gerrit-Change-Number: 6914636
    Gerrit-PatchSet: 9
    Gerrit-Owner: Anna Sato <anna...@chromium.org>
    Gerrit-Reviewer: Anna Sato <anna...@chromium.org>
    Gerrit-Reviewer: Fergal Daly <fer...@chromium.org>
    Gerrit-Reviewer: Yoshisato Yanagisawa <yyana...@chromium.org>
    Gerrit-Attention: Yoshisato Yanagisawa <yyana...@chromium.org>
    Gerrit-Attention: Fergal Daly <fer...@chromium.org>
    Gerrit-Comment-Date: Tue, 09 Sep 2025 08:16:32 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Fergal Daly <fer...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Fergal Daly (Gerrit)

    unread,
    Sep 9, 2025, 5:50:04 AMSep 9
    to Anna Sato, Yoshisato Yanagisawa, Chromium LUCI CQ, Fergal Daly, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
    Attention needed from Anna Sato and Yoshisato Yanagisawa

    Fergal Daly added 2 comments

    File content/browser/worker_host/shared_worker_host.cc
    Line 983, Patchset 3: if (info.render_frame_host_id == client_rfh_id) {
    continue;
    }
    Fergal Daly . resolved

    probably don't need this since it will no have `IsInBackForwardCache()`.

    Anna Sato

    This `continue` is needed to avoid the `else` below. Without it, the function would check the client against itself and return `false` saying there are active clients.

    Fergal Daly

    Sorry, I thought I had deleted that comment after figuring that out myself :)

    File third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-all-clients-bfcached.tentative.window.js
    Line 32, Patchset 9 (Latest): await assertBFCacheEligibility(rc2, /*shouldRestoreFromBfcache=*/ false);
    Fergal Daly . unresolved

    Should this also be doing `assertNotRestoredFromBFCache` with a reason?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Anna Sato
    • Yoshisato Yanagisawa
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    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: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
    Gerrit-Change-Number: 6914636
    Gerrit-PatchSet: 9
    Gerrit-Owner: Anna Sato <anna...@chromium.org>
    Gerrit-Reviewer: Anna Sato <anna...@chromium.org>
    Gerrit-Reviewer: Fergal Daly <fer...@chromium.org>
    Gerrit-Reviewer: Yoshisato Yanagisawa <yyana...@chromium.org>
    Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
    Gerrit-Attention: Yoshisato Yanagisawa <yyana...@chromium.org>
    Gerrit-Attention: Anna Sato <anna...@chromium.org>
    Gerrit-Comment-Date: Tue, 09 Sep 2025 09:49:32 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Fergal Daly <fer...@chromium.org>
    Comment-In-Reply-To: Anna Sato <anna...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Anna Sato (Gerrit)

    unread,
    Sep 9, 2025, 11:26:50 AMSep 9
    to Yoshisato Yanagisawa, Chromium LUCI CQ, Fergal Daly, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
    Attention needed from Fergal Daly and Yoshisato Yanagisawa

    Anna Sato added 2 comments

    Patchset-level comments
    File third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-all-clients-bfcached.tentative.window.js
    Line 32, Patchset 9: await assertBFCacheEligibility(rc2, /*shouldRestoreFromBfcache=*/ false);
    Fergal Daly . resolved

    Should this also be doing `assertNotRestoredFromBFCache` with a reason?

    Anna Sato

    That's right. Modified a bit and updated to use `assertNotRestoredFromBFCache` for both pages.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Fergal Daly
    • Yoshisato Yanagisawa
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    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: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
    Gerrit-Change-Number: 6914636
    Gerrit-PatchSet: 12
    Gerrit-Owner: Anna Sato <anna...@chromium.org>
    Gerrit-Reviewer: Anna Sato <anna...@chromium.org>
    Gerrit-Reviewer: Fergal Daly <fer...@chromium.org>
    Gerrit-Reviewer: Yoshisato Yanagisawa <yyana...@chromium.org>
    Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
    Gerrit-Attention: Yoshisato Yanagisawa <yyana...@chromium.org>
    Gerrit-Attention: Fergal Daly <fer...@chromium.org>
    Gerrit-Comment-Date: Tue, 09 Sep 2025 15:26:26 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Yoshisato Yanagisawa (Gerrit)

    unread,
    Sep 10, 2025, 1:42:02 AMSep 10
    to Anna Sato, Chromium LUCI CQ, Fergal Daly, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
    Attention needed from Anna Sato and Fergal Daly

    Yoshisato Yanagisawa added 6 comments

    Patchset-level comments
    File-level comment, Patchset 14 (Latest):
    Yoshisato Yanagisawa . resolved

    Will you leave comments on the design? I feel the implementation is not trivial.

    Commit Message
    Line 10, Patchset 9:clients are in BFCache. When the last active client of a SharedWorker
    Yoshisato Yanagisawa . unresolved

    This is for solving the "Worker state when last client enters BFCache." case explained in https://docs.google.com/document/d/1dZxwmUYOlDmZ-PF97mfoXbzMrFHBsqeUT3XxTkpNIb0/edit?tab=t.0, right?

    Line 22, Patchset 9:Bug: 406420935
    Yoshisato Yanagisawa . unresolved

    I guess it nice also link to https://crbug.com/431875857

    File content/browser/worker_host/shared_worker_host.cc
    Line 996, Patchset 12: return false;
    Yoshisato Yanagisawa . unresolved

    Will you leave a comment for this?
    Is this mean active client (i.e. non BFCache'd client) exist?

    File content/browser/worker_host/shared_worker_service_impl.h
    Line 109, Patchset 14 (Latest): // the last active client.
    Yoshisato Yanagisawa . unresolved

    I guess we lack an explanation that:
    We assume that this render frame host (i.e. document) can be a client of multiple SharedWorkers. We would like to list all SharedWorkerHosts and proceed `EvictBFCacheClientsIfLastActive()` to all of them.

    File content/browser/worker_host/shared_worker_service_impl.cc
    Line 532, Patchset 14 (Latest): for (const auto& entry : shared_worker_client_counts_) {
    Yoshisato Yanagisawa . unresolved

    Let me confirm what I have understand from here.
    Technically, you can use two approaches:
    1. loop with `worker_hosts_` or `shared_worker_hosts_`, and make it ensure if the client is belongs to it. Proceed SharedWorkerHost's `EvictBFCachedClientsIfLastActive()` for that case.
    2. loop with `shared_worker_client_counts_`, and select the SharedWorkerHost that has the given client, then run SharedWorkerHost's `EvictBFCachedClientsIfLastActive()`.

    I understand you chose the second. Will you leave some comments on why you chose the second, and how it works?
    Leaving a mini-design doc is welcomed as well.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Anna Sato
    • Fergal Daly
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      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: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
      Gerrit-Change-Number: 6914636
      Gerrit-PatchSet: 14
      Gerrit-Owner: Anna Sato <anna...@chromium.org>
      Gerrit-Reviewer: Anna Sato <anna...@chromium.org>
      Gerrit-Reviewer: Fergal Daly <fer...@chromium.org>
      Gerrit-Reviewer: Yoshisato Yanagisawa <yyana...@chromium.org>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-Attention: Fergal Daly <fer...@chromium.org>
      Gerrit-Attention: Anna Sato <anna...@chromium.org>
      Gerrit-Comment-Date: Wed, 10 Sep 2025 05:41:29 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Anna Sato (Gerrit)

      unread,
      Sep 11, 2025, 1:50:08 AMSep 11
      to Yoshisato Yanagisawa, Chromium LUCI CQ, Fergal Daly, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
      Attention needed from Yoshisato Yanagisawa

      Anna Sato added 2 comments

      Patchset-level comments
      File-level comment, Patchset 17 (Latest):
      Anna Sato . resolved

      Thanks for the review! I have a quick question for yanagisawa-san.

      File content/browser/worker_host/shared_worker_service_impl.cc
      Line 532, Patchset 14: for (const auto& entry : shared_worker_client_counts_) {
      Yoshisato Yanagisawa . unresolved

      Let me confirm what I have understand from here.
      Technically, you can use two approaches:
      1. loop with `worker_hosts_` or `shared_worker_hosts_`, and make it ensure if the client is belongs to it. Proceed SharedWorkerHost's `EvictBFCachedClientsIfLastActive()` for that case.
      2. loop with `shared_worker_client_counts_`, and select the SharedWorkerHost that has the given client, then run SharedWorkerHost's `EvictBFCachedClientsIfLastActive()`.

      I understand you chose the second. Will you leave some comments on why you chose the second, and how it works?
      Leaving a mini-design doc is welcomed as well.

      Anna Sato

      Thanks for summarizing the approaches, and yes I'm using 2.

      1 is better when a client is connected to most of the active workers, while 2 is better when it's connected to only a few, IIUC. I've put the details in this doc:
      https://docs.google.com/document/d/19ZMaAaRUnMwB-EyQLjt4YZNSjKlGRTbFbjJ57H2ZIag/edit?usp=sharing&resourcekey=0-K6Q2fbF8lAL2QYot2dE73Q

      Do you have any thoughts on which approach is better here?

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Yoshisato Yanagisawa
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      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: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
      Gerrit-Change-Number: 6914636
      Gerrit-PatchSet: 17
      Gerrit-Owner: Anna Sato <anna...@chromium.org>
      Gerrit-Reviewer: Anna Sato <anna...@chromium.org>
      Gerrit-Reviewer: Fergal Daly <fer...@chromium.org>
      Gerrit-Reviewer: Yoshisato Yanagisawa <yyana...@chromium.org>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-Attention: Yoshisato Yanagisawa <yyana...@chromium.org>
      Gerrit-Comment-Date: Thu, 11 Sep 2025 05:49:39 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Yoshisato Yanagisawa <yyana...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Yoshisato Yanagisawa (Gerrit)

      unread,
      Sep 11, 2025, 4:38:45 AMSep 11
      to Anna Sato, Chromium LUCI CQ, Fergal Daly, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
      Attention needed from Anna Sato

      Yoshisato Yanagisawa added 2 comments

      File content/browser/worker_host/shared_worker_service_impl.cc
      Line 532, Patchset 14: for (const auto& entry : shared_worker_client_counts_) {
      Yoshisato Yanagisawa . unresolved

      Let me confirm what I have understand from here.
      Technically, you can use two approaches:
      1. loop with `worker_hosts_` or `shared_worker_hosts_`, and make it ensure if the client is belongs to it. Proceed SharedWorkerHost's `EvictBFCachedClientsIfLastActive()` for that case.
      2. loop with `shared_worker_client_counts_`, and select the SharedWorkerHost that has the given client, then run SharedWorkerHost's `EvictBFCachedClientsIfLastActive()`.

      I understand you chose the second. Will you leave some comments on why you chose the second, and how it works?
      Leaving a mini-design doc is welcomed as well.

      Anna Sato

      Thanks for summarizing the approaches, and yes I'm using 2.

      1 is better when a client is connected to most of the active workers, while 2 is better when it's connected to only a few, IIUC. I've put the details in this doc:
      https://docs.google.com/document/d/19ZMaAaRUnMwB-EyQLjt4YZNSjKlGRTbFbjJ57H2ZIag/edit?usp=sharing&resourcekey=0-K6Q2fbF8lAL2QYot2dE73Q

      Do you have any thoughts on which approach is better here?

      Yoshisato Yanagisawa

      I feel Option 1 is straight forward because:
      a) `worker_hosts_` owns the SharedWorkerHost itself (i.e. no lookup is needed).
      b) we can directly write a logic other inside the SharedWorkerHost code,
      c) and all necessary information are available in the SharedWorkerHost's field (as you are already using).

      I am not sure which case usually happen without seeing a metric.

      File third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-all-clients-bfcached.tentative.window.js
      Line 25, Patchset 17 (Latest): '/wpt_internal/shared-worker/back-forward-cache/resources/worker-empty.js');
      Yoshisato Yanagisawa . unresolved

      Will you add three more test scenarios?

      1. a frame actually has multiple SharedWorker clients with the same SharedWorker instance. (inspired by https://chromium-review.googlesource.com/c/chromium/src/+/1872632, saying a frame can
      be added as a client multiple times to the same worker)
      2. a frame has multiple SharedWorker clients with different instances.
      3. two frames with shared and non-shared SharedWorker. non-shared SharedWorker is destroyed while shared is not. Frame A has SharedWorker a and SharedWorker c. Frame B has SharedWorker b and SharedWorker c. After Frame A unload, Frame A should be evicted on Frame B unload. My concern here is that wrong early return implementation may overlook SharedWorker c here.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Anna Sato
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      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: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
      Gerrit-Change-Number: 6914636
      Gerrit-PatchSet: 17
      Gerrit-Owner: Anna Sato <anna...@chromium.org>
      Gerrit-Reviewer: Anna Sato <anna...@chromium.org>
      Gerrit-Reviewer: Fergal Daly <fer...@chromium.org>
      Gerrit-Reviewer: Yoshisato Yanagisawa <yyana...@chromium.org>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-Attention: Anna Sato <anna...@chromium.org>
      Gerrit-Comment-Date: Thu, 11 Sep 2025 08:38:21 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Yoshisato Yanagisawa <yyana...@chromium.org>
      Comment-In-Reply-To: Anna Sato <anna...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Anna Sato (Gerrit)

      unread,
      Sep 12, 2025, 2:35:49 AMSep 12
      to Yoshisato Yanagisawa, Chromium LUCI CQ, Fergal Daly, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
      Attention needed from Fergal Daly and Yoshisato Yanagisawa

      Anna Sato voted and added 8 comments

      Votes added by Anna Sato

      Commit-Queue+1

      8 comments

      Patchset-level comments
      File-level comment, Patchset 21 (Latest):
      Anna Sato . resolved

      Thanks for the review! PTAL again?

      Commit Message
      Line 10, Patchset 9:clients are in BFCache. When the last active client of a SharedWorker
      Yoshisato Yanagisawa . resolved

      This is for solving the "Worker state when last client enters BFCache." case explained in https://docs.google.com/document/d/1dZxwmUYOlDmZ-PF97mfoXbzMrFHBsqeUT3XxTkpNIb0/edit?tab=t.0, right?

      Anna Sato

      Yes. Updated the desc.

      Line 22, Patchset 9:Bug: 406420935
      Yoshisato Yanagisawa . resolved

      I guess it nice also link to https://crbug.com/431875857

      Anna Sato

      Added the bug, on the parent CL as well, thanks!

      File content/browser/worker_host/shared_worker_host.cc
      Yoshisato Yanagisawa . resolved

      Will you leave a comment for this?
      Is this mean active client (i.e. non BFCache'd client) exist?

      Anna Sato

      Yes. Added a comment here.

      Line 1001, Patchset 20: other_rfh->GetMainFrame() == client_rfh->GetMainFrame()) {
      Anna Sato . unresolved

      Addressed the case where a main frame and its iframe are connected to the same worker, which @fer...@chromium.org also pointed out in [doc](https://docs.google.com/document/d/19ZMaAaRUnMwB-EyQLjt4YZNSjKlGRTbFbjJ57H2ZIag/edit?resourcekey=0-K6Q2fbF8lAL2QYot2dE73Q&disco=AAABrySJO4w), by adding a check its main frame to ensure they aren't considered as independent active clients.

      Added a test for this senario in `third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-with-iframe-client.tentative.window.js.`

      File content/browser/worker_host/shared_worker_service_impl.h
      Line 109, Patchset 14: // the last active client.
      Yoshisato Yanagisawa . resolved

      I guess we lack an explanation that:
      We assume that this render frame host (i.e. document) can be a client of multiple SharedWorkers. We would like to list all SharedWorkerHosts and proceed `EvictBFCacheClientsIfLastActive()` to all of them.

      Anna Sato

      Yeah right. Added "For all connected workers with `render_frame_host_id`," at the beginning.

      File content/browser/worker_host/shared_worker_service_impl.cc
      Line 532, Patchset 14: for (const auto& entry : shared_worker_client_counts_) {
      Yoshisato Yanagisawa . unresolved

      Let me confirm what I have understand from here.
      Technically, you can use two approaches:
      1. loop with `worker_hosts_` or `shared_worker_hosts_`, and make it ensure if the client is belongs to it. Proceed SharedWorkerHost's `EvictBFCachedClientsIfLastActive()` for that case.
      2. loop with `shared_worker_client_counts_`, and select the SharedWorkerHost that has the given client, then run SharedWorkerHost's `EvictBFCachedClientsIfLastActive()`.

      I understand you chose the second. Will you leave some comments on why you chose the second, and how it works?
      Leaving a mini-design doc is welcomed as well.

      Anna Sato

      Thanks for summarizing the approaches, and yes I'm using 2.

      1 is better when a client is connected to most of the active workers, while 2 is better when it's connected to only a few, IIUC. I've put the details in this doc:
      https://docs.google.com/document/d/19ZMaAaRUnMwB-EyQLjt4YZNSjKlGRTbFbjJ57H2ZIag/edit?usp=sharing&resourcekey=0-K6Q2fbF8lAL2QYot2dE73Q

      Do you have any thoughts on which approach is better here?

      Yoshisato Yanagisawa

      I feel Option 1 is straight forward because:
      a) `worker_hosts_` owns the SharedWorkerHost itself (i.e. no lookup is needed).
      b) we can directly write a logic other inside the SharedWorkerHost code,
      c) and all necessary information are available in the SharedWorkerHost's field (as you are already using).

      I am not sure which case usually happen without seeing a metric.

      Anna Sato

      Thank you! I now changed to use Option 1 and created a new `ContainsClient()` to avoid checking host that don't have a connection to the client.

      File third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-all-clients-bfcached.tentative.window.js
      Line 25, Patchset 17: '/wpt_internal/shared-worker/back-forward-cache/resources/worker-empty.js');
      Yoshisato Yanagisawa . unresolved

      Will you add three more test scenarios?

      1. a frame actually has multiple SharedWorker clients with the same SharedWorker instance. (inspired by https://chromium-review.googlesource.com/c/chromium/src/+/1872632, saying a frame can
      be added as a client multiple times to the same worker)
      2. a frame has multiple SharedWorker clients with different instances.
      3. two frames with shared and non-shared SharedWorker. non-shared SharedWorker is destroyed while shared is not. Frame A has SharedWorker a and SharedWorker c. Frame B has SharedWorker b and SharedWorker c. After Frame A unload, Frame A should be evicted on Frame B unload. My concern here is that wrong early return implementation may overlook SharedWorker c here.

      Anna Sato

      I've added new WPTs for:
      1. third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-multiple-clients-same-instance.tentative.window.js
      2. third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-multiple-clients-different-instances.tentative.window.js

      As for case 3, I guess when Frame A unloads, it should be blocked from BFCache immediately, since it's the only client for `worker a`? Please let me know if I've misunderstood, or if you had a different scenario in mind.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Fergal Daly
      • Yoshisato Yanagisawa
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      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: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
      Gerrit-Change-Number: 6914636
      Gerrit-PatchSet: 21
      Gerrit-Owner: Anna Sato <anna...@chromium.org>
      Gerrit-Reviewer: Anna Sato <anna...@chromium.org>
      Gerrit-Reviewer: Fergal Daly <fer...@chromium.org>
      Gerrit-Reviewer: Yoshisato Yanagisawa <yyana...@chromium.org>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-Attention: Yoshisato Yanagisawa <yyana...@chromium.org>
      Gerrit-Attention: Fergal Daly <fer...@chromium.org>
      Gerrit-Comment-Date: Fri, 12 Sep 2025 06:35:16 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Yoshisato Yanagisawa (Gerrit)

      unread,
      Sep 16, 2025, 4:33:14 AMSep 16
      to Anna Sato, Chromium LUCI CQ, Fergal Daly, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
      Attention needed from Anna Sato and Fergal Daly

      Yoshisato Yanagisawa voted and added 6 comments

      Votes added by Yoshisato Yanagisawa

      Code-Review+1

      6 comments

      Patchset-level comments
      Yoshisato Yanagisawa . resolved

      lgtm w/ comments.

      File content/browser/worker_host/shared_worker_service_impl.cc
      Line 530, Patchset 21 (Latest):bool SharedWorkerServiceImpl::EvictBFCachedClientsIfLastActive(
      Yoshisato Yanagisawa . unresolved

      You might be focus on correctness compared to keeping clients as much as possible, right?
      I am considering the scenario like:
      Frame 1 has SharedWorker A and SharedWorker B.
      Frame 2 has SharedWorker A and SharedWorker B.
      Frame 3 only has SharedWorker B.

      When Frame 1 got unloaded, Frame 1 will be BFCached.
      Then, when Frame 2 got unloaded, Frame 1 will be evicted because Frame 2 is the last client for SharedWorker A.
      Technically, Frame 3 and SharedWorker B alive at this time, and Frame 1-2 can technically be BFCached until Frame 3 unload. However, the current implementation should still be correct.

      Line 532, Patchset 14: for (const auto& entry : shared_worker_client_counts_) {
      Yoshisato Yanagisawa . resolved

      Let me confirm what I have understand from here.
      Technically, you can use two approaches:
      1. loop with `worker_hosts_` or `shared_worker_hosts_`, and make it ensure if the client is belongs to it. Proceed SharedWorkerHost's `EvictBFCachedClientsIfLastActive()` for that case.
      2. loop with `shared_worker_client_counts_`, and select the SharedWorkerHost that has the given client, then run SharedWorkerHost's `EvictBFCachedClientsIfLastActive()`.

      I understand you chose the second. Will you leave some comments on why you chose the second, and how it works?
      Leaving a mini-design doc is welcomed as well.

      Anna Sato

      Thanks for summarizing the approaches, and yes I'm using 2.

      1 is better when a client is connected to most of the active workers, while 2 is better when it's connected to only a few, IIUC. I've put the details in this doc:
      https://docs.google.com/document/d/19ZMaAaRUnMwB-EyQLjt4YZNSjKlGRTbFbjJ57H2ZIag/edit?usp=sharing&resourcekey=0-K6Q2fbF8lAL2QYot2dE73Q

      Do you have any thoughts on which approach is better here?

      Yoshisato Yanagisawa

      I feel Option 1 is straight forward because:
      a) `worker_hosts_` owns the SharedWorkerHost itself (i.e. no lookup is needed).
      b) we can directly write a logic other inside the SharedWorkerHost code,
      c) and all necessary information are available in the SharedWorkerHost's field (as you are already using).

      I am not sure which case usually happen without seeing a metric.

      Anna Sato

      Thank you! I now changed to use Option 1 and created a new `ContainsClient()` to avoid checking host that don't have a connection to the client.

      Yoshisato Yanagisawa

      Thank you!

      Line 532, Patchset 21 (Latest): for (const auto& host : worker_hosts_) {
      Yoshisato Yanagisawa . unresolved

      Can I ask you to add a trace and Uma to measure elapsed time here?
      The code will be executed every time documents with SharedWorker unload, and I just want to know if we need to improve performance or fine to be as-is.

      Line 535, Patchset 21 (Latest): return true;
      Yoshisato Yanagisawa . unresolved

      Why is it fine to return here instead of running `EvictBFCachedClientsIfLastActive()` to all `worker_hosts_`?

      File third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-all-clients-bfcached.tentative.window.js
      Line 25, Patchset 17: '/wpt_internal/shared-worker/back-forward-cache/resources/worker-empty.js');
      Yoshisato Yanagisawa . unresolved

      Will you add three more test scenarios?

      1. a frame actually has multiple SharedWorker clients with the same SharedWorker instance. (inspired by https://chromium-review.googlesource.com/c/chromium/src/+/1872632, saying a frame can
      be added as a client multiple times to the same worker)
      2. a frame has multiple SharedWorker clients with different instances.
      3. two frames with shared and non-shared SharedWorker. non-shared SharedWorker is destroyed while shared is not. Frame A has SharedWorker a and SharedWorker c. Frame B has SharedWorker b and SharedWorker c. After Frame A unload, Frame A should be evicted on Frame B unload. My concern here is that wrong early return implementation may overlook SharedWorker c here.

      Anna Sato

      I've added new WPTs for:
      1. third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-multiple-clients-same-instance.tentative.window.js
      2. third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-multiple-clients-different-instances.tentative.window.js

      As for case 3, I guess when Frame A unloads, it should be blocked from BFCache immediately, since it's the only client for `worker a`? Please let me know if I've misunderstood, or if you had a different scenario in mind.

      Yoshisato Yanagisawa

      Ah, good point. maybe Frame B should also have `worker a` to realize the scenario? i.e. Frame A has `Worker a` and `Worker b`, and Frame B has `worker a`, `worker b`, and `worker c`. Then, it clarifies my question in content/browser/worker_host/shared_worker_service_impl.cc

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Anna Sato
      • Fergal Daly
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      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: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
      Gerrit-Change-Number: 6914636
      Gerrit-PatchSet: 21
      Gerrit-Owner: Anna Sato <anna...@chromium.org>
      Gerrit-Reviewer: Anna Sato <anna...@chromium.org>
      Gerrit-Reviewer: Fergal Daly <fer...@chromium.org>
      Gerrit-Reviewer: Yoshisato Yanagisawa <yyana...@chromium.org>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-Attention: Fergal Daly <fer...@chromium.org>
      Gerrit-Attention: Anna Sato <anna...@chromium.org>
      Gerrit-Comment-Date: Tue, 16 Sep 2025 08:32:45 +0000
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Anna Sato (Gerrit)

      unread,
      Sep 17, 2025, 12:57:00 AMSep 17
      to Yoshisato Yanagisawa, Chromium LUCI CQ, Fergal Daly, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
      Attention needed from Fergal Daly and Yoshisato Yanagisawa

      Anna Sato added 5 comments

      Patchset-level comments
      File-level comment, Patchset 23 (Latest):
      Anna Sato . resolved

      Thank you for the review!

      File content/browser/worker_host/shared_worker_service_impl.cc
      Line 530, Patchset 21:bool SharedWorkerServiceImpl::EvictBFCachedClientsIfLastActive(
      Yoshisato Yanagisawa . unresolved

      You might be focus on correctness compared to keeping clients as much as possible, right?
      I am considering the scenario like:
      Frame 1 has SharedWorker A and SharedWorker B.
      Frame 2 has SharedWorker A and SharedWorker B.
      Frame 3 only has SharedWorker B.

      When Frame 1 got unloaded, Frame 1 will be BFCached.
      Then, when Frame 2 got unloaded, Frame 1 will be evicted because Frame 2 is the last client for SharedWorker A.
      Technically, Frame 3 and SharedWorker B alive at this time, and Frame 1-2 can technically be BFCached until Frame 3 unload. However, the current implementation should still be correct.

      Anna Sato

      Frames 1 and 2 could technically remain as worker B's client in BFCache while Frame 3 alive, but yeah I prefer the current design because of its simplicity, given that this is a temporary workaround until worker freezing is implemented.

      Line 532, Patchset 21: for (const auto& host : worker_hosts_) {
      Yoshisato Yanagisawa . resolved

      Can I ask you to add a trace and Uma to measure elapsed time here?
      The code will be executed every time documents with SharedWorker unload, and I just want to know if we need to improve performance or fine to be as-is.

      Anna Sato

      Added `TRACE` and UMA to record the execution time.

      Line 535, Patchset 21: return true;
      Yoshisato Yanagisawa . resolved

      Why is it fine to return here instead of running `EvictBFCachedClientsIfLastActive()` to all `worker_hosts_`?

      Anna Sato

      Ah you're right, the early return was incorrect. Fixed to iterate through all workers.

      File third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-all-clients-bfcached.tentative.window.js
      Line 25, Patchset 17: '/wpt_internal/shared-worker/back-forward-cache/resources/worker-empty.js');
      Yoshisato Yanagisawa . unresolved

      Will you add three more test scenarios?

      1. a frame actually has multiple SharedWorker clients with the same SharedWorker instance. (inspired by https://chromium-review.googlesource.com/c/chromium/src/+/1872632, saying a frame can
      be added as a client multiple times to the same worker)
      2. a frame has multiple SharedWorker clients with different instances.
      3. two frames with shared and non-shared SharedWorker. non-shared SharedWorker is destroyed while shared is not. Frame A has SharedWorker a and SharedWorker c. Frame B has SharedWorker b and SharedWorker c. After Frame A unload, Frame A should be evicted on Frame B unload. My concern here is that wrong early return implementation may overlook SharedWorker c here.

      Anna Sato

      I've added new WPTs for:
      1. third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-multiple-clients-same-instance.tentative.window.js
      2. third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-multiple-clients-different-instances.tentative.window.js

      As for case 3, I guess when Frame A unloads, it should be blocked from BFCache immediately, since it's the only client for `worker a`? Please let me know if I've misunderstood, or if you had a different scenario in mind.

      Yoshisato Yanagisawa

      Ah, good point. maybe Frame B should also have `worker a` to realize the scenario? i.e. Frame A has `Worker a` and `Worker b`, and Frame B has `worker a`, `worker b`, and `worker c`. Then, it clarifies my question in content/browser/worker_host/shared_worker_service_impl.cc

      Anna Sato

      Added a new WPT at third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-mixed-clients-eviction.tentative.window.js. (Sorry for the multiple updates...)

      • Frame 1 connects to workers A and B.
      • Frame 2 connects to workers A and C.
      • Frame 3 connects to worker B.

      The test verifies that when Frame 1 is in BFCache and Frame 2 navigates away, Frame 1 is correctly evicted. It also verifies the worker state, ensuring A and C are terminated while B is kept alive.

      I am still not completely sure if I understood the exact scenario you had in mind, please let me know if this new test covers your concern!

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Fergal Daly
      • Yoshisato Yanagisawa
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      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: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
      Gerrit-Change-Number: 6914636
      Gerrit-PatchSet: 23
      Gerrit-Owner: Anna Sato <anna...@chromium.org>
      Gerrit-Reviewer: Anna Sato <anna...@chromium.org>
      Gerrit-Reviewer: Fergal Daly <fer...@chromium.org>
      Gerrit-Reviewer: Yoshisato Yanagisawa <yyana...@chromium.org>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-Attention: Yoshisato Yanagisawa <yyana...@chromium.org>
      Gerrit-Attention: Fergal Daly <fer...@chromium.org>
      Gerrit-Comment-Date: Wed, 17 Sep 2025 04:56:37 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Anna Sato (Gerrit)

      unread,
      Sep 17, 2025, 12:57:03 AMSep 17
      to Yoshisato Yanagisawa, Chromium LUCI CQ, Fergal Daly, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
      Attention needed from Anna Sato, Fergal Daly and Yoshisato Yanagisawa

      Message from Anna Sato

      Set Ready For Review

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Anna Sato
      • Fergal Daly
      • Yoshisato Yanagisawa
      Gerrit-Attention: Anna Sato <anna...@chromium.org>
      Gerrit-Comment-Date: Wed, 17 Sep 2025 04:56:41 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Yoshisato Yanagisawa (Gerrit)

      unread,
      Sep 17, 2025, 4:21:38 AMSep 17
      to Anna Sato, Chromium LUCI CQ, Fergal Daly, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
      Attention needed from Anna Sato and Fergal Daly

      Yoshisato Yanagisawa added 3 comments

      File content/browser/worker_host/shared_worker_service_impl.cc
      Line 530, Patchset 21:bool SharedWorkerServiceImpl::EvictBFCachedClientsIfLastActive(
      Yoshisato Yanagisawa . resolved

      You might be focus on correctness compared to keeping clients as much as possible, right?
      I am considering the scenario like:
      Frame 1 has SharedWorker A and SharedWorker B.
      Frame 2 has SharedWorker A and SharedWorker B.
      Frame 3 only has SharedWorker B.

      When Frame 1 got unloaded, Frame 1 will be BFCached.
      Then, when Frame 2 got unloaded, Frame 1 will be evicted because Frame 2 is the last client for SharedWorker A.
      Technically, Frame 3 and SharedWorker B alive at this time, and Frame 1-2 can technically be BFCached until Frame 3 unload. However, the current implementation should still be correct.

      Anna Sato

      Frames 1 and 2 could technically remain as worker B's client in BFCache while Frame 3 alive, but yeah I prefer the current design because of its simplicity, given that this is a temporary workaround until worker freezing is implemented.

      Yoshisato Yanagisawa

      Acknowledged

      Line 545, Patchset 23 (Latest): UMA_HISTOGRAM_TIMES("SharedWorker.BFCache.LastClientCheckTime",
      timer.Elapsed());
      Yoshisato Yanagisawa . unresolved

      Thank you for adding a trace and uma. Let me ask something more for uma.

      1. if it is not in a critical path, a function is preferred to a macro (https://chromium.googlesource.com/chromium/src/tools/+/HEAD/metrics/histograms/README.md#coding-emitting-to-histograms)
      2. please update histograms.xml (maybe tools/metrics/histograms/metadata/content/histograms.xml?) for this. Unfortunately, SharedWorker is not a top level metrics, I suggest to use the "Content.SharedWorker" prefix instead.
      3. if you got stuck on writing a metric description, I suggest you to ask gemini to write it. Note that the description should be understandable without reading the code.

      File third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-all-clients-bfcached.tentative.window.js
      Line 25, Patchset 17: '/wpt_internal/shared-worker/back-forward-cache/resources/worker-empty.js');
      Yoshisato Yanagisawa . unresolved

      Will you add three more test scenarios?

      1. a frame actually has multiple SharedWorker clients with the same SharedWorker instance. (inspired by https://chromium-review.googlesource.com/c/chromium/src/+/1872632, saying a frame can
      be added as a client multiple times to the same worker)
      2. a frame has multiple SharedWorker clients with different instances.
      3. two frames with shared and non-shared SharedWorker. non-shared SharedWorker is destroyed while shared is not. Frame A has SharedWorker a and SharedWorker c. Frame B has SharedWorker b and SharedWorker c. After Frame A unload, Frame A should be evicted on Frame B unload. My concern here is that wrong early return implementation may overlook SharedWorker c here.

      Anna Sato

      I've added new WPTs for:
      1. third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-multiple-clients-same-instance.tentative.window.js
      2. third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-multiple-clients-different-instances.tentative.window.js

      As for case 3, I guess when Frame A unloads, it should be blocked from BFCache immediately, since it's the only client for `worker a`? Please let me know if I've misunderstood, or if you had a different scenario in mind.

      Yoshisato Yanagisawa

      Ah, good point. maybe Frame B should also have `worker a` to realize the scenario? i.e. Frame A has `Worker a` and `Worker b`, and Frame B has `worker a`, `worker b`, and `worker c`. Then, it clarifies my question in content/browser/worker_host/shared_worker_service_impl.cc

      Anna Sato

      Added a new WPT at third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-mixed-clients-eviction.tentative.window.js. (Sorry for the multiple updates...)

      • Frame 1 connects to workers A and B.
      • Frame 2 connects to workers A and C.
      • Frame 3 connects to worker B.

      The test verifies that when Frame 1 is in BFCache and Frame 2 navigates away, Frame 1 is correctly evicted. It also verifies the worker state, ensuring A and C are terminated while B is kept alive.

      I am still not completely sure if I understood the exact scenario you had in mind, please let me know if this new test covers your concern!

      Yoshisato Yanagisawa

      Sorry for going back and forward. My original motivation was creating a test case that won't work with `SharedWorkerServiceImpl::EvictBFCachedClientsIfLastActive()` to return at L542. I assume the case is covered by the case you wrote.

      Then, I just started to come up with the question how RFH work if the eviction happens twice. Assume Frame 1 connects to worker A, B, and C (and others are connected to what you wrote). Frame 1 goes to BFCache, then Frame 2 navigate away.
      Then, Frame 1 eviction might happen for Worker A and C. Will the second eviction just be ignored?

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Anna Sato
      • Fergal Daly
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      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: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
      Gerrit-Change-Number: 6914636
      Gerrit-PatchSet: 23
      Gerrit-Owner: Anna Sato <anna...@chromium.org>
      Gerrit-Reviewer: Anna Sato <anna...@chromium.org>
      Gerrit-Reviewer: Fergal Daly <fer...@chromium.org>
      Gerrit-Reviewer: Yoshisato Yanagisawa <yyana...@chromium.org>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-Attention: Fergal Daly <fer...@chromium.org>
      Gerrit-Attention: Anna Sato <anna...@chromium.org>
      Gerrit-Comment-Date: Wed, 17 Sep 2025 08:21:14 +0000
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Yoshisato Yanagisawa (Gerrit)

      unread,
      Sep 17, 2025, 4:21:55 AMSep 17
      to Anna Sato, Chromium LUCI CQ, Fergal Daly, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
      Attention needed from Anna Sato and Fergal Daly

      Yoshisato Yanagisawa voted and added 1 comment

      Votes added by Yoshisato Yanagisawa

      Code-Review+1

      1 comment

      Patchset-level comments
      Yoshisato Yanagisawa . resolved

      lgtm w/ comments.

      Gerrit-Comment-Date: Wed, 17 Sep 2025 08:21:28 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Anna Sato (Gerrit)

      unread,
      Sep 17, 2025, 7:07:57 AMSep 17
      to Chrome Metrics Logs, Yoshisato Yanagisawa, Chromium LUCI CQ, Fergal Daly, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
      Attention needed from Fergal Daly and Yoshisato Yanagisawa

      Anna Sato voted and added 2 comments

      Votes added by Anna Sato

      Commit-Queue+1

      2 comments

      File content/browser/worker_host/shared_worker_service_impl.cc
      Line 545, Patchset 23: UMA_HISTOGRAM_TIMES("SharedWorker.BFCache.LastClientCheckTime",
      timer.Elapsed());
      Yoshisato Yanagisawa . resolved

      Thank you for adding a trace and uma. Let me ask something more for uma.

      1. if it is not in a critical path, a function is preferred to a macro (https://chromium.googlesource.com/chromium/src/tools/+/HEAD/metrics/histograms/README.md#coding-emitting-to-histograms)
      2. please update histograms.xml (maybe tools/metrics/histograms/metadata/content/histograms.xml?) for this. Unfortunately, SharedWorker is not a top level metrics, I suggest to use the "Content.SharedWorker" prefix instead.
      3. if you got stuck on writing a metric description, I suggest you to ask gemini to write it. Note that the description should be understandable without reading the code.

      Anna Sato

      Totally forgot to add this, thanks. Added in tools/metrics/histograms/metadata/content/histograms.xml.

      File third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-all-clients-bfcached.tentative.window.js
      Attention is currently required from:
      • Fergal Daly
      • Yoshisato Yanagisawa
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      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: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
      Gerrit-Change-Number: 6914636
      Gerrit-PatchSet: 24
      Gerrit-Owner: Anna Sato <anna...@chromium.org>
      Gerrit-Reviewer: Anna Sato <anna...@chromium.org>
      Gerrit-Reviewer: Chrome Metrics Logs <chrome-metrics...@google.com>
      Gerrit-Reviewer: Fergal Daly <fer...@chromium.org>
      Gerrit-Reviewer: Yoshisato Yanagisawa <yyana...@chromium.org>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-Attention: Yoshisato Yanagisawa <yyana...@chromium.org>
      Gerrit-Attention: Fergal Daly <fer...@chromium.org>
      Gerrit-Comment-Date: Wed, 17 Sep 2025 11:07:24 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: Anna Sato <anna...@chromium.org>
      Comment-In-Reply-To: Yoshisato Yanagisawa <yyana...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Yoshisato Yanagisawa (Gerrit)

      unread,
      Sep 18, 2025, 2:13:31 AMSep 18
      to Anna Sato, Chrome Metrics Logs, Chromium LUCI CQ, Fergal Daly, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
      Attention needed from Anna Sato and Fergal Daly

      Yoshisato Yanagisawa voted and added 2 comments

      Votes added by Yoshisato Yanagisawa

      Code-Review+1

      2 comments

      Patchset-level comments
      Yoshisato Yanagisawa . resolved

      lgtm

      File third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-all-clients-bfcached.tentative.window.js
      Line 25, Patchset 17: '/wpt_internal/shared-worker/back-forward-cache/resources/worker-empty.js');
      Yoshisato Yanagisawa . resolved
      Yoshisato Yanagisawa

      Acknowledged

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Anna Sato
      • Fergal Daly
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      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: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
      Gerrit-Change-Number: 6914636
      Gerrit-PatchSet: 25
      Gerrit-Owner: Anna Sato <anna...@chromium.org>
      Gerrit-Reviewer: Anna Sato <anna...@chromium.org>
      Gerrit-Reviewer: Chrome Metrics Logs <chrome-metrics...@google.com>
      Gerrit-Reviewer: Fergal Daly <fer...@chromium.org>
      Gerrit-Reviewer: Yoshisato Yanagisawa <yyana...@chromium.org>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-Attention: Anna Sato <anna...@chromium.org>
      Gerrit-Attention: Fergal Daly <fer...@chromium.org>
      Gerrit-Comment-Date: Thu, 18 Sep 2025 06:13:08 +0000
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Fergal Daly (Gerrit)

      unread,
      Sep 22, 2025, 3:57:54 AMSep 22
      to Anna Sato, Code Review Nudger, Yoshisato Yanagisawa, Chrome Metrics Logs, Chromium LUCI CQ, Fergal Daly, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
      Attention needed from Anna Sato

      Fergal Daly added 4 comments

      File third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-all-clients-bfcached.tentative.window.js
      Line 39, Patchset 25 (Latest): // Neither should be restored from BFCache, sincfe a SharedWorker cannot be
      Fergal Daly . unresolved

      since

      File third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-mixed-clients-eviction.tentative.window.js
      Line 58, Patchset 25 (Latest): // Neither should be restored from BFCache, sincfe a SharedWorker cannot be
      Fergal Daly . unresolved

      since

      File third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-with-iframe-client.tentative.window.js
      Line 1, Patchset 25 (Latest):// META: title=BFCache is blocked for a page with an iframe that is also a SharedWorker client.
      Fergal Daly . unresolved

      I think you need one more test which involves 2 frames in the same frame tree connecting to the same worker. Can be 2 iframes or main frame and iframe.

      Line 19, Patchset 25 (Latest): await rc1.executeScript((workerUrl) => {
      Fergal Daly . unresolved

      I think you can simplify this with

      ```
      const iframe = rc1.addIframe(...);
      iframe.executeScript(...);
      ```

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Anna Sato
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      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: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
      Gerrit-Change-Number: 6914636
      Gerrit-PatchSet: 25
      Gerrit-Owner: Anna Sato <anna...@chromium.org>
      Gerrit-Reviewer: Anna Sato <anna...@chromium.org>
      Gerrit-Reviewer: Chrome Metrics Logs <chrome-metrics...@google.com>
      Gerrit-Reviewer: Fergal Daly <fer...@chromium.org>
      Gerrit-Reviewer: Yoshisato Yanagisawa <yyana...@chromium.org>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
      Gerrit-Comment-Date: Mon, 22 Sep 2025 07:57:21 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Fergal Daly (Gerrit)

      unread,
      Sep 22, 2025, 5:03:54 AMSep 22
      to Anna Sato, Code Review Nudger, Yoshisato Yanagisawa, Chrome Metrics Logs, Chromium LUCI CQ, Fergal Daly, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
      Attention needed from Anna Sato

      Fergal Daly added 6 comments

      File content/browser/renderer_host/back_forward_cache_impl.cc
      Line 1073, Patchset 25 (Latest): if (base::FeatureList::IsEnabled(blink::features::kBFCacheWithSharedWorker)) {
      Fergal Daly . unresolved

      Why in PopulateStickyReasonsForDocument? It's not a sticky reason.

      Line 1074, Patchset 25 (Latest): // If this is the last active client of a Shared Worker, block this frame
      Fergal Daly . unresolved

      I would suggest writing this as

      If this frame is a client of a Shared Worker and all other clients are in this frame's frame-tree, block this frame.

      Line 1078, Patchset 25 (Latest): if (!rfh->IsInBackForwardCache()) {
      Fergal Daly . unresolved

      why do we need this?

      File content/browser/worker_host/shared_worker_host.cc
      Line 992, Patchset 25 (Latest): const GlobalRenderFrameHostId& client_rfh_id) {
      Fergal Daly . unresolved

      Why not pass `RenderFrameHostImpl&` instead of converting to/from IDs?

      Line 1001, Patchset 25 (Latest): other_rfh->GetMainFrame() == client_rfh->GetMainFrame()) {
      Fergal Daly . unresolved

      This is called in a loop, so please capture the value outside the loop.

      Since this method itself is called in a loop, I think we can capture it once in the outer caller.

      Even that outer one is called traversing the frame tree. I wonder if we should be passing in the main frame all the way down the tree.

      Line 1001, Patchset 25 (Latest): other_rfh->GetMainFrame() == client_rfh->GetMainFrame()) {
      Fergal Daly . unresolved

      I was chatting with rakina and I think you want to use `GetOutermostMainFrame` for these to account for fenced frames.

      Ideally have a test for that too.

      Gerrit-Comment-Date: Mon, 22 Sep 2025 09:03:23 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Yoshisato Yanagisawa (Gerrit)

      unread,
      Sep 25, 2025, 11:02:30 PMSep 25
      to Anna Sato, Code Review Nudger, Chrome Metrics Logs, Chromium LUCI CQ, Fergal Daly, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
      Attention needed from Anna Sato

      Yoshisato Yanagisawa added 2 comments

      Patchset-level comments
      File-level comment, Patchset 27 (Latest):
      Yoshisato Yanagisawa . resolved

      still lgtm w/ minor comment.

      File content/browser/worker_host/shared_worker_host.h
      Line 173, Patchset 27 (Latest): RenderFrameHostImpl* client_render_frame_host_id);
      Yoshisato Yanagisawa . unresolved

      nit but I suggest to omit `_id`.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Anna Sato
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      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: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
      Gerrit-Change-Number: 6914636
      Gerrit-PatchSet: 27
      Gerrit-Owner: Anna Sato <anna...@chromium.org>
      Gerrit-Reviewer: Anna Sato <anna...@chromium.org>
      Gerrit-Reviewer: Chrome Metrics Logs <chrome-metrics...@google.com>
      Gerrit-Reviewer: Fergal Daly <fer...@chromium.org>
      Gerrit-Reviewer: Yoshisato Yanagisawa <yyana...@chromium.org>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
      Gerrit-Attention: Anna Sato <anna...@chromium.org>
      Gerrit-Comment-Date: Fri, 26 Sep 2025 03:02:20 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Yoshisato Yanagisawa (Gerrit)

      unread,
      Sep 25, 2025, 11:02:42 PMSep 25
      to Anna Sato, Code Review Nudger, Chrome Metrics Logs, Chromium LUCI CQ, Fergal Daly, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
      Attention needed from Anna Sato

      Yoshisato Yanagisawa voted Code-Review+1

      Code-Review+1
      Gerrit-Comment-Date: Fri, 26 Sep 2025 03:02:31 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Anna Sato (Gerrit)

      unread,
      Sep 29, 2025, 9:58:35 PMSep 29
      to Yoshisato Yanagisawa, Code Review Nudger, Chrome Metrics Logs, Chromium LUCI CQ, Fergal Daly, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
      Attention needed from Fergal Daly and Yoshisato Yanagisawa

      Anna Sato voted and added 12 comments

      Votes added by Anna Sato

      Commit-Queue+1

      12 comments

      Patchset-level comments
      File-level comment, Patchset 28 (Latest):
      Anna Sato . resolved

      Thank you so much for the review!

      File content/browser/renderer_host/back_forward_cache_impl.cc
      Line 1073, Patchset 25: if (base::FeatureList::IsEnabled(blink::features::kBFCacheWithSharedWorker)) {
      Fergal Daly . resolved

      Why in PopulateStickyReasonsForDocument? It's not a sticky reason.

      Anna Sato

      That's right. Moved to `PopulateNonStickyReasonsForDocument`.

      Line 1074, Patchset 25: // If this is the last active client of a Shared Worker, block this frame
      Fergal Daly . resolved

      I would suggest writing this as

      If this frame is a client of a Shared Worker and all other clients are in this frame's frame-tree, block this frame.

      Anna Sato

      Updated the comment.

      Line 1078, Patchset 25: if (!rfh->IsInBackForwardCache()) {
      Fergal Daly . unresolved

      why do we need this?

      Anna Sato

      IIUC this code is called when pages are going into BFCache and being restored from it.

      During a restore, there should be one more active clients, which would cause `EvictBFCachedClientsIfLastActive()` to return false. So the code would be WAI even without the `IsInBackForwardCache` check, but we can keep the check to avoid the cost of calling `EvictBFCachedClientsIfLastActive()`? (The new UMA metric "Content.SharedWorker.Service.LastClientCheckTime" will tell us exactly how much cost we're saving.)

      File content/browser/worker_host/shared_worker_host.h
      Line 173, Patchset 27: RenderFrameHostImpl* client_render_frame_host_id);
      Yoshisato Yanagisawa . resolved

      nit but I suggest to omit `_id`.

      Anna Sato

      Changed to `render_frame_host` align with the .cc file, thanks!

      File content/browser/worker_host/shared_worker_host.cc
      Line 992, Patchset 25: const GlobalRenderFrameHostId& client_rfh_id) {
      Fergal Daly . resolved

      Why not pass `RenderFrameHostImpl&` instead of converting to/from IDs?

      Anna Sato

      Fixed.

      Line 1001, Patchset 25: other_rfh->GetMainFrame() == client_rfh->GetMainFrame()) {
      Fergal Daly . unresolved

      I was chatting with rakina and I think you want to use `GetOutermostMainFrame` for these to account for fenced frames.

      Ideally have a test for that too.

      Anna Sato

      Switched to use GetOutermostMainFrame instead of GetMainFrame.

      Line 1001, Patchset 25: other_rfh->GetMainFrame() == client_rfh->GetMainFrame()) {
      Fergal Daly . resolved

      This is called in a loop, so please capture the value outside the loop.

      Since this method itself is called in a loop, I think we can capture it once in the outer caller.

      Even that outer one is called traversing the frame tree. I wonder if we should be passing in the main frame all the way down the tree.

      Anna Sato

      Moved it outside the loop, and now checking only if the two frames share the same main frame.

      Line 1001, Patchset 25: other_rfh->GetMainFrame() == client_rfh->GetMainFrame()) {
      Fergal Daly . unresolved

      I was chatting with rakina and I think you want to use `GetOutermostMainFrame` for these to account for fenced frames.

      Ideally have a test for that too.

      Anna Sato

      As we chatted, if fenced frames cannot share a SharedWorker with its main frame, using `GetMainFrame()` here is enough...? but I changed it to `GetOutermostMainFrame()` anyway as it seems like more robust option.

      File third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-all-clients-bfcached.tentative.window.js
      Line 39, Patchset 25: // Neither should be restored from BFCache, sincfe a SharedWorker cannot be
      Fergal Daly . resolved

      since

      Anna Sato

      Fixed.

      File third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-mixed-clients-eviction.tentative.window.js
      Line 58, Patchset 25: // Neither should be restored from BFCache, sincfe a SharedWorker cannot be
      Fergal Daly . resolved

      since

      Anna Sato

      Fixed.

      File third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-with-iframe-client.tentative.window.js
      Line 19, Patchset 25: await rc1.executeScript((workerUrl) => {
      Fergal Daly . resolved

      I think you can simplify this with

      ```
      const iframe = rc1.addIframe(...);
      iframe.executeScript(...);
      ```

      Anna Sato

      It should be. Changed, thanks!

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Fergal Daly
      • Yoshisato Yanagisawa
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      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: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
      Gerrit-Change-Number: 6914636
      Gerrit-PatchSet: 28
      Gerrit-Owner: Anna Sato <anna...@chromium.org>
      Gerrit-Reviewer: Anna Sato <anna...@chromium.org>
      Gerrit-Reviewer: Chrome Metrics Logs <chrome-metrics...@google.com>
      Gerrit-Reviewer: Fergal Daly <fer...@chromium.org>
      Gerrit-Reviewer: Yoshisato Yanagisawa <yyana...@chromium.org>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
      Gerrit-Attention: Yoshisato Yanagisawa <yyana...@chromium.org>
      Gerrit-Attention: Fergal Daly <fer...@chromium.org>
      Gerrit-Comment-Date: Tue, 30 Sep 2025 01:58:00 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: Yoshisato Yanagisawa <yyana...@chromium.org>
      Comment-In-Reply-To: Fergal Daly <fer...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Anna Sato (Gerrit)

      unread,
      Sep 30, 2025, 12:59:44 AMSep 30
      to Yoshisato Yanagisawa, Code Review Nudger, Chrome Metrics Logs, Chromium LUCI CQ, Fergal Daly, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
      Attention needed from Fergal Daly and Yoshisato Yanagisawa

      Anna Sato added 1 comment

      File third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-with-iframe-client.tentative.window.js
      Line 1, Patchset 25:// META: title=BFCache is blocked for a page with an iframe that is also a SharedWorker client.
      Fergal Daly . resolved

      I think you need one more test which involves 2 frames in the same frame tree connecting to the same worker. Can be 2 iframes or main frame and iframe.

      Anna Sato

      third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-with-iframe-client.tentative.window.js

      This test tests it with the main frame and its iframe.

      Gerrit-Comment-Date: Tue, 30 Sep 2025 04:59:14 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Fergal Daly <fer...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Yoshisato Yanagisawa (Gerrit)

      unread,
      Sep 30, 2025, 3:23:45 AM (14 days ago) Sep 30
      to Anna Sato, Code Review Nudger, Chrome Metrics Logs, Chromium LUCI CQ, Fergal Daly, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
      Attention needed from Anna Sato and Fergal Daly

      Yoshisato Yanagisawa voted and added 2 comments

      Votes added by Yoshisato Yanagisawa

      Code-Review+1

      2 comments

      Patchset-level comments
      Yoshisato Yanagisawa . resolved

      still lgtm.

      File content/browser/worker_host/shared_worker_host.cc
      Line 1001, Patchset 25: other_rfh->GetMainFrame() == client_rfh->GetMainFrame()) {
      Fergal Daly . unresolved

      I was chatting with rakina and I think you want to use `GetOutermostMainFrame` for these to account for fenced frames.

      Ideally have a test for that too.

      Anna Sato

      As we chatted, if fenced frames cannot share a SharedWorker with its main frame, using `GetMainFrame()` here is enough...? but I changed it to `GetOutermostMainFrame()` anyway as it seems like more robust option.

      Yoshisato Yanagisawa

      Pardon the question from a layman, but I'm trying to understand a specific lifecycle case. Given that a SharedWorker within a Fenced Frame cannot be shared with the embedder, what is the expected behavior when the embedding document is stored in the BFCache? It seems the worker would be left with no active clients, and I'm wondering how that state is managed upon restoration.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Anna Sato
      • Fergal Daly
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      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: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
      Gerrit-Change-Number: 6914636
      Gerrit-PatchSet: 28
      Gerrit-Owner: Anna Sato <anna...@chromium.org>
      Gerrit-Reviewer: Anna Sato <anna...@chromium.org>
      Gerrit-Reviewer: Chrome Metrics Logs <chrome-metrics...@google.com>
      Gerrit-Reviewer: Fergal Daly <fer...@chromium.org>
      Gerrit-Reviewer: Yoshisato Yanagisawa <yyana...@chromium.org>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
      Gerrit-Attention: Anna Sato <anna...@chromium.org>
      Gerrit-Attention: Fergal Daly <fer...@chromium.org>
      Gerrit-Comment-Date: Tue, 30 Sep 2025 07:23:09 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: Anna Sato <anna...@chromium.org>
      Comment-In-Reply-To: Fergal Daly <fer...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Anna Sato (Gerrit)

      unread,
      Sep 30, 2025, 8:24:16 PM (13 days ago) Sep 30
      to Yoshisato Yanagisawa, Code Review Nudger, Chrome Metrics Logs, Chromium LUCI CQ, Fergal Daly, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
      Attention needed from Fergal Daly and Yoshisato Yanagisawa

      Anna Sato added 1 comment

      File content/browser/worker_host/shared_worker_host.cc
      Line 1001, Patchset 25: other_rfh->GetMainFrame() == client_rfh->GetMainFrame()) {
      Fergal Daly . unresolved

      I was chatting with rakina and I think you want to use `GetOutermostMainFrame` for these to account for fenced frames.

      Ideally have a test for that too.

      Anna Sato

      As we chatted, if fenced frames cannot share a SharedWorker with its main frame, using `GetMainFrame()` here is enough...? but I changed it to `GetOutermostMainFrame()` anyway as it seems like more robust option.

      Yoshisato Yanagisawa

      Pardon the question from a layman, but I'm trying to understand a specific lifecycle case. Given that a SharedWorker within a Fenced Frame cannot be shared with the embedder, what is the expected behavior when the embedding document is stored in the BFCache? It seems the worker would be left with no active clients, and I'm wondering how that state is managed upon restoration.

      Anna Sato

      I quickly checked locally and confirmed when only a fenced frame connects a SharedWorker and its main page navigates away, the page would be evicted with `masked` reason instead of `sharedworker-with-no-active-client`, meaning that workers are terminated correctly. (I'm not very sure if the reason `masked` is correct here, I couldn't find any test for Fenced Frames + BFCache.)

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Fergal Daly
      • Yoshisato Yanagisawa
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      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: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
      Gerrit-Change-Number: 6914636
      Gerrit-PatchSet: 28
      Gerrit-Owner: Anna Sato <anna...@chromium.org>
      Gerrit-Reviewer: Anna Sato <anna...@chromium.org>
      Gerrit-Reviewer: Chrome Metrics Logs <chrome-metrics...@google.com>
      Gerrit-Reviewer: Fergal Daly <fer...@chromium.org>
      Gerrit-Reviewer: Yoshisato Yanagisawa <yyana...@chromium.org>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
      Gerrit-Attention: Yoshisato Yanagisawa <yyana...@chromium.org>
      Gerrit-Attention: Fergal Daly <fer...@chromium.org>
      Gerrit-Comment-Date: Wed, 01 Oct 2025 00:23:49 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Anna Sato <anna...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Anna Sato (Gerrit)

      unread,
      Oct 1, 2025, 3:11:10 AM (13 days ago) Oct 1
      to Yoshisato Yanagisawa, Code Review Nudger, Chrome Metrics Logs, Chromium LUCI CQ, Fergal Daly, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
      Attention needed from Fergal Daly and Yoshisato Yanagisawa

      Anna Sato added 1 comment

      File content/browser/worker_host/shared_worker_host.cc
      Line 1001, Patchset 25: other_rfh->GetMainFrame() == client_rfh->GetMainFrame()) {
      Fergal Daly . unresolved

      I was chatting with rakina and I think you want to use `GetOutermostMainFrame` for these to account for fenced frames.

      Ideally have a test for that too.

      Anna Sato

      As we chatted, if fenced frames cannot share a SharedWorker with its main frame, using `GetMainFrame()` here is enough...? but I changed it to `GetOutermostMainFrame()` anyway as it seems like more robust option.

      Yoshisato Yanagisawa

      Pardon the question from a layman, but I'm trying to understand a specific lifecycle case. Given that a SharedWorker within a Fenced Frame cannot be shared with the embedder, what is the expected behavior when the embedding document is stored in the BFCache? It seems the worker would be left with no active clients, and I'm wondering how that state is managed upon restoration.

      Anna Sato

      I quickly checked locally and confirmed when only a fenced frame connects a SharedWorker and its main page navigates away, the page would be evicted with `masked` reason instead of `sharedworker-with-no-active-client`, meaning that workers are terminated correctly. (I'm not very sure if the reason `masked` is correct here, I couldn't find any test for Fenced Frames + BFCache.)

      Anna Sato

      Thanks to fergal, I was finally able to create the scenario we were concerned about by creating two fenced frames in a frame tree, and connect to the same worker. The worker would be terminated on its main page unload.

      Added the test at `third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-with-fenced-frame-client.tentative.https.window.js`

      Sorry for adding many tests and making the CL larger but I believe it's worth to include them to make sure it's WAI.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Fergal Daly
      • Yoshisato Yanagisawa
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      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: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
      Gerrit-Change-Number: 6914636
      Gerrit-PatchSet: 30
      Gerrit-Owner: Anna Sato <anna...@chromium.org>
      Gerrit-Reviewer: Anna Sato <anna...@chromium.org>
      Gerrit-Reviewer: Chrome Metrics Logs <chrome-metrics...@google.com>
      Gerrit-Reviewer: Fergal Daly <fer...@chromium.org>
      Gerrit-Reviewer: Yoshisato Yanagisawa <yyana...@chromium.org>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
      Gerrit-Attention: Yoshisato Yanagisawa <yyana...@chromium.org>
      Gerrit-Attention: Fergal Daly <fer...@chromium.org>
      Gerrit-Comment-Date: Wed, 01 Oct 2025 07:10:38 +0000
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Fergal Daly (Gerrit)

      unread,
      Oct 1, 2025, 4:01:46 AM (13 days ago) Oct 1
      to Anna Sato, Yoshisato Yanagisawa, Code Review Nudger, Chrome Metrics Logs, Chromium LUCI CQ, Fergal Daly, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
      Attention needed from Anna Sato and Yoshisato Yanagisawa

      Fergal Daly added 3 comments

      File content/browser/worker_host/shared_worker_host.cc
      Line 1001, Patchset 25: other_rfh->GetMainFrame() == client_rfh->GetMainFrame()) {
      Fergal Daly . unresolved

      I was chatting with rakina and I think you want to use `GetOutermostMainFrame` for these to account for fenced frames.

      Ideally have a test for that too.

      Anna Sato

      As we chatted, if fenced frames cannot share a SharedWorker with its main frame, using `GetMainFrame()` here is enough...? but I changed it to `GetOutermostMainFrame()` anyway as it seems like more robust option.

      Yoshisato Yanagisawa

      Pardon the question from a layman, but I'm trying to understand a specific lifecycle case. Given that a SharedWorker within a Fenced Frame cannot be shared with the embedder, what is the expected behavior when the embedding document is stored in the BFCache? It seems the worker would be left with no active clients, and I'm wondering how that state is managed upon restoration.

      Anna Sato

      I quickly checked locally and confirmed when only a fenced frame connects a SharedWorker and its main page navigates away, the page would be evicted with `masked` reason instead of `sharedworker-with-no-active-client`, meaning that workers are terminated correctly. (I'm not very sure if the reason `masked` is correct here, I couldn't find any test for Fenced Frames + BFCache.)

      Fergal Daly

      I think a ShW can be shared between inside and outside the fenced frame. If the frame tree looks like

      ``` a.com

      then I think both b.coms are the same storage partition and so will share workers.

      Even if that's not correct, a frame tree like

      ```
      a.com
      - fenced b.com
      - c.com
      - c.com
      ```

      with both c.com using ShW, we need to ensure that if these are the only clients of that ShW that we will evict.

      For that to work reliably, we need to use `GetOutermostMainFrame` everywhere.

      File content/browser/worker_host/shared_worker_service_impl.cc
      Line 540, Patchset 28: RenderFrameHostImpl::FromID(client_render_frame_host_id);
      Fergal Daly . unresolved

      I'd like to calculature the main frame here...

      Line 543, Patchset 28: host->EvictBFCachedClientsIfLastActive(render_frame_host)) {
      Fergal Daly . unresolved

      and pass it in here, to avoid recalculating it every time in this loop too.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Anna Sato
      • Yoshisato Yanagisawa
      Gerrit-Attention: Anna Sato <anna...@chromium.org>
      Gerrit-Attention: Yoshisato Yanagisawa <yyana...@chromium.org>
      Gerrit-Comment-Date: Wed, 01 Oct 2025 08:01:12 +0000
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Fergal Daly (Gerrit)

      unread,
      Oct 1, 2025, 4:52:42 AM (13 days ago) Oct 1
      to Anna Sato, Yoshisato Yanagisawa, Code Review Nudger, Chrome Metrics Logs, Chromium LUCI CQ, Fergal Daly, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
      Attention needed from Yoshisato Yanagisawa

      Fergal Daly added 6 comments

      File content/browser/worker_host/shared_worker_host.cc
      Line 1001, Patchset 20: other_rfh->GetMainFrame() == client_rfh->GetMainFrame()) {
      Anna Sato . resolved

      Addressed the case where a main frame and its iframe are connected to the same worker, which @fer...@chromium.org also pointed out in [doc](https://docs.google.com/document/d/19ZMaAaRUnMwB-EyQLjt4YZNSjKlGRTbFbjJ57H2ZIag/edit?resourcekey=0-K6Q2fbF8lAL2QYot2dE73Q&disco=AAABrySJO4w), by adding a check its main frame to ensure they aren't considered as independent active clients.

      Added a test for this senario in `third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-with-iframe-client.tentative.window.js.`

      Fergal Daly

      Acknowledged

      File third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/resources/stateful-worker.js
      Line 1, Patchset 28:let worker_id = null;
      Fergal Daly . unresolved

      Please add a comment like

      // This worker sets a unique ID when first connected and posts that ID on when sent the "get_id" message.

      File third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-allows-bfcache.window.js
      Line 15, Patchset 28: // TODO(crbug.com/406420935): Remove this client once SharedWorker freezing is
      Fergal Daly . unresolved

      Can't we remove the whole test? I assume there are public WPTs that test the case of the document with a shared worker going into BFCache.

      Same for the following tests?

      File third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-mixed-clients-eviction.tentative.window.js
      Line 1, Patchset 28:// META: title=[Tentative] BFCache is blocked/evicted and SharedWorkers are terminated correctly.
      Fergal Daly . unresolved

      No need for tentative in internal WPTs (in test name and in file name).

      Line 1, Patchset 28:// META: title=[Tentative] BFCache is blocked/evicted and SharedWorkers are terminated correctly.
      Fergal Daly . unresolved

      This title doesn't explain what scenario this is testing.

      If it's too long, put it in a comment.

      I can figure out what you're doing but it's better to document what you intend the test to do, then I can

      • review your intention.
      • review your code to see if it matches your intention.
      File third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-with-iframe-client.tentative.window.js
      Line 44, Patchset 28: const iframe = document.createElement('iframe');
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Yoshisato Yanagisawa
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedNo-Unresolved-Comments
      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: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
      Gerrit-Change-Number: 6914636
      Gerrit-PatchSet: 25
      Gerrit-Owner: Anna Sato <anna...@chromium.org>
      Gerrit-Reviewer: Anna Sato <anna...@chromium.org>
      Gerrit-Reviewer: Chrome Metrics Logs <chrome-metrics...@google.com>
      Gerrit-Reviewer: Fergal Daly <fer...@chromium.org>
      Gerrit-Reviewer: Yoshisato Yanagisawa <yyana...@chromium.org>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
      Gerrit-Attention: Yoshisato Yanagisawa <yyana...@chromium.org>
      Gerrit-Comment-Date: Wed, 01 Oct 2025 08:52:11 +0000
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Anna Sato (Gerrit)

      unread,
      Oct 3, 2025, 1:19:43 AM (11 days ago) Oct 3
      to Yoshisato Yanagisawa, Code Review Nudger, Chrome Metrics Logs, Chromium LUCI CQ, Fergal Daly, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
      Attention needed from Fergal Daly

      Anna Sato added 10 comments

      Patchset-level comments
      File-level comment, Patchset 32 (Latest):
      Anna Sato . resolved

      Thank you for the review!

      File content/browser/worker_host/shared_worker_host.cc
      Line 1001, Patchset 25: other_rfh->GetMainFrame() == client_rfh->GetMainFrame()) {
      Fergal Daly . unresolved

      I was chatting with rakina and I think you want to use `GetOutermostMainFrame` for these to account for fenced frames.

      Ideally have a test for that too.

      Anna Sato

      As we chatted, if fenced frames cannot share a SharedWorker with its main frame, using `GetMainFrame()` here is enough...? but I changed it to `GetOutermostMainFrame()` anyway as it seems like more robust option.

      Yoshisato Yanagisawa

      Pardon the question from a layman, but I'm trying to understand a specific lifecycle case. Given that a SharedWorker within a Fenced Frame cannot be shared with the embedder, what is the expected behavior when the embedding document is stored in the BFCache? It seems the worker would be left with no active clients, and I'm wondering how that state is managed upon restoration.

      Anna Sato

      I quickly checked locally and confirmed when only a fenced frame connects a SharedWorker and its main page navigates away, the page would be evicted with `masked` reason instead of `sharedworker-with-no-active-client`, meaning that workers are terminated correctly. (I'm not very sure if the reason `masked` is correct here, I couldn't find any test for Fenced Frames + BFCache.)

      Fergal Daly

      I think a ShW can be shared between inside and outside the fenced frame. If the frame tree looks like

      ``` a.com

      then I think both b.coms are the same storage partition and so will share workers.

      Even if that's not correct, a frame tree like

      ```
      a.com
      - fenced b.com
      - c.com
      - c.com
      ```

      with both c.com using ShW, we need to ensure that if these are the only clients of that ShW that we will evict.

      For that to work reliably, we need to use `GetOutermostMainFrame` everywhere.

      Anna Sato

      Acknowledged and the pages will be evicted as expected. Do you want to me to add these tests as well?

      File content/browser/worker_host/shared_worker_service_impl.cc
      Line 540, Patchset 28: RenderFrameHostImpl::FromID(client_render_frame_host_id);
      Fergal Daly . resolved

      I'd like to calculature the main frame here...

      Anna Sato

      Done

      Line 543, Patchset 28: host->EvictBFCachedClientsIfLastActive(render_frame_host)) {
      Fergal Daly . resolved

      and pass it in here, to avoid recalculating it every time in this loop too.

      Anna Sato

      Changed to pass GetOutermostMainFrame() to SharedWorkerHost::EvictBFCachedClientsIfLastActive. Thanks!

      File third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/resources/stateful-worker.js
      Line 1, Patchset 28:let worker_id = null;
      Fergal Daly . resolved

      Please add a comment like

      // This worker sets a unique ID when first connected and posts that ID on when sent the "get_id" message.

      Anna Sato

      Added.

      File third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-allows-bfcache.window.js
      Line 15, Patchset 28: // TODO(crbug.com/406420935): Remove this client once SharedWorker freezing is
      Fergal Daly . unresolved

      Can't we remove the whole test? I assume there are public WPTs that test the case of the document with a shared worker going into BFCache.

      Same for the following tests?

      Anna Sato

      Removed this test but leave other tests since they check if pages are evicted with the correct reason, unlike external WPTs.

      File third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-mixed-clients-eviction.tentative.window.js
      Line 1, Patchset 28:// META: title=[Tentative] BFCache is blocked/evicted and SharedWorkers are terminated correctly.
      Fergal Daly . resolved

      No need for tentative in internal WPTs (in test name and in file name).

      Anna Sato

      Removed "tentative" from the title and file name.

      Line 1, Patchset 28:// META: title=[Tentative] BFCache is blocked/evicted and SharedWorkers are terminated correctly.
      Fergal Daly . unresolved

      This title doesn't explain what scenario this is testing.

      If it's too long, put it in a comment.

      I can figure out what you're doing but it's better to document what you intend the test to do, then I can

      • review your intention.
      • review your code to see if it matches your intention.
      Anna Sato

      Sorry for not being clear. Updated the test titles and added one comment at `third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-mixed-clients-eviction.window.js` on this CL.

      File third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-mixed-clients-eviction.window.js
      Line 1, Patchset 32 (Latest):// META: title=BFCache is blocked and SharedWorkers are terminated correctly when all clients are navigated away.

      The test verifies that when:

      • Frame 1 connects to workers A and B.
      • Frame 2 connects to workers A and C.
      • Frame 3 connects to worker B.

      and Frame 1 is in BFCache and Frame 2 navigates away, Frame 1 is evicted and Frame 2 is blocked. It also verifies the worker state, ensuring A and C are terminated while B is kept alive.

      File third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-with-iframe-client.tentative.window.js
      Line 44, Patchset 28: const iframe = document.createElement('iframe');
      Fergal Daly . resolved
      Anna Sato

      Updated to use addIframe.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Fergal Daly
      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: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
        Gerrit-Change-Number: 6914636
        Gerrit-PatchSet: 32
        Gerrit-Owner: Anna Sato <anna...@chromium.org>
        Gerrit-Reviewer: Anna Sato <anna...@chromium.org>
        Gerrit-Reviewer: Chrome Metrics Logs <chrome-metrics...@google.com>
        Gerrit-Reviewer: Fergal Daly <fer...@chromium.org>
        Gerrit-Reviewer: Yoshisato Yanagisawa <yyana...@chromium.org>
        Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
        Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
        Gerrit-Attention: Fergal Daly <fer...@chromium.org>
        Gerrit-Comment-Date: Fri, 03 Oct 2025 05:19:11 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Anna Sato <anna...@chromium.org>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Fergal Daly (Gerrit)

        unread,
        Oct 3, 2025, 3:39:56 AM (11 days ago) Oct 3
        to Anna Sato, Yoshisato Yanagisawa, Code Review Nudger, Chrome Metrics Logs, Chromium LUCI CQ, Fergal Daly, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
        Attention needed from Anna Sato

        Fergal Daly added 2 comments

        Patchset-level comments
        Fergal Daly . unresolved

        Why are you moving many of these from tentative? It's making it show these as a delete/add and I can't look at the diff. I'd rather remove tentative in a separate CL

        File content/browser/worker_host/shared_worker_service_impl.cc
        Line 541, Patchset 32 (Latest): if (!render_frame_host) {
        Fergal Daly . unresolved

        When does this happen? The caller passes an ID but it gets the ID from an RFH. Why not pass the RFH itself?

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Anna Sato
        Gerrit-Attention: Anna Sato <anna...@chromium.org>
        Gerrit-Comment-Date: Fri, 03 Oct 2025 07:39:22 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Anna Sato (Gerrit)

        unread,
        Oct 5, 2025, 9:50:52 PM (8 days ago) Oct 5
        to Yoshisato Yanagisawa, Code Review Nudger, Chrome Metrics Logs, Chromium LUCI CQ, Fergal Daly, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
        Attention needed from Fergal Daly

        Anna Sato added 5 comments

        Patchset-level comments
        File-level comment, Patchset 32:
        Fergal Daly . resolved

        Why are you moving many of these from tentative? It's making it show these as a delete/add and I can't look at the diff. I'd rather remove tentative in a separate CL

        Anna Sato

        Reverted. Moved them back to .tentative sorry.

        File-level comment, Patchset 37 (Latest):
        Anna Sato . resolved

        You can view the diff between Patch Set 31 and 37. Thanks!

        File content/browser/worker_host/shared_worker_service_impl.cc
        Line 541, Patchset 32: if (!render_frame_host) {
        Fergal Daly . resolved

        When does this happen? The caller passes an ID but it gets the ID from an RFH. Why not pass the RFH itself?

        Anna Sato

        Ah, that makes sense now. Changed it to pass `RenderFrameHostImpl` and get the ID inside `ContainsClient()` where the ID is needed.

        File third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-mixed-clients-eviction.tentative.window.js
        Line 1, Patchset 28:// META: title=[Tentative] BFCache is blocked/evicted and SharedWorkers are terminated correctly.
        Fergal Daly . unresolved

        This title doesn't explain what scenario this is testing.

        If it's too long, put it in a comment.

        I can figure out what you're doing but it's better to document what you intend the test to do, then I can

        • review your intention.
        • review your code to see if it matches your intention.
        Anna Sato

        Sorry for not being clear. Updated the test titles and added one comment at `third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-mixed-clients-eviction.window.js` on this CL.

        Anna Sato

        As disccussed in https://chromium-review.googlesource.com/c/chromium/src/+/6914636/comment/c05f6c5c_6b637bbe/,

        The test verifies that when:

        Frame 1 connects to workers A and B.
        Frame 2 connects to workers A and C.
        Frame 3 connects to worker B.
        and Frame 1 is in BFCache and Frame 2 navigates away, Frame 1 is evicted and Frame 2 is blocked. It also verifies the worker state, ensuring A and C are terminated while B is kept alive.

        File third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-mixed-clients-eviction.window.js
        Line 1, Patchset 32:// META: title=BFCache is blocked and SharedWorkers are terminated correctly when all clients are navigated away.
        Anna Sato . resolved

        As disccussed in https://chromium-review.googlesource.com/c/chromium/src/+/6914636/comment/c05f6c5c_6b637bbe/,

        The test verifies that when:

        • Frame 1 connects to workers A and B.
        • Frame 2 connects to workers A and C.
        • Frame 3 connects to worker B.

        and Frame 1 is in BFCache and Frame 2 navigates away, Frame 1 is evicted and Frame 2 is blocked. It also verifies the worker state, ensuring A and C are terminated while B is kept alive.

        Attention is currently required from:
        • Fergal Daly
        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: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
        Gerrit-Change-Number: 6914636
        Gerrit-PatchSet: 37
        Gerrit-Owner: Anna Sato <anna...@chromium.org>
        Gerrit-Reviewer: Anna Sato <anna...@chromium.org>
        Gerrit-Reviewer: Chrome Metrics Logs <chrome-metrics...@google.com>
        Gerrit-Reviewer: Fergal Daly <fer...@chromium.org>
        Gerrit-Reviewer: Yoshisato Yanagisawa <yyana...@chromium.org>
        Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
        Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
        Gerrit-Attention: Fergal Daly <fer...@chromium.org>
        Gerrit-Comment-Date: Mon, 06 Oct 2025 01:50:15 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Anna Sato <anna...@chromium.org>
        Comment-In-Reply-To: Fergal Daly <fer...@chromium.org>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Fergal Daly (Gerrit)

        unread,
        Oct 8, 2025, 5:32:10 AM (6 days ago) Oct 8
        to Anna Sato, Yoshisato Yanagisawa, Code Review Nudger, Chrome Metrics Logs, Chromium LUCI CQ, Fergal Daly, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
        Attention needed from Anna Sato

        Fergal Daly added 4 comments

        File content/browser/renderer_host/back_forward_cache_impl.cc
        Line 1078, Patchset 25: if (!rfh->IsInBackForwardCache()) {
        Fergal Daly . unresolved

        why do we need this?

        Anna Sato

        IIUC this code is called when pages are going into BFCache and being restored from it.

        During a restore, there should be one more active clients, which would cause `EvictBFCachedClientsIfLastActive()` to return false. So the code would be WAI even without the `IsInBackForwardCache` check, but we can keep the check to avoid the cost of calling `EvictBFCachedClientsIfLastActive()`? (The new UMA metric "Content.SharedWorker.Service.LastClientCheckTime" will tell us exactly how much cost we're saving.)

        Fergal Daly

        This code isn't called during a restore. Only when entering BFCache or when being evicted.

        Line 1174, Patchset 37 (Latest): if (!rfh->IsInBackForwardCache()) {
        Fergal Daly . unresolved

        Based on the discussion above (which not attached to a line of code anymore) I think you should add a comment here like

        // If `rfh` is already in BFCache then we are evicting it and there is no need to check if it's the last active client.

        File content/browser/worker_host/shared_worker_host.cc
        Line 1004, Patchset 37 (Latest): if (!other_rfh->IsInBackForwardCache()) {
        Fergal Daly . unresolved

        We need to be careful here because `!other_rfh->IsInBackForwardCache()` is different to `other_rfh->IsActive()`.

        In particular, `!rfh->IsInBackForwardCache()` would include pre-rendering clients and also clients that are in the `kPendingDeletion` state.

        Certainly I think pre-rendering RFHs shouldn't count and I think we have to also make sure that we cancel prerendering if any of the RFHs are pre-rendering.

        Sorry, this is going on forever.

        File third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/back-forward-cache/eligibility/shared-worker-active-client.window.js
        Line 26, Patchset 37 (Latest): <\/script>
        Fergal Daly . unresolved

        Do you really need this `\`?

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Anna Sato
        Gerrit-Attention: Anna Sato <anna...@chromium.org>
        Gerrit-Comment-Date: Wed, 08 Oct 2025 09:30:33 +0000
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Anna Sato (Gerrit)

        unread,
        Oct 8, 2025, 11:55:12 PM (5 days ago) Oct 8
        to Yoshisato Yanagisawa, Code Review Nudger, Chrome Metrics Logs, Chromium LUCI CQ, Fergal Daly, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
        Attention needed from Fergal Daly

        Anna Sato added 4 comments

        File content/browser/renderer_host/back_forward_cache_impl.cc
        Line 1078, Patchset 25: if (!rfh->IsInBackForwardCache()) {
        Fergal Daly . resolved

        why do we need this?

        Anna Sato

        IIUC this code is called when pages are going into BFCache and being restored from it.

        During a restore, there should be one more active clients, which would cause `EvictBFCachedClientsIfLastActive()` to return false. So the code would be WAI even without the `IsInBackForwardCache` check, but we can keep the check to avoid the cost of calling `EvictBFCachedClientsIfLastActive()`? (The new UMA metric "Content.SharedWorker.Service.LastClientCheckTime" will tell us exactly how much cost we're saving.)

        Fergal Daly

        This code isn't called during a restore. Only when entering BFCache or when being evicted.

        Anna Sato

        Got it, understood. I've left the check and added a comment as https://chromium-review.googlesource.com/c/chromium/src/+/6914636/comment/a539d476_0d5afc2a/

        Line 1174, Patchset 37: if (!rfh->IsInBackForwardCache()) {
        Fergal Daly . resolved

        Based on the discussion above (which not attached to a line of code anymore) I think you should add a comment here like

        // If `rfh` is already in BFCache then we are evicting it and there is no need to check if it's the last active client.

        Anna Sato

        Thanks! Added the comment.

        File content/browser/worker_host/shared_worker_host.cc
        Line 1004, Patchset 37: if (!other_rfh->IsInBackForwardCache()) {
        Fergal Daly . resolved

        We need to be careful here because `!other_rfh->IsInBackForwardCache()` is different to `other_rfh->IsActive()`.

        In particular, `!rfh->IsInBackForwardCache()` would include pre-rendering clients and also clients that are in the `kPendingDeletion` state.

        Certainly I think pre-rendering RFHs shouldn't count and I think we have to also make sure that we cancel prerendering if any of the RFHs are pre-rendering.

        Sorry, this is going on forever.

        Anna Sato

        Thanks for catching this important edge case! Since the fix is non-trivial, I've added a TODO and will address this in a follow-up CL.

        File third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/back-forward-cache/eligibility/shared-worker-active-client.window.js
        Line 26, Patchset 37: <\/script>
        Fergal Daly . resolved

        Do you really need this `\`?

        Anna Sato

        Sorry that was a typo, fixed.

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Fergal Daly
        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: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
        Gerrit-Change-Number: 6914636
        Gerrit-PatchSet: 38
        Gerrit-Owner: Anna Sato <anna...@chromium.org>
        Gerrit-Reviewer: Anna Sato <anna...@chromium.org>
        Gerrit-Reviewer: Chrome Metrics Logs <chrome-metrics...@google.com>
        Gerrit-Reviewer: Fergal Daly <fer...@chromium.org>
        Gerrit-Reviewer: Yoshisato Yanagisawa <yyana...@chromium.org>
        Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
        Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
        Gerrit-Attention: Fergal Daly <fer...@chromium.org>
        Gerrit-Comment-Date: Thu, 09 Oct 2025 03:53:29 +0000
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Anna Sato (Gerrit)

        unread,
        Oct 9, 2025, 7:02:37 AM (5 days ago) Oct 9
        to Yoshisato Yanagisawa, Code Review Nudger, Chrome Metrics Logs, Chromium LUCI CQ, Fergal Daly, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
        Attention needed from Fergal Daly

        Anna Sato voted and added 1 comment

        Votes added by Anna Sato

        Commit-Queue+1

        1 comment

        File content/browser/worker_host/shared_worker_host.cc
        Line 1004, Patchset 37: if (!other_rfh->IsInBackForwardCache()) {
        Fergal Daly . unresolved

        We need to be careful here because `!other_rfh->IsInBackForwardCache()` is different to `other_rfh->IsActive()`.

        In particular, `!rfh->IsInBackForwardCache()` would include pre-rendering clients and also clients that are in the `kPendingDeletion` state.

        Certainly I think pre-rendering RFHs shouldn't count and I think we have to also make sure that we cancel prerendering if any of the RFHs are pre-rendering.

        Sorry, this is going on forever.

        Anna Sato

        Thanks for catching this important edge case! Since the fix is non-trivial, I've added a TODO and will address this in a follow-up CL.

        Anna Sato

        Created https://crrev.com/c/7024414/ for it. While writing tests for these cases, I noticed that prerendered pages do not become SharedWorker clients until after the page is activated.

        There are WPTs for pre-render + SharedWorker:

        The second case is what we need to care about here, as it says "The prerendered page could be a client of the existing worker". But this test is expected to fail in [TestExpectations](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/TestExpectations;l=2806) and found the description in https://crrev.com/c/3874273, saying this is the known current behavior in Chrome. (I confirmed locally that it fails at [L90](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/external/wpt/speculation-rules/prerender/workers.https.html;l=90). )

        Updated the TODO comment to only cover the kPendingDeletion case. Does that seem right to you?

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Fergal Daly
        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: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
        Gerrit-Change-Number: 6914636
        Gerrit-PatchSet: 39
        Gerrit-Owner: Anna Sato <anna...@chromium.org>
        Gerrit-Reviewer: Anna Sato <anna...@chromium.org>
        Gerrit-Reviewer: Chrome Metrics Logs <chrome-metrics...@google.com>
        Gerrit-Reviewer: Fergal Daly <fer...@chromium.org>
        Gerrit-Reviewer: Yoshisato Yanagisawa <yyana...@chromium.org>
        Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
        Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
        Gerrit-Attention: Fergal Daly <fer...@chromium.org>
        Gerrit-Comment-Date: Thu, 09 Oct 2025 11:00:59 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Fergal Daly (Gerrit)

        unread,
        Oct 10, 2025, 4:58:33 AM (4 days ago) Oct 10
        to Anna Sato, Fergal Daly, Yoshisato Yanagisawa, Code Review Nudger, Chrome Metrics Logs, Chromium LUCI CQ, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
        Attention needed from Anna Sato

        Fergal Daly voted and added 1 comment

        Votes added by Fergal Daly

        Code-Review+1

        1 comment

        File content/browser/worker_host/shared_worker_host.cc
        Line 1006, Patchset 39 (Latest): if (!other_rfh->IsInBackForwardCache()) {
        Fergal Daly . unresolved

        Let's make this `IsActive()` and it will cover that. I don't think you need to write tests for the pending deletion case, it's impossible to write a WPT for it and not having a browser test will be OK, I think

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Anna Sato
        Submit Requirements:
          • requirement satisfiedCode-Coverage
          • requirement is not satisfiedCode-Owners
          • requirement is not 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: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
          Gerrit-Change-Number: 6914636
          Gerrit-PatchSet: 39
          Gerrit-Owner: Anna Sato <anna...@chromium.org>
          Gerrit-Reviewer: Anna Sato <anna...@chromium.org>
          Gerrit-Reviewer: Chrome Metrics Logs <chrome-metrics...@google.com>
          Gerrit-Reviewer: Fergal Daly <fer...@chromium.org>
          Gerrit-Reviewer: Yoshisato Yanagisawa <yyana...@chromium.org>
          Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
          Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
          Gerrit-Attention: Anna Sato <anna...@chromium.org>
          Gerrit-Comment-Date: Fri, 10 Oct 2025 08:56:14 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Anna Sato (Gerrit)

          unread,
          Oct 10, 2025, 5:43:18 AM (4 days ago) Oct 10
          to Anders Hartvoll Ruud, Guillem Perez, Fergal Daly, Yoshisato Yanagisawa, Code Review Nudger, Chromium LUCI CQ, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
          Attention needed from Anders Hartvoll Ruud and Guillem Perez

          Anna Sato added 5 comments

          Patchset-level comments
          File-level comment, Patchset 41 (Latest):
          Anna Sato . resolved

          Adding andruud@ for Virtualtestsuite, and guiperez@ for histograms.xml. The other parts of the CL have already been LGTM'd. Thanks!

          File content/browser/worker_host/shared_worker_host.cc
          Line 1001, Patchset 25: other_rfh->GetMainFrame() == client_rfh->GetMainFrame()) {
          Fergal Daly . resolved

          I was chatting with rakina and I think you want to use `GetOutermostMainFrame` for these to account for fenced frames.

          Ideally have a test for that too.

          Anna Sato

          As we chatted, if fenced frames cannot share a SharedWorker with its main frame, using `GetMainFrame()` here is enough...? but I changed it to `GetOutermostMainFrame()` anyway as it seems like more robust option.

          Yoshisato Yanagisawa

          Pardon the question from a layman, but I'm trying to understand a specific lifecycle case. Given that a SharedWorker within a Fenced Frame cannot be shared with the embedder, what is the expected behavior when the embedding document is stored in the BFCache? It seems the worker would be left with no active clients, and I'm wondering how that state is managed upon restoration.

          Anna Sato

          I quickly checked locally and confirmed when only a fenced frame connects a SharedWorker and its main page navigates away, the page would be evicted with `masked` reason instead of `sharedworker-with-no-active-client`, meaning that workers are terminated correctly. (I'm not very sure if the reason `masked` is correct here, I couldn't find any test for Fenced Frames + BFCache.)

          Fergal Daly

          I think a ShW can be shared between inside and outside the fenced frame. If the frame tree looks like

          ``` a.com

          then I think both b.coms are the same storage partition and so will share workers.

          Even if that's not correct, a frame tree like

          ```
          a.com
          - fenced b.com
          - c.com
          - c.com
          ```

          with both c.com using ShW, we need to ensure that if these are the only clients of that ShW that we will evict.

          For that to work reliably, we need to use `GetOutermostMainFrame` everywhere.

          Anna Sato

          Acknowledged and the pages will be evicted as expected. Do you want to me to add these tests as well?

          Anna Sato

          Done

          Line 1004, Patchset 37: if (!other_rfh->IsInBackForwardCache()) {
          Fergal Daly . resolved

          We need to be careful here because `!other_rfh->IsInBackForwardCache()` is different to `other_rfh->IsActive()`.

          In particular, `!rfh->IsInBackForwardCache()` would include pre-rendering clients and also clients that are in the `kPendingDeletion` state.

          Certainly I think pre-rendering RFHs shouldn't count and I think we have to also make sure that we cancel prerendering if any of the RFHs are pre-rendering.

          Sorry, this is going on forever.

          Anna Sato

          Thanks for catching this important edge case! Since the fix is non-trivial, I've added a TODO and will address this in a follow-up CL.

          Anna Sato

          Created https://crrev.com/c/7024414/ for it. While writing tests for these cases, I noticed that prerendered pages do not become SharedWorker clients until after the page is activated.

          There are WPTs for pre-render + SharedWorker:

          The second case is what we need to care about here, as it says "The prerendered page could be a client of the existing worker". But this test is expected to fail in [TestExpectations](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/TestExpectations;l=2806) and found the description in https://crrev.com/c/3874273, saying this is the known current behavior in Chrome. (I confirmed locally that it fails at [L90](https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/external/wpt/speculation-rules/prerender/workers.https.html;l=90). )

          Updated the TODO comment to only cover the kPendingDeletion case. Does that seem right to you?

          Anna Sato

          Done

          Line 1006, Patchset 39: if (!other_rfh->IsInBackForwardCache()) {
          Fergal Daly . resolved

          Let's make this `IsActive()` and it will cover that. I don't think you need to write tests for the pending deletion case, it's impossible to write a WPT for it and not having a browser test will be OK, I think

          Anna Sato

          Thanks! Switched from `!rfh->IsInBackForwardCache()` to `rfh-> IsActive()`.

          File third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-mixed-clients-eviction.tentative.window.js
          Line 1, Patchset 28:// META: title=[Tentative] BFCache is blocked/evicted and SharedWorkers are terminated correctly.
          Fergal Daly . resolved

          This title doesn't explain what scenario this is testing.

          If it's too long, put it in a comment.

          I can figure out what you're doing but it's better to document what you intend the test to do, then I can

          • review your intention.
          • review your code to see if it matches your intention.
          Anna Sato

          Sorry for not being clear. Updated the test titles and added one comment at `third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-mixed-clients-eviction.window.js` on this CL.

          Anna Sato

          As disccussed in https://chromium-review.googlesource.com/c/chromium/src/+/6914636/comment/c05f6c5c_6b637bbe/,

          The test verifies that when:

          Frame 1 connects to workers A and B.
          Frame 2 connects to workers A and C.
          Frame 3 connects to worker B.
          and Frame 1 is in BFCache and Frame 2 navigates away, Frame 1 is evicted and Frame 2 is blocked. It also verifies the worker state, ensuring A and C are terminated while B is kept alive.

          Anna Sato

          Done

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Anders Hartvoll Ruud
          • Guillem Perez
          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: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
            Gerrit-Change-Number: 6914636
            Gerrit-PatchSet: 41
            Gerrit-Owner: Anna Sato <anna...@chromium.org>
            Gerrit-Reviewer: Anders Hartvoll Ruud <and...@chromium.org>
            Gerrit-Reviewer: Anna Sato <anna...@chromium.org>
            Gerrit-Reviewer: Fergal Daly <fer...@chromium.org>
            Gerrit-Reviewer: Guillem Perez <guip...@google.com>
            Gerrit-Reviewer: Yoshisato Yanagisawa <yyana...@chromium.org>
            Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
            Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
            Gerrit-Attention: Guillem Perez <guip...@google.com>
            Gerrit-Attention: Anders Hartvoll Ruud <and...@chromium.org>
            Gerrit-Comment-Date: Fri, 10 Oct 2025 09:41:25 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: No
            Comment-In-Reply-To: Anna Sato <anna...@chromium.org>
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Anders Hartvoll Ruud (Gerrit)

            unread,
            Oct 13, 2025, 4:02:36 AM (22 hours ago) Oct 13
            to Anna Sato, Guillem Perez, Fergal Daly, Yoshisato Yanagisawa, Code Review Nudger, Chromium LUCI CQ, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
            Attention needed from Anna Sato and Guillem Perez

            Anders Hartvoll Ruud voted and added 1 comment

            Votes added by Anders Hartvoll Ruud

            Code-Review+1

            1 comment

            Patchset-level comments
            Anders Hartvoll Ruud . resolved

            VirtualTestSuites lgtm

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Anna Sato
            • Guillem Perez
            Submit Requirements:
              • requirement satisfiedCode-Coverage
              • requirement is not satisfiedCode-Owners
              • requirement is not 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: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
              Gerrit-Change-Number: 6914636
              Gerrit-PatchSet: 41
              Gerrit-Owner: Anna Sato <anna...@chromium.org>
              Gerrit-Reviewer: Anders Hartvoll Ruud <and...@chromium.org>
              Gerrit-Reviewer: Anna Sato <anna...@chromium.org>
              Gerrit-Reviewer: Fergal Daly <fer...@chromium.org>
              Gerrit-Reviewer: Guillem Perez <guip...@google.com>
              Gerrit-Reviewer: Yoshisato Yanagisawa <yyana...@chromium.org>
              Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
              Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
              Gerrit-Attention: Guillem Perez <guip...@google.com>
              Gerrit-Attention: Anna Sato <anna...@chromium.org>
              Gerrit-Comment-Date: Mon, 13 Oct 2025 08:01:31 +0000
              Gerrit-HasComments: Yes
              Gerrit-Has-Labels: Yes
              satisfied_requirement
              unsatisfied_requirement
              open
              diffy

              Guillem Perez (Gerrit)

              unread,
              Oct 13, 2025, 4:43:41 PM (10 hours ago) Oct 13
              to Anna Sato, Anders Hartvoll Ruud, Fergal Daly, Yoshisato Yanagisawa, Code Review Nudger, Chromium LUCI CQ, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org
              Attention needed from Anna Sato

              Guillem Perez voted and added 1 comment

              Votes added by Guillem Perez

              Code-Review+1

              1 comment

              Patchset-level comments
              Guillem Perez . resolved

              LGTM Histograms

              Open in Gerrit

              Related details

              Attention is currently required from:
              • Anna Sato
              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: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
              Gerrit-Change-Number: 6914636
              Gerrit-PatchSet: 41
              Gerrit-Owner: Anna Sato <anna...@chromium.org>
              Gerrit-Reviewer: Anders Hartvoll Ruud <and...@chromium.org>
              Gerrit-Reviewer: Anna Sato <anna...@chromium.org>
              Gerrit-Reviewer: Fergal Daly <fer...@chromium.org>
              Gerrit-Reviewer: Guillem Perez <guip...@google.com>
              Gerrit-Reviewer: Yoshisato Yanagisawa <yyana...@chromium.org>
              Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
              Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
              Gerrit-Attention: Anna Sato <anna...@chromium.org>
              Gerrit-Comment-Date: Mon, 13 Oct 2025 20:43:14 +0000
              Gerrit-HasComments: Yes
              Gerrit-Has-Labels: Yes
              satisfied_requirement
              unsatisfied_requirement
              open
              diffy

              Anna Sato (Gerrit)

              unread,
              Oct 13, 2025, 7:43:11 PM (7 hours ago) Oct 13
              to Guillem Perez, Anders Hartvoll Ruud, Fergal Daly, Yoshisato Yanagisawa, Code Review Nudger, Chromium LUCI CQ, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org

              Anna Sato voted and added 2 comments

              Votes added by Anna Sato

              Auto-Submit+1
              Commit-Queue+1

              2 comments

              Patchset-level comments
              Anna Sato . resolved

              Thanks for your review!

              File third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-allows-bfcache.window.js
              Line 15, Patchset 28: // TODO(crbug.com/406420935): Remove this client once SharedWorker freezing is
              Fergal Daly . resolved

              Can't we remove the whole test? I assume there are public WPTs that test the case of the document with a shared worker going into BFCache.

              Same for the following tests?

              Anna Sato

              Removed this test but leave other tests since they check if pages are evicted with the correct reason, unlike external WPTs.

              Anna Sato

              Done

              Open in Gerrit

              Related details

              Attention set is empty
              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: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
                Gerrit-Change-Number: 6914636
                Gerrit-PatchSet: 41
                Gerrit-Owner: Anna Sato <anna...@chromium.org>
                Gerrit-Reviewer: Anders Hartvoll Ruud <and...@chromium.org>
                Gerrit-Reviewer: Anna Sato <anna...@chromium.org>
                Gerrit-Reviewer: Fergal Daly <fer...@chromium.org>
                Gerrit-Reviewer: Guillem Perez <guip...@google.com>
                Gerrit-Reviewer: Yoshisato Yanagisawa <yyana...@chromium.org>
                Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
                Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
                Gerrit-Comment-Date: Mon, 13 Oct 2025 23:40:51 +0000
                Gerrit-HasComments: Yes
                Gerrit-Has-Labels: Yes
                Comment-In-Reply-To: Anna Sato <anna...@chromium.org>
                Comment-In-Reply-To: Fergal Daly <fer...@chromium.org>
                satisfied_requirement
                open
                diffy

                Anna Sato (Gerrit)

                unread,
                Oct 13, 2025, 7:43:20 PM (7 hours ago) Oct 13
                to Guillem Perez, Anders Hartvoll Ruud, Fergal Daly, Yoshisato Yanagisawa, Code Review Nudger, Chromium LUCI CQ, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org

                Anna Sato voted Commit-Queue+2

                Commit-Queue+2
                Gerrit-Comment-Date: Mon, 13 Oct 2025 23:41:03 +0000
                Gerrit-HasComments: No
                Gerrit-Has-Labels: Yes
                satisfied_requirement
                open
                diffy

                Blink W3C Test Autoroller (Gerrit)

                unread,
                Oct 13, 2025, 7:51:02 PM (6 hours ago) Oct 13
                to Anna Sato, Guillem Perez, Anders Hartvoll Ruud, Fergal Daly, Yoshisato Yanagisawa, Code Review Nudger, Chromium LUCI CQ, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org

                Message from Blink W3C Test Autoroller

                Exportable changes to web-platform-tests were detected in this CL and a pull request in the upstream repo has been made: https://github.com/web-platform-tests/wpt/pull/55410.

                When this CL lands, the bot will automatically merge the PR on GitHub if the required GitHub checks pass; otherwise, ecosystem-infra@ team will triage the failures and may contact you.

                WPT Export docs:
                https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_platform_tests.md#Automatic-export-process

                Open in Gerrit

                Related details

                Attention set is empty
                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: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
                Gerrit-Change-Number: 6914636
                Gerrit-PatchSet: 41
                Gerrit-Owner: Anna Sato <anna...@chromium.org>
                Gerrit-Reviewer: Anders Hartvoll Ruud <and...@chromium.org>
                Gerrit-Reviewer: Anna Sato <anna...@chromium.org>
                Gerrit-Reviewer: Fergal Daly <fer...@chromium.org>
                Gerrit-Reviewer: Guillem Perez <guip...@google.com>
                Gerrit-Reviewer: Yoshisato Yanagisawa <yyana...@chromium.org>
                Gerrit-CC: Blink W3C Test Autoroller <blink-w3c-te...@chromium.org>
                Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
                Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
                Gerrit-Comment-Date: Mon, 13 Oct 2025 23:50:54 +0000
                Gerrit-HasComments: No
                Gerrit-Has-Labels: No
                satisfied_requirement
                open
                diffy

                Chromium LUCI CQ (Gerrit)

                unread,
                Oct 13, 2025, 9:08:11 PM (5 hours ago) Oct 13
                to Anna Sato, Blink W3C Test Autoroller, Guillem Perez, Anders Hartvoll Ruud, Fergal Daly, Yoshisato Yanagisawa, Code Review Nudger, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org

                Chromium LUCI CQ submitted the change

                Change information

                Commit message:
                Evict BFCached pages with SharedWorker when the last client navigates away

                This CL prevents a SharedWorker from remaining active when all of its
                clients are in BFCache. When the last active client of a SharedWorker
                navigates away:

                - The navigating client is blocked from entering BFCache.
                - Any other clients of the same SharedWorker that are already in BFCache are evicted.
                - As a result, the SharedWorker is left with no clients and is
                subsequently terminated.

                This change is the minimum behavior required for the SharedWorkerBFCache
                launch as described at "Worker state when last client enters BFCache" in
                [1]. The better long-term solution is to freeze the worker instead of
                evicting clients, which is noted as TODOs.

                [1]
                https://docs.google.com/document/d/1dZxwmUYOlDmZ-PF97mfoXbzMrFHBsqeUT3XxTkpNIb0/edit?usp=sharing
                Bug: 406420935, 431875857
                Change-Id: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
                Reviewed-by: Anders Hartvoll Ruud <and...@chromium.org>
                Reviewed-by: Guillem Perez <guip...@google.com>
                Auto-Submit: Anna Sato <anna...@chromium.org>
                Commit-Queue: Anna Sato <anna...@chromium.org>
                Cr-Commit-Position: refs/heads/main@{#1529241}
                Files:
                • M content/browser/renderer_host/back_forward_cache_impl.cc
                • M content/browser/worker_host/shared_worker_host.cc
                • M content/browser/worker_host/shared_worker_host.h
                • M content/browser/worker_host/shared_worker_service_impl.cc
                • M content/browser/worker_host/shared_worker_service_impl.h
                • M third_party/blink/web_tests/VirtualTestSuites
                • A third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/back-forward-cache/eligibility/shared-worker-active-client.window.js
                • A third_party/blink/web_tests/external/wpt/html/browsers/browsing-the-web/back-forward-cache/eligibility/shared-worker-expected.txt
                • A third_party/blink/web_tests/external/wpt/web-locks/bfcache/abort.tentative.https-expected.txt
                • D third_party/blink/web_tests/external/wpt/web-locks/bfcache/held.tentative.https-expected.txt
                • A third_party/blink/web_tests/external/wpt/web-locks/bfcache/release.tentative.https-expected.txt
                • D third_party/blink/web_tests/external/wpt/web-locks/bfcache/sharedworker-multiple.tentative.https-expected.txt
                • A third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/resources/stateful-worker.js
                • A third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-all-clients-bfcached.tentative.window.js
                • D third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-allows-bfcache.window.js
                • M third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-client-postmessage-transferred-port.window.js
                • M third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-client-postmessage.window.js
                • A third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-mixed-clients-eviction.tentative.window.js
                • A third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-multiple-clients-different-instances.tentative.window.js
                • A third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-multiple-clients-same-instance.tentative.window.js
                • A third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-with-fenced-frame-client.tentative.https.window.js
                • A third_party/blink/web_tests/wpt_internal/shared-worker/back-forward-cache/shared-worker-with-iframe-client.tentative.window.js
                • M tools/metrics/histograms/metadata/content/histograms.xml
                Change size: L
                Delta: 23 files changed, 480 insertions(+), 39 deletions(-)
                Branch: refs/heads/main
                Submit Requirements:
                • requirement satisfiedCode-Review: +1 by Guillem Perez, +1 by Anders Hartvoll Ruud
                Open in Gerrit
                Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
                Gerrit-MessageType: merged
                Gerrit-Project: chromium/src
                Gerrit-Branch: main
                Gerrit-Change-Id: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
                Gerrit-Change-Number: 6914636
                Gerrit-PatchSet: 42
                Gerrit-Owner: Anna Sato <anna...@chromium.org>
                Gerrit-Reviewer: Anders Hartvoll Ruud <and...@chromium.org>
                Gerrit-Reviewer: Anna Sato <anna...@chromium.org>
                Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
                Gerrit-Reviewer: Fergal Daly <fer...@chromium.org>
                Gerrit-Reviewer: Guillem Perez <guip...@google.com>
                Gerrit-Reviewer: Yoshisato Yanagisawa <yyana...@chromium.org>
                Gerrit-CC: Blink W3C Test Autoroller <blink-w3c-te...@chromium.org>
                open
                diffy
                satisfied_requirement

                Blink W3C Test Autoroller (Gerrit)

                unread,
                Oct 13, 2025, 9:41:38 PM (5 hours ago) Oct 13
                to Anna Sato, Chromium LUCI CQ, Guillem Perez, Anders Hartvoll Ruud, Fergal Daly, Yoshisato Yanagisawa, Code Review Nudger, bfcach...@chromium.org, Chromium Metrics Reviews, chromium...@chromium.org, devtools...@chromium.org, alexmo...@chromium.org, asvitkine...@chromium.org, blink-revie...@chromium.org, blink-...@chromium.org, blink-work...@chromium.org, chikamu...@chromium.org, creis...@chromium.org, ddrone...@google.com, kinuko...@chromium.org, navigation...@chromium.org

                Message from Blink W3C Test Autoroller

                The WPT PR for this CL has been merged upstream! https://github.com/web-platform-tests/wpt/pull/55410

                Open in Gerrit

                Related details

                Attention set is empty
                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: I038b17dc890e50b7a57e6d8c5f496e11cb302f66
                Gerrit-Change-Number: 6914636
                Gerrit-PatchSet: 42
                Gerrit-Owner: Anna Sato <anna...@chromium.org>
                Gerrit-Reviewer: Anders Hartvoll Ruud <and...@chromium.org>
                Gerrit-Reviewer: Anna Sato <anna...@chromium.org>
                Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
                Gerrit-Reviewer: Fergal Daly <fer...@chromium.org>
                Gerrit-Reviewer: Guillem Perez <guip...@google.com>
                Gerrit-Reviewer: Yoshisato Yanagisawa <yyana...@chromium.org>
                Gerrit-CC: Blink W3C Test Autoroller <blink-w3c-te...@chromium.org>
                Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
                Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
                Gerrit-Comment-Date: Tue, 14 Oct 2025 01:41:31 +0000
                Gerrit-HasComments: No
                Gerrit-Has-Labels: No
                satisfied_requirement
                open
                diffy
                Reply all
                Reply to author
                Forward
                0 new messages