| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 88 |
| 89 struct NET_EXPORT AlternativeService { | 89 struct NET_EXPORT AlternativeService { |
| 90 AlternativeService() | 90 AlternativeService() |
| 91 : protocol(UNINITIALIZED_ALTERNATE_PROTOCOL), host(), port(0) {} | 91 : protocol(UNINITIALIZED_ALTERNATE_PROTOCOL), host(), port(0) {} |
| 92 | 92 |
| 93 AlternativeService(AlternateProtocol protocol, | 93 AlternativeService(AlternateProtocol protocol, |
| 94 const std::string& host, | 94 const std::string& host, |
| 95 uint16 port) | 95 uint16 port) |
| 96 : protocol(protocol), host(host), port(port) {} | 96 : protocol(protocol), host(host), port(port) {} |
| 97 | 97 |
| 98 AlternativeService(AlternateProtocol protocol, |
| 99 const HostPortPair& host_port_pair) |
| 100 : protocol(protocol), |
| 101 host(host_port_pair.host()), |
| 102 port(host_port_pair.port()) {} |
| 103 |
| 98 AlternativeService(const AlternativeService& alternative_service) = default; | 104 AlternativeService(const AlternativeService& alternative_service) = default; |
| 99 AlternativeService& operator=(const AlternativeService& alternative_service) = | 105 AlternativeService& operator=(const AlternativeService& alternative_service) = |
| 100 default; | 106 default; |
| 101 | 107 |
| 102 bool operator==(const AlternativeService& other) const { | 108 bool operator==(const AlternativeService& other) const { |
| 103 return protocol == other.protocol && host == other.host && | 109 return protocol == other.protocol && host == other.host && |
| 104 port == other.port; | 110 port == other.port; |
| 105 } | 111 } |
| 106 | 112 |
| 107 bool operator<(const AlternativeService& other) const { | 113 bool operator<(const AlternativeService& other) const { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 // Modify SSLConfig to force HTTP/1.1 if necessary. | 210 // Modify SSLConfig to force HTTP/1.1 if necessary. |
| 205 virtual void MaybeForceHTTP11(const HostPortPair& server, | 211 virtual void MaybeForceHTTP11(const HostPortPair& server, |
| 206 SSLConfig* ssl_config) = 0; | 212 SSLConfig* ssl_config) = 0; |
| 207 | 213 |
| 208 // Returns the alternative service for |origin| if it has probability equal to | 214 // Returns the alternative service for |origin| if it has probability equal to |
| 209 // or exceeding threshold, or else the forced AlternateProtocol if there is | 215 // or exceeding threshold, or else the forced AlternateProtocol if there is |
| 210 // one, or else one with UNINITIALIZED_ALTERNATE_PROTOCOL. | 216 // one, or else one with UNINITIALIZED_ALTERNATE_PROTOCOL. |
| 211 virtual AlternativeService GetAlternativeService( | 217 virtual AlternativeService GetAlternativeService( |
| 212 const HostPortPair& origin) = 0; | 218 const HostPortPair& origin) = 0; |
| 213 | 219 |
| 214 // Sets the Alternate-Protocol for |server|. | 220 // Sets the alternative service for |origin|. |
| 215 virtual void SetAlternateProtocol(const HostPortPair& origin, | 221 // TODO(bnc): alternative_service.host is currently ignored, fix it. |
| 216 uint16 alternate_port, | 222 virtual void SetAlternativeService( |
| 217 AlternateProtocol alternate_protocol, | 223 const HostPortPair& origin, |
| 218 double probability) = 0; | 224 const AlternativeService& alternative_service, |
| 225 double alternative_probability) = 0; |
| 219 | 226 |
| 220 // Sets the Alternate-Protocol for |server| to be BROKEN. | 227 // Marks |alternative_service| as broken. |
| 221 virtual void SetBrokenAlternateProtocol(const HostPortPair& origin) = 0; | 228 virtual void MarkAlternativeServiceBroken( |
| 229 const AlternativeService& alternative_service) = 0; |
| 222 | 230 |
| 223 // Marks |alternative_service| as recently broken. | 231 // Marks |alternative_service| as recently broken. |
| 224 virtual void MarkAlternativeServiceRecentlyBroken( | 232 virtual void MarkAlternativeServiceRecentlyBroken( |
| 225 const AlternativeService& alternative_service) = 0; | 233 const AlternativeService& alternative_service) = 0; |
| 226 | 234 |
| 227 // Returns true iff |alternative_service| is currently broken. | 235 // Returns true iff |alternative_service| is currently broken. |
| 228 virtual bool IsAlternativeServiceBroken( | 236 virtual bool IsAlternativeServiceBroken( |
| 229 const AlternativeService& alternative_service) = 0; | 237 const AlternativeService& alternative_service) = 0; |
| 230 | 238 |
| 231 // Returns true if Alternate-Protocol for |server| was recently BROKEN. | 239 // Returns true iff |alternative_service| was recently broken. |
| 232 virtual bool WasAlternateProtocolRecentlyBroken( | 240 virtual bool WasAlternativeServiceRecentlyBroken( |
| 233 const HostPortPair& origin) = 0; | 241 const AlternativeService& alternative_service) = 0; |
| 234 | 242 |
| 235 // Confirms that Alternate-Protocol for |server| is working. | 243 // Confirms that |alternative_service| is working. |
| 236 virtual void ConfirmAlternateProtocol(const HostPortPair& origin) = 0; | 244 virtual void ConfirmAlternativeService( |
| 245 const AlternativeService& alternative_service) = 0; |
| 237 | 246 |
| 238 // Clears the Alternate-Protocol for |server|. | 247 // Clears the alternative service for |origin|. |
| 239 virtual void ClearAlternateProtocol(const HostPortPair& origin) = 0; | 248 virtual void ClearAlternativeService(const HostPortPair& origin) = 0; |
| 240 | 249 |
| 241 // Returns all Alternate-Protocol mappings. | 250 // Returns all Alternate-Protocol mappings. |
| 242 virtual const AlternateProtocolMap& alternate_protocol_map() const = 0; | 251 virtual const AlternateProtocolMap& alternate_protocol_map() const = 0; |
| 243 | 252 |
| 244 // Sets the threshold to be used when evaluating Alternate-Protocol | 253 // Sets the threshold to be used when evaluating alternative service |
| 245 // advertisments. Only advertisements with a with a probability | 254 // advertisments. Only advertisements with a probability greater than or equal |
| 246 // greater than |threshold| will be honored. |threshold| must be | 255 // to |threshold| will be honored. |threshold| must be between 0.0 and 1.0 |
| 247 // between 0 and 1 inclusive. Hence, a threshold of 0 implies that | 256 // inclusive. Hence, a threshold of 0.0 implies that all advertisements will |
| 248 // all advertisements will be honored. | 257 // be honored. |
| 249 virtual void SetAlternateProtocolProbabilityThreshold( | 258 virtual void SetAlternateProtocolProbabilityThreshold( |
| 250 double threshold) = 0; | 259 double threshold) = 0; |
| 251 | 260 |
| 252 // Gets a reference to the SettingsMap stored for a host. | 261 // Gets a reference to the SettingsMap stored for a host. |
| 253 // If no settings are stored, returns an empty SettingsMap. | 262 // If no settings are stored, returns an empty SettingsMap. |
| 254 virtual const SettingsMap& GetSpdySettings( | 263 virtual const SettingsMap& GetSpdySettings( |
| 255 const HostPortPair& host_port_pair) = 0; | 264 const HostPortPair& host_port_pair) = 0; |
| 256 | 265 |
| 257 // Saves an individual SPDY setting for a host. Returns true if SPDY setting | 266 // Saves an individual SPDY setting for a host. Returns true if SPDY setting |
| 258 // is to be persisted. | 267 // is to be persisted. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 283 | 292 |
| 284 virtual const ServerNetworkStatsMap& server_network_stats_map() const = 0; | 293 virtual const ServerNetworkStatsMap& server_network_stats_map() const = 0; |
| 285 | 294 |
| 286 private: | 295 private: |
| 287 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); | 296 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); |
| 288 }; | 297 }; |
| 289 | 298 |
| 290 } // namespace net | 299 } // namespace net |
| 291 | 300 |
| 292 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ | 301 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ |
| OLD | NEW |