Prefetch: Add helper to collect prefetch candidate details [chromium/src : main]

1 view
Skip to first unread message

Ken Okada (Gerrit)

unread,
Jul 19, 2026, 2:08:16 AM (5 days ago) Jul 19
to Taiyo Mizuhashi, Luis Flores, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, prerendering-reviews, gavin...@chromium.org, tburkar...@chromium.org
Attention needed from Taiyo Mizuhashi

Ken Okada added 1 comment

Patchset-level comments
File-level comment, Patchset 13:
Ken Okada . resolved

Could you have a look?

Open in Gerrit

Related details

Attention is currently required from:
  • Taiyo Mizuhashi
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: Id60fc04ff99d6d3cdf3904c53b966caaddaccfad
Gerrit-Change-Number: 8113467
Gerrit-PatchSet: 14
Gerrit-Owner: Ken Okada <ken...@chromium.org>
Gerrit-Reviewer: Ken Okada <ken...@chromium.org>
Gerrit-Reviewer: Taiyo Mizuhashi <ta...@chromium.org>
Gerrit-CC: Luis Flores <luf...@microsoft.com>
Gerrit-CC: prerendering-reviews <prerenderi...@chromium.org>
Gerrit-Attention: Taiyo Mizuhashi <ta...@chromium.org>
Gerrit-Comment-Date: Sun, 19 Jul 2026 06:07:37 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Luis Flores (Gerrit)

unread,
Jul 20, 2026, 2:11:32 AM (4 days ago) Jul 20
to Ken Okada, Taiyo Mizuhashi, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, prerendering-reviews, gavin...@chromium.org, tburkar...@chromium.org
Attention needed from Ken Okada and Taiyo Mizuhashi

Luis Flores added 2 comments

Patchset-level comments
File-level comment, Patchset 15 (Latest):
Luis Flores . resolved

Thanks for the refactor in prep for https://crrev.com/c/8053444. I'll add further comments about consuming the new helper in that CL.

File content/browser/preloading/prefetch/prefetch_match_resolver.h
Line 538, Patchset 15 (Latest):// If `key_ahead_of_prerender` and `collect_result_ahead_of_prerender` are
Luis Flores . unresolved

nit: should this be removed now that the logic has moved?

Open in Gerrit

Related details

