Support DSEv1 Prefetch for PreloadServingMetrics.{Initiator}.{All/Srp} [chromium/src : main]

0 views
Skip to first unread message

Huanpo Lin (Gerrit)

unread,
Aug 17, 2026, 4:44:43 AM (3 days ago) Aug 17
to Ken Okada, Hiroki Nakagawa, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, lingqi...@chromium.org, tburkar...@chromium.org, gavin...@chromium.org, prerenderi...@chromium.org, bmcquad...@chromium.org, csharris...@chromium.org, loading-rev...@chromium.org, speed-metrics...@chromium.org, speed-metr...@chromium.org
Attention needed from Hiroki Nakagawa and Ken Okada

Huanpo Lin added 1 comment

Patchset-level comments
Open in Gerrit

Related details

Attention is currently required from:
  • Hiroki Nakagawa
  • Ken Okada
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I8191a9e7e56e8fbb88ef040f59f84a1939fa55fa
Gerrit-Change-Number: 8254478
Gerrit-PatchSet: 12
Gerrit-Owner: Huanpo Lin <robe...@chromium.org>
Gerrit-Reviewer: Hiroki Nakagawa <nhi...@chromium.org>
Gerrit-Reviewer: Huanpo Lin <robe...@chromium.org>
Gerrit-Reviewer: Ken Okada <ken...@chromium.org>
Gerrit-Attention: Hiroki Nakagawa <nhi...@chromium.org>
Gerrit-Attention: Ken Okada <ken...@chromium.org>
Gerrit-Comment-Date: Mon, 17 Aug 2026 08:44:10 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Hiroki Nakagawa (Gerrit)

unread,
Aug 18, 2026, 12:59:03 AM (2 days ago) Aug 18
to Huanpo Lin, Ken Okada, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, lingqi...@chromium.org, tburkar...@chromium.org, gavin...@chromium.org, prerenderi...@chromium.org, bmcquad...@chromium.org, csharris...@chromium.org, loading-rev...@chromium.org, speed-metrics...@chromium.org, speed-metr...@chromium.org
Attention needed from Huanpo Lin and Ken Okada

Hiroki Nakagawa added 1 comment

File components/page_load_metrics/browser/observers/preload_serving_metrics_page_load_metrics_observer.cc
Line 195, Patchset 12 (Latest): if (is_served_by_legacy_search_prefetch_) {
base::UmaHistogramEnumeration(
base::StrCat(
{"PreloadServingMetrics.", *navigation_initiator_string_, ".All"}),
UsedInstantLoad::kPrefetch);
if (is_url_srp_) {
base::UmaHistogramEnumeration(
base::StrCat({"PreloadServingMetrics.", *navigation_initiator_string_,
".SRP"}),
UsedInstantLoad::kPrefetch);
}
return;
}
Hiroki Nakagawa . unresolved

I'd prefer to avoid scattering UMA recording code over several functions. Can we pass `is_served_by_legacy_search_prefetch_` to `RecordPreloadServingMetricsByNavigationInitiator()` below and record this case in the function as well?

Open in Gerrit

Related details

