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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 // metrics as the application goes into the background. The application may be | 215 // metrics as the application goes into the background. The application may be |
216 // killed at any time after this method is invoked without further | 216 // killed at any time after this method is invoked without further |
217 // notification. | 217 // notification. |
218 void FlushMetricsOnAppEnterBackground(); | 218 void FlushMetricsOnAppEnterBackground(); |
219 | 219 |
220 void NotifyClientRedirectTo(const PageLoadTracker& destination); | 220 void NotifyClientRedirectTo(const PageLoadTracker& destination); |
221 | 221 |
222 void UpdateTiming(const PageLoadTiming& timing, | 222 void UpdateTiming(const PageLoadTiming& timing, |
223 const PageLoadMetadata& metadata); | 223 const PageLoadMetadata& metadata); |
224 | 224 |
| 225 void UpdateSubFrameTiming(content::RenderFrameHost* render_frame_host, |
| 226 const PageLoadTiming& new_timing, |
| 227 const PageLoadMetadata& new_metadata); |
| 228 |
225 // Update metadata for child frames. Updates for child frames arrive | 229 // Update metadata for child frames. Updates for child frames arrive |
226 // separately from updates for the main frame, so aren't included in | 230 // separately from updates for the main frame, so aren't included in |
227 // UpdateTiming. | 231 // UpdateTiming. |
228 void UpdateChildFrameMetadata(const PageLoadMetadata& child_metadata); | 232 void UpdateSubFrameMetadata(const PageLoadMetadata& child_metadata); |
229 | 233 |
230 void OnStartedResource( | 234 void OnStartedResource( |
231 const ExtraRequestStartInfo& extra_request_started_info); | 235 const ExtraRequestStartInfo& extra_request_started_info); |
232 | 236 |
233 void OnLoadedResource( | 237 void OnLoadedResource( |
234 const ExtraRequestCompleteInfo& extra_request_complete_info); | 238 const ExtraRequestCompleteInfo& extra_request_complete_info); |
235 | 239 |
236 // Signals that we should stop tracking metrics for the associated page load. | 240 // 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 | 241 // We may stop tracking a page load if it doesn't meet the criteria for |
238 // tracking metrics in DidFinishNavigation. | 242 // tracking metrics in DidFinishNavigation. |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 const content::WebContentsObserver::MediaPlayerInfo& video_type, | 303 const content::WebContentsObserver::MediaPlayerInfo& video_type, |
300 bool is_in_main_frame); | 304 bool is_in_main_frame); |
301 | 305 |
302 // Invoked on navigations where a navigation delay was added by the | 306 // Invoked on navigations where a navigation delay was added by the |
303 // DelayNavigationThrottle. This is a temporary method that will be removed | 307 // DelayNavigationThrottle. This is a temporary method that will be removed |
304 // once the experiment is complete. | 308 // once the experiment is complete. |
305 void OnNavigationDelayComplete(base::TimeDelta scheduled_delay, | 309 void OnNavigationDelayComplete(base::TimeDelta scheduled_delay, |
306 base::TimeDelta actual_delay); | 310 base::TimeDelta actual_delay); |
307 | 311 |
308 private: | 312 private: |
| 313 typedef int FrameTreeNodeId; |
| 314 |
309 // This function converts a TimeTicks value taken in the browser process | 315 // This function converts a TimeTicks value taken in the browser process |
310 // to navigation_start_ if: | 316 // to navigation_start_ if: |
311 // - base::TimeTicks is not comparable across processes because the clock | 317 // - base::TimeTicks is not comparable across processes because the clock |
312 // is not system wide monotonic. | 318 // is not system wide monotonic. |
313 // - *event_time < navigation_start_ | 319 // - *event_time < navigation_start_ |
314 void ClampBrowserTimestampIfInterProcessTimeTickSkew( | 320 void ClampBrowserTimestampIfInterProcessTimeTickSkew( |
315 base::TimeTicks* event_time); | 321 base::TimeTicks* event_time); |
316 | 322 |
317 void UpdatePageEndInternal(PageEndReason page_end_reason, | 323 void UpdatePageEndInternal(PageEndReason page_end_reason, |
318 UserInitiatedInfo user_initiated_info, | 324 UserInitiatedInfo user_initiated_info, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 | 402 |
397 // This member counts consecutive provisional aborts that share a url. It will | 403 // This member counts consecutive provisional aborts that share a url. It will |
398 // always be less than or equal to |aborted_chain_size_|. | 404 // always be less than or equal to |aborted_chain_size_|. |
399 const int aborted_chain_size_same_url_; | 405 const int aborted_chain_size_same_url_; |
400 | 406 |
401 // Interface to chrome features. Must outlive the class. | 407 // Interface to chrome features. Must outlive the class. |
402 PageLoadMetricsEmbedderInterface* const embedder_interface_; | 408 PageLoadMetricsEmbedderInterface* const embedder_interface_; |
403 | 409 |
404 std::vector<std::unique_ptr<PageLoadMetricsObserver>> observers_; | 410 std::vector<std::unique_ptr<PageLoadMetricsObserver>> observers_; |
405 | 411 |
| 412 // Navigation start offsets for the most recently committed document in each |
| 413 // frame. |
| 414 std::map<FrameTreeNodeId, base::TimeDelta> child_frame_navigation_start_; |
| 415 |
406 DISALLOW_COPY_AND_ASSIGN(PageLoadTracker); | 416 DISALLOW_COPY_AND_ASSIGN(PageLoadTracker); |
407 }; | 417 }; |
408 | 418 |
409 } // namespace page_load_metrics | 419 } // namespace page_load_metrics |
410 | 420 |
411 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_ | 421 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_ |
OLD | NEW |