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

Unified Diff: content/browser/web_contents/web_contents_impl.h

Issue 263973003: Move LoadProgressTracker to the browser process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanip Created 6 years, 7 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/web_contents/web_contents_impl.h
diff --git a/content/browser/web_contents/web_contents_impl.h b/content/browser/web_contents/web_contents_impl.h
index 4cd1943e5e5f12a58bce56a8286f343879532530..9799dab841c1ca03d409a2f6b78f809fb990144a 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -338,9 +338,9 @@ class CONTENT_EXPORT WebContentsImpl
virtual const GURL& GetMainFrameLastCommittedURL() const OVERRIDE;
virtual void RenderFrameCreated(RenderFrameHost* render_frame_host) OVERRIDE;
virtual void RenderFrameDeleted(RenderFrameHost* render_frame_host) OVERRIDE;
+ // Called once when the first frame on the page has started loading.
jam 2014/05/05 23:19:10 nit: in general comments go in the interface and n
Avi (use Gerrit) 2014/05/05 23:34:27 Done.
nasko 2014/05/05 23:51:12 This isn't quite correct. It is called when we sta
virtual void DidStartLoading(RenderFrameHost* render_frame_host,
bool to_different_document) OVERRIDE;
- virtual void DidStopLoading(RenderFrameHost* render_frame_host) OVERRIDE;
virtual void SwappedOut(RenderFrameHost* render_frame_host) OVERRIDE;
virtual void WorkerCrashed(RenderFrameHost* render_frame_host) OVERRIDE;
virtual void ShowContextMenu(RenderFrameHost* render_frame_host,
@@ -389,7 +389,6 @@ class CONTENT_EXPORT WebContentsImpl
virtual void Close(RenderViewHost* render_view_host) OVERRIDE;
virtual void RequestMove(const gfx::Rect& new_bounds) OVERRIDE;
virtual void DidCancelLoading() OVERRIDE;
- virtual void DidChangeLoadProgress(double progress) OVERRIDE;
virtual void DocumentAvailableInMainFrame(
RenderViewHost* render_view_host) OVERRIDE;
virtual void RouteCloseEvent(RenderViewHost* rvh) OVERRIDE;
@@ -714,6 +713,9 @@ class CONTENT_EXPORT WebContentsImpl
const GURL& target_url);
void OnDocumentLoadedInFrame();
void OnDidFinishLoad(const GURL& url);
+ void OnDidStartLoading(bool to_different_document);
+ void OnDidStopLoading();
+ void OnDidChangeLoadProgress(double load_progress);
void OnGoToEntryAtOffset(int offset);
void OnUpdateZoomLimits(int minimum_percent,
int maximum_percent,
@@ -834,6 +836,17 @@ class CONTENT_EXPORT WebContentsImpl
// called once as this call also removes it from the internal map.
WebContentsImpl* GetCreatedWindow(int route_id);
+ // Tracking loading progress -------------------------------------------------
+
+ // Resets the tracking state of the current load.
+ void ResetLoadProgressState();
+
+ // Calculates the progress of the current load and notifies the delegate.
+ void SendLoadProgressChanged();
jam 2014/05/05 23:19:10 since these two methods are called internally only
Avi (use Gerrit) 2014/05/05 23:34:27 This *is* the private section.
+
+ // Called once when the last frame on the page has stopped loading.
+ void DidStopLoading(RenderFrameHost* render_frame_host);
jam 2014/05/05 23:19:10 this is only called by OnDidStopLoading() right? i
Avi (use Gerrit) 2014/05/05 23:34:27 Nope. This is called by OnDidStopLoading and by On
+
// Misc non-view stuff -------------------------------------------------------
// Helper functions for sending notifications.
@@ -964,6 +977,21 @@ class CONTENT_EXPORT WebContentsImpl
// The current load state and the URL associated with it.
net::LoadStateWithParam load_state_;
base::string16 load_state_host_;
+
+ // LoadingProgressMap maps FrameTreeNode IDs to a double representing that
Avi (use Gerrit) 2014/05/05 22:28:42 A FrameTreeNode ID rather than a routing ID like b
+ // frame's completion (from 0 to 1).
+ typedef base::hash_map<int64, double> LoadingProgressMap;
+ LoadingProgressMap loading_progresses_;
+ double loading_total_progress_;
+
+ base::TimeTicks loading_last_progress_update_;
+
+ base::WeakPtrFactory<WebContentsImpl> loading_weak_factory_;
+
+ // Counter to track how many frames have sent start notifications but not
+ // stop notifications.
+ int loading_frames_in_progress_;
+
// Upload progress, for displaying in the status bar.
// Set to zero when there is no significant upload happening.
uint64 upload_size_;

Powered by Google App Engine
This is Rietveld 408576698