Attention is currently required from:
  • Huanpo Lin
  • Ken Okada
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: I8191a9e7e56e8fbb88ef040f59f84a1939fa55fa
    Gerrit-Change-Number: 8254478
    Gerrit-PatchSet: 12
    Gerrit-Owner: Huanpo Lin <robe...@chromium.org>
    Gerrit-Reviewer: Hiroki Nakagawa <nhi...@chromium.org>
    Gerrit-Reviewer: Huanpo Lin <robe...@chromium.org>
    Gerrit-Reviewer: Ken Okada <ken...@chromium.org>
    Gerrit-Attention: Huanpo Lin <robe...@chromium.org>
    Gerrit-Attention: Ken Okada <ken...@chromium.org>
    Gerrit-Comment-Date: Tue, 18 Aug 2026 04:58:33 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Ken Okada (Gerrit)

    unread,
    Aug 19, 2026, 7:47:18 AM (yesterday) Aug 19
    to Huanpo Lin, Hiroki Nakagawa, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, lingqi...@chromium.org, tburkar...@chromium.org, gavin...@chromium.org, prerenderi...@chromium.org, bmcquad...@chromium.org, csharris...@chromium.org, loading-rev...@chromium.org, speed-metrics...@chromium.org, speed-metr...@chromium.org
    Attention needed from Huanpo Lin

    Ken Okada added 4 comments

    Commit Message
    Line 9, Patchset 12 (Latest):Currently, DSEv1 Prefetch is classified as other in
    Ken Okada . unresolved

    `Other` (quoted) would be better?

    File chrome/browser/preloading/prefetch/search_prefetch/search_prefetch_navigation_throttle.h
    Line 17, Patchset 12 (Latest):class SearchPrefetchNavigationThrottle : public content::NavigationThrottle {
    Ken Okada . unresolved

    It's highly non trivial why we don't set `true` at the timing of serving and use navigation id, and set `true` latter by `SearchPrefetchNavigationThrottle`. It should be described as comments.

    How about adding this?

    ```
    // Marks `NavigationHandleUserData` when a navigation is served by search prefetch.
    //
    // While `//content` can access `content::NavigationHandle` from `FrameTreeNodeId`
    // inside a `URLLoaderInterceptor` (via `FrameTreeNode`), `//chrome` cannot access
    // it because `FrameTreeNode` is not exposed across the Content API boundary.
    // As a result, `SearchPrefetchURLLoaderInterceptor` cannot directly mark
    // `page_load_metrics::NavigationHandleUserData`. To bridge this gap:
    //
    // - `SearchPrefetchURLLoaderInterceptor` registers the navigation ID with
    // `SearchPrefetchService` upon intercepting a request.
    // - This throttle checks `SearchPrefetchService::IsServingNavigation()` in
    // `WillProcessResponse()` to mark `NavigationHandleUserData`.
    // - The tracked navigation ID is cleaned up in this throttle's destructor.
    ```

    File components/page_load_metrics/browser/observers/preload_serving_metrics_page_load_metrics_observer.cc
    Line 167, Patchset 12 (Parent):
    Ken Okada . unresolved

    Please keep this blank line. The above CHECK is precondition.

    Line 195, Patchset 12 (Latest): if (is_served_by_legacy_search_prefetch_) {
    base::UmaHistogramEnumeration(
    base::StrCat(
    {"PreloadServingMetrics.", *navigation_initiator_string_, ".All"}),
    UsedInstantLoad::kPrefetch);
    if (is_url_srp_) {
    base::UmaHistogramEnumeration(
    base::StrCat({"PreloadServingMetrics.", *navigation_initiator_string_,
    ".SRP"}),
    UsedInstantLoad::kPrefetch);
    }
    return;
    }
    Hiroki Nakagawa . unresolved

    I'd prefer to avoid scattering UMA recording code over several functions. Can we pass `is_served_by_legacy_search_prefetch_` to `RecordPreloadServingMetricsByNavigationInitiator()` below and record this case in the function as well?

    Ken Okada

    +1 (But I understand why Robert wrote this...)

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Huanpo Lin
    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: I8191a9e7e56e8fbb88ef040f59f84a1939fa55fa
    Gerrit-Change-Number: 8254478
    Gerrit-PatchSet: 12
    Gerrit-Owner: Huanpo Lin <robe...@chromium.org>
    Gerrit-Reviewer: Hiroki Nakagawa <nhi...@chromium.org>
    Gerrit-Reviewer: Huanpo Lin <robe...@chromium.org>
    Gerrit-Reviewer: Ken Okada <ken...@chromium.org>
    Gerrit-Attention: Huanpo Lin <robe...@chromium.org>
    Gerrit-Comment-Date: Wed, 19 Aug 2026 11:46:53 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Hiroki Nakagawa <nhi...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Ken Okada (Gerrit)

    unread,
    Aug 19, 2026, 8:03:47 AM (yesterday) Aug 19
    to Huanpo Lin, Hiroki Nakagawa, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, lingqi...@chromium.org, tburkar...@chromium.org, gavin...@chromium.org, prerenderi...@chromium.org, bmcquad...@chromium.org, csharris...@chromium.org, loading-rev...@chromium.org, speed-metrics...@chromium.org, speed-metr...@chromium.org
    Attention needed from Huanpo Lin

    Ken Okada added 2 comments

    Commit Message
    Line 12, Patchset 12 (Latest):`is_served_by_legacy_search_prefetch_` in NavigationHandleUserData for
    Ken Okada . unresolved

    The CL description mentions is_served_by_legacy_search_prefetch_ in NavigationHandleUserData, but the actual field name in NavigationHandleUserData is is_served_by_search_prefetch_.

    File components/page_load_metrics/browser/observers/preload_serving_metrics_page_load_metrics_observer.h
    Line 73, Patchset 12 (Latest): bool is_served_by_legacy_search_prefetch_ = false;
    Ken Okada . unresolved
    • NavigationHandleUserData: is_served_by_search_prefetch_
    • PreloadServingMetricsPLMO: is_served_by_legacy_search_prefetch_

    Is the difference intended?

    Gerrit-Comment-Date: Wed, 19 Aug 2026 12:03:16 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Huanpo Lin (Gerrit)

    unread,
    1:05 AM (11 hours ago) 1:05 AM
    to Ken Okada, Hiroki Nakagawa, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, lingqi...@chromium.org, tburkar...@chromium.org, gavin...@chromium.org, prerenderi...@chromium.org, bmcquad...@chromium.org, csharris...@chromium.org, loading-rev...@chromium.org, speed-metrics...@chromium.org, speed-metr...@chromium.org
    Attention needed from Hiroki Nakagawa and Ken Okada

    Huanpo Lin added 6 comments

    Commit Message
    Line 9, Patchset 12:Currently, DSEv1 Prefetch is classified as other in
    Ken Okada . resolved

    `Other` (quoted) would be better?

    Huanpo Lin

    Done

    Line 12, Patchset 12:`is_served_by_legacy_search_prefetch_` in NavigationHandleUserData for
    Ken Okada . resolved

    The CL description mentions is_served_by_legacy_search_prefetch_ in NavigationHandleUserData, but the actual field name in NavigationHandleUserData is is_served_by_search_prefetch_.

    Huanpo Lin

    Updated to be consistent. `is_served_by_legacy_search_prefetch_` is used, PTAL.

    File chrome/browser/preloading/prefetch/search_prefetch/search_prefetch_navigation_throttle.h
    Line 17, Patchset 12:class SearchPrefetchNavigationThrottle : public content::NavigationThrottle {
    Ken Okada . resolved

    It's highly non trivial why we don't set `true` at the timing of serving and use navigation id, and set `true` latter by `SearchPrefetchNavigationThrottle`. It should be described as comments.

    How about adding this?

    ```
    // Marks `NavigationHandleUserData` when a navigation is served by search prefetch.
    //
    // While `//content` can access `content::NavigationHandle` from `FrameTreeNodeId`
    // inside a `URLLoaderInterceptor` (via `FrameTreeNode`), `//chrome` cannot access
    // it because `FrameTreeNode` is not exposed across the Content API boundary.
    // As a result, `SearchPrefetchURLLoaderInterceptor` cannot directly mark
    // `page_load_metrics::NavigationHandleUserData`. To bridge this gap:
    //
    // - `SearchPrefetchURLLoaderInterceptor` registers the navigation ID with
    // `SearchPrefetchService` upon intercepting a request.
    // - This throttle checks `SearchPrefetchService::IsServingNavigation()` in
    // `WillProcessResponse()` to mark `NavigationHandleUserData`.
    // - The tracked navigation ID is cleaned up in this throttle's destructor.
    ```

    Huanpo Lin

    Updated, thanks.

    File components/page_load_metrics/browser/observers/preload_serving_metrics_page_load_metrics_observer.h
    Line 73, Patchset 12: bool is_served_by_legacy_search_prefetch_ = false;
    Ken Okada . resolved
    • NavigationHandleUserData: is_served_by_search_prefetch_
    • PreloadServingMetricsPLMO: is_served_by_legacy_search_prefetch_

    Is the difference intended?

    Huanpo Lin

    is_served_by_legacy_search_prefetch_ is the desired one, the first one wasn't updated by accident. Updated, PTAL.

    File components/page_load_metrics/browser/observers/preload_serving_metrics_page_load_metrics_observer.cc
    Ken Okada . resolved

    Please keep this blank line. The above CHECK is precondition.

    Huanpo Lin

    Done

    Line 195, Patchset 12: if (is_served_by_legacy_search_prefetch_) {

    base::UmaHistogramEnumeration(
    base::StrCat(
    {"PreloadServingMetrics.", *navigation_initiator_string_, ".All"}),
    UsedInstantLoad::kPrefetch);
    if (is_url_srp_) {
    base::UmaHistogramEnumeration(
    base::StrCat({"PreloadServingMetrics.", *navigation_initiator_string_,
    ".SRP"}),
    UsedInstantLoad::kPrefetch);
    }
    return;
    }
    Hiroki Nakagawa . resolved

    I'd prefer to avoid scattering UMA recording code over several functions. Can we pass `is_served_by_legacy_search_prefetch_` to `RecordPreloadServingMetricsByNavigationInitiator()` below and record this case in the function as well?

    Ken Okada

    +1 (But I understand why Robert wrote this...)

    Huanpo Lin

    Updated, PTAL.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Hiroki Nakagawa
    • Ken Okada
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I8191a9e7e56e8fbb88ef040f59f84a1939fa55fa
      Gerrit-Change-Number: 8254478
      Gerrit-PatchSet: 16
      Gerrit-Owner: Huanpo Lin <robe...@chromium.org>
      Gerrit-Reviewer: Hiroki Nakagawa <nhi...@chromium.org>
      Gerrit-Reviewer: Huanpo Lin <robe...@chromium.org>
      Gerrit-Reviewer: Ken Okada <ken...@chromium.org>
      Gerrit-Attention: Hiroki Nakagawa <nhi...@chromium.org>
      Gerrit-Attention: Ken Okada <ken...@chromium.org>
      Gerrit-Comment-Date: Thu, 20 Aug 2026 05:04:46 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Hiroki Nakagawa <nhi...@chromium.org>
      Comment-In-Reply-To: Ken Okada <ken...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Ken Okada (Gerrit)

      unread,
      6:17 AM (5 hours ago) 6:17 AM
      to Huanpo Lin, Hiroki Nakagawa, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, chromium...@chromium.org, lingqi...@chromium.org, tburkar...@chromium.org, gavin...@chromium.org, prerenderi...@chromium.org, bmcquad...@chromium.org, csharris...@chromium.org, loading-rev...@chromium.org, speed-metrics...@chromium.org, speed-metr...@chromium.org
      Attention needed from Hiroki Nakagawa and Huanpo Lin

      Ken Okada added 5 comments

      Patchset-level comments
      File-level comment, Patchset 16 (Latest):
      Ken Okada . unresolved

      Could you add the same logic to RecordFirstContentfulPaint? Or, it becomes trivial if we rebase it to https://chromium-review.git.corp.google.com/c/chromium/src/+/8254911.

      File chrome/browser/preloading/prefetch/search_prefetch/search_prefetch_navigation_throttle.cc
      Line 45, Patchset 16 (Latest): search_prefetch_service_ = service->GetWeakPtr();
      Ken Okada . unresolved

      Since `MaybeCreateAndAdd()` already performs the lookup and null-check for `SearchPrefetchService`, we can pass the service (or its `base::WeakPtr`) directly into the constructor (or `CHECK` it inside the constructor) to avoid duplicating the nested lookups:

      ```cpp
      // static
      void SearchPrefetchNavigationThrottle::MaybeCreateAndAdd(
      content::NavigationThrottleRegistry& registry) {
      // ...
      auto* profile =
      Profile::FromBrowserContext(web_contents->GetBrowserContext());
      if (!profile) {
      return;
      }
      auto* service = SearchPrefetchServiceFactory::GetForProfile(profile);
      if (!service) {
      return;
      }
      registry.AddThrottle(
      std::make_unique<SearchPrefetchNavigationThrottle>(registry, service->GetWeakPtr()));
      }
      ```
      File content/browser/preloading/preload_serving_metrics.h
      Line 229, Patchset 16 (Latest): bool is_served_by_legacy_search_prefetch = false) const;
      Ken Okada . unresolved

      Please avoid a default value. I believe this argument shouldn't be omitted.

      File content/browser/preloading/preload_serving_metrics.cc
      Line 328, Patchset 16 (Latest): bool did_nav_use_bfcache,
      Ken Okada . unresolved

      [nit] `is_served_by_legacy_search_prefetch` is a similar input like `did_nav_use_bfcache` and I prefer after it.

      Line 335, Patchset 16 (Latest): } else if (did_nav_use_bfcache) {
      Ken Okada . unresolved

      I prefer BFCache first as this is a variant of prefetch. Perhaps, after prerender? (My understanding of the SearchPrefetch prerender case is handled by the below prerender logic.)

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Hiroki Nakagawa
      • Huanpo Lin
      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: I8191a9e7e56e8fbb88ef040f59f84a1939fa55fa
        Gerrit-Change-Number: 8254478
        Gerrit-PatchSet: 16
        Gerrit-Owner: Huanpo Lin <robe...@chromium.org>
        Gerrit-Reviewer: Hiroki Nakagawa <nhi...@chromium.org>
        Gerrit-Reviewer: Huanpo Lin <robe...@chromium.org>
        Gerrit-Reviewer: Ken Okada <ken...@chromium.org>
        Gerrit-Attention: Huanpo Lin <robe...@chromium.org>
        Gerrit-Attention: Hiroki Nakagawa <nhi...@chromium.org>
        Gerrit-Comment-Date: Thu, 20 Aug 2026 10:16:55 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy
        Reply all
        Reply to author
        Forward
        0 new messages