| 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_OBSERVERS_DATA_REDUCTION_PROXY_METRICS_
OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_DATA_REDUCTION_PROXY_METRICS_
OBSERVER_H_ |
| 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_DATA_REDUCTION_PROXY_METRICS_
OBSERVER_H_ | 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_DATA_REDUCTION_PROXY_METRICS_
OBSERVER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> |
| 9 |
| 8 #include <memory> | 10 #include <memory> |
| 9 | 11 |
| 10 #include "base/macros.h" | 12 #include "base/macros.h" |
| 11 #include "chrome/browser/page_load_metrics/page_load_metrics_observer.h" | 13 #include "chrome/browser/page_load_metrics/page_load_metrics_observer.h" |
| 12 | 14 |
| 13 namespace content { | 15 namespace content { |
| 14 class BrowserContext; | 16 class BrowserContext; |
| 15 class NavigationHandle; | 17 class NavigationHandle; |
| 16 } | 18 } |
| 17 | 19 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 34 extern const char kHistogramLoadEventFiredSuffix[]; | 36 extern const char kHistogramLoadEventFiredSuffix[]; |
| 35 extern const char kHistogramFirstContentfulPaintSuffix[]; | 37 extern const char kHistogramFirstContentfulPaintSuffix[]; |
| 36 extern const char kHistogramFirstMeaningfulPaintSuffix[]; | 38 extern const char kHistogramFirstMeaningfulPaintSuffix[]; |
| 37 extern const char kHistogramFirstImagePaintSuffix[]; | 39 extern const char kHistogramFirstImagePaintSuffix[]; |
| 38 extern const char kHistogramFirstPaintSuffix[]; | 40 extern const char kHistogramFirstPaintSuffix[]; |
| 39 extern const char kHistogramFirstTextPaintSuffix[]; | 41 extern const char kHistogramFirstTextPaintSuffix[]; |
| 40 extern const char kHistogramParseStartSuffix[]; | 42 extern const char kHistogramParseStartSuffix[]; |
| 41 extern const char kHistogramParseBlockedOnScriptLoadSuffix[]; | 43 extern const char kHistogramParseBlockedOnScriptLoadSuffix[]; |
| 42 extern const char kHistogramParseDurationSuffix[]; | 44 extern const char kHistogramParseDurationSuffix[]; |
| 43 | 45 |
| 46 // Byte and request specific histogram suffixes. |
| 47 extern const char kRequestsPercentProxied[]; |
| 48 extern const char kBytesPercentProxied[]; |
| 49 extern const char kBytesCompressionRatio[]; |
| 50 extern const char kBytesInflationPercent[]; |
| 51 extern const char kNetworkRequests[]; |
| 52 extern const char kRequestsProxied[]; |
| 53 extern const char kRequestsNotProxied[]; |
| 54 extern const char kNetworkBytes[]; |
| 55 extern const char kBytesProxied[]; |
| 56 extern const char kBytesNotProxied[]; |
| 57 extern const char kBytesOriginal[]; |
| 58 extern const char kBytesSavings[]; |
| 59 extern const char kBytesInflation[]; |
| 60 |
| 44 } // namespace internal | 61 } // namespace internal |
| 45 | 62 |
| 46 // Observer responsible for recording core page load metrics releveant to | 63 // Observer responsible for recording core page load metrics releveant to |
| 47 // DataReductionProxy. | 64 // DataReductionProxy. |
| 48 class DataReductionProxyMetricsObserver | 65 class DataReductionProxyMetricsObserver |
| 49 : public page_load_metrics::PageLoadMetricsObserver { | 66 : public page_load_metrics::PageLoadMetricsObserver { |
| 50 public: | 67 public: |
| 51 DataReductionProxyMetricsObserver(); | 68 DataReductionProxyMetricsObserver(); |
| 52 ~DataReductionProxyMetricsObserver() override; | 69 ~DataReductionProxyMetricsObserver() override; |
| 53 | 70 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 83 void OnFirstContentfulPaint( | 100 void OnFirstContentfulPaint( |
| 84 const page_load_metrics::PageLoadTiming& timing, | 101 const page_load_metrics::PageLoadTiming& timing, |
| 85 const page_load_metrics::PageLoadExtraInfo& info) override; | 102 const page_load_metrics::PageLoadExtraInfo& info) override; |
| 86 void OnFirstMeaningfulPaint( | 103 void OnFirstMeaningfulPaint( |
| 87 const page_load_metrics::PageLoadTiming& timing, | 104 const page_load_metrics::PageLoadTiming& timing, |
| 88 const page_load_metrics::PageLoadExtraInfo& info) override; | 105 const page_load_metrics::PageLoadExtraInfo& info) override; |
| 89 void OnParseStart(const page_load_metrics::PageLoadTiming& timing, | 106 void OnParseStart(const page_load_metrics::PageLoadTiming& timing, |
| 90 const page_load_metrics::PageLoadExtraInfo& info) override; | 107 const page_load_metrics::PageLoadExtraInfo& info) override; |
| 91 void OnParseStop(const page_load_metrics::PageLoadTiming& timing, | 108 void OnParseStop(const page_load_metrics::PageLoadTiming& timing, |
| 92 const page_load_metrics::PageLoadExtraInfo& info) override; | 109 const page_load_metrics::PageLoadExtraInfo& info) override; |
| 110 void OnLoadedResource( |
| 111 const page_load_metrics::ExtraRequestInfo& extra_request_info) override; |
| 93 | 112 |
| 94 private: | 113 private: |
| 95 // Sends the page load information to the pingback client. | 114 // Sends the page load information to the pingback client. |
| 96 void SendPingback(const page_load_metrics::PageLoadTiming& timing, | 115 void SendPingback(const page_load_metrics::PageLoadTiming& timing, |
| 97 const page_load_metrics::PageLoadExtraInfo& info); | 116 const page_load_metrics::PageLoadExtraInfo& info); |
| 98 | 117 |
| 118 // Records UMA of page size when the observer is about to be deleted. |
| 119 void RecordPageSizeUMA() const; |
| 120 |
| 99 // Gets the default DataReductionProxyPingbackClient. Overridden in testing. | 121 // Gets the default DataReductionProxyPingbackClient. Overridden in testing. |
| 100 virtual DataReductionProxyPingbackClient* GetPingbackClient() const; | 122 virtual DataReductionProxyPingbackClient* GetPingbackClient() const; |
| 101 | 123 |
| 102 // Data related to this navigation. | 124 // Data related to this navigation. |
| 103 std::unique_ptr<DataReductionProxyData> data_; | 125 std::unique_ptr<DataReductionProxyData> data_; |
| 104 | 126 |
| 105 // The browser context this navigation is operating in. | 127 // The browser context this navigation is operating in. |
| 106 content::BrowserContext* browser_context_; | 128 content::BrowserContext* browser_context_; |
| 107 | 129 |
| 130 // The number of requests that used data reduction proxy. |
| 131 int num_data_reduction_proxy_requests_; |
| 132 |
| 133 // The number of request that did not come from cache. |
| 134 int num_network_requests_; |
| 135 |
| 136 // The total content network bytes that the user would have downloaded if they |
| 137 // were not using data reduction proxy. |
| 138 int64_t original_network_bytes_; |
| 139 |
| 140 // The total network bytes loaded through data reduction proxy. |
| 141 int64_t network_bytes_proxied_; |
| 142 |
| 143 // The total network bytes used. |
| 144 int64_t network_bytes_; |
| 145 |
| 108 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyMetricsObserver); | 146 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyMetricsObserver); |
| 109 }; | 147 }; |
| 110 | 148 |
| 111 } // namespace data_reduction_proxy | 149 } // namespace data_reduction_proxy |
| 112 | 150 |
| 113 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_DATA_REDUCTION_PROXY_METRI
CS_OBSERVER_H_ | 151 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_DATA_REDUCTION_PROXY_METRI
CS_OBSERVER_H_ |
| OLD | NEW |