-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BestEffortServiceWorker] Use custom URLLoaderFactory in fetch handler
This CL is a part of efforts that achieve the dedupe function to BestEffortServiceWorker. At a high-level, the dedupe is achieved by reusing the RaceNetworkRequest response as a response of the corresponding request in the fetch handler, and do not send a new fetch request. We can split into some smaller steps to implement this. 1. Generates a token of RaceNetworkRequest, and pass it to the blink side to make the corresponding request in the fetch handler discoverable. 2. (This CL) Adds a map of the token and URLLoaderFactory in ServiceWorkerGlobalScope, and replaces the default URLLoader when the fetch request is same as the one called in RaceNetworkRequest which is outside of the fetch handler. 3. Fuses two message pipes into one in a custom URLLoaderClient so that we can reuse the RaceNetworkRequest result and don't dispatch duplicated requests in the fetch handler. In this CL, `network::mojom::URLLoaderFactory` pending remote is added to DispatchFetchEventParams. In ServiceWorkerGlobalScope, this factory mojo remote is stored in the map along with the RaceNetworkRequest token. When a fetch event happens from worker, `LoaderFactoryForWorker::CreateURLLoader` is called to dispatch fetch request. In order to avoid making an additional requset, this CL replaces the default URLLoader with the one created from the custom URLLoaderFactory. This CL adds the mechanism to replace the URLLoader in blink but doesn't actually pass the custom URLLoaderClient via mojo to keep the CL small, this mechanism will be used in the descendant CL. This CL doesn't change default behavior. Change-Id: Ib3c2ecf850ead1637ef98b9098e83d71ab5a0497 Bug: 1420517 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4561004 Reviewed-by: Takashi Toyoshima <toyoshim@chromium.org> Commit-Queue: Shunya Shishido <sisidovski@chromium.org> Reviewed-by: Yoshisato Yanagisawa <yyanagisawa@chromium.org> Reviewed-by: Kouhei Ueno <kouhei@chromium.org> Reviewed-by: Minoru Chikamune <chikamune@chromium.org> Cr-Commit-Position: refs/heads/main@{#1150213}
- Loading branch information
1 parent
ab60569
commit 08607a9
Showing
7 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters