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

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: Incorporated comments. 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
« no previous file with comments | « net/http/http_response_info.h ('k') | net/http/http_transaction_unittest.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 // This bit is set if the response info has connection info. 84 // This bit is set if the response info has connection info.
85 RESPONSE_INFO_HAS_CONNECTION_INFO = 1 << 18, 85 RESPONSE_INFO_HAS_CONNECTION_INFO = 1 << 18,
86 86
87 // TODO(darin): Add other bits to indicate alternate request methods. 87 // TODO(darin): Add other bits to indicate alternate request methods.
88 // For now, we don't support storing those. 88 // For now, we don't support storing those.
89 }; 89 };
90 90
91 HttpResponseInfo::HttpResponseInfo() 91 HttpResponseInfo::HttpResponseInfo()
92 : was_cached(false), 92 : was_cached(false),
93 server_data_unavailable(false),
93 was_fetched_via_spdy(false), 94 was_fetched_via_spdy(false),
94 was_npn_negotiated(false), 95 was_npn_negotiated(false),
95 was_fetched_via_proxy(false), 96 was_fetched_via_proxy(false),
96 connection_info(CONNECTION_INFO_UNKNOWN) { 97 connection_info(CONNECTION_INFO_UNKNOWN) {
97 } 98 }
98 99
99 HttpResponseInfo::HttpResponseInfo(const HttpResponseInfo& rhs) 100 HttpResponseInfo::HttpResponseInfo(const HttpResponseInfo& rhs)
100 : was_cached(rhs.was_cached), 101 : was_cached(rhs.was_cached),
102 server_data_unavailable(rhs.server_data_unavailable),
101 was_fetched_via_spdy(rhs.was_fetched_via_spdy), 103 was_fetched_via_spdy(rhs.was_fetched_via_spdy),
102 was_npn_negotiated(rhs.was_npn_negotiated), 104 was_npn_negotiated(rhs.was_npn_negotiated),
103 was_fetched_via_proxy(rhs.was_fetched_via_proxy), 105 was_fetched_via_proxy(rhs.was_fetched_via_proxy),
104 socket_address(rhs.socket_address), 106 socket_address(rhs.socket_address),
105 npn_negotiated_protocol(rhs.npn_negotiated_protocol), 107 npn_negotiated_protocol(rhs.npn_negotiated_protocol),
106 connection_info(rhs.connection_info), 108 connection_info(rhs.connection_info),
107 request_time(rhs.request_time), 109 request_time(rhs.request_time),
108 response_time(rhs.response_time), 110 response_time(rhs.response_time),
109 auth_challenge(rhs.auth_challenge), 111 auth_challenge(rhs.auth_challenge),
110 cert_request_info(rhs.cert_request_info), 112 cert_request_info(rhs.cert_request_info),
111 ssl_info(rhs.ssl_info), 113 ssl_info(rhs.ssl_info),
112 headers(rhs.headers), 114 headers(rhs.headers),
113 vary_data(rhs.vary_data), 115 vary_data(rhs.vary_data),
114 metadata(rhs.metadata) { 116 metadata(rhs.metadata) {
115 } 117 }
116 118
117 HttpResponseInfo::~HttpResponseInfo() { 119 HttpResponseInfo::~HttpResponseInfo() {
118 } 120 }
119 121
120 HttpResponseInfo& HttpResponseInfo::operator=(const HttpResponseInfo& rhs) { 122 HttpResponseInfo& HttpResponseInfo::operator=(const HttpResponseInfo& rhs) {
121 was_cached = rhs.was_cached; 123 was_cached = rhs.was_cached;
124 server_data_unavailable = rhs.server_data_unavailable;
122 was_fetched_via_spdy = rhs.was_fetched_via_spdy; 125 was_fetched_via_spdy = rhs.was_fetched_via_spdy;
123 was_npn_negotiated = rhs.was_npn_negotiated; 126 was_npn_negotiated = rhs.was_npn_negotiated;
124 was_fetched_via_proxy = rhs.was_fetched_via_proxy; 127 was_fetched_via_proxy = rhs.was_fetched_via_proxy;
125 socket_address = rhs.socket_address; 128 socket_address = rhs.socket_address;
126 npn_negotiated_protocol = rhs.npn_negotiated_protocol; 129 npn_negotiated_protocol = rhs.npn_negotiated_protocol;
127 request_time = rhs.request_time; 130 request_time = rhs.request_time;
128 response_time = rhs.response_time; 131 response_time = rhs.response_time;
129 auth_challenge = rhs.auth_challenge; 132 auth_challenge = rhs.auth_challenge;
130 cert_request_info = rhs.cert_request_info; 133 cert_request_info = rhs.cert_request_info;
131 ssl_info = rhs.ssl_info; 134 ssl_info = rhs.ssl_info;
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 pickle->WriteUInt16(socket_address.port()); 308 pickle->WriteUInt16(socket_address.port());
306 309
307 if (was_npn_negotiated) 310 if (was_npn_negotiated)
308 pickle->WriteString(npn_negotiated_protocol); 311 pickle->WriteString(npn_negotiated_protocol);
309 312
310 if (connection_info != CONNECTION_INFO_UNKNOWN) 313 if (connection_info != CONNECTION_INFO_UNKNOWN)
311 pickle->WriteInt(static_cast<int>(connection_info)); 314 pickle->WriteInt(static_cast<int>(connection_info));
312 } 315 }
313 316
314 } // namespace net 317 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_response_info.h ('k') | net/http/http_transaction_unittest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698