Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Side by Side Diff: chrome/browser/net/chrome_network_delegate.cc

Issue 455623003: stale-while-revalidate experimental implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 if (!request->was_cached() && // Don't record cached content 563 if (!request->was_cached() && // Don't record cached content
564 received_content_length && // Zero-byte responses aren't useful. 564 received_content_length && // Zero-byte responses aren't useful.
565 (is_http || is_https)) { // Only record for HTTP or HTTPS urls. 565 (is_http || is_https)) { // Only record for HTTP or HTTPS urls.
566 int64 original_content_length = 566 int64 original_content_length =
567 request->response_info().headers->GetInt64HeaderValue( 567 request->response_info().headers->GetInt64HeaderValue(
568 "x-original-content-length"); 568 "x-original-content-length");
569 data_reduction_proxy::DataReductionProxyRequestType request_type = 569 data_reduction_proxy::DataReductionProxyRequestType request_type =
570 data_reduction_proxy::GetDataReductionProxyRequestType(request); 570 data_reduction_proxy::GetDataReductionProxyRequestType(request);
571 571
572 base::TimeDelta freshness_lifetime = 572 base::TimeDelta freshness_lifetime =
573 request->response_info().headers->GetFreshnessLifetime( 573 request->response_info()
574 request->response_info().response_time); 574 .headers->GetFreshnessLifetimes(
575 request->response_info().response_time)
mmenke 2014/10/09 14:29:58 nit: This should use 4-space indent.
576 .fresh;
mmenke 2014/10/09 14:29:58 nit: Think it's more consistent with prevailing s
575 int64 adjusted_original_content_length = 577 int64 adjusted_original_content_length =
576 data_reduction_proxy::GetAdjustedOriginalContentLength( 578 data_reduction_proxy::GetAdjustedOriginalContentLength(
577 request_type, original_content_length, 579 request_type, original_content_length,
578 received_content_length); 580 received_content_length);
579 AccumulateContentLength(received_content_length, 581 AccumulateContentLength(received_content_length,
580 adjusted_original_content_length, 582 adjusted_original_content_length,
581 request_type); 583 request_type);
582 RecordContentLengthHistograms(received_content_length, 584 RecordContentLengthHistograms(received_content_length,
583 original_content_length, 585 original_content_length,
584 freshness_lifetime); 586 freshness_lifetime);
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 if (data_reduction_proxy_statistics_prefs_) { 835 if (data_reduction_proxy_statistics_prefs_) {
834 StoreAccumulatedContentLength(received_content_length, 836 StoreAccumulatedContentLength(received_content_length,
835 original_content_length, 837 original_content_length,
836 request_type, 838 request_type,
837 reinterpret_cast<Profile*>(profile_), 839 reinterpret_cast<Profile*>(profile_),
838 data_reduction_proxy_statistics_prefs_); 840 data_reduction_proxy_statistics_prefs_);
839 } 841 }
840 received_content_length_ += received_content_length; 842 received_content_length_ += received_content_length;
841 original_content_length_ += original_content_length; 843 original_content_length_ += original_content_length;
842 } 844 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698