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

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: Remove --disable-stale-while-revalidate flag and strengthen must-revalidate. Created 6 years, 3 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 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 if (!request->was_cached() && // Don't record cached content 564 if (!request->was_cached() && // Don't record cached content
565 received_content_length && // Zero-byte responses aren't useful. 565 received_content_length && // Zero-byte responses aren't useful.
566 (is_http || is_https)) { // Only record for HTTP or HTTPS urls. 566 (is_http || is_https)) { // Only record for HTTP or HTTPS urls.
567 int64 original_content_length = 567 int64 original_content_length =
568 request->response_info().headers->GetInt64HeaderValue( 568 request->response_info().headers->GetInt64HeaderValue(
569 "x-original-content-length"); 569 "x-original-content-length");
570 data_reduction_proxy::DataReductionProxyRequestType request_type = 570 data_reduction_proxy::DataReductionProxyRequestType request_type =
571 data_reduction_proxy::GetDataReductionProxyRequestType(request); 571 data_reduction_proxy::GetDataReductionProxyRequestType(request);
572 572
573 base::TimeDelta freshness_lifetime = 573 base::TimeDelta freshness_lifetime =
574 request->response_info().headers->GetFreshnessLifetime( 574 request->response_info()
575 request->response_info().response_time); 575 .headers->GetFreshnessLifetimes(
576 request->response_info().response_time)
577 .fresh;
576 int64 adjusted_original_content_length = 578 int64 adjusted_original_content_length =
577 data_reduction_proxy::GetAdjustedOriginalContentLength( 579 data_reduction_proxy::GetAdjustedOriginalContentLength(
578 request_type, original_content_length, 580 request_type, original_content_length,
579 received_content_length); 581 received_content_length);
580 AccumulateContentLength(received_content_length, 582 AccumulateContentLength(received_content_length,
581 adjusted_original_content_length, 583 adjusted_original_content_length,
582 request_type); 584 request_type);
583 RecordContentLengthHistograms(received_content_length, 585 RecordContentLengthHistograms(received_content_length,
584 original_content_length, 586 original_content_length,
585 freshness_lifetime); 587 freshness_lifetime);
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 data_reduction_proxy::DataReductionProxyRequestType request_type) { 819 data_reduction_proxy::DataReductionProxyRequestType request_type) {
818 DCHECK_GE(received_content_length, 0); 820 DCHECK_GE(received_content_length, 0);
819 DCHECK_GE(original_content_length, 0); 821 DCHECK_GE(original_content_length, 0);
820 StoreAccumulatedContentLength(received_content_length, 822 StoreAccumulatedContentLength(received_content_length,
821 original_content_length, 823 original_content_length,
822 request_type, 824 request_type,
823 reinterpret_cast<Profile*>(profile_)); 825 reinterpret_cast<Profile*>(profile_));
824 received_content_length_ += received_content_length; 826 received_content_length_ += received_content_length;
825 original_content_length_ += original_content_length; 827 original_content_length_ += original_content_length;
826 } 828 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698