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

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

Issue 983973002: Revert of Refactor the loading tracking logic in WebContentsImpl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed patch conflict 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_RENDER_FRAME_HOST_IMPL_H_ 5 #ifndef CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 6 #define CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // The RenderFrameHost will have a new RenderWidgetHost created and 88 // The RenderFrameHost will have a new RenderWidgetHost created and
89 // attached to it. This is used when the RenderFrameHost is in a different 89 // attached to it. This is used when the RenderFrameHost is in a different
90 // process from its parent frame. 90 // process from its parent frame.
91 CREATE_RF_NEEDS_RENDER_WIDGET_HOST = 1 << 3 91 CREATE_RF_NEEDS_RENDER_WIDGET_HOST = 1 << 3
92 }; 92 };
93 93
94 class CONTENT_EXPORT RenderFrameHostImpl 94 class CONTENT_EXPORT RenderFrameHostImpl
95 : public RenderFrameHost, 95 : public RenderFrameHost,
96 public BrowserAccessibilityDelegate { 96 public BrowserAccessibilityDelegate {
97 public: 97 public:
98 // These values indicate the loading progress status. The minimum progress
99 // value matches what Blink's ProgressTracker has traditionally used for a
100 // minimum progress value.
101 // TODO(fdegans): Move these values to the implementation when the relevant
102 // IPCs are moved from WebContentsImpl to RenderFrameHost.
103 static const double kLoadingProgressNotStarted;
104 static const double kLoadingProgressMinimum;
105 static const double kLoadingProgressDone;
106
107 // Keeps track of the state of the RenderFrameHostImpl, particularly with 98 // Keeps track of the state of the RenderFrameHostImpl, particularly with
108 // respect to swap out. 99 // respect to swap out.
109 enum RenderFrameHostImplState { 100 enum RenderFrameHostImplState {
110 // The standard state for a RFH handling the communication with an active 101 // The standard state for a RFH handling the communication with an active
111 // RenderFrame. 102 // RenderFrame.
112 STATE_DEFAULT = 0, 103 STATE_DEFAULT = 0,
113 // The RFH has not received the SwapOutACK yet, but the new page has 104 // The RFH has not received the SwapOutACK yet, but the new page has
114 // committed in a different RFH. Upon reception of the SwapOutACK, the RFH 105 // committed in a different RFH. Upon reception of the SwapOutACK, the RFH
115 // will either enter STATE_SWAPPED_OUT (if it is a main frame and there are 106 // will either enter STATE_SWAPPED_OUT (if it is a main frame and there are
116 // other active frames in its SiteInstance) or it will be deleted. 107 // other active frames in its SiteInstance) or it will be deleted.
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 197
207 int routing_id() const { return routing_id_; } 198 int routing_id() const { return routing_id_; }
208 void OnCreateChildFrame(int new_routing_id, 199 void OnCreateChildFrame(int new_routing_id,
209 const std::string& frame_name, 200 const std::string& frame_name,
210 SandboxFlags sandbox_flags); 201 SandboxFlags sandbox_flags);
211 202
212 RenderViewHostImpl* render_view_host() { return render_view_host_; } 203 RenderViewHostImpl* render_view_host() { return render_view_host_; }
213 RenderFrameHostDelegate* delegate() { return delegate_; } 204 RenderFrameHostDelegate* delegate() { return delegate_; }
214 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } 205 FrameTreeNode* frame_tree_node() { return frame_tree_node_; }
215 206
216 // Sets this RenderFrameHost's loading state.
217 void set_is_loading(bool is_loading) {
218 is_loading_ = is_loading;
219 }
220
221 // Returns this RenderFrameHost's loading state. This method is only used by
222 // FrameTreeNode. The proper way to check whether a frame is loading is to
223 // call FrameTreeNode::IsLoading.
224 bool is_loading() const { return is_loading_; }
225
226 // Sets this RenderFrameHost's loading progress (from 0 to 1).
227 void set_loading_progress(double loading_progress) {
228 loading_progress_ = loading_progress;
229 }
230
231 // Returns this RenderFrameHost's loading progress. This is only used by
232 // FrameTreeNode. The proper way to check a frame loading progress is to call
233 // FrameTreeNode::GetLoadingProgress.
234 double loading_progress() const { return loading_progress_; }
235
236 // This returns the RenderFrameHost's owned RenderWidgetHost if it has one, 207 // This returns the RenderFrameHost's owned RenderWidgetHost if it has one,
237 // or else it returns nullptr. 208 // or else it returns nullptr.
238 // If the RenderFrameHost is the page's main frame, this returns instead a 209 // If the RenderFrameHost is the page's main frame, this returns instead a
239 // pointer to the RenderViewHost (which inherits RenderWidgetHost). 210 // pointer to the RenderViewHost (which inherits RenderWidgetHost).
240 RenderWidgetHostImpl* GetRenderWidgetHost(); 211 RenderWidgetHostImpl* GetRenderWidgetHost();
241 212
242 // This returns the RenderWidgetHostView that can be used to control 213 // This returns the RenderWidgetHostView that can be used to control
243 // focus and visibility for this frame. 214 // focus and visibility for this frame.
244 RenderWidgetHostView* GetView(); 215 RenderWidgetHostView* GetView();
245 216
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 bool is_waiting_for_beforeunload_ack_; 660 bool is_waiting_for_beforeunload_ack_;
690 661
691 // Valid only when is_waiting_for_beforeunload_ack_ or 662 // Valid only when is_waiting_for_beforeunload_ack_ or
692 // IsWaitingForUnloadACK is true. This tells us if the unload request 663 // IsWaitingForUnloadACK is true. This tells us if the unload request
693 // is for closing the entire tab ( = false), or only this RenderFrameHost in 664 // is for closing the entire tab ( = false), or only this RenderFrameHost in
694 // the case of a navigation ( = true). Currently only cross-site navigations 665 // the case of a navigation ( = true). Currently only cross-site navigations
695 // require a beforeUnload/unload ACK. 666 // require a beforeUnload/unload ACK.
696 // PlzNavigate: all navigations require a beforeUnload ACK. 667 // PlzNavigate: all navigations require a beforeUnload ACK.
697 bool unload_ack_is_for_navigation_; 668 bool unload_ack_is_for_navigation_;
698 669
699 // Indicates whether this RenderFrameHost is in the process of loading a
700 // document or not.
701 bool is_loading_;
702
703 // Used to track this RenderFrameHost's loading progress (from 0 to 1).
704 double loading_progress_;
705
706 // Used to swap out or shut down this RFH when the unload event is taking too 670 // Used to swap out or shut down this RFH when the unload event is taking too
707 // long to execute, depending on the number of active frames in the 671 // long to execute, depending on the number of active frames in the
708 // SiteInstance. 672 // SiteInstance.
709 scoped_ptr<TimeoutMonitor> swapout_event_monitor_timeout_; 673 scoped_ptr<TimeoutMonitor> swapout_event_monitor_timeout_;
710 674
711 scoped_ptr<ServiceRegistryImpl> service_registry_; 675 scoped_ptr<ServiceRegistryImpl> service_registry_;
712 676
713 #if defined(OS_ANDROID) 677 #if defined(OS_ANDROID)
714 scoped_ptr<ServiceRegistryAndroid> service_registry_android_; 678 scoped_ptr<ServiceRegistryAndroid> service_registry_android_;
715 #endif 679 #endif
(...skipping 27 matching lines...) Expand all
743 707
744 // NOTE: This must be the last member. 708 // NOTE: This must be the last member.
745 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; 709 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_;
746 710
747 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); 711 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl);
748 }; 712 };
749 713
750 } // namespace content 714 } // namespace content
751 715
752 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 716 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/frame_host/frame_tree_node.cc ('k') | content/browser/frame_host/render_frame_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698