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

Side by Side Diff: content/browser/web_contents/web_contents_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 + 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 (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 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 WebContentsImpl* GetCreatedWindow(int route_id); 901 WebContentsImpl* GetCreatedWindow(int route_id);
902 902
903 // Tracking loading progress ------------------------------------------------- 903 // Tracking loading progress -------------------------------------------------
904 904
905 // Resets the tracking state of the current load. 905 // Resets the tracking state of the current load.
906 void ResetLoadProgressState(); 906 void ResetLoadProgressState();
907 907
908 // Calculates the progress of the current load and notifies the delegate. 908 // Calculates the progress of the current load and notifies the delegate.
909 void SendLoadProgressChanged(); 909 void SendLoadProgressChanged();
910 910
911 // Returns true if at least one of the nodes in the |frame_tree_| is loading,
912 // false otherwise.
913 bool IsFrameTreeLoading();
914
911 // Misc non-view stuff ------------------------------------------------------- 915 // Misc non-view stuff -------------------------------------------------------
912 916
913 // Sets the history for a specified RenderViewHost to |history_length| 917 // Sets the history for a specified RenderViewHost to |history_length|
914 // entries, with an offset of |history_offset|. 918 // entries, with an offset of |history_offset|.
915 void SetHistoryOffsetAndLengthForView(RenderViewHost* render_view_host, 919 void SetHistoryOffsetAndLengthForView(RenderViewHost* render_view_host,
916 int history_offset, 920 int history_offset,
917 int history_length); 921 int history_length);
918 922
919 // Helper functions for sending notifications. 923 // Helper functions for sending notifications.
920 void NotifyViewSwapped(RenderViewHost* old_host, RenderViewHost* new_host); 924 void NotifyViewSwapped(RenderViewHost* old_host, RenderViewHost* new_host);
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 1060
1057 // Map of SiteInstance ID to max page ID for this tab. A page ID is specific 1061 // Map of SiteInstance ID to max page ID for this tab. A page ID is specific
1058 // to a given tab and SiteInstance, and must be valid for the lifetime of the 1062 // to a given tab and SiteInstance, and must be valid for the lifetime of the
1059 // WebContentsImpl. 1063 // WebContentsImpl.
1060 std::map<int32, int32> max_page_ids_; 1064 std::map<int32, int32> max_page_ids_;
1061 1065
1062 // The current load state and the URL associated with it. 1066 // The current load state and the URL associated with it.
1063 net::LoadStateWithParam load_state_; 1067 net::LoadStateWithParam load_state_;
1064 base::string16 load_state_host_; 1068 base::string16 load_state_host_;
1065 1069
1066 // LoadingProgressMap maps FrameTreeNode IDs to a double representing that
1067 // frame's completion (from 0 to 1).
1068 typedef base::hash_map<int64, double> LoadingProgressMap;
1069 LoadingProgressMap loading_progresses_;
1070 double loading_total_progress_; 1070 double loading_total_progress_;
1071 1071
1072 base::TimeTicks loading_last_progress_update_; 1072 base::TimeTicks loading_last_progress_update_;
1073 1073
1074 // Counter to track how many frames have sent start notifications but not
1075 // stop notifications.
1076 int loading_frames_in_progress_;
1077
1078 // Upload progress, for displaying in the status bar. 1074 // Upload progress, for displaying in the status bar.
1079 // Set to zero when there is no significant upload happening. 1075 // Set to zero when there is no significant upload happening.
1080 uint64 upload_size_; 1076 uint64 upload_size_;
1081 uint64 upload_position_; 1077 uint64 upload_position_;
1082 1078
1083 // Data for current page ----------------------------------------------------- 1079 // Data for current page -----------------------------------------------------
1084 1080
1085 // When a title cannot be taken from any entry, this title will be used. 1081 // When a title cannot be taken from any entry, this title will be used.
1086 base::string16 page_title_when_no_navigation_entry_; 1082 base::string16 page_title_when_no_navigation_entry_;
1087 1083
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1272 // Adds/removes a callback called on creation of each new WebContents. 1268 // Adds/removes a callback called on creation of each new WebContents.
1273 static void AddCreatedCallbackForTesting(const CreatedCallback& callback); 1269 static void AddCreatedCallbackForTesting(const CreatedCallback& callback);
1274 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback); 1270 static void RemoveCreatedCallbackForTesting(const CreatedCallback& callback);
1275 1271
1276 DISALLOW_COPY_AND_ASSIGN(FriendZone); 1272 DISALLOW_COPY_AND_ASSIGN(FriendZone);
1277 }; 1273 };
1278 1274
1279 } // namespace content 1275 } // namespace content
1280 1276
1281 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_ 1277 #endif // CONTENT_BROWSER_WEB_CONTENTS_WEB_CONTENTS_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698