| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_METRICS_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ |
| 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ | 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/optional.h" | 9 #include "base/optional.h" |
| 10 #include "chrome/common/page_load_metrics/page_load_timing.h" | 10 #include "chrome/common/page_load_metrics/page_load_timing.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 struct PageLoadExtraInfo { | 68 struct PageLoadExtraInfo { |
| 69 PageLoadExtraInfo( | 69 PageLoadExtraInfo( |
| 70 const base::Optional<base::TimeDelta>& first_background_time, | 70 const base::Optional<base::TimeDelta>& first_background_time, |
| 71 const base::Optional<base::TimeDelta>& first_foreground_time, | 71 const base::Optional<base::TimeDelta>& first_foreground_time, |
| 72 bool started_in_foreground, | 72 bool started_in_foreground, |
| 73 bool user_gesture, | 73 bool user_gesture, |
| 74 const GURL& committed_url, | 74 const GURL& committed_url, |
| 75 const GURL& start_url, | 75 const GURL& start_url, |
| 76 const base::Optional<base::TimeDelta>& time_to_commit, | |
| 77 UserAbortType abort_type, | 76 UserAbortType abort_type, |
| 78 bool abort_user_initiated, | 77 bool abort_user_initiated, |
| 79 const base::Optional<base::TimeDelta>& time_to_abort, | 78 const base::Optional<base::TimeDelta>& time_to_abort, |
| 80 int num_cache_requests, | 79 int num_cache_requests, |
| 81 int num_network_requests, | 80 int num_network_requests, |
| 82 const PageLoadMetadata& metadata); | 81 const PageLoadMetadata& metadata); |
| 83 | 82 |
| 84 PageLoadExtraInfo(const PageLoadExtraInfo& other); | 83 PageLoadExtraInfo(const PageLoadExtraInfo& other); |
| 85 | 84 |
| 86 ~PageLoadExtraInfo(); | 85 ~PageLoadExtraInfo(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 98 // bit is true in the renderer. | 97 // bit is true in the renderer. |
| 99 const bool user_gesture; | 98 const bool user_gesture; |
| 100 | 99 |
| 101 // Committed URL. If the page load did not commit, |committed_url| will be | 100 // Committed URL. If the page load did not commit, |committed_url| will be |
| 102 // empty. | 101 // empty. |
| 103 const GURL committed_url; | 102 const GURL committed_url; |
| 104 | 103 |
| 105 // The URL that started the navigation, before redirects. | 104 // The URL that started the navigation, before redirects. |
| 106 const GURL start_url; | 105 const GURL start_url; |
| 107 | 106 |
| 108 // Time from navigation start until commit. | |
| 109 const base::Optional<base::TimeDelta> time_to_commit; | |
| 110 | |
| 111 // The abort time and time to abort for this page load. If the page was not | 107 // The abort time and time to abort for this page load. If the page was not |
| 112 // aborted, |abort_type| will be |ABORT_NONE|. | 108 // aborted, |abort_type| will be |ABORT_NONE|. |
| 113 const UserAbortType abort_type; | 109 const UserAbortType abort_type; |
| 114 | 110 |
| 115 // TODO(csharrison): If more metadata for aborts is needed we should provide a | 111 // TODO(csharrison): If more metadata for aborts is needed we should provide a |
| 116 // better abstraction. Note that this is an approximation. | 112 // better abstraction. Note that this is an approximation. |
| 117 bool abort_user_initiated; | 113 bool abort_user_initiated; |
| 118 | 114 |
| 119 const base::Optional<base::TimeDelta> time_to_abort; | 115 const base::Optional<base::TimeDelta> time_to_abort; |
| 120 | 116 |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 virtual void OnLoadingBehaviorObserved( | 223 virtual void OnLoadingBehaviorObserved( |
| 228 const page_load_metrics::PageLoadExtraInfo& extra_info) {} | 224 const page_load_metrics::PageLoadExtraInfo& extra_info) {} |
| 229 | 225 |
| 230 // Invoked when the UMA metrics subsystem is persisting metrics as the | 226 // Invoked when the UMA metrics subsystem is persisting metrics as the |
| 231 // application goes into the background, on platforms where the browser | 227 // application goes into the background, on platforms where the browser |
| 232 // process may be killed after backgrounding (Android). Implementers should | 228 // process may be killed after backgrounding (Android). Implementers should |
| 233 // persist any metrics that have been buffered in memory in this callback, as | 229 // persist any metrics that have been buffered in memory in this callback, as |
| 234 // the application may be killed at any time after this method is invoked | 230 // the application may be killed at any time after this method is invoked |
| 235 // without further notification. Note that this may be called both for | 231 // without further notification. Note that this may be called both for |
| 236 // provisional loads as well as committed loads. Implementations that only | 232 // provisional loads as well as committed loads. Implementations that only |
| 237 // want to track committed loads should check extra_info.time_to_commit to | 233 // want to track committed loads should check whether extra_info.committed_url |
| 238 // determine if the load had committed. If the implementation returns | 234 // is empty to determine if the load had committed. If the implementation |
| 239 // CONTINUE_OBSERVING, this method may be called multiple times per observer, | 235 // returns CONTINUE_OBSERVING, this method may be called multiple times per |
| 240 // once for each time that the application enters the backround. | 236 // observer, once for each time that the application enters the backround. |
| 241 // | 237 // |
| 242 // The default implementation does nothing, and returns CONTINUE_OBSERVING. | 238 // The default implementation does nothing, and returns CONTINUE_OBSERVING. |
| 243 virtual ObservePolicy FlushMetricsOnAppEnterBackground( | 239 virtual ObservePolicy FlushMetricsOnAppEnterBackground( |
| 244 const PageLoadTiming& timing, | 240 const PageLoadTiming& timing, |
| 245 const PageLoadExtraInfo& extra_info); | 241 const PageLoadExtraInfo& extra_info); |
| 246 | 242 |
| 247 // One of OnComplete or OnFailedProvisionalLoad is invoked for tracked page | 243 // One of OnComplete or OnFailedProvisionalLoad is invoked for tracked page |
| 248 // loads, immediately before the observer is deleted. These callbacks will not | 244 // loads, immediately before the observer is deleted. These callbacks will not |
| 249 // be invoked for page loads that did not meet the criteria for being tracked | 245 // be invoked for page loads that did not meet the criteria for being tracked |
| 250 // at the time the navigation completed. The PageLoadTiming struct contains | 246 // at the time the navigation completed. The PageLoadTiming struct contains |
| (...skipping 12 matching lines...) Expand all Loading... |
| 263 // OnFailedProvisionalLoad is invoked for tracked page loads that did not | 259 // OnFailedProvisionalLoad is invoked for tracked page loads that did not |
| 264 // commit, immediately before the observer is deleted. | 260 // commit, immediately before the observer is deleted. |
| 265 virtual void OnFailedProvisionalLoad( | 261 virtual void OnFailedProvisionalLoad( |
| 266 const FailedProvisionalLoadInfo& failed_provisional_load_info, | 262 const FailedProvisionalLoadInfo& failed_provisional_load_info, |
| 267 const PageLoadExtraInfo& extra_info) {} | 263 const PageLoadExtraInfo& extra_info) {} |
| 268 }; | 264 }; |
| 269 | 265 |
| 270 } // namespace page_load_metrics | 266 } // namespace page_load_metrics |
| 271 | 267 |
| 272 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ | 268 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ |
| OLD | NEW |