| 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 #include "chrome/browser/page_load_metrics/observers/data_reduction_proxy_metric
s_observer.h" | 5 #include "chrome/browser/page_load_metrics/observers/data_reduction_proxy_metric
s_observer.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "base/optional.h" | 10 #include "base/optional.h" |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 base::TimeDelta parse_duration = | 406 base::TimeDelta parse_duration = |
| 407 timing.parse_stop.value() - timing.parse_start.value(); | 407 timing.parse_stop.value() - timing.parse_start.value(); |
| 408 RECORD_HISTOGRAMS_FOR_SUFFIX(data_, parse_duration, | 408 RECORD_HISTOGRAMS_FOR_SUFFIX(data_, parse_duration, |
| 409 internal::kHistogramParseDurationSuffix); | 409 internal::kHistogramParseDurationSuffix); |
| 410 RECORD_HISTOGRAMS_FOR_SUFFIX( | 410 RECORD_HISTOGRAMS_FOR_SUFFIX( |
| 411 data_, timing.parse_blocked_on_script_load_duration.value(), | 411 data_, timing.parse_blocked_on_script_load_duration.value(), |
| 412 internal::kHistogramParseBlockedOnScriptLoadSuffix); | 412 internal::kHistogramParseBlockedOnScriptLoadSuffix); |
| 413 } | 413 } |
| 414 | 414 |
| 415 void DataReductionProxyMetricsObserver::OnLoadedResource( | 415 void DataReductionProxyMetricsObserver::OnLoadedResource( |
| 416 const page_load_metrics::ExtraRequestInfo& extra_request_info) { | 416 const page_load_metrics::ExtraRequestCompleteInfo& extra_request_info) { |
| 417 if (extra_request_info.was_cached) | 417 if (extra_request_info.was_cached) |
| 418 return; | 418 return; |
| 419 original_network_bytes_ += extra_request_info.original_network_content_length; | 419 original_network_bytes_ += extra_request_info.original_network_content_length; |
| 420 network_bytes_ += extra_request_info.raw_body_bytes; | 420 network_bytes_ += extra_request_info.raw_body_bytes; |
| 421 num_network_resources_++; | 421 num_network_resources_++; |
| 422 if (!extra_request_info.data_reduction_proxy_used) | 422 if (!extra_request_info.data_reduction_proxy_used) |
| 423 return; | 423 return; |
| 424 num_data_reduction_proxy_resources_++; | 424 num_data_reduction_proxy_resources_++; |
| 425 network_bytes_proxied_ += extra_request_info.raw_body_bytes; | 425 network_bytes_proxied_ += extra_request_info.raw_body_bytes; |
| 426 } | 426 } |
| 427 | 427 |
| 428 DataReductionProxyPingbackClient* | 428 DataReductionProxyPingbackClient* |
| 429 DataReductionProxyMetricsObserver::GetPingbackClient() const { | 429 DataReductionProxyMetricsObserver::GetPingbackClient() const { |
| 430 return DataReductionProxyChromeSettingsFactory::GetForBrowserContext( | 430 return DataReductionProxyChromeSettingsFactory::GetForBrowserContext( |
| 431 browser_context_) | 431 browser_context_) |
| 432 ->data_reduction_proxy_service() | 432 ->data_reduction_proxy_service() |
| 433 ->pingback_client(); | 433 ->pingback_client(); |
| 434 } | 434 } |
| 435 | 435 |
| 436 } // namespace data_reduction_proxy | 436 } // namespace data_reduction_proxy |
| OLD | NEW |