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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 void OnInputEvent(const blink::WebInputEvent& event); | 217 void OnInputEvent(const blink::WebInputEvent& event); |
218 | 218 |
219 // Flush any buffered metrics, as part of the metrics subsystem persisting | 219 // Flush any buffered metrics, as part of the metrics subsystem persisting |
220 // 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 |
221 // killed at any time after this method is invoked without further | 221 // killed at any time after this method is invoked without further |
222 // notification. | 222 // notification. |
223 void FlushMetricsOnAppEnterBackground(); | 223 void FlushMetricsOnAppEnterBackground(); |
224 | 224 |
225 void NotifyClientRedirectTo(const PageLoadTracker& destination); | 225 void NotifyClientRedirectTo(const PageLoadTracker& destination); |
226 | 226 |
227 void UpdateTiming(const PageLoadTiming& timing, | 227 void UpdateTiming(const mojom::PageLoadTiming& timing, |
228 const PageLoadMetadata& metadata); | 228 const mojom::PageLoadMetadata& metadata); |
229 | 229 |
230 void UpdateSubFrameTiming(content::RenderFrameHost* render_frame_host, | 230 void UpdateSubFrameTiming(content::RenderFrameHost* render_frame_host, |
231 const PageLoadTiming& new_timing, | 231 const mojom::PageLoadTiming& new_timing, |
232 const PageLoadMetadata& new_metadata); | 232 const mojom::PageLoadMetadata& new_metadata); |
233 | 233 |
234 // Update metadata for child frames. Updates for child frames arrive | 234 // Update metadata for child frames. Updates for child frames arrive |
235 // 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 |
236 // UpdateTiming. | 236 // UpdateTiming. |
237 void UpdateSubFrameMetadata(const PageLoadMetadata& subframe_metadata); | 237 void UpdateSubFrameMetadata(const mojom::PageLoadMetadata& subframe_metadata); |
238 | 238 |
239 void OnStartedResource( | 239 void OnStartedResource( |
240 const ExtraRequestStartInfo& extra_request_started_info); | 240 const ExtraRequestStartInfo& extra_request_started_info); |
241 | 241 |
242 void OnLoadedResource( | 242 void OnLoadedResource( |
243 const ExtraRequestCompleteInfo& extra_request_complete_info); | 243 const ExtraRequestCompleteInfo& extra_request_complete_info); |
244 | 244 |
245 // 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. |
246 // 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 |
247 // tracking metrics in DidFinishNavigation. | 247 // tracking metrics in DidFinishNavigation. |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 // If |final_navigation| is null, then this is an "unparented" abort chain, | 333 // If |final_navigation| is null, then this is an "unparented" abort chain, |
334 // and represents a sequence of provisional aborts that never ends with a | 334 // and represents a sequence of provisional aborts that never ends with a |
335 // committed load. | 335 // committed load. |
336 void LogAbortChainHistograms(content::NavigationHandle* final_navigation); | 336 void LogAbortChainHistograms(content::NavigationHandle* final_navigation); |
337 | 337 |
338 void MaybeUpdateURL(content::NavigationHandle* navigation_handle); | 338 void MaybeUpdateURL(content::NavigationHandle* navigation_handle); |
339 | 339 |
340 // Merge values from |new_paint_timing| into |merged_page_timing_|, offsetting | 340 // Merge values from |new_paint_timing| into |merged_page_timing_|, offsetting |
341 // any new timings by the |navigation_start_offset|. | 341 // any new timings by the |navigation_start_offset|. |
342 void MergePaintTiming(base::TimeDelta navigation_start_offset, | 342 void MergePaintTiming(base::TimeDelta navigation_start_offset, |
343 const page_load_metrics::PaintTiming& new_paint_timing, | 343 const mojom::PaintTiming& new_paint_timing, |
344 bool is_main_frame); | 344 bool is_main_frame); |
345 | 345 |
346 void DispatchTimingUpdates(); | 346 void DispatchTimingUpdates(); |
347 | 347 |
348 UserInputTracker input_tracker_; | 348 UserInputTracker input_tracker_; |
349 | 349 |
350 // Whether we stopped tracking this navigation after it was initiated. We may | 350 // Whether we stopped tracking this navigation after it was initiated. We may |
351 // stop tracking a navigation if it doesn't meet the criteria for tracking | 351 // stop tracking a navigation if it doesn't meet the criteria for tracking |
352 // metrics in DidFinishNavigation. | 352 // metrics in DidFinishNavigation. |
353 bool did_stop_tracking_; | 353 bool did_stop_tracking_; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 // We record separate metrics for events that occur after a background, | 390 // We record separate metrics for events that occur after a background, |
391 // because metrics like layout/paint are delayed artificially | 391 // because metrics like layout/paint are delayed artificially |
392 // when they occur in the background. | 392 // when they occur in the background. |
393 base::TimeTicks background_time_; | 393 base::TimeTicks background_time_; |
394 base::TimeTicks foreground_time_; | 394 base::TimeTicks foreground_time_; |
395 bool started_in_foreground_; | 395 bool started_in_foreground_; |
396 | 396 |
397 // PageLoadTiming for the currently tracked page. The fields in |paint_timing| | 397 // PageLoadTiming for the currently tracked page. The fields in |paint_timing| |
398 // are merged across all frames in the document. All other fields are for the | 398 // are merged across all frames in the document. All other fields are for the |
399 // main frame document. | 399 // main frame document. |
400 PageLoadTiming merged_page_timing_; | 400 mojom::PageLoadTimingPtr merged_page_timing_; |
401 PageLoadTiming last_dispatched_merged_page_timing_; | 401 mojom::PageLoadTimingPtr last_dispatched_merged_page_timing_; |
402 | 402 |
403 PageLoadMetadata main_frame_metadata_; | 403 mojom::PageLoadMetadata main_frame_metadata_; |
404 PageLoadMetadata last_dispatched_main_frame_metadata_; | 404 mojom::PageLoadMetadataPtr last_dispatched_main_frame_metadata_; |
405 | 405 |
406 PageLoadMetadata subframe_metadata_; | 406 mojom::PageLoadMetadata subframe_metadata_; |
407 | 407 |
408 ui::PageTransition page_transition_; | 408 ui::PageTransition page_transition_; |
409 | 409 |
410 base::Optional<content::GlobalRequestID> navigation_request_id_; | 410 base::Optional<content::GlobalRequestID> navigation_request_id_; |
411 | 411 |
412 // Whether this page load was user initiated. | 412 // Whether this page load was user initiated. |
413 UserInitiatedInfo user_initiated_info_; | 413 UserInitiatedInfo user_initiated_info_; |
414 | 414 |
415 // This is a subtle member. If a provisional load A gets aborted by | 415 // This is a subtle member. If a provisional load A gets aborted by |
416 // provisional load B, which gets aborted by C that eventually commits, then | 416 // provisional load B, which gets aborted by C that eventually commits, then |
(...skipping 15 matching lines...) Expand all Loading... |
432 // Navigation start offsets for the most recently committed document in each | 432 // Navigation start offsets for the most recently committed document in each |
433 // frame. | 433 // frame. |
434 std::map<FrameTreeNodeId, base::TimeDelta> subframe_navigation_start_offset_; | 434 std::map<FrameTreeNodeId, base::TimeDelta> subframe_navigation_start_offset_; |
435 | 435 |
436 DISALLOW_COPY_AND_ASSIGN(PageLoadTracker); | 436 DISALLOW_COPY_AND_ASSIGN(PageLoadTracker); |
437 }; | 437 }; |
438 | 438 |
439 } // namespace page_load_metrics | 439 } // namespace page_load_metrics |
440 | 440 |
441 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_ | 441 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_TRACKER_H_ |
OLD | NEW |