| 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 <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 const base::Optional<base::TimeDelta>& first_background_time, | 111 const base::Optional<base::TimeDelta>& first_background_time, |
| 112 const base::Optional<base::TimeDelta>& first_foreground_time, | 112 const base::Optional<base::TimeDelta>& first_foreground_time, |
| 113 bool started_in_foreground, | 113 bool started_in_foreground, |
| 114 UserInitiatedInfo user_initiated_info, | 114 UserInitiatedInfo user_initiated_info, |
| 115 const GURL& url, | 115 const GURL& url, |
| 116 const GURL& start_url, | 116 const GURL& start_url, |
| 117 bool did_commit, | 117 bool did_commit, |
| 118 PageEndReason page_end_reason, | 118 PageEndReason page_end_reason, |
| 119 UserInitiatedInfo page_end_user_initiated_info, | 119 UserInitiatedInfo page_end_user_initiated_info, |
| 120 const base::Optional<base::TimeDelta>& page_end_time, | 120 const base::Optional<base::TimeDelta>& page_end_time, |
| 121 const PageLoadMetadata& metadata); | 121 const PageLoadMetadata& main_frame_metadata, |
| 122 const PageLoadMetadata& child_frame_metadata); |
| 122 | 123 |
| 123 // Simplified version of the constructor, intended for use in tests. | 124 // Simplified version of the constructor, intended for use in tests. |
| 124 static PageLoadExtraInfo CreateForTesting(const GURL& url, | 125 static PageLoadExtraInfo CreateForTesting(const GURL& url, |
| 125 bool started_in_foreground); | 126 bool started_in_foreground); |
| 126 | 127 |
| 127 PageLoadExtraInfo(const PageLoadExtraInfo& other); | 128 PageLoadExtraInfo(const PageLoadExtraInfo& other); |
| 128 | 129 |
| 129 ~PageLoadExtraInfo(); | 130 ~PageLoadExtraInfo(); |
| 130 | 131 |
| 131 // The time the navigation was initiated. | 132 // The time the navigation was initiated. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 // * the load of the main resource fails | 180 // * the load of the main resource fails |
| 180 // * the page load is stopped | 181 // * the page load is stopped |
| 181 // * the tab hosting the page is closed | 182 // * the tab hosting the page is closed |
| 182 // * the render process hosting the page goes away | 183 // * the render process hosting the page goes away |
| 183 // * a new navigation which later commits is initiated in the same tab | 184 // * a new navigation which later commits is initiated in the same tab |
| 184 // This field will not be set if the page is still active and hasn't yet | 185 // This field will not be set if the page is still active and hasn't yet |
| 185 // finished. | 186 // finished. |
| 186 const base::Optional<base::TimeDelta> page_end_time; | 187 const base::Optional<base::TimeDelta> page_end_time; |
| 187 | 188 |
| 188 // Extra information supplied to the page load metrics system from the | 189 // Extra information supplied to the page load metrics system from the |
| 189 // renderer. | 190 // renderer for the main frame. |
| 190 const PageLoadMetadata metadata; | 191 const PageLoadMetadata main_frame_metadata; |
| 192 |
| 193 // PageLoadMetadata for child frames of the current page load. |
| 194 const PageLoadMetadata child_frame_metadata; |
| 191 }; | 195 }; |
| 192 | 196 |
| 193 // Container for various information about a request within a page load. | 197 // Container for various information about a request within a page load. |
| 194 struct ExtraRequestInfo { | 198 struct ExtraRequestInfo { |
| 195 ExtraRequestInfo(bool was_cached, | 199 ExtraRequestInfo(bool was_cached, |
| 196 int64_t raw_body_bytes, | 200 int64_t raw_body_bytes, |
| 197 bool data_reduction_proxy_used, | 201 bool data_reduction_proxy_used, |
| 198 int64_t original_network_content_length); | 202 int64_t original_network_content_length); |
| 199 | 203 |
| 200 ExtraRequestInfo(const ExtraRequestInfo& other); | 204 ExtraRequestInfo(const ExtraRequestInfo& other); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 const PageLoadExtraInfo& extra_info) {} | 311 const PageLoadExtraInfo& extra_info) {} |
| 308 virtual void OnFirstContentfulPaint(const PageLoadTiming& timing, | 312 virtual void OnFirstContentfulPaint(const PageLoadTiming& timing, |
| 309 const PageLoadExtraInfo& extra_info) {} | 313 const PageLoadExtraInfo& extra_info) {} |
| 310 virtual void OnFirstMeaningfulPaint(const PageLoadTiming& timing, | 314 virtual void OnFirstMeaningfulPaint(const PageLoadTiming& timing, |
| 311 const PageLoadExtraInfo& extra_info) {} | 315 const PageLoadExtraInfo& extra_info) {} |
| 312 virtual void OnParseStart(const PageLoadTiming& timing, | 316 virtual void OnParseStart(const PageLoadTiming& timing, |
| 313 const PageLoadExtraInfo& extra_info) {} | 317 const PageLoadExtraInfo& extra_info) {} |
| 314 virtual void OnParseStop(const PageLoadTiming& timing, | 318 virtual void OnParseStop(const PageLoadTiming& timing, |
| 315 const PageLoadExtraInfo& extra_info) {} | 319 const PageLoadExtraInfo& extra_info) {} |
| 316 | 320 |
| 317 // Invoked when there is a change in PageLoadMetadata's behavior_flags. | 321 // Invoked when there is a change in either the main_frame_metadata or the |
| 322 // child_frame_metadata's loading behavior_flags. |
| 318 virtual void OnLoadingBehaviorObserved( | 323 virtual void OnLoadingBehaviorObserved( |
| 319 const page_load_metrics::PageLoadExtraInfo& extra_info) {} | 324 const page_load_metrics::PageLoadExtraInfo& extra_info) {} |
| 320 | 325 |
| 321 // Invoked when the UMA metrics subsystem is persisting metrics as the | 326 // Invoked when the UMA metrics subsystem is persisting metrics as the |
| 322 // application goes into the background, on platforms where the browser | 327 // application goes into the background, on platforms where the browser |
| 323 // process may be killed after backgrounding (Android). Implementers should | 328 // process may be killed after backgrounding (Android). Implementers should |
| 324 // persist any metrics that have been buffered in memory in this callback, as | 329 // persist any metrics that have been buffered in memory in this callback, as |
| 325 // the application may be killed at any time after this method is invoked | 330 // the application may be killed at any time after this method is invoked |
| 326 // without further notification. Note that this may be called both for | 331 // without further notification. Note that this may be called both for |
| 327 // provisional loads as well as committed loads. Implementations that only | 332 // provisional loads as well as committed loads. Implementations that only |
| (...skipping 30 matching lines...) Expand all Loading... |
| 358 const FailedProvisionalLoadInfo& failed_provisional_load_info, | 363 const FailedProvisionalLoadInfo& failed_provisional_load_info, |
| 359 const PageLoadExtraInfo& extra_info) {} | 364 const PageLoadExtraInfo& extra_info) {} |
| 360 | 365 |
| 361 // Called whenever a request is loaded for this page load. | 366 // Called whenever a request is loaded for this page load. |
| 362 virtual void OnLoadedResource(const ExtraRequestInfo& extra_request_info) {} | 367 virtual void OnLoadedResource(const ExtraRequestInfo& extra_request_info) {} |
| 363 }; | 368 }; |
| 364 | 369 |
| 365 } // namespace page_load_metrics | 370 } // namespace page_load_metrics |
| 366 | 371 |
| 367 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ | 372 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_PAGE_LOAD_METRICS_OBSERVER_H_ |
| OLD | NEW |