[PM] Mark a page as loading as soon as "DidStartLoading" is invoked.
Today, PageNode::IsLoading() transitions to "true" when a response is received for a main frame different-document navigation (WebContentsObserver::DidReceiveResponse()). It transitions to "false" when the load has stopped (WebContentsObserver::DidStopLoading()) and the page has been idling for a short timeout. This implies that PageNode::IsLoading() is "false" between when a navigation starts and when the initial response is received. We want to build a policy that preempts BEST_EFFORT tasks when any page is loading. If we use PageNode::IsLoading() to build that policy, BEST_EFFORT tasks will still be able to execute between when a navigation starts and when the initial response is received. This is undesirable, because BEST_EFFORT tasks could still interfere with navigation. This CL solves the issue by replacing PageNode::IsLoading() with PageNode::GetLoadingState(). This method returns an enum: - kLoadingNotStarted: No top-level document has started loading yet. - kLoading: A different top-level document is loading. This correspond to WebContents::IsLoadingToDifferentDocument(). - kLoadedBusy: A different top-level document finished loading, but the page did not reach CPU and network quiescence since then. - kLoadedIdle: The page reached CPU and network quiescence after loading the current top-level document, or the load failed. In a different CL, we will preempt BEST_EFFORT tasks when any page is kLoading or kLoadedBusy. Bug: 887407 Change-Id: Ie88a56457309aa86221f1ea31f7ceda731547b07 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2300400 Commit-Queue: François Doray <fdoray@chromium.org> Reviewed-by:Joe Mason <joenotcharles@chromium.org> Cr-Commit-Position: refs/heads/master@{#832480}
Showing
This diff is collapsed.
This diff is collapsed.
Please register or sign in to comment