| 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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 if (!request->was_cached() && // Don't record cached content | 566 if (!request->was_cached() && // Don't record cached content |
| 567 received_content_length && // Zero-byte responses aren't useful. | 567 received_content_length && // Zero-byte responses aren't useful. |
| 568 (is_http || is_https)) { // Only record for HTTP or HTTPS urls. | 568 (is_http || is_https)) { // Only record for HTTP or HTTPS urls. |
| 569 int64 original_content_length = | 569 int64 original_content_length = |
| 570 request->response_info().headers->GetInt64HeaderValue( | 570 request->response_info().headers->GetInt64HeaderValue( |
| 571 "x-original-content-length"); | 571 "x-original-content-length"); |
| 572 data_reduction_proxy::DataReductionProxyRequestType request_type = | 572 data_reduction_proxy::DataReductionProxyRequestType request_type = |
| 573 data_reduction_proxy::GetDataReductionProxyRequestType(request); | 573 data_reduction_proxy::GetDataReductionProxyRequestType(request); |
| 574 | 574 |
| 575 base::TimeDelta freshness_lifetime = | 575 base::TimeDelta freshness_lifetime = |
| 576 request->response_info() | 576 request->response_info().headers->GetFreshnessLifetimes( |
| 577 .headers->GetFreshnessLifetimes( | 577 request->response_info().response_time).freshness; |
| 578 request->response_info().response_time) | |
| 579 .fresh; | |
| 580 int64 adjusted_original_content_length = | 578 int64 adjusted_original_content_length = |
| 581 data_reduction_proxy::GetAdjustedOriginalContentLength( | 579 data_reduction_proxy::GetAdjustedOriginalContentLength( |
| 582 request_type, original_content_length, | 580 request_type, original_content_length, |
| 583 received_content_length); | 581 received_content_length); |
| 584 AccumulateContentLength(received_content_length, | 582 AccumulateContentLength(received_content_length, |
| 585 adjusted_original_content_length, | 583 adjusted_original_content_length, |
| 586 request_type); | 584 request_type); |
| 587 RecordContentLengthHistograms(received_content_length, | 585 RecordContentLengthHistograms(received_content_length, |
| 588 original_content_length, | 586 original_content_length, |
| 589 freshness_lifetime); | 587 freshness_lifetime); |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 838 if (data_reduction_proxy_statistics_prefs_) { | 836 if (data_reduction_proxy_statistics_prefs_) { |
| 839 StoreAccumulatedContentLength(received_content_length, | 837 StoreAccumulatedContentLength(received_content_length, |
| 840 original_content_length, | 838 original_content_length, |
| 841 request_type, | 839 request_type, |
| 842 reinterpret_cast<Profile*>(profile_), | 840 reinterpret_cast<Profile*>(profile_), |
| 843 data_reduction_proxy_statistics_prefs_); | 841 data_reduction_proxy_statistics_prefs_); |
| 844 } | 842 } |
| 845 received_content_length_ += received_content_length; | 843 received_content_length_ += received_content_length; |
| 846 original_content_length_ += original_content_length; | 844 original_content_length_ += original_content_length; |
| 847 } | 845 } |
| OLD | NEW |