Introduce PLMO for preloading serving type for each initiator [chromium/src : main]

0 views
Skip to first unread message

Huanpo Lin (Gerrit)

unread,
Jul 6, 2026, 2:59:17 AM (3 days ago) Jul 6
to Takashi Toyoshima, Ken Okada, Hiroki Nakagawa, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, Chromium Metrics Reviews, chromium...@chromium.org, asvitkine...@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, Ken Okada and Takashi Toyoshima

Huanpo Lin added 1 comment

Patchset-level comments
Open in Gerrit

Related details

Attention is currently required from:
  • Hiroki Nakagawa
  • Ken Okada
  • Takashi Toyoshima
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: I19e3fdce68d1f26ae5d8119ed31d72abb1d5e511
Gerrit-Change-Number: 8033521
Gerrit-PatchSet: 13
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-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
Gerrit-Attention: Hiroki Nakagawa <nhi...@chromium.org>
Gerrit-Attention: Ken Okada <ken...@chromium.org>
Gerrit-Comment-Date: Mon, 06 Jul 2026 06:59:02 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Ken Okada (Gerrit)

unread,
Jul 6, 2026, 3:19:57 AM (3 days ago) Jul 6
to Huanpo Lin, Takashi Toyoshima, Hiroki Nakagawa, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, Chromium Metrics Reviews, chromium...@chromium.org, asvitkine...@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, Huanpo Lin and Takashi Toyoshima

Ken Okada added 3 comments

Patchset-level comments
Ken Okada . unresolved

Only high-level comments for now.

File chrome/browser/page_load_metrics/observers/preload_serving_type_page_load_metrics_observer.cc
Line 27, Patchset 13 (Latest):};
Ken Okada . unresolved

Cloud you migrate the new PLMO into existing components/page_load_metrics/browser/observers/preload_serving_metrics_page_load_metrics_observer.*? OK to move it and recording logic (partially) to //chrome.

The existing one already has suffix logic. This CL is a natuarl enhancement of it. https://source.chromium.org/chromium/chromium/src/+/main:content/browser/preloading/preload_serving_metrics.cc;l=444-451;drc=ed4f6f5e1fca8223e6041e7e2c3fc4a9deff2c64

Line 134, Patchset 13 (Latest): base::UmaHistogramEnumeration(histogram_name_all, serving_type);
Ken Okada . unresolved

Related to the above comment.

It looks enough to record FCP if we need ratio of triggers. It's natural enhancement of existing `PreloadServingMetrics.PageLoad.Clients.PaintTiming.NavigationToFirstContentfulPaint.<suffix>` https://docs.google.com/document/d/1urfbqZd8Y6iCBenTWEpJFkLO4rm7GlUvnOjFRjQ-cII/edit?disco=AAAB9C04S2w

Open in Gerrit

Related details

