Low-level fetching code.
Fetching/loading code is divided into:
- core/fetch: Fetch API
- core/loader: high-level fetching
- platform/loader/fetch: low-level fetching
Request Prioritization
The request priority used for any given fetch is a browser-specific internal attribute that is generated by considering the destination of the resource, any explicit priority hints as well as browser-specific heuristics. In Chrome's case, it includes:
- Position in the document so that late-body scripts are not given as high of a priority as early render-blocking scripts.
- If a fetch is generated by a preload or if it is for the underlying resource directly.
There is a web.dev article describing the priority scheme used by Chrome here.
Determining request priority is spread across 3 different locations in Chrome:
- platform/loader/fetch/resource_fetcher.cc: The core prioritization logic handling most resource requests.
- /content/browser/loader/navigation_early_hints_manager.cc:
Prioritization for
Link:preload response headers in HTTP 103 early-hint responses. - /chrome/browser/predictors/loading_predictor_tab_helper.cc: Prioritization for resources that are likely going to be needed.