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

Side by Side Diff: content/browser/frame_host/frame_tree_node.h

Issue 925623002: Refactor the loading tracking logic in WebContentsImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ 5 #ifndef CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_
6 #define CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ 6 #define CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 12 matching lines...) Expand all
23 class FrameTree; 23 class FrameTree;
24 class Navigator; 24 class Navigator;
25 class RenderFrameHostImpl; 25 class RenderFrameHostImpl;
26 26
27 // When a page contains iframes, its renderer process maintains a tree structure 27 // When a page contains iframes, its renderer process maintains a tree structure
28 // of those frames. We are mirroring this tree in the browser process. This 28 // of those frames. We are mirroring this tree in the browser process. This
29 // class represents a node in this tree and is a wrapper for all objects that 29 // class represents a node in this tree and is a wrapper for all objects that
30 // are frame-specific (as opposed to page-specific). 30 // are frame-specific (as opposed to page-specific).
31 class CONTENT_EXPORT FrameTreeNode { 31 class CONTENT_EXPORT FrameTreeNode {
32 public: 32 public:
33
34 FrameTreeNode(FrameTree* frame_tree, 33 FrameTreeNode(FrameTree* frame_tree,
35 Navigator* navigator, 34 Navigator* navigator,
36 RenderFrameHostDelegate* render_frame_delegate, 35 RenderFrameHostDelegate* render_frame_delegate,
37 RenderViewHostDelegate* render_view_delegate, 36 RenderViewHostDelegate* render_view_delegate,
38 RenderWidgetHostDelegate* render_widget_delegate, 37 RenderWidgetHostDelegate* render_widget_delegate,
39 RenderFrameHostManager::Delegate* manager_delegate, 38 RenderFrameHostManager::Delegate* manager_delegate,
40 const std::string& name); 39 const std::string& name);
41 40
42 ~FrameTreeNode(); 41 ~FrameTreeNode();
43 42
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 } 97 }
99 98
100 bool HasSameOrigin(const FrameTreeNode& node) const { 99 bool HasSameOrigin(const FrameTreeNode& node) const {
101 return replication_state_.origin.IsSameAs(node.replication_state_.origin); 100 return replication_state_.origin.IsSameAs(node.replication_state_.origin);
102 } 101 }
103 102
104 const FrameReplicationState& current_replication_state() const { 103 const FrameReplicationState& current_replication_state() const {
105 return replication_state_; 104 return replication_state_;
106 } 105 }
107 106
108 void set_is_loading(bool is_loading) {
109 is_loading_ = is_loading;
110 }
111 bool is_loading() const {
112 return is_loading_;
113 }
114
115 RenderFrameHostImpl* current_frame_host() const { 107 RenderFrameHostImpl* current_frame_host() const {
116 return render_manager_.current_frame_host(); 108 return render_manager_.current_frame_host();
117 } 109 }
118 110
119 bool IsDescendantOf(FrameTreeNode* other) const; 111 bool IsDescendantOf(FrameTreeNode* other) const;
120 112
113 // Returns true if either the current or pending RenderFrameHost from the
nasko 2015/02/26 23:30:33 nit: Let's avoid putting implementation details in
Fabrice (no longer in Chrome) 2015/02/27 17:45:25 Acknowledged.
114 // associated RenderFrameHostManager is loading.
115 bool IsLoading() const;
116
117 // Returns the loading progress of the current RenderFrameHost from the
118 // associated RenderFrameHostManager.
119 double GetLoadingProgress() const;
120
121 private: 121 private:
122 void set_parent(FrameTreeNode* parent) { parent_ = parent; } 122 void set_parent(FrameTreeNode* parent) { parent_ = parent; }
123 123
124 // The next available browser-global FrameTreeNode ID. 124 // The next available browser-global FrameTreeNode ID.
125 static int64 next_frame_tree_node_id_; 125 static int64 next_frame_tree_node_id_;
126 126
127 // The FrameTree that owns us. 127 // The FrameTree that owns us.
128 FrameTree* frame_tree_; // not owned. 128 FrameTree* frame_tree_; // not owned.
129 129
130 // The Navigator object responsible for managing navigations at this node 130 // The Navigator object responsible for managing navigations at this node
131 // of the frame tree. 131 // of the frame tree.
132 scoped_refptr<Navigator> navigator_; 132 scoped_refptr<Navigator> navigator_;
133 133
134 // Manages creation and swapping of RenderFrameHosts for this frame. This 134 // Manages creation and swapping of RenderFrameHosts for this frame. This
135 // must be declared before |children_| so that it gets deleted after them. 135 // must be declared before |children_| so that it gets deleted after them.
136 // That's currently necessary so that RenderFrameHostImpl's destructor can 136 // That's currently necessary so that RenderFrameHostImpl's destructor can
137 // call GetProcess. 137 // call GetProcess.
138 RenderFrameHostManager render_manager_; 138 RenderFrameHostManager render_manager_;
139 139
140 // A browser-global identifier for the frame in the page, which stays stable 140 // A browser-global identifier for the frame in the page, which stays stable
141 // even if the frame does a cross-process navigation. 141 // even if the frame does a cross-process navigation.
142 const int64 frame_tree_node_id_; 142 const int64 frame_tree_node_id_;
143 143
144 // The parent node of this frame. NULL if this node is the root or if it has 144 // The parent node of this frame. NULL if this node is the root or if it has
145 // not yet been attached to the frame tree. 145 // not yet been attached to the frame tree.
146 FrameTreeNode* parent_; 146 FrameTreeNode* parent_;
147 147
148 // The immediate children of this specific frame. 148 // The immediate children of this specific frame.
149 ScopedVector<FrameTreeNode> children_; 149 ScopedVector<FrameTreeNode> children_;
150 150
151 // Track the current frame's last committed URL, so we can estimate the 151 // Track the current frame's last committed URL, so we can estimate the
152 // process impact of out-of-process iframes. 152 // process impact of out-of-process iframes.
153 // TODO(creis): Remove this when we can store subframe URLs in the 153 // TODO(creis): Remove this when we can store subframe URLs in the
154 // NavigationController. 154 // NavigationController.
155 GURL current_url_; 155 GURL current_url_;
156 156
157 // Track information that needs to be replicated to processes that have 157 // Track information that needs to be replicated to processes that have
158 // proxies for this frame. 158 // proxies for this frame.
159 FrameReplicationState replication_state_; 159 FrameReplicationState replication_state_;
160 160
161 // Boolean value indicating whether the frame is in the process of loading
162 // a document or not. In cross-process transfer navigation the DidStartLoading
163 // message is received from both existing RenderFrame and from the pending
164 // RenderFrame. However, there will be only one DidStopLoading message sent by
165 // the pending-which-becomes-current RenderFrame. Since both renderers belong
166 // to the FrameTreeNode, it is better to ask it about the loading status than
167 // RenderFrameHost or using a counter to balance the events out.
168 bool is_loading_;
169
170 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); 161 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode);
171 }; 162 };
172 163
173 } // namespace content 164 } // namespace content
174 165
175 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ 166 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/frame_tree_node.cc » ('j') | content/browser/frame_host/render_frame_host_impl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698