OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/net/chrome_network_delegate.h" | 5 #include "chrome/browser/net/chrome_network_delegate.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 if (!request->was_cached() && // Don't record cached content | 565 if (!request->was_cached() && // Don't record cached content |
566 received_content_length && // Zero-byte responses aren't useful. | 566 received_content_length && // Zero-byte responses aren't useful. |
567 (is_http || is_https)) { // Only record for HTTP or HTTPS urls. | 567 (is_http || is_https)) { // Only record for HTTP or HTTPS urls. |
568 int64 original_content_length = | 568 int64 original_content_length = |
569 request->response_info().headers->GetInt64HeaderValue( | 569 request->response_info().headers->GetInt64HeaderValue( |
570 "x-original-content-length"); | 570 "x-original-content-length"); |
571 data_reduction_proxy::DataReductionProxyRequestType request_type = | 571 data_reduction_proxy::DataReductionProxyRequestType request_type = |
572 data_reduction_proxy::GetDataReductionProxyRequestType(request); | 572 data_reduction_proxy::GetDataReductionProxyRequestType(request); |
573 | 573 |
574 base::TimeDelta freshness_lifetime = | 574 base::TimeDelta freshness_lifetime = |
575 request->response_info() | 575 request->response_info().headers->GetFreshnessLifetimes( |
576 .headers->GetFreshnessLifetimes( | 576 request->response_info().response_time).freshness; |
577 request->response_info().response_time) | |
578 .fresh; | |
579 int64 adjusted_original_content_length = | 577 int64 adjusted_original_content_length = |
580 data_reduction_proxy::GetAdjustedOriginalContentLength( | 578 data_reduction_proxy::GetAdjustedOriginalContentLength( |
581 request_type, original_content_length, | 579 request_type, original_content_length, |
582 received_content_length); | 580 received_content_length); |
583 AccumulateContentLength(received_content_length, | 581 AccumulateContentLength(received_content_length, |
584 adjusted_original_content_length, | 582 adjusted_original_content_length, |
585 request_type); | 583 request_type); |
586 RecordContentLengthHistograms(received_content_length, | 584 RecordContentLengthHistograms(received_content_length, |
587 original_content_length, | 585 original_content_length, |
588 freshness_lifetime); | 586 freshness_lifetime); |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 if (data_reduction_proxy_statistics_prefs_) { | 818 if (data_reduction_proxy_statistics_prefs_) { |
821 StoreAccumulatedContentLength(received_content_length, | 819 StoreAccumulatedContentLength(received_content_length, |
822 original_content_length, | 820 original_content_length, |
823 request_type, | 821 request_type, |
824 reinterpret_cast<Profile*>(profile_), | 822 reinterpret_cast<Profile*>(profile_), |
825 data_reduction_proxy_statistics_prefs_); | 823 data_reduction_proxy_statistics_prefs_); |
826 } | 824 } |
827 received_content_length_ += received_content_length; | 825 received_content_length_ += received_content_length; |
828 original_content_length_ += original_content_length; | 826 original_content_length_ += original_content_length; |
829 } | 827 } |
OLD | NEW |