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

Unified 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: Review comments 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/render_frame_host_impl.h
diff --git a/content/browser/frame_host/render_frame_host_impl.h b/content/browser/frame_host/render_frame_host_impl.h
index ca442d27367f9a9f528b4d49454b85457810d156..c3f9fefa429dd918b224e3d146a3a460cba9d5ef 100644
--- a/content/browser/frame_host/render_frame_host_impl.h
+++ b/content/browser/frame_host/render_frame_host_impl.h
@@ -94,6 +94,15 @@ class CONTENT_EXPORT RenderFrameHostImpl
: public RenderFrameHost,
public BrowserAccessibilityDelegate {
public:
+ // These values indicate the loading progress status. The minimum progress
+ // value matches what Blink's ProgressTracker has traditionally used for a
+ // minimum progress value.
+ // TODO(fdegans): Move these values to the implementation when the relevant
+ // IPCs are moved from WebContentsImpl to RFHI.
+ static const double kLoadingProgressNotStarted;
+ static const double kLoadingProgressMinimum;
+ static const double kLoadingProgressDone;
+
// Keeps track of the state of the RenderFrameHostImpl, particularly with
// respect to swap out.
enum RenderFrameHostImplState {
@@ -203,6 +212,26 @@ class CONTENT_EXPORT RenderFrameHostImpl
RenderFrameHostDelegate* delegate() { return delegate_; }
FrameTreeNode* frame_tree_node() { return frame_tree_node_; }
+ // Sets this RenderFrameHost loading state.
+ void set_is_loading(bool is_loading) {
+ is_loading_ = is_loading;
+ }
+
+ // Returns this RenderFrameHost loading state. This method is only to be used
Charlie Reis 2015/03/05 04:46:18 nit: RenderFrameHost's nit: used by (Same in load
Fabrice (no longer in Chrome) 2015/03/05 12:37:43 Done.
+ // in FrameTreeNode. The proper way to check whether a frame is loading is to
+ // call FrameTreeNode::IsLoading.
+ bool is_loading() const { return is_loading_; }
+
+ // Sets this RenderFrameHost loading progress (from 0 to 1).
Charlie Reis 2015/03/05 04:46:18 nit: RenderFrameHost's
Fabrice (no longer in Chrome) 2015/03/05 12:37:43 Done.
+ void set_loading_progress(double loading_progress) {
+ loading_progress_ = loading_progress;
+ }
+
+ // Returns this RenderFrameHost loading progress. This is only to be used in
+ // FrameTreeNode. The proper way to check a frame loading progress is to call
+ // FrameTreeNode::GetLoadingProgress.
+ double loading_progress() const { return loading_progress_; }
+
// This returns the RenderFrameHost's owned RenderWidgetHost if it has one,
// or else it returns nullptr.
// If the RenderFrameHost is the page's main frame, this returns instead a
@@ -664,6 +693,13 @@ class CONTENT_EXPORT RenderFrameHostImpl
// PlzNavigate: all navigations require a beforeUnload ACK.
bool unload_ack_is_for_navigation_;
+ // Indicates whether this RenderFrameHost is in the process of loading a
+ // document or not.
+ bool is_loading_;
+
+ // Used to represent this RenderFrameHost loading progress (from 0 to 1).
Charlie Reis 2015/03/05 04:46:18 nit: RenderFrameHost's
Fabrice (no longer in Chrome) 2015/03/05 12:37:43 Done.
+ double loading_progress_;
+
// Used to swap out or shut down this RFH when the unload event is taking too
// long to execute, depending on the number of active frames in the
// SiteInstance.

Powered by Google App Engine
This is Rietveld 408576698