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 <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 return port < other.port; | 112 return port < other.port; |
113 } | 113 } |
114 | 114 |
115 AlternateProtocol protocol; | 115 AlternateProtocol protocol; |
116 std::string host; | 116 std::string host; |
117 uint16 port; | 117 uint16 port; |
118 }; | 118 }; |
119 | 119 |
120 struct NET_EXPORT AlternateProtocolInfo { | 120 struct NET_EXPORT AlternateProtocolInfo { |
121 AlternateProtocolInfo() | 121 AlternateProtocolInfo() |
122 : port(0), | 122 : port(0), protocol(UNINITIALIZED_ALTERNATE_PROTOCOL), probability(0) {} |
123 protocol(UNINITIALIZED_ALTERNATE_PROTOCOL), | |
124 probability(0), | |
125 is_broken(false) {} | |
126 | 123 |
127 AlternateProtocolInfo(uint16 port, | 124 AlternateProtocolInfo(uint16 port, |
128 AlternateProtocol protocol, | 125 AlternateProtocol protocol, |
129 double probability) | 126 double probability) |
130 : port(port), | 127 : port(port), protocol(protocol), probability(probability) {} |
131 protocol(protocol), | |
132 probability(probability), | |
133 is_broken(false) {} | |
134 | |
135 AlternateProtocolInfo(uint16 port, | |
136 AlternateProtocol protocol, | |
137 double probability, | |
138 bool is_broken) | |
139 : port(port), | |
140 protocol(protocol), | |
141 probability(probability), | |
142 is_broken(is_broken) {} | |
143 | 128 |
144 bool Equals(const AlternateProtocolInfo& other) const { | 129 bool Equals(const AlternateProtocolInfo& other) const { |
145 return port == other.port && | 130 return port == other.port && |
146 protocol == other.protocol && | 131 protocol == other.protocol && |
147 probability == other.probability; | 132 probability == other.probability; |
148 } | 133 } |
149 | 134 |
150 std::string ToString() const; | 135 std::string ToString() const; |
151 | 136 |
152 uint16 port; | 137 uint16 port; |
153 AlternateProtocol protocol; | 138 AlternateProtocol protocol; |
154 double probability; | 139 double probability; |
155 bool is_broken; | |
156 }; | 140 }; |
157 | 141 |
158 struct NET_EXPORT SupportsQuic { | 142 struct NET_EXPORT SupportsQuic { |
159 SupportsQuic() : used_quic(false) {} | 143 SupportsQuic() : used_quic(false) {} |
160 SupportsQuic(bool used_quic, const std::string& address) | 144 SupportsQuic(bool used_quic, const std::string& address) |
161 : used_quic(used_quic), | 145 : used_quic(used_quic), |
162 address(address) {} | 146 address(address) {} |
163 | 147 |
164 bool Equals(const SupportsQuic& other) const { | 148 bool Equals(const SupportsQuic& other) const { |
165 return used_quic == other.used_quic && address == other.address; | 149 return used_quic == other.used_quic && address == other.address; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 | 213 |
230 // Sets the Alternate-Protocol for |server|. | 214 // Sets the Alternate-Protocol for |server|. |
231 virtual void SetAlternateProtocol(const HostPortPair& server, | 215 virtual void SetAlternateProtocol(const HostPortPair& server, |
232 uint16 alternate_port, | 216 uint16 alternate_port, |
233 AlternateProtocol alternate_protocol, | 217 AlternateProtocol alternate_protocol, |
234 double probability) = 0; | 218 double probability) = 0; |
235 | 219 |
236 // Sets the Alternate-Protocol for |server| to be BROKEN. | 220 // Sets the Alternate-Protocol for |server| to be BROKEN. |
237 virtual void SetBrokenAlternateProtocol(const HostPortPair& server) = 0; | 221 virtual void SetBrokenAlternateProtocol(const HostPortPair& server) = 0; |
238 | 222 |
| 223 // Returns true iff |alternative_service| is currently broken. |
| 224 virtual bool IsAlternativeServiceBroken( |
| 225 const AlternativeService& alternative_service) = 0; |
| 226 |
239 // Returns true if Alternate-Protocol for |server| was recently BROKEN. | 227 // Returns true if Alternate-Protocol for |server| was recently BROKEN. |
240 virtual bool WasAlternateProtocolRecentlyBroken( | 228 virtual bool WasAlternateProtocolRecentlyBroken( |
241 const HostPortPair& server) = 0; | 229 const HostPortPair& server) = 0; |
242 | 230 |
243 // Confirms that Alternate-Protocol for |server| is working. | 231 // Confirms that Alternate-Protocol for |server| is working. |
244 virtual void ConfirmAlternateProtocol(const HostPortPair& server) = 0; | 232 virtual void ConfirmAlternateProtocol(const HostPortPair& server) = 0; |
245 | 233 |
246 // Clears the Alternate-Protocol for |server|. | 234 // Clears the Alternate-Protocol for |server|. |
247 virtual void ClearAlternateProtocol(const HostPortPair& server) = 0; | 235 virtual void ClearAlternateProtocol(const HostPortPair& server) = 0; |
248 | 236 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 | 279 |
292 virtual const ServerNetworkStatsMap& server_network_stats_map() const = 0; | 280 virtual const ServerNetworkStatsMap& server_network_stats_map() const = 0; |
293 | 281 |
294 private: | 282 private: |
295 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); | 283 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); |
296 }; | 284 }; |
297 | 285 |
298 } // namespace net | 286 } // namespace net |
299 | 287 |
300 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ | 288 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ |
OLD | NEW |