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

Side by Side Diff: chrome/browser/page_load_metrics/page_load_tracker.h

Issue 2737563007: Add support for tracking loading behavior of child frames. (Closed)
Patch Set: test fixes Created 3 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_ 5 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_
6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_ 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 // renderer process and the system clock has inter process time tick skew. 100 // renderer process and the system clock has inter process time tick skew.
101 ERR_INTER_PROCESS_TIME_TICK_SKEW, 101 ERR_INTER_PROCESS_TIME_TICK_SKEW,
102 102
103 // At the time a PageLoadTracker was destroyed, we had received neither a 103 // At the time a PageLoadTracker was destroyed, we had received neither a
104 // commit nor a failed provisional load. 104 // commit nor a failed provisional load.
105 ERR_NO_COMMIT_OR_FAILED_PROVISIONAL_LOAD, 105 ERR_NO_COMMIT_OR_FAILED_PROVISIONAL_LOAD,
106 106
107 // No page load end time was recorded for this page load. 107 // No page load end time was recorded for this page load.
108 ERR_NO_PAGE_LOAD_END_TIME, 108 ERR_NO_PAGE_LOAD_END_TIME,
109 109
110 // Received a timing update from a subframe.
111 ERR_TIMING_IPC_FROM_SUBFRAME,
112
110 // Add values before this final count. 113 // Add values before this final count.
111 ERR_LAST_ENTRY, 114 ERR_LAST_ENTRY,
112 }; 115 };
113 116
114 // NOTE: these functions are shared by page_load_tracker.cc and 117 // NOTE: these functions are shared by page_load_tracker.cc and
115 // metrics_web_contents_observer.cc. They are declared here to allow both files 118 // metrics_web_contents_observer.cc. They are declared here to allow both files
116 // to access them. 119 // to access them.
117 void RecordInternalError(InternalErrorLoadEvent event); 120 void RecordInternalError(InternalErrorLoadEvent event);
118 PageEndReason EndReasonForPageTransition(ui::PageTransition transition); 121 PageEndReason EndReasonForPageTransition(ui::PageTransition transition);
119 void LogAbortChainSameURLHistogram(int aborted_chain_size_same_url); 122 void LogAbortChainSameURLHistogram(int aborted_chain_size_same_url);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 // killed at any time after this method is invoked without further 156 // killed at any time after this method is invoked without further
154 // notification. 157 // notification.
155 void FlushMetricsOnAppEnterBackground(); 158 void FlushMetricsOnAppEnterBackground();
156 159
157 void NotifyClientRedirectTo(const PageLoadTracker& destination); 160 void NotifyClientRedirectTo(const PageLoadTracker& destination);
158 161
159 // Returns true if the timing was successfully updated. 162 // Returns true if the timing was successfully updated.
160 bool UpdateTiming(const PageLoadTiming& timing, 163 bool UpdateTiming(const PageLoadTiming& timing,
161 const PageLoadMetadata& metadata); 164 const PageLoadMetadata& metadata);
162 165
166 void UpdateChildMetadata(const PageLoadMetadata& child_metadata);
167
163 void OnLoadedResource(const ExtraRequestInfo& extra_request_info); 168 void OnLoadedResource(const ExtraRequestInfo& extra_request_info);
164 169
165 // Signals that we should stop tracking metrics for the associated page load. 170 // Signals that we should stop tracking metrics for the associated page load.
166 // We may stop tracking a page load if it doesn't meet the criteria for 171 // We may stop tracking a page load if it doesn't meet the criteria for
167 // tracking metrics in DidFinishNavigation. 172 // tracking metrics in DidFinishNavigation.
168 void StopTracking(); 173 void StopTracking();
169 174
170 int aborted_chain_size() const { return aborted_chain_size_; } 175 int aborted_chain_size() const { return aborted_chain_size_; }
171 int aborted_chain_size_same_url() const { 176 int aborted_chain_size_same_url() const {
172 return aborted_chain_size_same_url_; 177 return aborted_chain_size_same_url_;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 PageLoadTiming timing_; 301 PageLoadTiming timing_;
297 PageLoadMetadata metadata_; 302 PageLoadMetadata metadata_;
298 303
299 ui::PageTransition page_transition_; 304 ui::PageTransition page_transition_;
300 305
301 base::Optional<content::GlobalRequestID> navigation_request_id_; 306 base::Optional<content::GlobalRequestID> navigation_request_id_;
302 307
303 // Whether this page load was user initiated. 308 // Whether this page load was user initiated.
304 UserInitiatedInfo user_initiated_info_; 309 UserInitiatedInfo user_initiated_info_;
305 310
311 // WebLoadingBehaviorFlags for all child frames in this page.
312 int child_loading_behavior_flags_;
313
306 // This is a subtle member. If a provisional load A gets aborted by 314 // This is a subtle member. If a provisional load A gets aborted by
307 // provisional load B, which gets aborted by C that eventually commits, then 315 // provisional load B, which gets aborted by C that eventually commits, then
308 // there exists an abort chain of length 2, starting at A's navigation_start. 316 // there exists an abort chain of length 2, starting at A's navigation_start.
309 // This is useful because it allows histograming abort chain lengths based on 317 // This is useful because it allows histograming abort chain lengths based on
310 // what the last load's transition type is. i.e. holding down F-5 to spam 318 // what the last load's transition type is. i.e. holding down F-5 to spam
311 // reload will produce a long chain with the RELOAD transition. 319 // reload will produce a long chain with the RELOAD transition.
312 const int aborted_chain_size_; 320 const int aborted_chain_size_;
313 321
314 // This member counts consecutive provisional aborts that share a url. It will 322 // This member counts consecutive provisional aborts that share a url. It will
315 // always be less than or equal to |aborted_chain_size_|. 323 // always be less than or equal to |aborted_chain_size_|.
316 const int aborted_chain_size_same_url_; 324 const int aborted_chain_size_same_url_;
317 325
318 // Interface to chrome features. Must outlive the class. 326 // Interface to chrome features. Must outlive the class.
319 PageLoadMetricsEmbedderInterface* const embedder_interface_; 327 PageLoadMetricsEmbedderInterface* const embedder_interface_;
320 328
321 std::vector<std::unique_ptr<PageLoadMetricsObserver>> observers_; 329 std::vector<std::unique_ptr<PageLoadMetricsObserver>> observers_;
322 330
323 DISALLOW_COPY_AND_ASSIGN(PageLoadTracker); 331 DISALLOW_COPY_AND_ASSIGN(PageLoadTracker);
324 }; 332 };
325 333
326 } // namespace page_load_metrics 334 } // namespace page_load_metrics
327 335
328 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_ 336 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698