Keep browser alive while fetch keepalive URLLoaders exist [chromium/src : main]

0 views
Skip to first unread message

Helmut Januschka (Gerrit)

unread,
Jun 23, 2026, 4:09:52 AMJun 23
to Ming-Ying Chung, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, asvitkine...@chromium.org, loading...@chromium.org
Attention needed from Ming-Ying Chung

Helmut Januschka added 1 comment

Patchset-level comments
File-level comment, Patchset 4 (Latest):
Helmut Januschka . resolved

hi @my...@chromium.org i think this solves it, verified it on on all platforms, could you PTAL and re-route if its better fit for other reviewers.

and please let me know if you want me to change anything.


for easier testing here is a sampler with a demo server: https://static.januschka.com/i-408010432/index.html if you want to take a look

Open in Gerrit

Related details

Attention is currently required from:
  • Ming-Ying Chung
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: I8a8d2d7a8770e8f1cdedf9d279db2359a5192ff4
Gerrit-Change-Number: 7972217
Gerrit-PatchSet: 4
Gerrit-Owner: Helmut Januschka <hel...@januschka.com>
Gerrit-Reviewer: Helmut Januschka <hel...@januschka.com>
Gerrit-Reviewer: Ming-Ying Chung <my...@chromium.org>
Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
Gerrit-Attention: Ming-Ying Chung <my...@chromium.org>
Gerrit-Comment-Date: Tue, 23 Jun 2026 08:09:37 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Ming-Ying Chung (Gerrit)

unread,
Jun 25, 2026, 6:38:41 AM (14 days ago) Jun 25
to Helmut Januschka, Barry Pollard, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, asvitkine...@chromium.org, loading...@chromium.org
Attention needed from Helmut Januschka

Ming-Ying Chung added 1 comment

