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