Index: net/http/http_response_headers.cc |
diff --git a/net/http/http_response_headers.cc b/net/http/http_response_headers.cc |
index 4ffed825b05888b8122b8deb8eb913bfe1ed72ad..84b22b56b95dbb9e719804a9ed583b4581304acf 100644 |
--- a/net/http/http_response_headers.cc |
+++ b/net/http/http_response_headers.cc |
@@ -966,15 +966,15 @@ ValidationType HttpResponseHeaders::RequiresValidation( |
const Time& response_time, |
const Time& current_time) const { |
FreshnessLifetimes lifetimes = GetFreshnessLifetimes(response_time); |
- if (lifetimes.fresh == TimeDelta() && lifetimes.stale == TimeDelta()) |
+ if (lifetimes.freshness == TimeDelta() && lifetimes.staleness == TimeDelta()) |
return VALIDATION_SYNCHRONOUS; |
TimeDelta age = GetCurrentAge(request_time, response_time, current_time); |
- if (lifetimes.fresh > age) |
+ if (lifetimes.freshness > age) |
return VALIDATION_NONE; |
- if (lifetimes.fresh + lifetimes.stale > age) |
+ if (lifetimes.freshness + lifetimes.staleness > age) |
return VALIDATION_ASYNCHRONOUS; |
return VALIDATION_SYNCHRONOUS; |
@@ -1001,7 +1001,7 @@ ValidationType HttpResponseHeaders::RequiresValidation( |
// freshness_lifetime = (date_value - last_modified_value) * 0.10 |
// |
// If the stale-while-revalidate directive is present, then it is used to set |
-// the |stale| time, unless it overridden by another directive. |
+// the |staleness| time, unless it overridden by another directive. |
// |
HttpResponseHeaders::FreshnessLifetimes |
HttpResponseHeaders::GetFreshnessLifetimes(const Time& response_time) const { |
@@ -1020,14 +1020,14 @@ HttpResponseHeaders::GetFreshnessLifetimes(const Time& response_time) const { |
// Cache-Control directive must_revalidate overrides stale-while-revalidate. |
bool must_revalidate = HasHeaderValue("cache-control", "must-revalidate"); |
- if (must_revalidate || !GetStaleWhileRevalidateValue(&lifetimes.stale)) |
- DCHECK(lifetimes.stale == TimeDelta()); |
+ if (must_revalidate || !GetStaleWhileRevalidateValue(&lifetimes.staleness)) |
+ DCHECK(lifetimes.staleness == TimeDelta()); |
mmenke
2014/10/20 14:41:08
WHile you're here, should probably use DCHECK_EQ h
mmenke
2014/10/20 14:41:08
Also, seems safest to use braces when the body of
Adam Rice
2014/10/21 09:26:14
Done.
Adam Rice
2014/10/21 09:26:14
I did it, but it got a little bit out of control.
mmenke
2014/10/21 14:20:09
I hadn't realized TimeDeltas did not support displ
|
// NOTE: "Cache-Control: max-age" overrides Expires, so we only check the |
// Expires header after checking for max-age in GetFreshnessLifetimes. This |
// is important since "Expires: <date in the past>" means not fresh, but |
// it should not trump a max-age value. |
- if (GetMaxAgeValue(&lifetimes.fresh)) |
+ if (GetMaxAgeValue(&lifetimes.freshness)) |
return lifetimes; |
// If there is no Date header, then assume that the server response was |
@@ -1040,11 +1040,11 @@ HttpResponseHeaders::GetFreshnessLifetimes(const Time& response_time) const { |
if (GetExpiresValue(&expires_value)) { |
// The expires value can be a date in the past! |
if (expires_value > date_value) { |
- lifetimes.fresh = expires_value - date_value; |
+ lifetimes.freshness = expires_value - date_value; |
return lifetimes; |
} |
- DCHECK(lifetimes.fresh == TimeDelta()); |
+ DCHECK(lifetimes.freshness == TimeDelta()); |
return lifetimes; |
} |
@@ -1079,7 +1079,7 @@ HttpResponseHeaders::GetFreshnessLifetimes(const Time& response_time) const { |
if (GetLastModifiedValue(&last_modified_value)) { |
// The last-modified value can be a date in the future! |
if (last_modified_value <= date_value) { |
- lifetimes.fresh = (date_value - last_modified_value) / 10; |
+ lifetimes.freshness = (date_value - last_modified_value) / 10; |
return lifetimes; |
} |
} |
@@ -1088,15 +1088,15 @@ HttpResponseHeaders::GetFreshnessLifetimes(const Time& response_time) const { |
// These responses are implicitly fresh (unless otherwise overruled): |
if (response_code_ == 300 || response_code_ == 301 || response_code_ == 308 || |
response_code_ == 410) { |
- lifetimes.fresh = TimeDelta::Max(); |
- lifetimes.stale = TimeDelta(); // It should never be stale. |
+ lifetimes.freshness = TimeDelta::Max(); |
+ lifetimes.staleness = TimeDelta(); // It should never be stale. |
return lifetimes; |
} |
// Our heuristic freshness estimate for this resource is 0 seconds, in |
// accordance with common browser behaviour. However, stale-while-revalidate |
// may still apply. |
- DCHECK(lifetimes.fresh == TimeDelta()); |
+ DCHECK(lifetimes.freshness == TimeDelta()); |
return lifetimes; |
} |