File chrome/browser/chrome_content_browser_client.cc
Line 8337, Patchset 4 (Latest):void ChromeContentBrowserClient::OnFetchKeepAliveRequestCreated(
Ming-Ying Chung . unresolved

The overall idea looks okay. But I roughly remember one of the goal of the fetch keepalive in-browser migration is to get rid of the usage of `ScopedKeepAlive` (or all its callbacks `OnKeepaliveRequest*` above). Unfortunately the code is not cleaned up after it's launched.

Given that new callbacks to increase `num_fetch_keepalive_loaders_` are added, I think we want to make sure that they don't really depend on all other existing callbacks, i.e. we only want to keep the requests alive in extreme case (browser shutdown), not due to fetch keepalive legacy path.

Open in Gerrit

Related details

Attention is currently required from:
  • Helmut Januschka
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: I8a8d2d7a8770e8f1cdedf9d279db2359a5192ff4
    Gerrit-Change-Number: 7972217
    Gerrit-PatchSet: 4
    Gerrit-Owner: Helmut Januschka <hel...@januschka.com>
    Gerrit-Reviewer: Helmut Januschka <hel...@januschka.com>
    Gerrit-Reviewer: Ming-Ying Chung <my...@chromium.org>
    Gerrit-CC: Barry Pollard <barryp...@chromium.org>
    Gerrit-Attention: Helmut Januschka <hel...@januschka.com>
    Gerrit-Comment-Date: Thu, 25 Jun 2026 10:38:08 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Helmut Januschka (Gerrit)

    unread,
    Jun 28, 2026, 3:12:30 PM (11 days ago) Jun 28
    to Barry Pollard, Ming-Ying Chung, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, asvitkine...@chromium.org, loading...@chromium.org
    Attention needed from Ming-Ying Chung

    Helmut Januschka added 1 comment

    File chrome/browser/chrome_content_browser_client.cc
    Line 8337, Patchset 4 (Latest):void ChromeContentBrowserClient::OnFetchKeepAliveRequestCreated(
    Ming-Ying Chung . unresolved

    The overall idea looks okay. But I roughly remember one of the goal of the fetch keepalive in-browser migration is to get rid of the usage of `ScopedKeepAlive` (or all its callbacks `OnKeepaliveRequest*` above). Unfortunately the code is not cleaned up after it's launched.

    Given that new callbacks to increase `num_fetch_keepalive_loaders_` are added, I think we want to make sure that they don't really depend on all other existing callbacks, i.e. we only want to keep the requests alive in extreme case (browser shutdown), not due to fetch keepalive legacy path.

    Helmut Januschka

    thanks for the insights! the new `num_fetch_keepalive_loaders_` path is fully decoupled from the legacy `num_keepalive_requests_`/`keepalive_timer_` one.

    for the legacy cleanup i can file a tracking bug, WDYT?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Ming-Ying Chung
    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: I8a8d2d7a8770e8f1cdedf9d279db2359a5192ff4
    Gerrit-Change-Number: 7972217
    Gerrit-PatchSet: 4
    Gerrit-Owner: Helmut Januschka <hel...@januschka.com>
    Gerrit-Reviewer: Helmut Januschka <hel...@januschka.com>
    Gerrit-Reviewer: Ming-Ying Chung <my...@chromium.org>
    Gerrit-CC: Barry Pollard <barryp...@chromium.org>
    Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
    Gerrit-Attention: Ming-Ying Chung <my...@chromium.org>
    Gerrit-Comment-Date: Sun, 28 Jun 2026 19:12:06 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Ming-Ying Chung <my...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Helmut Januschka (Gerrit)

    unread,
    Jul 8, 2026, 2:39:46 AM (yesterday) Jul 8
    to Barry Pollard, Ming-Ying Chung, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, asvitkine...@chromium.org, loading...@chromium.org
    Attention needed from Ming-Ying Chung

    Helmut Januschka added 1 comment

    Patchset-level comments
    Helmut Januschka . unresolved

    ping, please let me know if i should re-assign to someone else, or if you want me to address anything

    Gerrit-Comment-Date: Wed, 08 Jul 2026 06:39:24 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Ming-Ying Chung (Gerrit)

    unread,
    Jul 8, 2026, 3:46:43 AM (yesterday) Jul 8
    to Helmut Januschka, Barry Pollard, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, asvitkine...@chromium.org, loading...@chromium.org
    Attention needed from Helmut Januschka

    Ming-Ying Chung voted and added 5 comments

    Votes added by Ming-Ying Chung

    Code-Review+1

    5 comments

    Patchset-level comments
    Helmut Januschka . resolved

    ping, please let me know if i should re-assign to someone else, or if you want me to address anything

    Ming-Ying Chung

    LGTM but you need owner review.

    File chrome/browser/chrome_content_browser_client.cc
    Line 8337, Patchset 4 (Latest):void ChromeContentBrowserClient::OnFetchKeepAliveRequestCreated(
    Ming-Ying Chung . resolved

    The overall idea looks okay. But I roughly remember one of the goal of the fetch keepalive in-browser migration is to get rid of the usage of `ScopedKeepAlive` (or all its callbacks `OnKeepaliveRequest*` above). Unfortunately the code is not cleaned up after it's launched.

    Given that new callbacks to increase `num_fetch_keepalive_loaders_` are added, I think we want to make sure that they don't really depend on all other existing callbacks, i.e. we only want to keep the requests alive in extreme case (browser shutdown), not due to fetch keepalive legacy path.

    Helmut Januschka

    thanks for the insights! the new `num_fetch_keepalive_loaders_` path is fully decoupled from the legacy `num_keepalive_requests_`/`keepalive_timer_` one.

    for the legacy cleanup i can file a tracking bug, WDYT?

    Ming-Ying Chung

    sgtm.

    Line 8337, Patchset 4 (Latest):void ChromeContentBrowserClient::OnFetchKeepAliveRequestCreated(
    Ming-Ying Chung . unresolved

    Better to have commentes (either here or in the header) explaining why we re-introduce the scoped keepalive usage even with the in-browser migration.

    Line 8358, Patchset 4 (Latest): fetch_keepalive_profile_keep_alive_ = ScopedProfileKeepAlive::TryAcquire(
    profile, ProfileKeepAliveOrigin::kFetchKeepAlive);
    Ming-Ying Chung . unresolved

    How if multiple requests from different profiles exist? It looks like only the last profile will be held.

    File chrome/browser/loader/keep_alive_browser_process_alive_browsertest.cc
    Line 23, Patchset 4 (Latest):// Tests for https://crbug.com/408010432.
    Ming-Ying Chung . unresolved

    We should have proper test description in addition to links to bug.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Helmut Januschka
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not 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: I8a8d2d7a8770e8f1cdedf9d279db2359a5192ff4
      Gerrit-Change-Number: 7972217
      Gerrit-PatchSet: 4
      Gerrit-Owner: Helmut Januschka <hel...@januschka.com>
      Gerrit-Reviewer: Helmut Januschka <hel...@januschka.com>
      Gerrit-Reviewer: Ming-Ying Chung <my...@chromium.org>
      Gerrit-CC: Barry Pollard <barryp...@chromium.org>
      Gerrit-CC: Chromium Metrics Reviews <chromium-met...@google.com>
      Gerrit-Attention: Helmut Januschka <hel...@januschka.com>
      Gerrit-Comment-Date: Wed, 08 Jul 2026 07:46:19 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: Helmut Januschka <hel...@januschka.com>
      Comment-In-Reply-To: Ming-Ying Chung <my...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Helmut Januschka (Gerrit)

      unread,
      Jul 8, 2026, 5:53:02 PM (10 hours ago) Jul 8
      to Rakina Zata Amni, Nicolas Ouellet-Payeur, Ming-Ying Chung, Barry Pollard, android-bu...@system.gserviceaccount.com, Chromium LUCI CQ, Chromium Metrics Reviews, chromium...@chromium.org, asvitkine...@chromium.org, loading...@chromium.org
      Attention needed from Nicolas Ouellet-Payeur and Rakina Zata Amni

      Helmut Januschka added 3 comments

      File chrome/browser/chrome_content_browser_client.cc
      Line 8337, Patchset 4:void ChromeContentBrowserClient::OnFetchKeepAliveRequestCreated(
      Ming-Ying Chung . resolved

      Better to have commentes (either here or in the header) explaining why we re-introduce the scoped keepalive usage even with the in-browser migration.

      Helmut Januschka

      Done

      Line 8358, Patchset 4: fetch_keepalive_profile_keep_alive_ = ScopedProfileKeepAlive::TryAcquire(
      profile, ProfileKeepAliveOrigin::kFetchKeepAlive);
      Ming-Ying Chung . resolved

      How if multiple requests from different profiles exist? It looks like only the last profile will be held.

      Helmut Januschka

      gosh, good catch, now tracking loaders per BrowserContext: OnFetchKeepAliveRequestDestroyed() receives the BrowserContext too, and a ScopedProfileKeepAlive is held for every profile with in-flight loaders (acquired on that profile's first loader, released on its last). The pointer at destroy time may belong to a context mid-destruction, so it is only used as a lookup key and never dereferenced. Added a multi-profile browser test (HoldsEveryProfileWithInFlightLoaders) covering this.

      File chrome/browser/loader/keep_alive_browser_process_alive_browsertest.cc
      Line 23, Patchset 4:// Tests for https://crbug.com/408010432.
      Ming-Ying Chung . resolved

      We should have proper test description in addition to links to bug.

      Helmut Januschka

      Done

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Nicolas Ouellet-Payeur
      • Rakina Zata Amni
      Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not satisfiedCode-Owners
        • requirement satisfiedCode-Review
        • requirement satisfiedReview-Enforcement
        Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
        Gerrit-MessageType: comment
        Gerrit-Project: chromium/src
        Gerrit-Branch: main
        Gerrit-Change-Id: I8a8d2d7a8770e8f1cdedf9d279db2359a5192ff4
        Gerrit-Change-Number: 7972217
        Gerrit-PatchSet: 5
        Gerrit-Owner: Helmut Januschka <hel...@januschka.com>
        Gerrit-Reviewer: Helmut Januschka <hel...@januschka.com>
        Gerrit-Reviewer: Ming-Ying Chung <my...@chromium.org>
        Gerrit-Reviewer: Nicolas Ouellet-Payeur <nico...@chromium.org>
        Gerrit-Reviewer: Rakina Zata Amni <rak...@chromium.org>
        Gerrit-Attention: Nicolas Ouellet-Payeur <nico...@chromium.org>
        Gerrit-Attention: Rakina Zata Amni <rak...@chromium.org>
        Gerrit-Comment-Date: Wed, 08 Jul 2026 21:52:40 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Ming-Ying Chung <my...@chromium.org>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy
        Reply all
        Reply to author
        Forward
        0 new messages