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

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

Issue 989473003: Reland of Refactor the loading tracking logic in WebContentsImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change DCHECK to LOG(WARNING) and go cry in a corner. 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 bool CommitPendingSandboxFlags(); 103 bool CommitPendingSandboxFlags();
105 104
106 bool HasSameOrigin(const FrameTreeNode& node) const { 105 bool HasSameOrigin(const FrameTreeNode& node) const {
107 return replication_state_.origin.IsSameAs(node.replication_state_.origin); 106 return replication_state_.origin.IsSameAs(node.replication_state_.origin);
108 } 107 }
109 108
110 const FrameReplicationState& current_replication_state() const { 109 const FrameReplicationState& current_replication_state() const {
111 return replication_state_; 110 return replication_state_;
112 } 111 }
113 112
114 void set_is_loading(bool is_loading) {
115 is_loading_ = is_loading;
116 }
117 bool is_loading() const {
118 return is_loading_;
119 }
120
121 RenderFrameHostImpl* current_frame_host() const { 113 RenderFrameHostImpl* current_frame_host() const {
122 return render_manager_.current_frame_host(); 114 return render_manager_.current_frame_host();
123 } 115 }
124 116
125 bool IsDescendantOf(FrameTreeNode* other) const; 117 bool IsDescendantOf(FrameTreeNode* other) const;
126 118
119 // Returns true if this frame is in a loading state.
120 bool IsLoading() const;
121
122 // Returns the loading progress of this frame.
123 double GetLoadingProgress() const;
124
127 private: 125 private:
128 void set_parent(FrameTreeNode* parent) { parent_ = parent; } 126 void set_parent(FrameTreeNode* parent) { parent_ = parent; }
129 127
130 // The next available browser-global FrameTreeNode ID. 128 // The next available browser-global FrameTreeNode ID.
131 static int64 next_frame_tree_node_id_; 129 static int64 next_frame_tree_node_id_;
132 130
133 // The FrameTree that owns us. 131 // The FrameTree that owns us.
134 FrameTree* frame_tree_; // not owned. 132 FrameTree* frame_tree_; // not owned.
135 133
136 // The Navigator object responsible for managing navigations at this node 134 // The Navigator object responsible for managing navigations at this node
137 // of the frame tree. 135 // of the frame tree.
138 scoped_refptr<Navigator> navigator_; 136 scoped_refptr<Navigator> navigator_;
139 137
140 // Manages creation and swapping of RenderFrameHosts for this frame. This 138 // Manages creation and swapping of RenderFrameHosts for this frame. This
141 // must be declared before |children_| so that it gets deleted after them. 139 // must be declared before |children_| so that it gets deleted after them.
142 // That's currently necessary so that RenderFrameHostImpl's destructor can 140 // That's currently necessary so that RenderFrameHostImpl's destructor can
143 // call GetProcess. 141 // call GetProcess.
144 RenderFrameHostManager render_manager_; 142 RenderFrameHostManager render_manager_;
145 143
146 // A browser-global identifier for the frame in the page, which stays stable 144 // A browser-global identifier for the frame in the page, which stays stable
147 // even if the frame does a cross-process navigation. 145 // even if the frame does a cross-process navigation.
148 const int64 frame_tree_node_id_; 146 const int64 frame_tree_node_id_;
149 147
150 // The parent node of this frame. NULL if this node is the root or if it has 148 // The parent node of this frame. NULL if this node is the root or if it has
151 // not yet been attached to the frame tree. 149 // not yet been attached to the frame tree.
152 FrameTreeNode* parent_; 150 FrameTreeNode* parent_;
(...skipping 14 matching lines...) Expand all
167 // Track the effective sandbox flags for this frame. When a parent frame 165 // Track the effective sandbox flags for this frame. When a parent frame
168 // dynamically updates sandbox flags for a child frame, the child's updated 166 // dynamically updates sandbox flags for a child frame, the child's updated
169 // sandbox flags are stored in replication_state_.sandbox_flags. However, the 167 // sandbox flags are stored in replication_state_.sandbox_flags. However, the
170 // update only takes effect on the next frame navigation, so the effective 168 // update only takes effect on the next frame navigation, so the effective
171 // sandbox flags are tracked separately here. When enforcing sandbox flags 169 // sandbox flags are tracked separately here. When enforcing sandbox flags
172 // directives in the browser process, |effective_sandbox_flags_| should be 170 // directives in the browser process, |effective_sandbox_flags_| should be
173 // used. |effective_sandbox_flags_| is updated with any pending sandbox 171 // used. |effective_sandbox_flags_| is updated with any pending sandbox
174 // flags when a navigation for this frame commits. 172 // flags when a navigation for this frame commits.
175 SandboxFlags effective_sandbox_flags_; 173 SandboxFlags effective_sandbox_flags_;
176 174
177 // Boolean value indicating whether the frame is in the process of loading
178 // a document or not. In cross-process transfer navigation the DidStartLoading
179 // message is received from both existing RenderFrame and from the pending
180 // RenderFrame. However, there will be only one DidStopLoading message sent by
181 // the pending-which-becomes-current RenderFrame. Since both renderers belong
182 // to the FrameTreeNode, it is better to ask it about the loading status than
183 // RenderFrameHost or using a counter to balance the events out.
184 bool is_loading_;
185
186 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); 175 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode);
187 }; 176 };
188 177
189 } // namespace content 178 } // namespace content
190 179
191 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ 180 #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/web_contents/web_contents_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698