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

Side by Side 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: yep 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ 5 #ifndef CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ 6 #define CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 virtual bool Send(IPC::Message* message) OVERRIDE; 333 virtual bool Send(IPC::Message* message) OVERRIDE;
334 334
335 // RenderFrameHostDelegate --------------------------------------------------- 335 // RenderFrameHostDelegate ---------------------------------------------------
336 virtual bool OnMessageReceived(RenderFrameHost* render_frame_host, 336 virtual bool OnMessageReceived(RenderFrameHost* render_frame_host,
337 const IPC::Message& message) OVERRIDE; 337 const IPC::Message& message) OVERRIDE;
338 virtual const GURL& GetMainFrameLastCommittedURL() const OVERRIDE; 338 virtual const GURL& GetMainFrameLastCommittedURL() const OVERRIDE;
339 virtual void RenderFrameCreated(RenderFrameHost* render_frame_host) OVERRIDE; 339 virtual void RenderFrameCreated(RenderFrameHost* render_frame_host) OVERRIDE;
340 virtual void RenderFrameDeleted(RenderFrameHost* render_frame_host) OVERRIDE; 340 virtual void RenderFrameDeleted(RenderFrameHost* render_frame_host) OVERRIDE;
341 virtual void DidStartLoading(RenderFrameHost* render_frame_host, 341 virtual void DidStartLoading(RenderFrameHost* render_frame_host,
342 bool to_different_document) OVERRIDE; 342 bool to_different_document) OVERRIDE;
343 virtual void DidStopLoading(RenderFrameHost* render_frame_host) OVERRIDE;
344 virtual void SwappedOut(RenderFrameHost* render_frame_host) OVERRIDE; 343 virtual void SwappedOut(RenderFrameHost* render_frame_host) OVERRIDE;
345 virtual void WorkerCrashed(RenderFrameHost* render_frame_host) OVERRIDE; 344 virtual void WorkerCrashed(RenderFrameHost* render_frame_host) OVERRIDE;
346 virtual void ShowContextMenu(RenderFrameHost* render_frame_host, 345 virtual void ShowContextMenu(RenderFrameHost* render_frame_host,
347 const ContextMenuParams& params) OVERRIDE; 346 const ContextMenuParams& params) OVERRIDE;
348 virtual void RunJavaScriptMessage(RenderFrameHost* render_frame_host, 347 virtual void RunJavaScriptMessage(RenderFrameHost* render_frame_host,
349 const base::string16& message, 348 const base::string16& message,
350 const base::string16& default_prompt, 349 const base::string16& default_prompt,
351 const GURL& frame_url, 350 const GURL& frame_url,
352 JavaScriptMessageType type, 351 JavaScriptMessageType type,
353 IPC::Message* reply_msg) OVERRIDE; 352 IPC::Message* reply_msg) OVERRIDE;
(...skipping 28 matching lines...) Expand all
382 virtual void UpdateTitle(RenderViewHost* render_view_host, 381 virtual void UpdateTitle(RenderViewHost* render_view_host,
383 int32 page_id, 382 int32 page_id,
384 const base::string16& title, 383 const base::string16& title,
385 base::i18n::TextDirection title_direction) OVERRIDE; 384 base::i18n::TextDirection title_direction) OVERRIDE;
386 virtual void UpdateEncoding(RenderViewHost* render_view_host, 385 virtual void UpdateEncoding(RenderViewHost* render_view_host,
387 const std::string& encoding) OVERRIDE; 386 const std::string& encoding) OVERRIDE;
388 virtual void UpdateTargetURL(int32 page_id, const GURL& url) OVERRIDE; 387 virtual void UpdateTargetURL(int32 page_id, const GURL& url) OVERRIDE;
389 virtual void Close(RenderViewHost* render_view_host) OVERRIDE; 388 virtual void Close(RenderViewHost* render_view_host) OVERRIDE;
390 virtual void RequestMove(const gfx::Rect& new_bounds) OVERRIDE; 389 virtual void RequestMove(const gfx::Rect& new_bounds) OVERRIDE;
391 virtual void DidCancelLoading() OVERRIDE; 390 virtual void DidCancelLoading() OVERRIDE;
392 virtual void DidChangeLoadProgress(double progress) OVERRIDE;
393 virtual void DocumentAvailableInMainFrame( 391 virtual void DocumentAvailableInMainFrame(
394 RenderViewHost* render_view_host) OVERRIDE; 392 RenderViewHost* render_view_host) OVERRIDE;
395 virtual void RouteCloseEvent(RenderViewHost* rvh) OVERRIDE; 393 virtual void RouteCloseEvent(RenderViewHost* rvh) OVERRIDE;
396 virtual void RouteMessageEvent( 394 virtual void RouteMessageEvent(
397 RenderViewHost* rvh, 395 RenderViewHost* rvh,
398 const ViewMsg_PostMessage_Params& params) OVERRIDE; 396 const ViewMsg_PostMessage_Params& params) OVERRIDE;
399 virtual bool AddMessageToConsole(int32 level, 397 virtual bool AddMessageToConsole(int32 level,
400 const base::string16& message, 398 const base::string16& message,
401 int32 line_no, 399 int32 line_no,
402 const base::string16& source_id) OVERRIDE; 400 const base::string16& source_id) OVERRIDE;
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 void OnDidLoadResourceFromMemoryCache(const GURL& url, 705 void OnDidLoadResourceFromMemoryCache(const GURL& url,
708 const std::string& security_info, 706 const std::string& security_info,
709 const std::string& http_request, 707 const std::string& http_request,
710 const std::string& mime_type, 708 const std::string& mime_type,
711 ResourceType::Type resource_type); 709 ResourceType::Type resource_type);
712 void OnDidDisplayInsecureContent(); 710 void OnDidDisplayInsecureContent();
713 void OnDidRunInsecureContent(const std::string& security_origin, 711 void OnDidRunInsecureContent(const std::string& security_origin,
714 const GURL& target_url); 712 const GURL& target_url);
715 void OnDocumentLoadedInFrame(); 713 void OnDocumentLoadedInFrame();
716 void OnDidFinishLoad(const GURL& url); 714 void OnDidFinishLoad(const GURL& url);
715 void OnDidStartLoading(bool to_different_document);
716 void OnDidStopLoading();
717 void OnDidChangeLoadProgress(double load_progress);
717 void OnGoToEntryAtOffset(int offset); 718 void OnGoToEntryAtOffset(int offset);
718 void OnUpdateZoomLimits(int minimum_percent, 719 void OnUpdateZoomLimits(int minimum_percent,
719 int maximum_percent, 720 int maximum_percent,
720 bool remember); 721 bool remember);
721 void OnEnumerateDirectory(int request_id, const base::FilePath& path); 722 void OnEnumerateDirectory(int request_id, const base::FilePath& path);
722 723
723 void OnRegisterProtocolHandler(const std::string& protocol, 724 void OnRegisterProtocolHandler(const std::string& protocol,
724 const GURL& url, 725 const GURL& url,
725 const base::string16& title, 726 const base::string16& title,
726 bool user_gesture); 727 bool user_gesture);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 828
828 // Finds the new RenderWidgetHost and returns it. Note that this can only be 829 // Finds the new RenderWidgetHost and returns it. Note that this can only be
829 // called once as this call also removes it from the internal map. 830 // called once as this call also removes it from the internal map.
830 RenderWidgetHostView* GetCreatedWidget(int route_id); 831 RenderWidgetHostView* GetCreatedWidget(int route_id);
831 832
832 // Finds the new WebContentsImpl by route_id, initializes it for 833 // Finds the new WebContentsImpl by route_id, initializes it for
833 // renderer-initiated creation, and returns it. Note that this can only be 834 // renderer-initiated creation, and returns it. Note that this can only be
834 // called once as this call also removes it from the internal map. 835 // called once as this call also removes it from the internal map.
835 WebContentsImpl* GetCreatedWindow(int route_id); 836 WebContentsImpl* GetCreatedWindow(int route_id);
836 837
838 // Tracking loading progress -------------------------------------------------
839
840 // Resets the tracking state of the current load.
841 void ResetLoadProgressState();
842
843 // Calculates the progress of the current load and notifies the delegate.
844 void SendLoadProgressChanged();
845
846 // Called once when the last frame on the page has stopped loading.
847 void DidStopLoading(RenderFrameHost* render_frame_host);
848
837 // Misc non-view stuff ------------------------------------------------------- 849 // Misc non-view stuff -------------------------------------------------------
838 850
839 // Helper functions for sending notifications. 851 // Helper functions for sending notifications.
840 void NotifySwapped(RenderViewHost* old_host, RenderViewHost* new_host); 852 void NotifySwapped(RenderViewHost* old_host, RenderViewHost* new_host);
841 void NotifyDisconnected(); 853 void NotifyDisconnected();
842 854
843 void SetEncoding(const std::string& encoding); 855 void SetEncoding(const std::string& encoding);
844 856
845 // TODO(creis): This should take in a FrameTreeNode to know which node's 857 // TODO(creis): This should take in a FrameTreeNode to know which node's
846 // render manager to return. For now, we just return the root's. 858 // render manager to return. For now, we just return the root's.
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 bool waiting_for_response_; 969 bool waiting_for_response_;
958 970
959 // Map of SiteInstance ID to max page ID for this tab. A page ID is specific 971 // Map of SiteInstance ID to max page ID for this tab. A page ID is specific
960 // to a given tab and SiteInstance, and must be valid for the lifetime of the 972 // to a given tab and SiteInstance, and must be valid for the lifetime of the
961 // WebContentsImpl. 973 // WebContentsImpl.
962 std::map<int32, int32> max_page_ids_; 974 std::map<int32, int32> max_page_ids_;
963 975
964 // The current load state and the URL associated with it. 976 // The current load state and the URL associated with it.
965 net::LoadStateWithParam load_state_; 977 net::LoadStateWithParam load_state_;
966 base::string16 load_state_host_; 978 base::string16 load_state_host_;
979
980 // LoadingProgressMap maps FrameTreeNode IDs to a double representing that
981 // frame's completion (from 0 to 1).
982 typedef base::hash_map<int64, double> LoadingProgressMap;
983 LoadingProgressMap loading_progresses_;
984 double loading_total_progress_;
985
986 base::TimeTicks loading_last_progress_update_;
987
988 base::WeakPtrFactory<WebContentsImpl> loading_weak_factory_;
989
990 // Counter to track how many frames have sent start notifications but not
991 // stop notifications.
992 int loading_frames_in_progress_;
Charlie Reis 2014/05/07 23:51:00 Are we updating this if the process crashes? I'm
Avi (use Gerrit) 2014/05/13 21:08:08 What happens today? Today we'll get a FrameHostMsg
Charlie Reis 2014/05/13 22:44:37 Yes, that's probably the reason the throbber stops
993
967 // Upload progress, for displaying in the status bar. 994 // Upload progress, for displaying in the status bar.
968 // Set to zero when there is no significant upload happening. 995 // Set to zero when there is no significant upload happening.
969 uint64 upload_size_; 996 uint64 upload_size_;
970 uint64 upload_position_; 997 uint64 upload_position_;
971 998
972 // Data for current page ----------------------------------------------------- 999 // Data for current page -----------------------------------------------------
973 1000
974 // When a title cannot be taken from any entry, this title will be used. 1001 // When a title cannot be taken from any entry, this title will be used.
975 base::string16 page_title_when_no_navigation_entry_; 1002 base::string16 page_title_when_no_navigation_entry_;
976 1003
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 1140
1114 // Whether the last JavaScript dialog shown was suppressed. Used for testing. 1141 // Whether the last JavaScript dialog shown was suppressed. Used for testing.
1115 bool last_dialog_suppressed_; 1142 bool last_dialog_suppressed_;
1116 1143
1117 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl); 1144 DISALLOW_COPY_AND_ASSIGN(WebContentsImpl);
1118 }; 1145 };
1119 1146
1120 } // namespace content 1147 } // namespace content
1121 1148
1122 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ 1149 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698