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

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: WIP (Fix tests) 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 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 // These values indicate the loading progress status. The minimum progress
Charlie Reis 2015/02/20 23:42:12 Hmm, I'm not thrilled about having these as public
Fabrice (no longer in Chrome) 2015/02/24 13:14:47 We should be able to move these out of the class o
34 // value matches what Blink's ProgressTracker has traditionally used for a
35 // minimum progress value.
36 static double kNotStartedLoadingProgress;
Charlie Reis 2015/02/20 23:42:12 static const double Also, it would be clearer for
Fabrice (no longer in Chrome) 2015/02/23 20:02:06 Done.
37 static double kMinimumLoadingProgress;
38 static double kDoneLoadingProgress;
33 39
34 FrameTreeNode(FrameTree* frame_tree, 40 FrameTreeNode(FrameTree* frame_tree,
35 Navigator* navigator, 41 Navigator* navigator,
36 RenderFrameHostDelegate* render_frame_delegate, 42 RenderFrameHostDelegate* render_frame_delegate,
37 RenderViewHostDelegate* render_view_delegate, 43 RenderViewHostDelegate* render_view_delegate,
38 RenderWidgetHostDelegate* render_widget_delegate, 44 RenderWidgetHostDelegate* render_widget_delegate,
39 RenderFrameHostManager::Delegate* manager_delegate, 45 RenderFrameHostManager::Delegate* manager_delegate,
40 const std::string& name); 46 const std::string& name);
41 47
42 ~FrameTreeNode(); 48 ~FrameTreeNode();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 return replication_state_.origin.IsSameAs(node.replication_state_.origin); 107 return replication_state_.origin.IsSameAs(node.replication_state_.origin);
102 } 108 }
103 109
104 const FrameReplicationState& current_replication_state() const { 110 const FrameReplicationState& current_replication_state() const {
105 return replication_state_; 111 return replication_state_;
106 } 112 }
107 113
108 void set_is_loading(bool is_loading) { 114 void set_is_loading(bool is_loading) {
109 is_loading_ = is_loading; 115 is_loading_ = is_loading;
110 } 116 }
117
111 bool is_loading() const { 118 bool is_loading() const {
112 return is_loading_; 119 return is_loading_;
113 } 120 }
114 121
122 void set_loading_progress(double loading_progress) {
123 loading_progress_ = loading_progress;
124 }
125
126 double loading_progress() const { return loading_progress_; }
127
115 RenderFrameHostImpl* current_frame_host() const { 128 RenderFrameHostImpl* current_frame_host() const {
116 return render_manager_.current_frame_host(); 129 return render_manager_.current_frame_host();
117 } 130 }
118 131
119 bool IsDescendantOf(FrameTreeNode* other) const; 132 bool IsDescendantOf(FrameTreeNode* other) const;
120 133
121 private: 134 private:
122 void set_parent(FrameTreeNode* parent) { parent_ = parent; } 135 void set_parent(FrameTreeNode* parent) { parent_ = parent; }
123 136
124 // The next available browser-global FrameTreeNode ID. 137 // The next available browser-global FrameTreeNode ID.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 173
161 // Boolean value indicating whether the frame is in the process of loading 174 // Boolean value indicating whether the frame is in the process of loading
162 // a document or not. In cross-process transfer navigation the DidStartLoading 175 // a document or not. In cross-process transfer navigation the DidStartLoading
163 // message is received from both existing RenderFrame and from the pending 176 // message is received from both existing RenderFrame and from the pending
164 // RenderFrame. However, there will be only one DidStopLoading message sent by 177 // RenderFrame. However, there will be only one DidStopLoading message sent by
165 // the pending-which-becomes-current RenderFrame. Since both renderers belong 178 // 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 179 // 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. 180 // RenderFrameHost or using a counter to balance the events out.
168 bool is_loading_; 181 bool is_loading_;
169 182
183 // Double value representing the frame's completion progress (from 0 to 1).
184 double loading_progress_;
185
170 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode); 186 DISALLOW_COPY_AND_ASSIGN(FrameTreeNode);
171 }; 187 };
172 188
173 } // namespace content 189 } // namespace content
174 190
175 #endif // CONTENT_BROWSER_FRAME_HOST_FRAME_TREE_NODE_H_ 191 #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/frame_tree_node.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698