| 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 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 base::TimeDelta parse_duration = timing.parse_timing.parse_stop.value() - | 411 base::TimeDelta parse_duration = timing.parse_timing.parse_stop.value() - |
| 412 timing.parse_timing.parse_start.value(); | 412 timing.parse_timing.parse_start.value(); |
| 413 RECORD_HISTOGRAMS_FOR_SUFFIX(data_, parse_duration, | 413 RECORD_HISTOGRAMS_FOR_SUFFIX(data_, parse_duration, |
| 414 internal::kHistogramParseDurationSuffix); | 414 internal::kHistogramParseDurationSuffix); |
| 415 RECORD_HISTOGRAMS_FOR_SUFFIX( | 415 RECORD_HISTOGRAMS_FOR_SUFFIX( |
| 416 data_, timing.parse_timing.parse_blocked_on_script_load_duration.value(), | 416 data_, timing.parse_timing.parse_blocked_on_script_load_duration.value(), |
| 417 internal::kHistogramParseBlockedOnScriptLoadSuffix); | 417 internal::kHistogramParseBlockedOnScriptLoadSuffix); |
| 418 } | 418 } |
| 419 | 419 |
| 420 void DataReductionProxyMetricsObserver::OnLoadedResource( | 420 void DataReductionProxyMetricsObserver::OnLoadedResource( |
| 421 const page_load_metrics::ExtraRequestInfo& extra_request_info) { | 421 const page_load_metrics::ExtraRequestCompleteInfo& |
| 422 if (extra_request_info.was_cached) | 422 extra_request_complete_info) { |
| 423 if (extra_request_complete_info.was_cached) |
| 423 return; | 424 return; |
| 424 original_network_bytes_ += extra_request_info.original_network_content_length; | 425 original_network_bytes_ += |
| 425 network_bytes_ += extra_request_info.raw_body_bytes; | 426 extra_request_complete_info.original_network_content_length; |
| 427 network_bytes_ += extra_request_complete_info.raw_body_bytes; |
| 426 num_network_resources_++; | 428 num_network_resources_++; |
| 427 if (!extra_request_info.data_reduction_proxy_used) | 429 if (!extra_request_complete_info.data_reduction_proxy_used) |
| 428 return; | 430 return; |
| 429 num_data_reduction_proxy_resources_++; | 431 num_data_reduction_proxy_resources_++; |
| 430 network_bytes_proxied_ += extra_request_info.raw_body_bytes; | 432 network_bytes_proxied_ += extra_request_complete_info.raw_body_bytes; |
| 431 } | 433 } |
| 432 | 434 |
| 433 DataReductionProxyPingbackClient* | 435 DataReductionProxyPingbackClient* |
| 434 DataReductionProxyMetricsObserver::GetPingbackClient() const { | 436 DataReductionProxyMetricsObserver::GetPingbackClient() const { |
| 435 return DataReductionProxyChromeSettingsFactory::GetForBrowserContext( | 437 return DataReductionProxyChromeSettingsFactory::GetForBrowserContext( |
| 436 browser_context_) | 438 browser_context_) |
| 437 ->data_reduction_proxy_service() | 439 ->data_reduction_proxy_service() |
| 438 ->pingback_client(); | 440 ->pingback_client(); |
| 439 } | 441 } |
| 440 | 442 |
| 441 } // namespace data_reduction_proxy | 443 } // namespace data_reduction_proxy |
| OLD | NEW |