| 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 // renderer process and the system clock has inter process time tick skew. | 145 // renderer process and the system clock has inter process time tick skew. |
| 146 ERR_INTER_PROCESS_TIME_TICK_SKEW, | 146 ERR_INTER_PROCESS_TIME_TICK_SKEW, |
| 147 | 147 |
| 148 // At the time a PageLoadTracker was destroyed, we had received neither a | 148 // At the time a PageLoadTracker was destroyed, we had received neither a |
| 149 // commit nor a failed provisional load. | 149 // commit nor a failed provisional load. |
| 150 ERR_NO_COMMIT_OR_FAILED_PROVISIONAL_LOAD, | 150 ERR_NO_COMMIT_OR_FAILED_PROVISIONAL_LOAD, |
| 151 | 151 |
| 152 // No page load end time was recorded for this page load. | 152 // No page load end time was recorded for this page load. |
| 153 ERR_NO_PAGE_LOAD_END_TIME, | 153 ERR_NO_PAGE_LOAD_END_TIME, |
| 154 | 154 |
| 155 // Received a timing update from a subframe. | 155 // Received a timing update from a subframe (deprecated). |
| 156 ERR_TIMING_IPC_FROM_SUBFRAME, | 156 DEPRECATED_ERR_TIMING_IPC_FROM_SUBFRAME, |
| 157 | 157 |
| 158 // A timing IPC was sent from the renderer that contained timing data which | 158 // A timing IPC was sent from the renderer that contained timing data which |
| 159 // was inconsistent with our timing data for the currently committed load. | 159 // was inconsistent with our timing data for the currently committed load. |
| 160 ERR_BAD_TIMING_IPC_INVALID_TIMING_DESCENDENT, | 160 ERR_BAD_TIMING_IPC_INVALID_TIMING_DESCENDENT, |
| 161 | 161 |
| 162 // A timing IPC was sent from the renderer that contained loading behavior | 162 // A timing IPC was sent from the renderer that contained loading behavior |
| 163 // data which was inconsistent with our loading behavior data for the | 163 // data which was inconsistent with our loading behavior data for the |
| 164 // currently committed load. | 164 // currently committed load. |
| 165 ERR_BAD_TIMING_IPC_INVALID_BEHAVIOR_DESCENDENT, | 165 ERR_BAD_TIMING_IPC_INVALID_BEHAVIOR_DESCENDENT, |
| 166 | 166 |
| 167 // A timing IPC was sent from the renderer that contained invalid timing data | 167 // A timing IPC was sent from the renderer that contained invalid timing data |
| 168 // (e.g. out of order timings, or other issues). | 168 // (e.g. out of order timings, or other issues). |
| 169 ERR_BAD_TIMING_IPC_INVALID_TIMING, | 169 ERR_BAD_TIMING_IPC_INVALID_TIMING, |
| 170 | 170 |
| 171 // We received an IPC for a subframe when we weren't tracking a committed load |
| 172 // in that frame. This can happen if the frame fails to commit but a document |
| 173 // is created in it from the parent document via document.open(). |
| 174 ERR_SUBFRAME_IPC_WITH_NO_RELEVANT_LOAD, |
| 175 |
| 171 // Add values before this final count. | 176 // Add values before this final count. |
| 172 ERR_LAST_ENTRY, | 177 ERR_LAST_ENTRY, |
| 173 }; | 178 }; |
| 174 | 179 |
| 175 // NOTE: these functions are shared by page_load_tracker.cc and | 180 // NOTE: these functions are shared by page_load_tracker.cc and |
| 176 // metrics_web_contents_observer.cc. They are declared here to allow both files | 181 // metrics_web_contents_observer.cc. They are declared here to allow both files |
| 177 // to access them. | 182 // to access them. |
| 178 void RecordInternalError(InternalErrorLoadEvent event); | 183 void RecordInternalError(InternalErrorLoadEvent event); |
| 179 PageEndReason EndReasonForPageTransition(ui::PageTransition transition); | 184 PageEndReason EndReasonForPageTransition(ui::PageTransition transition); |
| 180 void LogAbortChainSameURLHistogram(int aborted_chain_size_same_url); | 185 void LogAbortChainSameURLHistogram(int aborted_chain_size_same_url); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 // metrics as the application goes into the background. The application may be | 220 // metrics as the application goes into the background. The application may be |
| 216 // killed at any time after this method is invoked without further | 221 // killed at any time after this method is invoked without further |
| 217 // notification. | 222 // notification. |
| 218 void FlushMetricsOnAppEnterBackground(); | 223 void FlushMetricsOnAppEnterBackground(); |
| 219 | 224 |
| 220 void NotifyClientRedirectTo(const PageLoadTracker& destination); | 225 void NotifyClientRedirectTo(const PageLoadTracker& destination); |
| 221 | 226 |
| 222 void UpdateTiming(const PageLoadTiming& timing, | 227 void UpdateTiming(const PageLoadTiming& timing, |
| 223 const PageLoadMetadata& metadata); | 228 const PageLoadMetadata& metadata); |
| 224 | 229 |
| 230 void UpdateSubFrameTiming(content::RenderFrameHost* render_frame_host, |
| 231 const PageLoadTiming& new_timing, |
| 232 const PageLoadMetadata& new_metadata); |
| 233 |
| 225 // Update metadata for child frames. Updates for child frames arrive | 234 // Update metadata for child frames. Updates for child frames arrive |
| 226 // separately from updates for the main frame, so aren't included in | 235 // separately from updates for the main frame, so aren't included in |
| 227 // UpdateTiming. | 236 // UpdateTiming. |
| 228 void UpdateChildFrameMetadata(const PageLoadMetadata& child_metadata); | 237 void UpdateSubFrameMetadata(const PageLoadMetadata& child_metadata); |
| 229 | 238 |
| 230 void OnStartedResource( | 239 void OnStartedResource( |
| 231 const ExtraRequestStartInfo& extra_request_started_info); | 240 const ExtraRequestStartInfo& extra_request_started_info); |
| 232 | 241 |
| 233 void OnLoadedResource( | 242 void OnLoadedResource( |
| 234 const ExtraRequestCompleteInfo& extra_request_complete_info); | 243 const ExtraRequestCompleteInfo& extra_request_complete_info); |
| 235 | 244 |
| 236 // Signals that we should stop tracking metrics for the associated page load. | 245 // Signals that we should stop tracking metrics for the associated page load. |
| 237 // We may stop tracking a page load if it doesn't meet the criteria for | 246 // We may stop tracking a page load if it doesn't meet the criteria for |
| 238 // tracking metrics in DidFinishNavigation. | 247 // tracking metrics in DidFinishNavigation. |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 const content::WebContentsObserver::MediaPlayerInfo& video_type, | 308 const content::WebContentsObserver::MediaPlayerInfo& video_type, |
| 300 bool is_in_main_frame); | 309 bool is_in_main_frame); |
| 301 | 310 |
| 302 // Invoked on navigations where a navigation delay was added by the | 311 // Invoked on navigations where a navigation delay was added by the |
| 303 // DelayNavigationThrottle. This is a temporary method that will be removed | 312 // DelayNavigationThrottle. This is a temporary method that will be removed |
| 304 // once the experiment is complete. | 313 // once the experiment is complete. |
| 305 void OnNavigationDelayComplete(base::TimeDelta scheduled_delay, | 314 void OnNavigationDelayComplete(base::TimeDelta scheduled_delay, |
| 306 base::TimeDelta actual_delay); | 315 base::TimeDelta actual_delay); |
| 307 | 316 |
| 308 private: | 317 private: |
| 318 typedef int FrameTreeNodeId; |
| 319 |
| 309 // This function converts a TimeTicks value taken in the browser process | 320 // This function converts a TimeTicks value taken in the browser process |
| 310 // to navigation_start_ if: | 321 // to navigation_start_ if: |
| 311 // - base::TimeTicks is not comparable across processes because the clock | 322 // - base::TimeTicks is not comparable across processes because the clock |
| 312 // is not system wide monotonic. | 323 // is not system wide monotonic. |
| 313 // - *event_time < navigation_start_ | 324 // - *event_time < navigation_start_ |
| 314 void ClampBrowserTimestampIfInterProcessTimeTickSkew( | 325 void ClampBrowserTimestampIfInterProcessTimeTickSkew( |
| 315 base::TimeTicks* event_time); | 326 base::TimeTicks* event_time); |
| 316 | 327 |
| 317 void UpdatePageEndInternal(PageEndReason page_end_reason, | 328 void UpdatePageEndInternal(PageEndReason page_end_reason, |
| 318 UserInitiatedInfo user_initiated_info, | 329 UserInitiatedInfo user_initiated_info, |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 | 407 |
| 397 // This member counts consecutive provisional aborts that share a url. It will | 408 // This member counts consecutive provisional aborts that share a url. It will |
| 398 // always be less than or equal to |aborted_chain_size_|. | 409 // always be less than or equal to |aborted_chain_size_|. |
| 399 const int aborted_chain_size_same_url_; | 410 const int aborted_chain_size_same_url_; |
| 400 | 411 |
| 401 // Interface to chrome features. Must outlive the class. | 412 // Interface to chrome features. Must outlive the class. |
| 402 PageLoadMetricsEmbedderInterface* const embedder_interface_; | 413 PageLoadMetricsEmbedderInterface* const embedder_interface_; |
| 403 | 414 |
| 404 std::vector<std::unique_ptr<PageLoadMetricsObserver>> observers_; | 415 std::vector<std::unique_ptr<PageLoadMetricsObserver>> observers_; |
| 405 | 416 |
| 417 // Navigation start offsets for the most recently committed document in each |
| 418 // frame. |
| 419 std::map<FrameTreeNodeId, base::TimeDelta> |
| 420 child_frame_navigation_start_offset_; |
| 421 |
| 406 DISALLOW_COPY_AND_ASSIGN(PageLoadTracker); | 422 DISALLOW_COPY_AND_ASSIGN(PageLoadTracker); |
| 407 }; | 423 }; |
| 408 | 424 |
| 409 } // namespace page_load_metrics | 425 } // namespace page_load_metrics |
| 410 | 426 |
| 411 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_ | 427 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_ |
| OLD | NEW |