Attention is currently required from:
  • Ken Okada
  • Taiyo Mizuhashi
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement 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: Id60fc04ff99d6d3cdf3904c53b966caaddaccfad
    Gerrit-Change-Number: 8113467
    Gerrit-PatchSet: 15
    Gerrit-Owner: Ken Okada <ken...@chromium.org>
    Gerrit-Reviewer: Ken Okada <ken...@chromium.org>
    Gerrit-Reviewer: Taiyo Mizuhashi <ta...@chromium.org>
    Gerrit-CC: Luis Flores <luf...@microsoft.com>
    Gerrit-CC: prerendering-reviews <prerenderi...@chromium.org>
    Gerrit-Attention: Taiyo Mizuhashi <ta...@chromium.org>
    Gerrit-Attention: Ken Okada <ken...@chromium.org>
    Gerrit-Comment-Date: Mon, 20 Jul 2026 06:11:14 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Ken Okada (Gerrit)

    unread,
    Jul 23, 2026, 12:26:01 PM (20 hours ago) Jul 23
    to Code Review Nudger, Taiyo Mizuhashi, Luis Flores, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, prerendering-reviews, gavin...@chromium.org, tburkar...@chromium.org
    Attention needed from Luis Flores and Taiyo Mizuhashi

    Ken Okada added 1 comment

    File content/browser/preloading/prefetch/prefetch_match_resolver.h
    Line 538, Patchset 15:// If `key_ahead_of_prerender` and `collect_result_ahead_of_prerender` are
    Luis Flores . resolved

    nit: should this be removed now that the logic has moved?

    Ken Okada

    Thanks! Done.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Luis Flores
    • Taiyo Mizuhashi
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: Id60fc04ff99d6d3cdf3904c53b966caaddaccfad
      Gerrit-Change-Number: 8113467
      Gerrit-PatchSet: 16
      Gerrit-Owner: Ken Okada <ken...@chromium.org>
      Gerrit-Reviewer: Ken Okada <ken...@chromium.org>
      Gerrit-Reviewer: Taiyo Mizuhashi <ta...@chromium.org>
      Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
      Gerrit-CC: Luis Flores <luf...@microsoft.com>
      Gerrit-CC: prerendering-reviews <prerenderi...@chromium.org>
      Gerrit-Attention: Taiyo Mizuhashi <ta...@chromium.org>
      Gerrit-Attention: Luis Flores <luf...@microsoft.com>
      Gerrit-Comment-Date: Thu, 23 Jul 2026 16:25:34 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Luis Flores <luf...@microsoft.com>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Taiyo Mizuhashi (Gerrit)

      unread,
      2:24 AM (6 hours ago) 2:24 AM
      to Ken Okada, Code Review Nudger, Luis Flores, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, prerendering-reviews, gavin...@chromium.org, tburkar...@chromium.org
      Attention needed from Ken Okada and Luis Flores

      Taiyo Mizuhashi voted and added 9 comments

      Votes added by Taiyo Mizuhashi

      Code-Review+1

      9 comments

      Patchset-level comments
      File-level comment, Patchset 16 (Latest):
      Taiyo Mizuhashi . resolved

      Overall LGTM, sorry for the delay

      Commit Message
      Line 20, Patchset 15: `CollectMatchCandidatesGeneric` to `void`. Callers now retrieve matched
      Taiyo Mizuhashi . unresolved

      super nit: exceeds 72 chars?

      Line 25, Patchset 15:- Remove `key_ahead_of_prerender` and `collect_result_ahead_of_prerender`
      Taiyo Mizuhashi . unresolved

      ditto

      File content/browser/preloading/prefetch/prefetch_match_resolver.h
      Line 538, Patchset 16 (Parent): // Debug: Fill `PrefetchPotentialCandidateCollectResult` if the navigation
      Taiyo Mizuhashi . unresolved

      nit: ditto above, can we retain this comment?

      Line 528, Patchset 16 (Parent): if (is_available) {
      candidates_available.push_back(candidate);
      servable_states.emplace(candidate->key(), servable_state);
      }
      Taiyo Mizuhashi . unresolved

      Code reading note:

      So these are moved to `PrefetchCandidateCollectHelper`'s `GetMatchedCandidates()` and `GetServableStates()` respectively, by checking
      `PrefetchPotentialCandidateCollectResult::kAvailable`?

      Line 498, Patchset 16 (Parent):
      // Debug: Fill `kUnavailablePrefetchIsNotInPrefetchService` if prefetch ahead
      // of prerender is not in `candidates`.
      Taiyo Mizuhashi . unresolved

      nit: can we retain this comment?

      Line 365, Patchset 15: // `PrefetchMatchResolver::FindInternal2()`. `PrefechContainer`'s dtor is
      Taiyo Mizuhashi . unresolved

      nit: `FindInternal2` -> `FindPrefetchInternal2`, and `PrefechContainer` -> `PrefetchContainer`

      Line 364, Patchset 15: // Safety: `CollectDetails`'s lifitime is bounded by
      Taiyo Mizuhashi . unresolved

      nit: `lifitime` -> `lifetime`

      File content/browser/preloading/prefetch/prefetch_service.h
      Line 209, Patchset 16 (Latest): // Returns candidate `PrefetchContainer`s and servable states for matching
      Taiyo Mizuhashi . resolved

      Code reading note: this will be updated in the next CL

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Ken Okada
      • Luis Flores
      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: Id60fc04ff99d6d3cdf3904c53b966caaddaccfad
        Gerrit-Change-Number: 8113467
        Gerrit-PatchSet: 16
        Gerrit-Owner: Ken Okada <ken...@chromium.org>
        Gerrit-Reviewer: Ken Okada <ken...@chromium.org>
        Gerrit-Reviewer: Taiyo Mizuhashi <ta...@chromium.org>
        Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
        Gerrit-CC: Luis Flores <luf...@microsoft.com>
        Gerrit-CC: prerendering-reviews <prerenderi...@chromium.org>
        Gerrit-Attention: Luis Flores <luf...@microsoft.com>
        Gerrit-Attention: Ken Okada <ken...@chromium.org>
        Gerrit-Comment-Date: Fri, 24 Jul 2026 06:23:58 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: Yes
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Ken Okada (Gerrit)

        unread,
        5:20 AM (3 hours ago) 5:20 AM
        to Taiyo Mizuhashi, Code Review Nudger, Luis Flores, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, prerendering-reviews, gavin...@chromium.org, tburkar...@chromium.org
        Attention needed from Luis Flores

        Ken Okada added 7 comments

        Commit Message
        Line 20, Patchset 15: `CollectMatchCandidatesGeneric` to `void`. Callers now retrieve matched
        Taiyo Mizuhashi . resolved

        super nit: exceeds 72 chars?

        Ken Okada

        Done

        Line 25, Patchset 15:- Remove `key_ahead_of_prerender` and `collect_result_ahead_of_prerender`
        Taiyo Mizuhashi . resolved

        ditto

        Ken Okada

        Done

        File content/browser/preloading/prefetch/prefetch_match_resolver.h
        Line 538, Patchset 16 (Parent): // Debug: Fill `PrefetchPotentialCandidateCollectResult` if the navigation
        Taiyo Mizuhashi . resolved

        nit: ditto above, can we retain this comment?

        Ken Okada

        Done

        Line 528, Patchset 16 (Parent): if (is_available) {
        candidates_available.push_back(candidate);
        servable_states.emplace(candidate->key(), servable_state);
        }
        Taiyo Mizuhashi . resolved

        Code reading note:

        So these are moved to `PrefetchCandidateCollectHelper`'s `GetMatchedCandidates()` and `GetServableStates()` respectively, by checking
        `PrefetchPotentialCandidateCollectResult::kAvailable`?

        Ken Okada

        Yes.

        Line 498, Patchset 16 (Parent):
        // Debug: Fill `kUnavailablePrefetchIsNotInPrefetchService` if prefetch ahead
        // of prerender is not in `candidates`.
        Taiyo Mizuhashi . resolved

        nit: can we retain this comment?

        Ken Okada

        Done

        Line 365, Patchset 15: // `PrefetchMatchResolver::FindInternal2()`. `PrefechContainer`'s dtor is
        Taiyo Mizuhashi . resolved

        nit: `FindInternal2` -> `FindPrefetchInternal2`, and `PrefechContainer` -> `PrefetchContainer`

        Ken Okada

        Thanks!

        Line 364, Patchset 15: // Safety: `CollectDetails`'s lifitime is bounded by
        Taiyo Mizuhashi . resolved

        nit: `lifitime` -> `lifetime`

        Ken Okada

        Done

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Luis Flores
        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: Id60fc04ff99d6d3cdf3904c53b966caaddaccfad
          Gerrit-Change-Number: 8113467
          Gerrit-PatchSet: 17
          Gerrit-Owner: Ken Okada <ken...@chromium.org>
          Gerrit-Reviewer: Ken Okada <ken...@chromium.org>
          Gerrit-Reviewer: Taiyo Mizuhashi <ta...@chromium.org>
          Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
          Gerrit-CC: Luis Flores <luf...@microsoft.com>
          Gerrit-CC: prerendering-reviews <prerenderi...@chromium.org>
          Gerrit-Attention: Luis Flores <luf...@microsoft.com>
          Gerrit-Comment-Date: Fri, 24 Jul 2026 09:19:59 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: No
          Comment-In-Reply-To: Taiyo Mizuhashi <ta...@chromium.org>
          satisfied_requirement
          open
          diffy

          Ken Okada (Gerrit)

          unread,
          5:58 AM (2 hours ago) 5:58 AM
          to Taiyo Mizuhashi, Code Review Nudger, Luis Flores, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, prerendering-reviews, gavin...@chromium.org, tburkar...@chromium.org
          Attention needed from Luis Flores

          Ken Okada voted Commit-Queue+2

          Commit-Queue+2
          Open in Gerrit

          Related details

          Attention is currently required from:
          • Luis Flores
          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: Id60fc04ff99d6d3cdf3904c53b966caaddaccfad
          Gerrit-Change-Number: 8113467
          Gerrit-PatchSet: 18
          Gerrit-Owner: Ken Okada <ken...@chromium.org>
          Gerrit-Reviewer: Ken Okada <ken...@chromium.org>
          Gerrit-Reviewer: Taiyo Mizuhashi <ta...@chromium.org>
          Gerrit-CC: Code Review Nudger <android-build...@prod.google.com>
          Gerrit-CC: Luis Flores <luf...@microsoft.com>
          Gerrit-CC: prerendering-reviews <prerenderi...@chromium.org>
          Gerrit-Attention: Luis Flores <luf...@microsoft.com>
          Gerrit-Comment-Date: Fri, 24 Jul 2026 09:57:42 +0000
          Gerrit-HasComments: No
          Gerrit-Has-Labels: Yes
          satisfied_requirement
          open
          diffy

          Chromium LUCI CQ (Gerrit)

          unread,
          6:47 AM (2 hours ago) 6:47 AM
          to Ken Okada, Taiyo Mizuhashi, Code Review Nudger, Luis Flores, android-bu...@system.gserviceaccount.com, chromium...@chromium.org, prerendering-reviews, gavin...@chromium.org, tburkar...@chromium.org

          Chromium LUCI CQ submitted the change with unreviewed changes

          Unreviewed changes

          16 is the latest approved patch-set.
          The change was submitted with unreviewed changes in the following files:

          ```
          The name of the file: content/browser/preloading/prefetch/prefetch_match_resolver.h
          Insertions: 3, Deletions: 3.

          @@ -361,9 +361,9 @@
          class PrefetchCandidateCollectHelper {
          public:
          struct CollectDetails {
          - // Safety: `CollectDetails`'s lifitime is bounded by
          - // `PrefetchMatchResolver::FindInternal2()`. `PrefechContainer`'s dtor is
          - // not called in it.
          + // Safety: `CollectDetails`'s lifetime is bounded by
          + // `PrefetchMatchResolver::FindPrefetchInternal2()`. `PrefetchContainer`'s
          + // dtor is not called in it.
          raw_ptr<T> candidate;
          PrefetchServableState servable_state;
          PrefetchPotentialCandidateCollectResult collect_result;
          ```
          ```
          The name of the file: content/browser/preloading/prefetch/prefetch_match_resolver.cc
          Insertions: 4, Deletions: 0.

          @@ -302,6 +302,8 @@

          servable_states = helper.GetServableStates();

          + // Debug: Fill `PrefetchPotentialCandidateCollectResult` if the navigation
          + // is prerender and has prefetch ahead of prerender.
          if (prefetch_container_ahead_of_prerender) {
          [&]() {
          for (const auto& details : helper.GetCandidates()) {
          @@ -312,6 +314,8 @@
          return;
          }
          }
          + // Defaults to `kUnavailablePrefetchIsNotInPrefetchService` if prefetch
          + // ahead of prerender is not in the candidates.
          collect_result_ahead_of_prerender_for_metrics_ =
          PrefetchPotentialCandidateCollectResult::
          kUnavailablePrefetchIsNotInPrefetchService;
          ```

          Change information

          Commit message:
          Prefetch: Add helper to collect prefetch candidate details

          This is a preparation of https://crrev.com/c/8053444.

          Refactoring. No behavioral change.

          This CL introduces `PrefetchCandidateCollectHelper` template class to
          collect details of candidate prefetch containers during the candidate
          collection phase of prefetch matching. Key changes:
          - Pass `PrefetchCandidateCollectHelper` to `CollectMatchCandidates` to
          record candidate details (e.g. `PrefetchServableState` and
          `PrefetchPotentialCandidateCollectResult`).
          - Change the return type of `CollectMatchCandidates` and

          `CollectMatchCandidatesGeneric` to `void`. Callers now retrieve
            matched candidates and servable states directly from the helper.
          - Refactor `IsCandidateAvailable` into `JudgeCandidateCollectResult`,
          which returns `PrefetchPotentialCandidateCollectResult` directly
          instead of mutating an out-parameter.
          - Remove `key_ahead_of_prerender` and
          `collect_result_ahead_of_prerender` parameters from
          `CollectMatchCandidates`, handling the check on the caller side
          using the helper.
          - Store `raw_ptr<T>` in `CollectDetails` with lifetime safety
          comments, passing `CollectDetails` by value and moving it into the
          helper.

          TAG=agy
          CONV=69517bc6-16b1-4b64-a5c3-ee901b49e323
          Co-Authored-By: Gemini <nor...@google.com>
          Change-Id: Id60fc04ff99d6d3cdf3904c53b966caaddaccfad
          Fuchsia-Binary-Size: Size increase is unavoidable.
          Commit-Queue: Ken Okada <ken...@chromium.org>
          Reviewed-by: Taiyo Mizuhashi <ta...@chromium.org>
          Cr-Commit-Position: refs/heads/main@{#1667766}
          Files:
          • M content/browser/preloading/prefetch/prefetch_match_resolver.cc
          • M content/browser/preloading/prefetch/prefetch_match_resolver.h
          • M content/browser/preloading/prefetch/prefetch_match_resolver_unittest.cc
          • M content/browser/preloading/prefetch/prefetch_service.cc
          • M content/browser/preloading/prefetch/prefetch_service.h
          Change size: L
          Delta: 5 files changed, 150 insertions(+), 109 deletions(-)
          Branch: refs/heads/main
          Submit Requirements:
          • requirement satisfiedCode-Review: +1 by Taiyo Mizuhashi
          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: Id60fc04ff99d6d3cdf3904c53b966caaddaccfad
          Gerrit-Change-Number: 8113467
          Gerrit-PatchSet: 19
          Gerrit-Owner: Ken Okada <ken...@chromium.org>
          Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
          Gerrit-Reviewer: Ken Okada <ken...@chromium.org>
          Gerrit-Reviewer: Taiyo Mizuhashi <ta...@chromium.org>
          open
          diffy
          satisfied_requirement
          Reply all
          Reply to author
          Forward
          0 new messages