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

Side by Side Diff: net/http/http_server_properties.h

Issue 2901093004: Add and persist a new field in AlternativeServiceInfo to list QUIC verisons advertised (Closed)
Patch Set: self review Created 3 years, 7 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
« no previous file with comments | « net/http/http_network_transaction_unittest.cc ('k') | net/http/http_server_properties.cc » ('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 #ifndef NET_HTTP_HTTP_SERVER_PROPERTIES_H_ 5 #ifndef NET_HTTP_HTTP_SERVER_PROPERTIES_H_
6 #define NET_HTTP_HTTP_SERVER_PROPERTIES_H_ 6 #define NET_HTTP_HTTP_SERVER_PROPERTIES_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 #include <ostream> 11 #include <ostream>
12 #include <string> 12 #include <string>
13 #include <tuple> 13 #include <tuple>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/containers/mru_cache.h" 16 #include "base/containers/mru_cache.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/time/time.h" 18 #include "base/time/time.h"
19 #include "net/base/host_port_pair.h" 19 #include "net/base/host_port_pair.h"
20 #include "net/base/net_export.h" 20 #include "net/base/net_export.h"
21 #include "net/quic/core/quic_bandwidth.h" 21 #include "net/quic/core/quic_bandwidth.h"
22 #include "net/quic/core/quic_server_id.h" 22 #include "net/quic/core/quic_server_id.h"
23 #include "net/quic/core/quic_versions.h"
23 #include "net/socket/next_proto.h" 24 #include "net/socket/next_proto.h"
24 #include "net/spdy/core/spdy_framer.h" // TODO(willchan): Reconsider this. 25 #include "net/spdy/core/spdy_framer.h" // TODO(willchan): Reconsider this.
25 #include "net/spdy/core/spdy_protocol.h" 26 #include "net/spdy/core/spdy_protocol.h"
26 #include "url/scheme_host_port.h" 27 #include "url/scheme_host_port.h"
27 28
28 namespace base { 29 namespace base {
29 class Value; 30 class Value;
30 } 31 }
31 32
32 namespace net { 33 namespace net {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 NextProto protocol; 109 NextProto protocol;
109 std::string host; 110 std::string host;
110 uint16_t port; 111 uint16_t port;
111 }; 112 };
112 113
113 NET_EXPORT_PRIVATE std::ostream& operator<<( 114 NET_EXPORT_PRIVATE std::ostream& operator<<(
114 std::ostream& os, 115 std::ostream& os,
115 const AlternativeService& alternative_service); 116 const AlternativeService& alternative_service);
116 117
117 struct NET_EXPORT AlternativeServiceInfo { 118 struct NET_EXPORT AlternativeServiceInfo {
118 AlternativeServiceInfo() : alternative_service() {} 119 AlternativeServiceInfo();
120 ~AlternativeServiceInfo();
119 121
122 // HTTP/2 Alternative Service.
120 AlternativeServiceInfo(const AlternativeService& alternative_service, 123 AlternativeServiceInfo(const AlternativeService& alternative_service,
121 base::Time expiration) 124 base::Time expiration);
Ryan Hamilton 2017/05/24 19:52:53 Does anything use this constructor? SetAlternative
Zhongyi Shi 2017/05/24 22:44:54 SetAlternativeService uses the second, SetAlternat
Ryan Hamilton 2017/05/24 23:12:12 Can SpdySession create a QUIC Alt-Svc?
122 : alternative_service(alternative_service),
123 expiration(expiration) {}
124 125
125 AlternativeServiceInfo(NextProto protocol, 126 // QUIC Alternative Service.
Ryan Hamilton 2017/05/24 19:52:53 I'm not sure these two comments are accurate. I do
Zhongyi Shi 2017/05/24 22:44:55 Done.
126 const std::string& host, 127 AlternativeServiceInfo(const AlternativeService& alternative_service,
127 uint16_t port, 128 base::Time expiration,
128 base::Time expiration) 129 const QuicVersionVector& advertised_versions);
129 : alternative_service(protocol, host, port), expiration(expiration) {}
130 130
131 AlternativeServiceInfo( 131 AlternativeServiceInfo(
132 const AlternativeServiceInfo& alternative_service_info) = default; 132 const AlternativeServiceInfo& alternative_service_info);
133
133 AlternativeServiceInfo& operator=( 134 AlternativeServiceInfo& operator=(
134 const AlternativeServiceInfo& alternative_service_info) = default; 135 const AlternativeServiceInfo& alternative_service_info) = default;
Ryan Hamilton 2017/05/24 19:52:53 (I'm surprised that you don't get a compiler compl
135 136
137 // TODO(zhongyi): add equality check on |advertised_versions| once it
138 // is persisted to disk.
Ryan Hamilton 2017/05/24 19:52:54 Why not do this now?
Zhongyi Shi 2017/05/24 22:44:54 Ah, apparently I forgot to give a heads-up on this
Ryan Hamilton 2017/05/24 23:12:12 Heh. OK. Any reason not to land this?
136 bool operator==(const AlternativeServiceInfo& other) const { 139 bool operator==(const AlternativeServiceInfo& other) const {
137 return alternative_service == other.alternative_service && 140 return alternative_service == other.alternative_service &&
138 expiration == other.expiration; 141 expiration == other.expiration;
139 } 142 }
140 143
141 bool operator!=(const AlternativeServiceInfo& other) const { 144 bool operator!=(const AlternativeServiceInfo& other) const {
142 return !this->operator==(other); 145 return !this->operator==(other);
143 } 146 }
144 147
145 std::string ToString() const; 148 std::string ToString() const;
146 149
147 AlternativeService alternative_service; 150 AlternativeService alternative_service;
148 base::Time expiration; 151 base::Time expiration;
152 QuicVersionVector advertised_versions;
149 }; 153 };
150 154
151 struct NET_EXPORT SupportsQuic { 155 struct NET_EXPORT SupportsQuic {
152 SupportsQuic() : used_quic(false) {} 156 SupportsQuic() : used_quic(false) {}
153 SupportsQuic(bool used_quic, const std::string& address) 157 SupportsQuic(bool used_quic, const std::string& address)
154 : used_quic(used_quic), 158 : used_quic(used_quic),
155 address(address) {} 159 address(address) {}
156 160
157 bool Equals(const SupportsQuic& other) const { 161 bool Equals(const SupportsQuic& other) const {
158 return used_quic == other.used_quic && address == other.address; 162 return used_quic == other.used_quic && address == other.address;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 const url::SchemeHostPort& origin) = 0; 248 const url::SchemeHostPort& origin) = 0;
245 249
246 // Set a single alternative service for |origin|. Previous alternative 250 // Set a single alternative service for |origin|. Previous alternative
247 // services for |origin| are discarded. 251 // services for |origin| are discarded.
248 // |alternative_service.host| may be empty. 252 // |alternative_service.host| may be empty.
249 // Return true if |alternative_service_map_| has changed significantly enough 253 // Return true if |alternative_service_map_| has changed significantly enough
250 // that it should be persisted to disk. 254 // that it should be persisted to disk.
251 virtual bool SetAlternativeService( 255 virtual bool SetAlternativeService(
252 const url::SchemeHostPort& origin, 256 const url::SchemeHostPort& origin,
253 const AlternativeService& alternative_service, 257 const AlternativeService& alternative_service,
254 base::Time expiration) = 0; 258 base::Time expiration,
259 const QuicVersionVector& advertised_versions) = 0;
255 260
256 // Set alternative services for |origin|. Previous alternative services for 261 // Set alternative services for |origin|. Previous alternative services for
257 // |origin| are discarded. 262 // |origin| are discarded.
258 // Hostnames in |alternative_service_info_vector| may be empty. 263 // Hostnames in |alternative_service_info_vector| may be empty.
259 // |alternative_service_info_vector| may be empty. 264 // |alternative_service_info_vector| may be empty.
260 // Return true if |alternative_service_map_| has changed significantly enough 265 // Return true if |alternative_service_map_| has changed significantly enough
261 // that it should be persisted to disk. 266 // that it should be persisted to disk.
262 virtual bool SetAlternativeServices( 267 virtual bool SetAlternativeServices(
263 const url::SchemeHostPort& origin, 268 const url::SchemeHostPort& origin,
264 const AlternativeServiceInfoVector& alternative_service_info_vector) = 0; 269 const AlternativeServiceInfoVector& alternative_service_info_vector) = 0;
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 // Returns whether HttpServerProperties is initialized. 342 // Returns whether HttpServerProperties is initialized.
338 virtual bool IsInitialized() const = 0; 343 virtual bool IsInitialized() const = 0;
339 344
340 private: 345 private:
341 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); 346 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties);
342 }; 347 };
343 348
344 } // namespace net 349 } // namespace net
345 350
346 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ 351 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_
OLDNEW
« no previous file with comments | « net/http/http_network_transaction_unittest.cc ('k') | net/http/http_server_properties.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698