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

Side by Side 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: Moved new flag to nearer other flags in same file. Created 7 years, 9 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 | Annotate | Revision Log
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 "net/http/http_response_info.h" 5 #include "net/http/http_response_info.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/pickle.h" 8 #include "base/pickle.h"
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "net/base/auth.h" 10 #include "net/base/auth.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 80
81 // This bit is set if the response info has protocol version. 81 // This bit is set if the response info has protocol version.
82 RESPONSE_INFO_HAS_NPN_NEGOTIATED_PROTOCOL = 1 << 17, 82 RESPONSE_INFO_HAS_NPN_NEGOTIATED_PROTOCOL = 1 << 17,
83 83
84 // TODO(darin): Add other bits to indicate alternate request methods. 84 // TODO(darin): Add other bits to indicate alternate request methods.
85 // For now, we don't support storing those. 85 // For now, we don't support storing those.
86 }; 86 };
87 87
88 HttpResponseInfo::HttpResponseInfo() 88 HttpResponseInfo::HttpResponseInfo()
89 : was_cached(false), 89 : was_cached(false),
90 server_data_unavailable(false),
90 was_fetched_via_spdy(false), 91 was_fetched_via_spdy(false),
91 was_npn_negotiated(false), 92 was_npn_negotiated(false),
92 was_fetched_via_proxy(false) { 93 was_fetched_via_proxy(false) {
93 } 94 }
94 95
95 HttpResponseInfo::HttpResponseInfo(const HttpResponseInfo& rhs) 96 HttpResponseInfo::HttpResponseInfo(const HttpResponseInfo& rhs)
96 : was_cached(rhs.was_cached), 97 : was_cached(rhs.was_cached),
98 server_data_unavailable(rhs.server_data_unavailable),
97 was_fetched_via_spdy(rhs.was_fetched_via_spdy), 99 was_fetched_via_spdy(rhs.was_fetched_via_spdy),
98 was_npn_negotiated(rhs.was_npn_negotiated), 100 was_npn_negotiated(rhs.was_npn_negotiated),
99 was_fetched_via_proxy(rhs.was_fetched_via_proxy), 101 was_fetched_via_proxy(rhs.was_fetched_via_proxy),
100 socket_address(rhs.socket_address), 102 socket_address(rhs.socket_address),
101 npn_negotiated_protocol(rhs.npn_negotiated_protocol), 103 npn_negotiated_protocol(rhs.npn_negotiated_protocol),
102 request_time(rhs.request_time), 104 request_time(rhs.request_time),
103 response_time(rhs.response_time), 105 response_time(rhs.response_time),
104 auth_challenge(rhs.auth_challenge), 106 auth_challenge(rhs.auth_challenge),
105 cert_request_info(rhs.cert_request_info), 107 cert_request_info(rhs.cert_request_info),
106 ssl_info(rhs.ssl_info), 108 ssl_info(rhs.ssl_info),
107 headers(rhs.headers), 109 headers(rhs.headers),
108 vary_data(rhs.vary_data), 110 vary_data(rhs.vary_data),
109 metadata(rhs.metadata) { 111 metadata(rhs.metadata) {
110 } 112 }
111 113
112 HttpResponseInfo::~HttpResponseInfo() { 114 HttpResponseInfo::~HttpResponseInfo() {
113 } 115 }
114 116
115 HttpResponseInfo& HttpResponseInfo::operator=(const HttpResponseInfo& rhs) { 117 HttpResponseInfo& HttpResponseInfo::operator=(const HttpResponseInfo& rhs) {
116 was_cached = rhs.was_cached; 118 was_cached = rhs.was_cached;
119 server_data_unavailable = rhs.server_data_unavailable;
117 was_fetched_via_spdy = rhs.was_fetched_via_spdy; 120 was_fetched_via_spdy = rhs.was_fetched_via_spdy;
118 was_npn_negotiated = rhs.was_npn_negotiated; 121 was_npn_negotiated = rhs.was_npn_negotiated;
119 was_fetched_via_proxy = rhs.was_fetched_via_proxy; 122 was_fetched_via_proxy = rhs.was_fetched_via_proxy;
120 socket_address = rhs.socket_address; 123 socket_address = rhs.socket_address;
121 npn_negotiated_protocol = rhs.npn_negotiated_protocol; 124 npn_negotiated_protocol = rhs.npn_negotiated_protocol;
122 request_time = rhs.request_time; 125 request_time = rhs.request_time;
123 response_time = rhs.response_time; 126 response_time = rhs.response_time;
124 auth_challenge = rhs.auth_challenge; 127 auth_challenge = rhs.auth_challenge;
125 cert_request_info = rhs.cert_request_info; 128 cert_request_info = rhs.cert_request_info;
126 ssl_info = rhs.ssl_info; 129 ssl_info = rhs.ssl_info;
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 vary_data.Persist(pickle); 286 vary_data.Persist(pickle);
284 287
285 pickle->WriteString(socket_address.host()); 288 pickle->WriteString(socket_address.host());
286 pickle->WriteUInt16(socket_address.port()); 289 pickle->WriteUInt16(socket_address.port());
287 290
288 if (was_npn_negotiated) 291 if (was_npn_negotiated)
289 pickle->WriteString(npn_negotiated_protocol); 292 pickle->WriteString(npn_negotiated_protocol);
290 } 293 }
291 294
292 } // namespace net 295 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698