| OLD | NEW |
| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 // killed at any time after this method is invoked without further | 145 // killed at any time after this method is invoked without further |
| 146 // notification. | 146 // notification. |
| 147 void FlushMetricsOnAppEnterBackground(); | 147 void FlushMetricsOnAppEnterBackground(); |
| 148 | 148 |
| 149 void NotifyClientRedirectTo(const PageLoadTracker& destination); | 149 void NotifyClientRedirectTo(const PageLoadTracker& destination); |
| 150 | 150 |
| 151 // Returns true if the timing was successfully updated. | 151 // Returns true if the timing was successfully updated. |
| 152 bool UpdateTiming(const PageLoadTiming& timing, | 152 bool UpdateTiming(const PageLoadTiming& timing, |
| 153 const PageLoadMetadata& metadata); | 153 const PageLoadMetadata& metadata); |
| 154 | 154 |
| 155 void OnLoadedSubresource(bool was_cached); | 155 void OnLoadedResource(bool was_cached, int64_t raw_body_bytes); |
| 156 | 156 |
| 157 // Signals that we should stop tracking metrics for the associated page load. | 157 // Signals that we should stop tracking metrics for the associated page load. |
| 158 // We may stop tracking a page load if it doesn't meet the criteria for | 158 // We may stop tracking a page load if it doesn't meet the criteria for |
| 159 // tracking metrics in DidFinishNavigation. | 159 // tracking metrics in DidFinishNavigation. |
| 160 void StopTracking(); | 160 void StopTracking(); |
| 161 | 161 |
| 162 int aborted_chain_size() const { return aborted_chain_size_; } | 162 int aborted_chain_size() const { return aborted_chain_size_; } |
| 163 int aborted_chain_size_same_url() const { | 163 int aborted_chain_size_same_url() const { |
| 164 return aborted_chain_size_same_url_; | 164 return aborted_chain_size_same_url_; |
| 165 } | 165 } |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 PageLoadMetadata metadata_; | 278 PageLoadMetadata metadata_; |
| 279 | 279 |
| 280 ui::PageTransition page_transition_; | 280 ui::PageTransition page_transition_; |
| 281 | 281 |
| 282 // Note: these are only approximations, based on WebContents attribution from | 282 // Note: these are only approximations, based on WebContents attribution from |
| 283 // ResourceRequestInfo objects while this is the currently committed load in | 283 // ResourceRequestInfo objects while this is the currently committed load in |
| 284 // the WebContents. | 284 // the WebContents. |
| 285 int num_cache_requests_; | 285 int num_cache_requests_; |
| 286 int num_network_requests_; | 286 int num_network_requests_; |
| 287 | 287 |
| 288 // The number of body (not header) prefilter bytes consumed by requests for |
| 289 // the page. |
| 290 int64_t cache_bytes_; |
| 291 int64_t network_bytes_; |
| 292 |
| 288 // Whether this page load was user initiated. | 293 // Whether this page load was user initiated. |
| 289 UserInitiatedInfo user_initiated_info_; | 294 UserInitiatedInfo user_initiated_info_; |
| 290 | 295 |
| 291 // This is a subtle member. If a provisional load A gets aborted by | 296 // This is a subtle member. If a provisional load A gets aborted by |
| 292 // provisional load B, which gets aborted by C that eventually commits, then | 297 // provisional load B, which gets aborted by C that eventually commits, then |
| 293 // there exists an abort chain of length 2, starting at A's navigation_start. | 298 // there exists an abort chain of length 2, starting at A's navigation_start. |
| 294 // This is useful because it allows histograming abort chain lengths based on | 299 // This is useful because it allows histograming abort chain lengths based on |
| 295 // what the last load's transition type is. i.e. holding down F-5 to spam | 300 // what the last load's transition type is. i.e. holding down F-5 to spam |
| 296 // reload will produce a long chain with the RELOAD transition. | 301 // reload will produce a long chain with the RELOAD transition. |
| 297 const int aborted_chain_size_; | 302 const int aborted_chain_size_; |
| 298 | 303 |
| 299 // This member counts consecutive provisional aborts that share a url. It will | 304 // This member counts consecutive provisional aborts that share a url. It will |
| 300 // always be less than or equal to |aborted_chain_size_|. | 305 // always be less than or equal to |aborted_chain_size_|. |
| 301 const int aborted_chain_size_same_url_; | 306 const int aborted_chain_size_same_url_; |
| 302 | 307 |
| 303 // Interface to chrome features. Must outlive the class. | 308 // Interface to chrome features. Must outlive the class. |
| 304 PageLoadMetricsEmbedderInterface* const embedder_interface_; | 309 PageLoadMetricsEmbedderInterface* const embedder_interface_; |
| 305 | 310 |
| 306 std::vector<std::unique_ptr<PageLoadMetricsObserver>> observers_; | 311 std::vector<std::unique_ptr<PageLoadMetricsObserver>> observers_; |
| 307 | 312 |
| 308 DISALLOW_COPY_AND_ASSIGN(PageLoadTracker); | 313 DISALLOW_COPY_AND_ASSIGN(PageLoadTracker); |
| 309 }; | 314 }; |
| 310 | 315 |
| 311 } // namespace page_load_metrics | 316 } // namespace page_load_metrics |
| 312 | 317 |
| 313 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_ | 318 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_ |
| OLD | NEW |