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

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

Issue 925623002: Refactor the loading tracking logic in WebContentsImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comments. Created 5 years, 10 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
Index: content/browser/frame_host/frame_tree_node.cc
diff --git a/content/browser/frame_host/frame_tree_node.cc b/content/browser/frame_host/frame_tree_node.cc
index 845aecea62afc5945311f283f029c8d8b6504682..bb5bf4839d53762dd0b1689cb189079665bc2a96 100644
--- a/content/browser/frame_host/frame_tree_node.cc
+++ b/content/browser/frame_host/frame_tree_node.cc
@@ -34,8 +34,7 @@ FrameTreeNode::FrameTreeNode(FrameTree* frame_tree,
manager_delegate),
frame_tree_node_id_(next_frame_tree_node_id_++),
parent_(NULL),
- replication_state_(name),
- is_loading_(false) {
+ replication_state_(name) {
}
FrameTreeNode::~FrameTreeNode() {
@@ -115,4 +114,27 @@ bool FrameTreeNode::IsDescendantOf(FrameTreeNode* other) const {
return false;
}
+bool FrameTreeNode::IsLoading() const {
+ RenderFrameHostImpl* current_frame_host =
+ render_manager_.current_frame_host();
+ RenderFrameHostImpl* pending_frame_host =
+ render_manager_.pending_frame_host();
+
+ DCHECK(current_frame_host != nullptr);
Charlie Reis 2015/03/03 06:32:22 nit: Drop the "!= nullptr" The check is equivalent
Fabrice (no longer in Chrome) 2015/03/03 13:12:16 Done.
+ // TODO(fdegans): Change the implementation logic for PlzNavigate once
+ // DidStartLoading and DidStopLoading are properly called.
+ if (pending_frame_host != nullptr)
+ return current_frame_host->is_loading() || pending_frame_host->is_loading();
+ else
Charlie Reis 2015/03/03 06:32:22 You don't need this else, since the previous branc
Fabrice (no longer in Chrome) 2015/03/03 13:12:16 Done. I like leaving the else because it makes for
+ return current_frame_host->is_loading();
+}
+
+double FrameTreeNode::GetLoadingProgress() const {
+ RenderFrameHostImpl* current_frame_host =
+ render_manager_.current_frame_host();
+
+ DCHECK(current_frame_host != nullptr);
Charlie Reis 2015/03/03 06:32:22 nit: Drop the "!= nullptr"
Fabrice (no longer in Chrome) 2015/03/03 13:12:16 Done.
+ return current_frame_host->loading_progress();
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698