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