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