OLD | NEW |
---|---|
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 Loading... | |
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 |
120 AlternativeServiceInfo(const AlternativeService& alternative_service, | 122 AlternativeServiceInfo(const AlternativeService& alternative_service, |
121 base::Time expiration) | 123 base::Time expiration); |
122 : alternative_service(alternative_service), | |
123 expiration(expiration) {} | |
124 | |
125 AlternativeServiceInfo(NextProto protocol, | |
126 const std::string& host, | |
127 uint16_t port, | |
128 base::Time expiration) | |
129 : alternative_service(protocol, host, port), expiration(expiration) {} | |
130 | 124 |
131 AlternativeServiceInfo( | 125 AlternativeServiceInfo( |
132 const AlternativeServiceInfo& alternative_service_info) = default; | 126 const AlternativeServiceInfo& alternative_service_info); |
127 | |
133 AlternativeServiceInfo& operator=( | 128 AlternativeServiceInfo& operator=( |
134 const AlternativeServiceInfo& alternative_service_info) = default; | 129 const AlternativeServiceInfo& alternative_service_info); |
135 | 130 |
131 // TODO(zhongyi): add equality check on |advertised_versions| once it | |
132 // is persisted to disk. | |
Ryan Hamilton
2017/05/25 22:01:45
I'm not sure I understand why we can't do this now
Zhongyi Shi
2017/06/06 22:04:52
Done.
Ah, we definitely can do this together. I wa
| |
136 bool operator==(const AlternativeServiceInfo& other) const { | 133 bool operator==(const AlternativeServiceInfo& other) const { |
137 return alternative_service == other.alternative_service && | 134 return alternative_service == other.alternative_service && |
138 expiration == other.expiration; | 135 expiration == other.expiration; |
139 } | 136 } |
140 | 137 |
141 bool operator!=(const AlternativeServiceInfo& other) const { | 138 bool operator!=(const AlternativeServiceInfo& other) const { |
142 return !this->operator==(other); | 139 return !this->operator==(other); |
143 } | 140 } |
144 | 141 |
145 std::string ToString() const; | 142 std::string ToString() const; |
146 | 143 |
147 AlternativeService alternative_service; | 144 AlternativeService alternative_service; |
148 base::Time expiration; | 145 base::Time expiration; |
146 QuicVersionVector advertised_versions; | |
149 }; | 147 }; |
150 | 148 |
151 struct NET_EXPORT SupportsQuic { | 149 struct NET_EXPORT SupportsQuic { |
152 SupportsQuic() : used_quic(false) {} | 150 SupportsQuic() : used_quic(false) {} |
153 SupportsQuic(bool used_quic, const std::string& address) | 151 SupportsQuic(bool used_quic, const std::string& address) |
154 : used_quic(used_quic), | 152 : used_quic(used_quic), |
155 address(address) {} | 153 address(address) {} |
156 | 154 |
157 bool Equals(const SupportsQuic& other) const { | 155 bool Equals(const SupportsQuic& other) const { |
158 return used_quic == other.used_quic && address == other.address; | 156 return used_quic == other.used_quic && address == other.address; |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
337 // Returns whether HttpServerProperties is initialized. | 335 // Returns whether HttpServerProperties is initialized. |
338 virtual bool IsInitialized() const = 0; | 336 virtual bool IsInitialized() const = 0; |
339 | 337 |
340 private: | 338 private: |
341 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); | 339 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); |
342 }; | 340 }; |
343 | 341 |
344 } // namespace net | 342 } // namespace net |
345 | 343 |
346 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ | 344 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ |
OLD | NEW |