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

Side by Side Diff: net/http/http_response_info.cc

Issue 2808010: Add field trial stats for alternate_protocol. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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/url_request/url_request.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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/http/http_response_headers.h" 10 #include "net/http/http_response_headers.h"
(...skipping 29 matching lines...) Expand all
40 40
41 // This bit is set if the response was received via SPDY. 41 // This bit is set if the response was received via SPDY.
42 RESPONSE_INFO_WAS_SPDY = 1 << 13, 42 RESPONSE_INFO_WAS_SPDY = 1 << 13,
43 43
44 // This bit is set if the request has NPN negotiated. 44 // This bit is set if the request has NPN negotiated.
45 RESPONSE_INFO_WAS_NPN = 1 << 14, 45 RESPONSE_INFO_WAS_NPN = 1 << 14,
46 46
47 // This bit is set if the request was fetched via an explicit proxy. 47 // This bit is set if the request was fetched via an explicit proxy.
48 RESPONSE_INFO_WAS_PROXY = 1 << 15, 48 RESPONSE_INFO_WAS_PROXY = 1 << 15,
49 49
50 // This bit is set if response could use alternate protocol. However, browser
51 // will ingore the alternate protocol if spdy is not enabled.
52 RESPONSE_INFO_WAS_ALTERNATE_PROTOCOL_AVAILABLE = 1 << 16,
53
50 // TODO(darin): Add other bits to indicate alternate request methods. 54 // TODO(darin): Add other bits to indicate alternate request methods.
51 // For now, we don't support storing those. 55 // For now, we don't support storing those.
52 }; 56 };
53 57
54 HttpResponseInfo::HttpResponseInfo() 58 HttpResponseInfo::HttpResponseInfo()
55 : was_cached(false), 59 : was_cached(false),
56 was_fetched_via_spdy(false), 60 was_fetched_via_spdy(false),
57 was_npn_negotiated(false), 61 was_npn_negotiated(false),
62 was_alternate_protocol_available(false),
58 was_fetched_via_proxy(false) { 63 was_fetched_via_proxy(false) {
59 } 64 }
60 65
61 HttpResponseInfo::~HttpResponseInfo() { 66 HttpResponseInfo::~HttpResponseInfo() {
62 } 67 }
63 68
64 bool HttpResponseInfo::InitFromPickle(const Pickle& pickle, 69 bool HttpResponseInfo::InitFromPickle(const Pickle& pickle,
65 bool* response_truncated) { 70 bool* response_truncated) {
66 void* iter = NULL; 71 void* iter = NULL;
67 72
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 // read vary-data 117 // read vary-data
113 if (flags & RESPONSE_INFO_HAS_VARY_DATA) { 118 if (flags & RESPONSE_INFO_HAS_VARY_DATA) {
114 if (!vary_data.InitFromPickle(pickle, &iter)) 119 if (!vary_data.InitFromPickle(pickle, &iter))
115 return false; 120 return false;
116 } 121 }
117 122
118 was_fetched_via_spdy = (flags & RESPONSE_INFO_WAS_SPDY) != 0; 123 was_fetched_via_spdy = (flags & RESPONSE_INFO_WAS_SPDY) != 0;
119 124
120 was_npn_negotiated = (flags & RESPONSE_INFO_WAS_NPN) != 0; 125 was_npn_negotiated = (flags & RESPONSE_INFO_WAS_NPN) != 0;
121 126
127 was_alternate_protocol_available =
128 (flags & RESPONSE_INFO_WAS_ALTERNATE_PROTOCOL_AVAILABLE) != 0;
129
122 was_fetched_via_proxy = (flags & RESPONSE_INFO_WAS_PROXY) != 0; 130 was_fetched_via_proxy = (flags & RESPONSE_INFO_WAS_PROXY) != 0;
123 131
124 *response_truncated = (flags & RESPONSE_INFO_TRUNCATED) ? true : false; 132 *response_truncated = (flags & RESPONSE_INFO_TRUNCATED) ? true : false;
125 133
126 return true; 134 return true;
127 } 135 }
128 136
129 void HttpResponseInfo::Persist(Pickle* pickle, 137 void HttpResponseInfo::Persist(Pickle* pickle,
130 bool skip_transient_headers, 138 bool skip_transient_headers,
131 bool response_truncated) const { 139 bool response_truncated) const {
132 int flags = RESPONSE_INFO_VERSION; 140 int flags = RESPONSE_INFO_VERSION;
133 if (ssl_info.cert) { 141 if (ssl_info.cert) {
134 flags |= RESPONSE_INFO_HAS_CERT; 142 flags |= RESPONSE_INFO_HAS_CERT;
135 flags |= RESPONSE_INFO_HAS_CERT_STATUS; 143 flags |= RESPONSE_INFO_HAS_CERT_STATUS;
136 } 144 }
137 if (ssl_info.security_bits != -1) 145 if (ssl_info.security_bits != -1)
138 flags |= RESPONSE_INFO_HAS_SECURITY_BITS; 146 flags |= RESPONSE_INFO_HAS_SECURITY_BITS;
139 if (vary_data.is_valid()) 147 if (vary_data.is_valid())
140 flags |= RESPONSE_INFO_HAS_VARY_DATA; 148 flags |= RESPONSE_INFO_HAS_VARY_DATA;
141 if (response_truncated) 149 if (response_truncated)
142 flags |= RESPONSE_INFO_TRUNCATED; 150 flags |= RESPONSE_INFO_TRUNCATED;
143 if (was_fetched_via_spdy) 151 if (was_fetched_via_spdy)
144 flags |= RESPONSE_INFO_WAS_SPDY; 152 flags |= RESPONSE_INFO_WAS_SPDY;
145 if (was_npn_negotiated) 153 if (was_npn_negotiated)
146 flags |= RESPONSE_INFO_WAS_NPN; 154 flags |= RESPONSE_INFO_WAS_NPN;
155 if (was_alternate_protocol_available)
156 flags |= RESPONSE_INFO_WAS_ALTERNATE_PROTOCOL_AVAILABLE;
147 if (was_fetched_via_proxy) 157 if (was_fetched_via_proxy)
148 flags |= RESPONSE_INFO_WAS_PROXY; 158 flags |= RESPONSE_INFO_WAS_PROXY;
149 159
150 pickle->WriteInt(flags); 160 pickle->WriteInt(flags);
151 pickle->WriteInt64(request_time.ToInternalValue()); 161 pickle->WriteInt64(request_time.ToInternalValue());
152 pickle->WriteInt64(response_time.ToInternalValue()); 162 pickle->WriteInt64(response_time.ToInternalValue());
153 163
154 net::HttpResponseHeaders::PersistOptions persist_options = 164 net::HttpResponseHeaders::PersistOptions persist_options =
155 net::HttpResponseHeaders::PERSIST_RAW; 165 net::HttpResponseHeaders::PERSIST_RAW;
156 166
(...skipping 13 matching lines...) Expand all
170 pickle->WriteInt(ssl_info.cert_status); 180 pickle->WriteInt(ssl_info.cert_status);
171 } 181 }
172 if (ssl_info.security_bits != -1) 182 if (ssl_info.security_bits != -1)
173 pickle->WriteInt(ssl_info.security_bits); 183 pickle->WriteInt(ssl_info.security_bits);
174 184
175 if (vary_data.is_valid()) 185 if (vary_data.is_valid())
176 vary_data.Persist(pickle); 186 vary_data.Persist(pickle);
177 } 187 }
178 188
179 } // namespace net 189 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_response_info.h ('k') | net/url_request/url_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698