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

Unified Diff: chrome/browser/net/chrome_network_delegate.cc

Issue 154243006: Add GetExpirationTimes() to HttpResponseHeader. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remediate to review Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/http/http_response_headers.h » ('j') | net/http/http_response_headers.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/chrome_network_delegate.cc
diff --git a/chrome/browser/net/chrome_network_delegate.cc b/chrome/browser/net/chrome_network_delegate.cc
index 747f670bfc10b753149a2e07a67728e818375ee4..5a1b9f77e36d458286543edfd40f49e119dd2008 100644
--- a/chrome/browser/net/chrome_network_delegate.cc
+++ b/chrome/browser/net/chrome_network_delegate.cc
@@ -6,6 +6,7 @@
#include <stdlib.h>
+#include <limits>
#include <vector>
#include "base/base_paths.h"
@@ -272,7 +273,8 @@ void StoreAccumulatedContentLength(
void RecordContentLengthHistograms(
int64 received_content_length,
int64 original_content_length,
- const base::TimeDelta& freshness_lifetime) {
+ base::TimeDelta freshness_lifetime,
+ bool has_finite_freshness_lifetime) {
#if defined(OS_ANDROID)
// Add the current resource to these histograms only when a valid
// X-Original-Content-Length header is present.
@@ -293,8 +295,12 @@ void RecordContentLengthHistograms(
original_content_length);
UMA_HISTOGRAM_COUNTS("Net.HttpContentLengthDifference",
original_content_length - received_content_length);
+
+ const double freshness_lifetime_seconds =
+ has_finite_freshness_lifetime ? freshness_lifetime.InSeconds() :
+ std::numeric_limit<double>::max();
UMA_HISTOGRAM_CUSTOM_COUNTS("Net.HttpContentFreshnessLifetime",
- freshness_lifetime.InSeconds(),
+ freshness_lifetime_seconds,
base::TimeDelta::FromHours(1).InSeconds(),
base::TimeDelta::FromDays(30).InSeconds(),
100);
@@ -576,9 +582,6 @@ void ChromeNetworkDelegate::OnCompleted(net::URLRequest* request,
spdyproxy::DataReductionRequestType data_reduction_type =
spdyproxy::GetDataReductionRequestType(request);
- base::TimeDelta freshness_lifetime =
- request->response_info().headers->GetFreshnessLifetime(
- request->response_info().response_time);
int64 adjusted_original_content_length =
spdyproxy::GetAdjustedOriginalContentLength(
data_reduction_type, original_content_length,
@@ -586,9 +589,15 @@ void ChromeNetworkDelegate::OnCompleted(net::URLRequest* request,
AccumulateContentLength(received_content_length,
adjusted_original_content_length,
data_reduction_type);
+ base::TimeDelta freshness_lifetime;
+ bool has_finite_freshness_lifetime;
+ request->response_info().headers->GetFreshnessLifetime(
+ request->response_info().response_time,
+ &freshness_lifetime, &has_finite_freshness_lifetime);
RecordContentLengthHistograms(received_content_length,
original_content_length,
- freshness_lifetime);
+ freshness_lifetime,
+ has_finite_freshness_lifetime);
DVLOG(2) << __FUNCTION__
<< " received content length: " << received_content_length
<< " original content length: " << original_content_length
« no previous file with comments | « no previous file | net/http/http_response_headers.h » ('j') | net/http/http_response_headers.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698