| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 // Update metadata for child frames. Updates for child frames arrive |
| 167 // separately from updates for the main frame, so aren't included in |
| 168 // UpdateTiming. |
| 169 void UpdateChildFrameMetadata(const PageLoadMetadata& child_metadata); |
| 170 |
| 163 void OnLoadedResource(const ExtraRequestInfo& extra_request_info); | 171 void OnLoadedResource(const ExtraRequestInfo& extra_request_info); |
| 164 | 172 |
| 165 // Signals that we should stop tracking metrics for the associated page load. | 173 // 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 | 174 // We may stop tracking a page load if it doesn't meet the criteria for |
| 167 // tracking metrics in DidFinishNavigation. | 175 // tracking metrics in DidFinishNavigation. |
| 168 void StopTracking(); | 176 void StopTracking(); |
| 169 | 177 |
| 170 int aborted_chain_size() const { return aborted_chain_size_; } | 178 int aborted_chain_size() const { return aborted_chain_size_; } |
| 171 int aborted_chain_size_same_url() const { | 179 int aborted_chain_size_same_url() const { |
| 172 return aborted_chain_size_same_url_; | 180 return aborted_chain_size_same_url_; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 base::TimeTicks page_end_time_; | 295 base::TimeTicks page_end_time_; |
| 288 | 296 |
| 289 // We record separate metrics for events that occur after a background, | 297 // We record separate metrics for events that occur after a background, |
| 290 // because metrics like layout/paint are delayed artificially | 298 // because metrics like layout/paint are delayed artificially |
| 291 // when they occur in the background. | 299 // when they occur in the background. |
| 292 base::TimeTicks background_time_; | 300 base::TimeTicks background_time_; |
| 293 base::TimeTicks foreground_time_; | 301 base::TimeTicks foreground_time_; |
| 294 bool started_in_foreground_; | 302 bool started_in_foreground_; |
| 295 | 303 |
| 296 PageLoadTiming timing_; | 304 PageLoadTiming timing_; |
| 297 PageLoadMetadata metadata_; | 305 PageLoadMetadata main_frame_metadata_; |
| 306 PageLoadMetadata child_frame_metadata_; |
| 298 | 307 |
| 299 ui::PageTransition page_transition_; | 308 ui::PageTransition page_transition_; |
| 300 | 309 |
| 301 base::Optional<content::GlobalRequestID> navigation_request_id_; | 310 base::Optional<content::GlobalRequestID> navigation_request_id_; |
| 302 | 311 |
| 303 // Whether this page load was user initiated. | 312 // Whether this page load was user initiated. |
| 304 UserInitiatedInfo user_initiated_info_; | 313 UserInitiatedInfo user_initiated_info_; |
| 305 | 314 |
| 306 // This is a subtle member. If a provisional load A gets aborted by | 315 // 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 | 316 // provisional load B, which gets aborted by C that eventually commits, then |
| (...skipping 11 matching lines...) Expand all Loading... |
| 319 PageLoadMetricsEmbedderInterface* const embedder_interface_; | 328 PageLoadMetricsEmbedderInterface* const embedder_interface_; |
| 320 | 329 |
| 321 std::vector<std::unique_ptr<PageLoadMetricsObserver>> observers_; | 330 std::vector<std::unique_ptr<PageLoadMetricsObserver>> observers_; |
| 322 | 331 |
| 323 DISALLOW_COPY_AND_ASSIGN(PageLoadTracker); | 332 DISALLOW_COPY_AND_ASSIGN(PageLoadTracker); |
| 324 }; | 333 }; |
| 325 | 334 |
| 326 } // namespace page_load_metrics | 335 } // namespace page_load_metrics |
| 327 | 336 |
| 328 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_ | 337 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_ |
| OLD | NEW |