Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Unified Diff: content/browser/frame_host/frame_tree.cc

Issue 1080143003: Move DidStartLoading, DidStopLoading, DidChangeLoadProgress to RFHI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Rebase Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/frame_host/frame_tree.h ('k') | content/browser/frame_host/frame_tree_node.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/frame_host/frame_tree.cc
diff --git a/content/browser/frame_host/frame_tree.cc b/content/browser/frame_host/frame_tree.cc
index e7c814e6b49527fae2c15cf64ed019cd2d919f97..332524e76e3e87905a9fcad3edee45b66372355e 100644
--- a/content/browser/frame_host/frame_tree.cc
+++ b/content/browser/frame_host/frame_tree.cc
@@ -52,19 +52,18 @@ bool CollectLoadProgress(double* progress,
int* frame_count,
FrameTreeNode* node) {
// Ignore the current frame if it has not started loading.
- double frame_progress = node->loading_progress();
- if (frame_progress == FrameTreeNode::kLoadingProgressNotStarted)
+ if (!node->has_started_loading())
return true;
// Collect progress.
- *progress += frame_progress;
+ *progress += node->loading_progress();
(*frame_count)++;
return true;
}
// Helper function used with FrameTree::ForEach() to reset the load progress.
bool ResetNodeLoadProgress(FrameTreeNode* node) {
- node->set_loading_progress(FrameTreeNode::kLoadingProgressNotStarted);
+ node->reset_loading_progress();
return true;
}
@@ -97,7 +96,8 @@ FrameTree::FrameTree(Navigator* navigator,
render_widget_delegate,
manager_delegate,
std::string())),
- focused_frame_tree_node_id_(-1) {
+ focused_frame_tree_node_id_(-1),
+ load_progress_(0.0) {
}
FrameTree::~FrameTree() {
@@ -347,18 +347,25 @@ void FrameTree::FrameRemoved(FrameTreeNode* frame) {
on_frame_removed_.Run(frame->current_frame_host());
}
-double FrameTree::GetLoadProgress() {
+void FrameTree::UpdateLoadProgress() {
double progress = 0.0;
int frame_count = 0;
ForEach(base::Bind(&CollectLoadProgress, &progress, &frame_count));
if (frame_count != 0)
progress /= frame_count;
- return progress;
+
+ if (progress <= load_progress_)
+ return;
+ load_progress_ = progress;
+
+ // Notify the WebContents.
+ root_->navigator()->GetDelegate()->DidChangeLoadProgress();
}
void FrameTree::ResetLoadProgress() {
ForEach(base::Bind(&ResetNodeLoadProgress));
+ load_progress_ = 0.0;
}
bool FrameTree::IsLoading() {
« no previous file with comments | « content/browser/frame_host/frame_tree.h ('k') | content/browser/frame_host/frame_tree_node.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698