OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_bypa
ss_stats.h" | 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_bypa
ss_stats.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "base/metrics/sparse_histogram.h" | 9 #include "base/metrics/sparse_histogram.h" |
10 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
ig.h" | 10 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_conf
ig.h" |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 successful_requests_through_proxy_count_ <= | 234 successful_requests_through_proxy_count_ <= |
235 kMaxSuccessfulRequestsWhenUnavailable); | 235 kMaxSuccessfulRequestsWhenUnavailable); |
236 if (prev_unavailable != unavailable_) | 236 if (prev_unavailable != unavailable_) |
237 unreachable_callback_.Run(unavailable_); | 237 unreachable_callback_.Run(unavailable_); |
238 } | 238 } |
239 | 239 |
240 void DataReductionProxyBypassStats::RecordBypassedBytesHistograms( | 240 void DataReductionProxyBypassStats::RecordBypassedBytesHistograms( |
241 const net::URLRequest& request, | 241 const net::URLRequest& request, |
242 bool data_reduction_proxy_enabled, | 242 bool data_reduction_proxy_enabled, |
243 const net::ProxyConfig& data_reduction_proxy_config) { | 243 const net::ProxyConfig& data_reduction_proxy_config) { |
244 int64 content_length = request.received_response_content_length(); | 244 int64_t content_length = request.received_response_content_length(); |
245 | 245 |
246 // Only record histograms when the data reduction proxy is enabled. | 246 // Only record histograms when the data reduction proxy is enabled. |
247 if (!data_reduction_proxy_enabled) | 247 if (!data_reduction_proxy_enabled) |
248 return; | 248 return; |
249 | 249 |
250 // TODO(bengr): Add histogram(s) for byte counts of unsupported schemes, e.g., | 250 // TODO(bengr): Add histogram(s) for byte counts of unsupported schemes, e.g., |
251 // ws and wss. | 251 // ws and wss. |
252 if (!request.url().SchemeIsHTTPOrHTTPS()) | 252 if (!request.url().SchemeIsHTTPOrHTTPS()) |
253 return; | 253 return; |
254 | 254 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 } | 379 } |
380 | 380 |
381 void DataReductionProxyBypassStats::OnNetworkChanged( | 381 void DataReductionProxyBypassStats::OnNetworkChanged( |
382 NetworkChangeNotifier::ConnectionType type) { | 382 NetworkChangeNotifier::ConnectionType type) { |
383 ClearRequestCounts(); | 383 ClearRequestCounts(); |
384 } | 384 } |
385 | 385 |
386 void DataReductionProxyBypassStats::RecordBypassedBytes( | 386 void DataReductionProxyBypassStats::RecordBypassedBytes( |
387 DataReductionProxyBypassType bypass_type, | 387 DataReductionProxyBypassType bypass_type, |
388 DataReductionProxyBypassStats::BypassedBytesType bypassed_bytes_type, | 388 DataReductionProxyBypassStats::BypassedBytesType bypassed_bytes_type, |
389 int64 content_length) { | 389 int64_t content_length) { |
390 // Individual histograms are needed to count the bypassed bytes for each | 390 // Individual histograms are needed to count the bypassed bytes for each |
391 // bypass type so that we can see the size of requests. This helps us | 391 // bypass type so that we can see the size of requests. This helps us |
392 // remove outliers that would skew the sum of bypassed bytes for each type. | 392 // remove outliers that would skew the sum of bypassed bytes for each type. |
393 switch (bypassed_bytes_type) { | 393 switch (bypassed_bytes_type) { |
394 case DataReductionProxyBypassStats::NOT_BYPASSED: | 394 case DataReductionProxyBypassStats::NOT_BYPASSED: |
395 UMA_HISTOGRAM_COUNTS( | 395 UMA_HISTOGRAM_COUNTS( |
396 "DataReductionProxy.BypassedBytes.NotBypassed", content_length); | 396 "DataReductionProxy.BypassedBytes.NotBypassed", content_length); |
397 break; | 397 break; |
398 case DataReductionProxyBypassStats::SSL: | 398 case DataReductionProxyBypassStats::SSL: |
399 UMA_HISTOGRAM_COUNTS( | 399 UMA_HISTOGRAM_COUNTS( |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 content_length); | 512 content_length); |
513 break; | 513 break; |
514 default: | 514 default: |
515 break; | 515 break; |
516 } | 516 } |
517 break; | 517 break; |
518 } | 518 } |
519 } | 519 } |
520 | 520 |
521 } // namespace data_reduction_proxy | 521 } // namespace data_reduction_proxy |
OLD | NEW |