Attention is currently required from:
  • Hiroki Nakagawa
  • Huanpo Lin
  • Takashi Toyoshima
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: I19e3fdce68d1f26ae5d8119ed31d72abb1d5e511
    Gerrit-Change-Number: 8033521
    Gerrit-PatchSet: 13
    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-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
    Gerrit-Attention: Huanpo Lin <robe...@chromium.org>
    Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-Attention: Hiroki Nakagawa <nhi...@chromium.org>
    Gerrit-Comment-Date: Mon, 06 Jul 2026 07:19:19 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Ken Okada (Gerrit)

    unread,
    Jul 6, 2026, 3:20:38 AM (3 days ago) Jul 6
    to Huanpo Lin, Takashi Toyoshima, Hiroki Nakagawa, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, Chromium Metrics Reviews, chromium...@chromium.org, asvitkine...@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, Huanpo Lin and Takashi Toyoshima

    Ken Okada added 1 comment

    Patchset-level comments
    Ken Okada . unresolved

    Only high-level comments for now.

    Ken Okada

    Let me know if you want me to handle it. I can write a CL.

    Gerrit-Comment-Date: Mon, 06 Jul 2026 07:20:22 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Ken Okada <ken...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Ken Okada (Gerrit)

    unread,
    Jul 6, 2026, 4:14:33 AM (3 days ago) Jul 6
    to Huanpo Lin, Takashi Toyoshima, Hiroki Nakagawa, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, Chromium Metrics Reviews, chromium...@chromium.org, asvitkine...@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, Huanpo Lin and Takashi Toyoshima

    Ken Okada added 1 comment

    File chrome/browser/page_load_metrics/observers/preload_serving_type_page_load_metrics_observer.cc
    Line 134, Patchset 13 (Latest): base::UmaHistogramEnumeration(histogram_name_all, serving_type);
    Ken Okada . resolved

    Related to the above comment.

    It looks enough to record FCP if we need ratio of triggers. It's natural enhancement of existing `PreloadServingMetrics.PageLoad.Clients.PaintTiming.NavigationToFirstContentfulPaint.<suffix>` https://docs.google.com/document/d/1urfbqZd8Y6iCBenTWEpJFkLO4rm7GlUvnOjFRjQ-cII/edit?disco=AAAB9C04S2w

    Ken Okada

    Chatted with nhiroki. Keeping this metrics as is is suitable for our purpose.

    Gerrit-Comment-Date: Mon, 06 Jul 2026 08:14:22 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Takashi Toyoshima (Gerrit)

    unread,
    Jul 6, 2026, 4:41:56 AM (3 days ago) Jul 6
    to Huanpo Lin, Ken Okada, Hiroki Nakagawa, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, Chromium Metrics Reviews, chromium...@chromium.org, asvitkine...@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

    Takashi Toyoshima added 4 comments

    File chrome/browser/page_load_metrics/observers/preload_serving_type_page_load_metrics_observer.h
    Line 9, Patchset 13 (Latest):
    Takashi Toyoshima . unresolved

    Can you add a short description for the class?

    File chrome/browser/page_load_metrics/observers/preload_serving_type_page_load_metrics_observer.cc
    Line 10, Patchset 13 (Latest):#include "components/page_load_metrics/google/browser/google_url_util.h"
    Takashi Toyoshima . unresolved

    Sorry if I asked this before but why you are adding this to //Chrome, rather than //components/page_load_metrics/google/browser/?

    This google_url_util.h disallows placing this in //components/page_load_metrics/browser/, but the google/browser is the directory for observers who want to depend on it. If we have other dependency to //chrome, the current place will be the best.

    If you have a plan to add dependency later, can you clarify it as a TODO comment or something so that we can ensure here is a right place for this observer?

    Line 18, Patchset 13 (Latest):// See PreloadServingType in
    // tools/metrics/histograms/metadata/navigation/enums.xml
    Takashi Toyoshima . unresolved

    Replace with an empty line? This is directly expressed by the LINT today. So, just following the example will be the best practice unless something is special?
    https://chromium.googlesource.com/chromium/src/tools/+/refs/heads/main/metrics/histograms/README.md#usage

    Line 108, Patchset 13 (Latest): content::NavigationHandle* navigation_handle) {
    Takashi Toyoshima . unresolved

    For BFCache restores and Prerender activations, the `navigation_handle` provided to these methods is a new handle that may not contain the original `InitiatorLocation` metadata.

    To ensure we correctly attribute these preloading hits to the original source (e.g., a bookmark click that was later BFCached), you should:
    1. Add a member variable `std::optional<InitiatorLocation> initiator_location_` to the observer.
    2. In `OnCommit`, always capture and store the location from the `navigation_handle`.
    3. In `RecordMetrics`, use the stored `initiator_location_` if available, falling back to the handle's data (or `kOther`) only if necessary.

    This is my understanding but did you ensure these scenarios in the browser tests?

    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: I19e3fdce68d1f26ae5d8119ed31d72abb1d5e511
    Gerrit-Change-Number: 8033521
    Gerrit-PatchSet: 13
    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-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
    Gerrit-Attention: Huanpo Lin <robe...@chromium.org>
    Gerrit-Attention: Hiroki Nakagawa <nhi...@chromium.org>
    Gerrit-Comment-Date: Mon, 06 Jul 2026 08:41:43 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Huanpo Lin (Gerrit)

    unread,
    Jul 7, 2026, 10:40:37 PM (2 days ago) Jul 7
    to Takashi Toyoshima, Ken Okada, Hiroki Nakagawa, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, Chromium Metrics Reviews, chromium...@chromium.org, tburkar...@chromium.org, gavin...@chromium.org, prerenderi...@chromium.org, asvitkine...@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, Ken Okada and Takashi Toyoshima

    Huanpo Lin voted and added 6 comments

    Votes added by Huanpo Lin

    Commit-Queue+1

    6 comments

    Patchset-level comments

    Only high-level comments for now.

    Ken Okada

    Let me know if you want me to handle it. I can write a CL.

    Huanpo Lin

    Allow me to mark as closed as another discussion thread is initiated somewhere else.

    File chrome/browser/page_load_metrics/observers/preload_serving_type_page_load_metrics_observer.h
    Line 9, Patchset 13:
    Takashi Toyoshima . resolved

    Can you add a short description for the class?

    Huanpo Lin

    Done

    File chrome/browser/page_load_metrics/observers/preload_serving_type_page_load_metrics_observer.cc
    Line 10, Patchset 13:#include "components/page_load_metrics/google/browser/google_url_util.h"
    Takashi Toyoshima . resolved

    Sorry if I asked this before but why you are adding this to //Chrome, rather than //components/page_load_metrics/google/browser/?

    This google_url_util.h disallows placing this in //components/page_load_metrics/browser/, but the google/browser is the directory for observers who want to depend on it. If we have other dependency to //chrome, the current place will be the best.

    If you have a plan to add dependency later, can you clarify it as a TODO comment or something so that we can ensure here is a right place for this observer?

    Huanpo Lin

    The reason is the same as `chrome/browser/page_load_metrics/observers/navigation_initiator_page_load_metrics_observer.cc`. I've added some comments in this file, PTAL. Thanks.

    Line 18, Patchset 13:// See PreloadServingType in
    // tools/metrics/histograms/metadata/navigation/enums.xml
    Takashi Toyoshima . resolved

    Replace with an empty line? This is directly expressed by the LINT today. So, just following the example will be the best practice unless something is special?
    https://chromium.googlesource.com/chromium/src/tools/+/refs/heads/main/metrics/histograms/README.md#usage

    Huanpo Lin

    Done

    Ken Okada . unresolved

    Cloud you migrate the new PLMO into existing components/page_load_metrics/browser/observers/preload_serving_metrics_page_load_metrics_observer.*? OK to move it and recording logic (partially) to //chrome.

    The existing one already has suffix logic. This CL is a natuarl enhancement of it. https://source.chromium.org/chromium/chromium/src/+/main:content/browser/preloading/preload_serving_metrics.cc;l=444-451;drc=ed4f6f5e1fca8223e6041e7e2c3fc4a9deff2c64

    Huanpo Lin

    As part of the plan migrating initiator enum back to //chrome, I think putting PLMO in //chrome is still necessary?

    Line 108, Patchset 13: content::NavigationHandle* navigation_handle) {
    Takashi Toyoshima . unresolved

    For BFCache restores and Prerender activations, the `navigation_handle` provided to these methods is a new handle that may not contain the original `InitiatorLocation` metadata.

    To ensure we correctly attribute these preloading hits to the original source (e.g., a bookmark click that was later BFCached), you should:
    1. Add a member variable `std::optional<InitiatorLocation> initiator_location_` to the observer.
    2. In `OnCommit`, always capture and store the location from the `navigation_handle`.
    3. In `RecordMetrics`, use the stored `initiator_location_` if available, falling back to the handle's data (or `kOther`) only if necessary.

    This is my understanding but did you ensure these scenarios in the browser tests?

    Huanpo Lin

    I see, thanks. I've added `std::optional<InitiatorLocation> initiator_location_`.
    About test coverage, there are omnibox related tests verifying prerender cases.
    But for BFCache, if I understand correctly, it has only history navigation usage so I have added one kOther case only.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Hiroki Nakagawa
    • Ken Okada
    • Takashi Toyoshima
    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: I19e3fdce68d1f26ae5d8119ed31d72abb1d5e511
    Gerrit-Change-Number: 8033521
    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-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
    Gerrit-Attention: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-Attention: Hiroki Nakagawa <nhi...@chromium.org>
    Gerrit-Attention: Ken Okada <ken...@chromium.org>
    Gerrit-Comment-Date: Wed, 08 Jul 2026 02:40:07 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    Comment-In-Reply-To: Takashi Toyoshima <toyo...@chromium.org>
    Comment-In-Reply-To: Ken Okada <ken...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Takashi Toyoshima (Gerrit)

    unread,
    Jul 8, 2026, 6:48:13 AM (22 hours ago) Jul 8
    to Huanpo Lin, Ken Okada, Hiroki Nakagawa, Chromium LUCI CQ, android-bu...@system.gserviceaccount.com, Chromium Metrics Reviews, chromium...@chromium.org, tburkar...@chromium.org, gavin...@chromium.org, prerenderi...@chromium.org, asvitkine...@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, Huanpo Lin and Ken Okada

    Takashi Toyoshima added 1 comment

    File chrome/browser/page_load_metrics/observers/preload_serving_type_page_load_metrics_observer.cc
    Line 108, Patchset 13: content::NavigationHandle* navigation_handle) {
    Takashi Toyoshima . unresolved

    For BFCache restores and Prerender activations, the `navigation_handle` provided to these methods is a new handle that may not contain the original `InitiatorLocation` metadata.

    To ensure we correctly attribute these preloading hits to the original source (e.g., a bookmark click that was later BFCached), you should:
    1. Add a member variable `std::optional<InitiatorLocation> initiator_location_` to the observer.
    2. In `OnCommit`, always capture and store the location from the `navigation_handle`.
    3. In `RecordMetrics`, use the stored `initiator_location_` if available, falling back to the handle's data (or `kOther`) only if necessary.

    This is my understanding but did you ensure these scenarios in the browser tests?

    Huanpo Lin

    I see, thanks. I've added `std::optional<InitiatorLocation> initiator_location_`.
    About test coverage, there are omnibox related tests verifying prerender cases.
    But for BFCache, if I understand correctly, it has only history navigation usage so I have added one kOther case only.

    Takashi Toyoshima

    I think the prerender activation has the same problem that the navigation handle is different among the first navigation and the second activation. So, it's curious if no tests failed...

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Hiroki Nakagawa
    • 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: I19e3fdce68d1f26ae5d8119ed31d72abb1d5e511
    Gerrit-Change-Number: 8033521
    Gerrit-PatchSet: 21
    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-Reviewer: Takashi Toyoshima <toyo...@chromium.org>
    Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
    Gerrit-Attention: Huanpo Lin <robe...@chromium.org>
    Gerrit-Attention: Hiroki Nakagawa <nhi...@chromium.org>
    Gerrit-Attention: Ken Okada <ken...@chromium.org>
    Gerrit-Comment-Date: Wed, 08 Jul 2026 10:47:39 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Huanpo Lin <robe...@chromium.org>
    Comment-In-Reply-To: Takashi Toyoshima <toyo...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages