OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_OBSERVERS_UKM_PAGE_LOAD_METRICS_OBSERVE
R_H_ | 5 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_UKM_PAGE_LOAD_METRICS_OBSERVE
R_H_ |
6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_UKM_PAGE_LOAD_METRICS_OBSERVE
R_H_ | 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_UKM_PAGE_LOAD_METRICS_OBSERVE
R_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 "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 ~UkmPageLoadMetricsObserver() override; | 50 ~UkmPageLoadMetricsObserver() override; |
51 | 51 |
52 // page_load_metrics::PageLoadMetricsObserver implementation: | 52 // page_load_metrics::PageLoadMetricsObserver implementation: |
53 ObservePolicy OnStart(content::NavigationHandle* navigation_handle, | 53 ObservePolicy OnStart(content::NavigationHandle* navigation_handle, |
54 const GURL& currently_committed_url, | 54 const GURL& currently_committed_url, |
55 bool started_in_foreground) override; | 55 bool started_in_foreground) override; |
56 | 56 |
57 ObservePolicy OnCommit(content::NavigationHandle* navigation_handle) override; | 57 ObservePolicy OnCommit(content::NavigationHandle* navigation_handle) override; |
58 | 58 |
59 ObservePolicy FlushMetricsOnAppEnterBackground( | 59 ObservePolicy FlushMetricsOnAppEnterBackground( |
60 const page_load_metrics::PageLoadTiming& timing, | 60 const page_load_metrics::mojom::PageLoadTiming& timing, |
61 const page_load_metrics::PageLoadExtraInfo& info) override; | 61 const page_load_metrics::PageLoadExtraInfo& info) override; |
62 | 62 |
63 ObservePolicy OnHidden( | 63 ObservePolicy OnHidden( |
64 const page_load_metrics::PageLoadTiming& timing, | 64 const page_load_metrics::mojom::PageLoadTiming& timing, |
65 const page_load_metrics::PageLoadExtraInfo& info) override; | 65 const page_load_metrics::PageLoadExtraInfo& info) override; |
66 | 66 |
67 void OnFailedProvisionalLoad( | 67 void OnFailedProvisionalLoad( |
68 const page_load_metrics::FailedProvisionalLoadInfo& failed_load_info, | 68 const page_load_metrics::FailedProvisionalLoadInfo& failed_load_info, |
69 const page_load_metrics::PageLoadExtraInfo& extra_info) override; | 69 const page_load_metrics::PageLoadExtraInfo& extra_info) override; |
70 | 70 |
71 void OnComplete(const page_load_metrics::PageLoadTiming& timing, | 71 void OnComplete(const page_load_metrics::mojom::PageLoadTiming& timing, |
72 const page_load_metrics::PageLoadExtraInfo& info) override; | 72 const page_load_metrics::PageLoadExtraInfo& info) override; |
73 | 73 |
74 private: | 74 private: |
75 // Records page load timing related metrics available in PageLoadTiming, such | 75 // Records page load timing related metrics available in PageLoadTiming, such |
76 // as first contentful paint. | 76 // as first contentful paint. |
77 void RecordTimingMetrics(const page_load_metrics::PageLoadTiming& timing); | 77 void RecordTimingMetrics( |
| 78 const page_load_metrics::mojom::PageLoadTiming& timing); |
78 | 79 |
79 // Records metrics based on the PageLoadExtraInfo struct, as well as updating | 80 // Records metrics based on the PageLoadExtraInfo struct, as well as updating |
80 // the URL. |app_background_time| should be set to a timestamp if the app was | 81 // the URL. |app_background_time| should be set to a timestamp if the app was |
81 // backgrounded, otherwise it should be set to a null TimeTicks. | 82 // backgrounded, otherwise it should be set to a null TimeTicks. |
82 void RecordPageLoadExtraInfoMetrics( | 83 void RecordPageLoadExtraInfoMetrics( |
83 const page_load_metrics::PageLoadExtraInfo& info, | 84 const page_load_metrics::PageLoadExtraInfo& info, |
84 base::TimeTicks app_background_time); | 85 base::TimeTicks app_background_time); |
85 | 86 |
86 net::NetworkQualityEstimator::NetworkQualityProvider* const | 87 net::NetworkQualityEstimator::NetworkQualityProvider* const |
87 network_quality_provider_; | 88 network_quality_provider_; |
88 | 89 |
89 // Unique UKM identifier for the page load we are recording metrics for. | 90 // Unique UKM identifier for the page load we are recording metrics for. |
90 const int32_t source_id_; | 91 const int32_t source_id_; |
91 | 92 |
92 // Network quality estimates. | 93 // Network quality estimates. |
93 net::EffectiveConnectionType effective_connection_type_ = | 94 net::EffectiveConnectionType effective_connection_type_ = |
94 net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN; | 95 net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN; |
95 base::Optional<base::TimeDelta> http_rtt_estimate_; | 96 base::Optional<base::TimeDelta> http_rtt_estimate_; |
96 base::Optional<base::TimeDelta> transport_rtt_estimate_; | 97 base::Optional<base::TimeDelta> transport_rtt_estimate_; |
97 | 98 |
98 // PAGE_TRANSITION_LINK is the default PageTransition value. | 99 // PAGE_TRANSITION_LINK is the default PageTransition value. |
99 ui::PageTransition page_transition_ = ui::PAGE_TRANSITION_LINK; | 100 ui::PageTransition page_transition_ = ui::PAGE_TRANSITION_LINK; |
100 | 101 |
101 DISALLOW_COPY_AND_ASSIGN(UkmPageLoadMetricsObserver); | 102 DISALLOW_COPY_AND_ASSIGN(UkmPageLoadMetricsObserver); |
102 }; | 103 }; |
103 | 104 |
104 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_UKM_PAGE_LOAD_METRICS_OBSE
RVER_H_ | 105 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_UKM_PAGE_LOAD_METRICS_OBSE
RVER_H_ |
OLD | NEW |