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

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: tweaks 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..c2245a6390a7d0e627e063caeb72846d23c6ec6f 100644
--- a/content/browser/web_contents/web_contents_impl.h
+++ b/content/browser/web_contents/web_contents_impl.h
@@ -340,7 +340,6 @@ class CONTENT_EXPORT WebContentsImpl
virtual void RenderFrameDeleted(RenderFrameHost* render_frame_host) OVERRIDE;
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 +388,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 +712,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 +835,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();
+
+ // Called once when the last frame on the page has stopped loading.
+ void DidStopLoading(RenderFrameHost* render_frame_host);
+
// Misc non-view stuff -------------------------------------------------------
// Helper functions for sending notifications.
@@ -964,6 +976,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
+ // frame's completion (from 0 to 1).
+ typedef base::hash_map<int64, double> LoadingProgressMap;
nasko 2014/05/05 23:51:12 I think this is the right choice, but one note her
Avi (use Gerrit) 2014/05/06 00:03:40 I am not experienced enough in the loading code to
Nate Chapin 2014/05/07 20:16:02 Unless we create a way to notify the new process t
Charlie Reis 2014/05/07 23:51:00 Yes, I don't think it should cause a big problem.
Nate Chapin 2014/05/08 00:19:45 We should be able to avoid going backwards in the
Avi (use Gerrit) 2014/05/13 21:08:08 **THIS ISSUE REMAINS UNADDRESSED** In the continu
Charlie Reis 2014/05/13 22:44:37 We may need to try this out to be sure, since I'm
Avi (use Gerrit) 2014/05/14 00:14:32 This already does a good job of failing just about
Charlie Reis 2014/05/14 17:18:33 Yeah, the SitePerProcessBrowserTests exercise the
+ 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