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