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

Unified Diff: net/http/http_response_info.cc

Issue 12310075: Cache failover to LOAD_PREFERRING_CACHE if network response suggests offline. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Incorporated most comments; responded with questions to a few. Created 7 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
Index: net/http/http_response_info.cc
diff --git a/net/http/http_response_info.cc b/net/http/http_response_info.cc
index 9c33ab4f53e8b0bef1ef03cb6c82cf16f7b6152a..a70f1403489a6f838ef2b3c5fb868c1e4d39b1b9 100644
--- a/net/http/http_response_info.cc
+++ b/net/http/http_response_info.cc
@@ -81,12 +81,17 @@ enum {
// This bit is set if the response info has protocol version.
RESPONSE_INFO_HAS_NPN_NEGOTIATED_PROTOCOL = 1 << 17,
+ // This bit is set if the request was overriden from cache due to
+ // various load flags being set.
+ RESPONSE_INFO_WAS_CACHE_OVERRIDE = 1 << 18,
+
// TODO(darin): Add other bits to indicate alternate request methods.
// For now, we don't support storing those.
};
HttpResponseInfo::HttpResponseInfo()
: was_cached(false),
+ was_cache_override(false),
was_fetched_via_spdy(false),
was_npn_negotiated(false),
was_fetched_via_proxy(false) {
@@ -94,6 +99,7 @@ HttpResponseInfo::HttpResponseInfo()
HttpResponseInfo::HttpResponseInfo(const HttpResponseInfo& rhs)
: was_cached(rhs.was_cached),
+ was_cache_override(rhs.was_cache_override),
was_fetched_via_spdy(rhs.was_fetched_via_spdy),
was_npn_negotiated(rhs.was_npn_negotiated),
was_fetched_via_proxy(rhs.was_fetched_via_proxy),
@@ -114,6 +120,7 @@ HttpResponseInfo::~HttpResponseInfo() {
HttpResponseInfo& HttpResponseInfo::operator=(const HttpResponseInfo& rhs) {
was_cached = rhs.was_cached;
+ was_cache_override = rhs.was_cache_override;
was_fetched_via_spdy = rhs.was_fetched_via_spdy;
was_npn_negotiated = rhs.was_npn_negotiated;
was_fetched_via_proxy = rhs.was_fetched_via_proxy;
@@ -215,6 +222,8 @@ bool HttpResponseInfo::InitFromPickle(const Pickle& pickle,
return false;
}
+ was_cache_override = (flags & RESPONSE_INFO_WAS_CACHE_OVERRIDE) != 0;
+
was_fetched_via_spdy = (flags & RESPONSE_INFO_WAS_SPDY) != 0;
was_npn_negotiated = (flags & RESPONSE_INFO_WAS_NPN) != 0;
@@ -242,6 +251,8 @@ void HttpResponseInfo::Persist(Pickle* pickle,
flags |= RESPONSE_INFO_HAS_VARY_DATA;
if (response_truncated)
flags |= RESPONSE_INFO_TRUNCATED;
+ if (was_cache_override)
+ flags |= RESPONSE_INFO_WAS_CACHE_OVERRIDE;
if (was_fetched_via_spdy)
flags |= RESPONSE_INFO_WAS_SPDY;
if (was_npn_negotiated) {

Powered by Google App Engine
This is Rietveld 408576698