forked from chromium/chromium
-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Merge M108][ThreadedBodyLoader] Send data to preload scanner in the …
…background When ThreadedBodyLoader is enabled we have the decoded body data available on a background thread. Previously the data was still sent to the main thread before going to the preload scanner, even when the preload scanner was also running on a background thread. This patch allows sending data directly from NavigationBodyLoader::OffThreadBodyReader to the preload scanner when they are both on background threads. This avoids potential delays from having to bounce to the main thread before preload scanning can happen. On local traces, there could be >100ms delay between when the body data has been read and when the preload scanner receives that data. The flow of data to the preload scanner will go like this: 1. NavigationBodyLoader calls DecodedBodyDataReceived, which will end up getting forwarded to HTMLDocumentParser::Append 2. HTMLDocumentParser::Append will cause the background preload scanner to be created and scan the initial data passed to Append. 3. NavigationBodyLoader calls TakeProcessBackgroundDataCallback() which tells HTMLDocumentParser to stop sending data to the preload scanner in Append. 4. NavigationBodyLoader will pass data directly to the callback taken from TakeProcessBackgroundDataCallback(), which avoids hitting the main thread at all. HTMLDocumentParser will still receive data through Append() calls. A couple notes: - Had to add a few *ForTesting() methods to make sure tests weren't flaky with the threading logic going on. - HTMLPreloadScanner is no longer SequenceBound but instead is a unique_ptr with a deleter on the sequence because I needed to grab a WeakPtr to it on the main thread. (cherry picked from commit 0f0ddbd) Bug: 1373213 Change-Id: If67df50f66e2ffb09e9fd75cbae0b78da66e31d5 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3953138 Reviewed-by: Mason Freed <masonf@chromium.org> Reviewed-by: Nate Chapin <japhet@chromium.org> Commit-Queue: Clark DuVall <cduvall@chromium.org> Cr-Original-Commit-Position: refs/heads/main@{#1059543} Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3961308 Cr-Commit-Position: refs/branch-heads/5359@{#48} Cr-Branched-From: 27d3765-refs/heads/main@{#1058933}
- Loading branch information
1 parent
3d9f378
commit 8425894
Showing
16 changed files
with
323 additions
and
49 deletions.
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
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
Oops, something went wrong.