Prerendering: Fire WebContentsObserver::LoadProgressChanged only on activation
This CL delays firing LoadProgressChanged for prerender frame tree and
dispatches the notification only on activation during calls to
DidStartLoading and DidStopLoading which invoked on activation.
Why?
This is done to ensure that WebContentsObserver::LoadProgressChanged is
per-WebContents i.e., it is not affected by navigations in the
prerendering frame tree.
Now the observers don't use LoadProgressChanged to dispatch show UI
visible changes and other events on an inactive RenderFrameHost.
Document explaining load events and prerendering:
https://docs.google.com/document/d/1WqzPSpWtJ9bqaaecYWTWvg6h2Q1UMh7kVB8C61o8QL4/edit?usp=sharing&resourcekey=0-q9YIhsh5LS-ZfBXcBQCOew
Bug: 1199682
Change-Id: I638d319802a6b6e77748af4057835dc47461fa5f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2993855
Commit-Queue: Sreeja Kamishetty <sreejakshetty@chromium.org>
Reviewed-by: Matt Falkenhagen <falken@chromium.org>
Reviewed-by: Alexander Timin <altimin@chromium.org>
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Cr-Commit-Position: refs/heads/master@{#911364}
diff --git a/content/browser/renderer_host/frame_tree.h b/content/browser/renderer_host/frame_tree.h
index 556d2df46..c249c92 100644
--- a/content/browser/renderer_host/frame_tree.h
+++ b/content/browser/renderer_host/frame_tree.h
@@ -355,14 +355,11 @@
bool to_different_document,
bool was_previously_loading);
void DidStopLoadingNode(FrameTreeNode& node);
- void DidChangeLoadProgressForNode(FrameTreeNode& node, double load_progress);
void DidCancelLoading();
- // Returns this FrameTree's total load progress.
- double load_progress() const { return load_progress_; }
-
- // Resets the load progress on all nodes in this FrameTree.
- void ResetLoadProgress();
+ // Returns this FrameTree's total load progress. If the `root_` FrameTreeNode
+ // is navigating returns `blink::kInitialLoadProgress`.
+ double GetLoadProgress();
// Returns true if at least one of the nodes in this FrameTree is loading.
bool IsLoading() const;