Refactor CronetAdaptiveRequestContext to do everything in one method that just returns the network handles (primary and fallback) that should be use for a request. [chromium/src : main]

0 views
Skip to first unread message

Erik Ovelius (Gerrit)

unread,
Apr 4, 2026, 2:10:17 PM (yesterday) Apr 4
to Chromium LUCI CQ, Stefano Duo, AyeAye, net-r...@chromium.org
Attention needed from Stefano Duo

Erik Ovelius added 2 comments

File components/cronet/android/java/src/org/chromium/net/impl/CronetAdaptiveRequestContext.java
Line 171, Patchset 2: return null;
Stefano Duo . resolved

Could we inline AdaptiveRequestContextcomputeAlternativeNetworkHandle here?

That way we can re-use the call to `mConnectivityManagerWrapper.getAllNetworks` above and we won't have to call into connectivity manager twice. This is preferable because the time it takes to query connectivity manager can have a long tail.

Erik Ovelius

Done

File components/cronet/android/java/src/org/chromium/net/impl/CronetUrlRequestContext.java
Line 544, Patchset 2: Long memorizedFallback = mAdaptiveRequestContext.getFallbackNetworkHandle(url);
Stefano Duo . resolved

Alongside my other comment, we could go as far as making `AdaptiveRequestContext.getFallbackNetworkHandle` (renaming it to `getNetworkHandles`/`getPrimaryAndFallbackNetworkHandles`) return a pair of network handles: primary and fallback.

Though, this fells mainly editorial, so it's up to you.

Erik Ovelius

Excellent comment, this simplifies things a lot. Done.

getPrimaryAndFallbackNetworkHandles ->computeStreamNetworkHandles though.

(I general a think a get* method should be a vanilla getter and not do too much work).

PTAL.

Open in Gerrit

Related details

Attention is currently required from:
  • Stefano Duo
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: I0c75e32de350ae87b50ee78443b4112abe7a2325
Gerrit-Change-Number: 7710283
Gerrit-PatchSet: 4
Gerrit-Owner: Erik Ovelius <ove...@google.com>
Gerrit-Reviewer: Erik Ovelius <ove...@google.com>
Gerrit-Reviewer: Stefano Duo <stefa...@google.com>
Gerrit-Attention: Stefano Duo <stefa...@google.com>
Gerrit-Comment-Date: Sat, 04 Apr 2026 18:09:55 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Stefano Duo <stefa...@google.com>
satisfied_requirement
unsatisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages