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

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.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_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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // The RenderFrameHost will have a new RenderWidgetHost created and 87 // The RenderFrameHost will have a new RenderWidgetHost created and
88 // attached to it. This is used when the RenderFrameHost is in a different 88 // attached to it. This is used when the RenderFrameHost is in a different
89 // process from its parent frame. 89 // process from its parent frame.
90 CREATE_RF_NEEDS_RENDER_WIDGET_HOST = 1 << 3 90 CREATE_RF_NEEDS_RENDER_WIDGET_HOST = 1 << 3
91 }; 91 };
92 92
93 class CONTENT_EXPORT RenderFrameHostImpl 93 class CONTENT_EXPORT RenderFrameHostImpl
94 : public RenderFrameHost, 94 : public RenderFrameHost,
95 public BrowserAccessibilityDelegate { 95 public BrowserAccessibilityDelegate {
96 public: 96 public:
97 // These values indicate the loading progress status. The minimum progress
98 // value matches what Blink's ProgressTracker has traditionally used for a
99 // minimum progress value.
nasko 2015/02/26 23:30:33 If we plan to hide these values internally in the
Fabrice (no longer in Chrome) 2015/02/27 17:45:25 Acknowledged.
100 static const double kLoadingProgressNotStarted;
101 static const double kLoadingProgressMinimum;
102 static const double kLoadingProgressDone;
103
97 // Keeps track of the state of the RenderFrameHostImpl, particularly with 104 // Keeps track of the state of the RenderFrameHostImpl, particularly with
98 // respect to swap out. 105 // respect to swap out.
99 enum RenderFrameHostImplState { 106 enum RenderFrameHostImplState {
100 // The standard state for a RFH handling the communication with an active 107 // The standard state for a RFH handling the communication with an active
101 // RenderFrame. 108 // RenderFrame.
102 STATE_DEFAULT = 0, 109 STATE_DEFAULT = 0,
103 // The RFH has not received the SwapOutACK yet, but the new page has 110 // The RFH has not received the SwapOutACK yet, but the new page has
104 // committed in a different RFH. Upon reception of the SwapOutACK, the RFH 111 // committed in a different RFH. Upon reception of the SwapOutACK, the RFH
105 // will either enter STATE_SWAPPED_OUT (if it is a main frame and there are 112 // will either enter STATE_SWAPPED_OUT (if it is a main frame and there are
106 // other active frames in its SiteInstance) or it will be deleted. 113 // other active frames in its SiteInstance) or it will be deleted.
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 203
197 int routing_id() const { return routing_id_; } 204 int routing_id() const { return routing_id_; }
198 void OnCreateChildFrame(int new_routing_id, 205 void OnCreateChildFrame(int new_routing_id,
199 const std::string& frame_name, 206 const std::string& frame_name,
200 SandboxFlags sandbox_flags); 207 SandboxFlags sandbox_flags);
201 208
202 RenderViewHostImpl* render_view_host() { return render_view_host_; } 209 RenderViewHostImpl* render_view_host() { return render_view_host_; }
203 RenderFrameHostDelegate* delegate() { return delegate_; } 210 RenderFrameHostDelegate* delegate() { return delegate_; }
204 FrameTreeNode* frame_tree_node() { return frame_tree_node_; } 211 FrameTreeNode* frame_tree_node() { return frame_tree_node_; }
205 212
213 void set_is_loading(bool is_loading) {
214 is_loading_ = is_loading;
215 }
216 bool is_loading() const { return is_loading_; }
217
218 void set_loading_progress(double loading_progress) {
219 loading_progress_ = loading_progress;
220 }
221 double loading_progress() const { return loading_progress_; }
222
206 // This returns the RenderFrameHost's owned RenderWidgetHost if it has one, 223 // This returns the RenderFrameHost's owned RenderWidgetHost if it has one,
207 // or else it returns nullptr. 224 // or else it returns nullptr.
208 // If the RenderFrameHost is the page's main frame, this returns instead a 225 // If the RenderFrameHost is the page's main frame, this returns instead a
209 // pointer to the RenderViewHost (which inherits RenderWidgetHost). 226 // pointer to the RenderViewHost (which inherits RenderWidgetHost).
210 RenderWidgetHostImpl* GetRenderWidgetHost(); 227 RenderWidgetHostImpl* GetRenderWidgetHost();
211 228
212 // This returns the RenderWidgetHostView that can be used to control 229 // This returns the RenderWidgetHostView that can be used to control
213 // focus and visibility for this frame. 230 // focus and visibility for this frame.
214 RenderWidgetHostView* GetView(); 231 RenderWidgetHostView* GetView();
215 232
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 bool is_waiting_for_beforeunload_ack_; 674 bool is_waiting_for_beforeunload_ack_;
658 675
659 // Valid only when is_waiting_for_beforeunload_ack_ or 676 // Valid only when is_waiting_for_beforeunload_ack_ or
660 // IsWaitingForUnloadACK is true. This tells us if the unload request 677 // IsWaitingForUnloadACK is true. This tells us if the unload request
661 // is for closing the entire tab ( = false), or only this RenderFrameHost in 678 // is for closing the entire tab ( = false), or only this RenderFrameHost in
662 // the case of a navigation ( = true). Currently only cross-site navigations 679 // the case of a navigation ( = true). Currently only cross-site navigations
663 // require a beforeUnload/unload ACK. 680 // require a beforeUnload/unload ACK.
664 // PlzNavigate: all navigations require a beforeUnload ACK. 681 // PlzNavigate: all navigations require a beforeUnload ACK.
665 bool unload_ack_is_for_navigation_; 682 bool unload_ack_is_for_navigation_;
666 683
684 // Boolean value indicating whether this RFH is in the process of loading a
nasko 2015/02/26 23:30:33 Let's drop the "Boolean" part of the comment, it i
Fabrice (no longer in Chrome) 2015/02/27 17:45:25 Acknowledged.
685 // document or not.
686 bool is_loading_;
687
688 // Double value representing this RFH's loading progress (from 0 to 1).
689 double loading_progress_;
690
667 // Used to swap out or shut down this RFH when the unload event is taking too 691 // Used to swap out or shut down this RFH when the unload event is taking too
668 // long to execute, depending on the number of active frames in the 692 // long to execute, depending on the number of active frames in the
669 // SiteInstance. 693 // SiteInstance.
670 scoped_ptr<TimeoutMonitor> swapout_event_monitor_timeout_; 694 scoped_ptr<TimeoutMonitor> swapout_event_monitor_timeout_;
671 695
672 scoped_ptr<ServiceRegistryImpl> service_registry_; 696 scoped_ptr<ServiceRegistryImpl> service_registry_;
673 697
674 #if defined(OS_ANDROID) 698 #if defined(OS_ANDROID)
675 scoped_ptr<ServiceRegistryAndroid> service_registry_android_; 699 scoped_ptr<ServiceRegistryAndroid> service_registry_android_;
676 #endif 700 #endif
(...skipping 27 matching lines...) Expand all
704 728
705 // NOTE: This must be the last member. 729 // NOTE: This must be the last member.
706 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_; 730 base::WeakPtrFactory<RenderFrameHostImpl> weak_ptr_factory_;
707 731
708 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl); 732 DISALLOW_COPY_AND_ASSIGN(RenderFrameHostImpl);
709 }; 733 };
710 734
711 } // namespace content 735 } // namespace content
712 736
713 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_ 737 #endif // CONTENT_BROWSER_FRAME_HOST_RENDER_FRAME_HOST_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698