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

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.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: Revert change + nits 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
98 // Keeps track of the state of the RenderFrameHostImpl, particularly with 107 // Keeps track of the state of the RenderFrameHostImpl, particularly with
99 // respect to swap out. 108 // respect to swap out.
100 enum RenderFrameHostImplState { 109 enum RenderFrameHostImplState {
101 // The standard state for a RFH handling the communication with an active 110 // The standard state for a RFH handling the communication with an active
102 // RenderFrame. 111 // RenderFrame.
103 STATE_DEFAULT = 0, 112 STATE_DEFAULT = 0,
104 // The RFH has not received the SwapOutACK yet, but the new page has 113 // The RFH has not received the SwapOutACK yet, but the new page has
105 // committed in a different RFH. Upon reception of the SwapOutACK, the RFH 114 // committed in a different RFH. Upon reception of the SwapOutACK, the RFH
106 // will either enter STATE_SWAPPED_OUT (if it is a main frame and there are 115 // will either enter STATE_SWAPPED_OUT (if it is a main frame and there are
107 // other active frames in its SiteInstance) or it will be deleted. 116 // other active frames in its SiteInstance) or it will be deleted.
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 206
198 int routing_id() const { return routing_id_; } 207 int routing_id() const { return routing_id_; }
199 void OnCreateChildFrame(int new_routing_id, 208 void OnCreateChildFrame(int new_routing_id,
200 const std::string& frame_name, 209 const std::string& frame_name,
201 SandboxFlags sandbox_flags); 210 SandboxFlags sandbox_flags);
202 211
203 RenderViewHostImpl* render_view_host() { return render_view_host_; } 212 RenderViewHostImpl* render_view_host() { return render_view_host_; }
204 RenderFrameHostDelegate* delegate() { return delegate_; } 213 RenderFrameHostDelegate* delegate() { return delegate_; }
205 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } 214 FrameTreeNode* frame_tree_node() { return frame_tree_node_; }
206 215
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
207 // This returns the RenderFrameHost's owned RenderWidgetHost if it has one, 236 // This returns the RenderFrameHost's owned RenderWidgetHost if it has one,
208 // or else it returns nullptr. 237 // or else it returns nullptr.
209 // If the RenderFrameHost is the page's main frame, this returns instead a 238 // If the RenderFrameHost is the page's main frame, this returns instead a
210 // pointer to the RenderViewHost (which inherits RenderWidgetHost). 239 // pointer to the RenderViewHost (which inherits RenderWidgetHost).
211 RenderWidgetHostImpl* GetRenderWidgetHost(); 240 RenderWidgetHostImpl* GetRenderWidgetHost();
212 241
213 // This returns the RenderWidgetHostView that can be used to control 242 // This returns the RenderWidgetHostView that can be used to control
214 // focus and visibility for this frame. 243 // focus and visibility for this frame.
215 RenderWidgetHostView* GetView(); 244 RenderWidgetHostView* GetView();
216 245
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 bool is_waiting_for_beforeunload_ack_; 690 bool is_waiting_for_beforeunload_ack_;
662 691
663 // Valid only when is_waiting_for_beforeunload_ack_ or 692 // Valid only when is_waiting_for_beforeunload_ack_ or
664 // IsWaitingForUnloadACK is true. This tells us if the unload request 693 // IsWaitingForUnloadACK is true. This tells us if the unload request
665 // is for closing the entire tab ( = false), or only this RenderFrameHost in 694 // is for closing the entire tab ( = false), or only this RenderFrameHost in
666 // the case of a navigation ( = true). Currently only cross-site navigations 695 // the case of a navigation ( = true). Currently only cross-site navigations
667 // require a beforeUnload/unload ACK. 696 // require a beforeUnload/unload ACK.
668 // PlzNavigate: all navigations require a beforeUnload ACK. 697 // PlzNavigate: all navigations require a beforeUnload ACK.
669 bool unload_ack_is_for_navigation_; 698 bool unload_ack_is_for_navigation_;
670 699
700 // Indicates whether this RenderFrameHost is in the process of loading a
701 // document or not.
702 bool is_loading_;
703
704 // Used to track this RenderFrameHost's loading progress (from 0 to 1).
705 double loading_progress_;
706
671 // Used to swap out or shut down this RFH when the unload event is taking too 707 // Used to swap out or shut down this RFH when the unload event is taking too
672 // long to execute, depending on the number of active frames in the 708 // long to execute, depending on the number of active frames in the
673 // SiteInstance. 709 // SiteInstance.
674 scoped_ptr<TimeoutMonitor> swapout_event_monitor_timeout_; 710 scoped_ptr<TimeoutMonitor> swapout_event_monitor_timeout_;
675 711
676 scoped_ptr<ServiceRegistryImpl> service_registry_; 712 scoped_ptr<ServiceRegistryImpl> service_registry_;
677 713
678 #if defined(OS_ANDROID) 714 #if defined(OS_ANDROID)
679 scoped_ptr<ServiceRegistryAndroid> service_registry_android_; 715 scoped_ptr<ServiceRegistryAndroid> service_registry_android_;
680 #endif 716 #endif
(...skipping 27 matching lines...) Expand all
708 744
709 // NOTE: This must be the last member. 745 // NOTE: This must be the last member.
710 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; 746 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_;
711 747
712 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); 748 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl);
713 }; 749 };
714 750
715 } // namespace content 751 } // namespace content
716 752
717 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 753 #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