| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 bool operator!=(const ServerNetworkStats& other) const { | 197 bool operator!=(const ServerNetworkStats& other) const { |
| 198 return !this->operator==(other); | 198 return !this->operator==(other); |
| 199 } | 199 } |
| 200 | 200 |
| 201 base::TimeDelta srtt; | 201 base::TimeDelta srtt; |
| 202 QuicBandwidth bandwidth_estimate; | 202 QuicBandwidth bandwidth_estimate; |
| 203 }; | 203 }; |
| 204 | 204 |
| 205 typedef std::vector<AlternativeService> AlternativeServiceVector; | 205 typedef std::vector<AlternativeService> AlternativeServiceVector; |
| 206 typedef std::vector<AlternativeServiceInfo> AlternativeServiceInfoVector; | 206 typedef std::vector<AlternativeServiceInfo> AlternativeServiceInfoVector; |
| 207 typedef base::MRUCache<HostPortPair, AlternativeServiceInfoVector> | 207 typedef base::MRUCache<url::SchemeHostPort, AlternativeServiceInfoVector> |
| 208 AlternativeServiceMap; | 208 AlternativeServiceMap; |
| 209 typedef base::MRUCache<url::SchemeHostPort, SettingsMap> SpdySettingsMap; | 209 typedef base::MRUCache<url::SchemeHostPort, SettingsMap> SpdySettingsMap; |
| 210 typedef base::MRUCache<url::SchemeHostPort, ServerNetworkStats> | 210 typedef base::MRUCache<url::SchemeHostPort, ServerNetworkStats> |
| 211 ServerNetworkStatsMap; | 211 ServerNetworkStatsMap; |
| 212 typedef base::MRUCache<QuicServerId, std::string> QuicServerInfoMap; | 212 typedef base::MRUCache<QuicServerId, std::string> QuicServerInfoMap; |
| 213 | 213 |
| 214 // Persist 5 QUIC Servers. This is mainly used by cronet. | 214 // Persist 5 QUIC Servers. This is mainly used by cronet. |
| 215 const int kMaxQuicServersToPersist = 5; | 215 const int kMaxQuicServersToPersist = 5; |
| 216 | 216 |
| 217 extern const char kAlternateProtocolHeader[]; | 217 extern const char kAlternateProtocolHeader[]; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 // Modify SSLConfig to force HTTP/1.1. | 258 // Modify SSLConfig to force HTTP/1.1. |
| 259 static void ForceHTTP11(SSLConfig* ssl_config); | 259 static void ForceHTTP11(SSLConfig* ssl_config); |
| 260 | 260 |
| 261 // Modify SSLConfig to force HTTP/1.1 if necessary. | 261 // Modify SSLConfig to force HTTP/1.1 if necessary. |
| 262 virtual void MaybeForceHTTP11(const HostPortPair& server, | 262 virtual void MaybeForceHTTP11(const HostPortPair& server, |
| 263 SSLConfig* ssl_config) = 0; | 263 SSLConfig* ssl_config) = 0; |
| 264 | 264 |
| 265 // Return all alternative services for |origin|, including broken ones. | 265 // Return all alternative services for |origin|, including broken ones. |
| 266 // Returned alternative services never have empty hostnames. | 266 // Returned alternative services never have empty hostnames. |
| 267 virtual AlternativeServiceVector GetAlternativeServices( | 267 virtual AlternativeServiceVector GetAlternativeServices( |
| 268 const HostPortPair& origin) = 0; | 268 const url::SchemeHostPort& origin) = 0; |
| 269 | 269 |
| 270 // Set a single alternative service for |origin|. Previous alternative | 270 // Set a single alternative service for |origin|. Previous alternative |
| 271 // services for |origin| are discarded. | 271 // services for |origin| are discarded. |
| 272 // |alternative_service.host| may be empty. | 272 // |alternative_service.host| may be empty. |
| 273 // Return true if |alternative_service_map_| is changed. | 273 // Return true if |alternative_service_map_| is changed. |
| 274 virtual bool SetAlternativeService( | 274 virtual bool SetAlternativeService( |
| 275 const HostPortPair& origin, | 275 const url::SchemeHostPort& origin, |
| 276 const AlternativeService& alternative_service, | 276 const AlternativeService& alternative_service, |
| 277 base::Time expiration) = 0; | 277 base::Time expiration) = 0; |
| 278 | 278 |
| 279 // Set alternative services for |origin|. Previous alternative services for | 279 // Set alternative services for |origin|. Previous alternative services for |
| 280 // |origin| are discarded. | 280 // |origin| are discarded. |
| 281 // Hostnames in |alternative_service_info_vector| may be empty. | 281 // Hostnames in |alternative_service_info_vector| may be empty. |
| 282 // Return true if |alternative_service_map_| is changed. | 282 // Return true if |alternative_service_map_| is changed. |
| 283 virtual bool SetAlternativeServices( | 283 virtual bool SetAlternativeServices( |
| 284 const HostPortPair& origin, | 284 const url::SchemeHostPort& origin, |
| 285 const AlternativeServiceInfoVector& alternative_service_info_vector) = 0; | 285 const AlternativeServiceInfoVector& alternative_service_info_vector) = 0; |
| 286 | 286 |
| 287 // Marks |alternative_service| as broken. | 287 // Marks |alternative_service| as broken. |
| 288 // |alternative_service.host| must not be empty. | 288 // |alternative_service.host| must not be empty. |
| 289 virtual void MarkAlternativeServiceBroken( | 289 virtual void MarkAlternativeServiceBroken( |
| 290 const AlternativeService& alternative_service) = 0; | 290 const AlternativeService& alternative_service) = 0; |
| 291 | 291 |
| 292 // Marks |alternative_service| as recently broken. | 292 // Marks |alternative_service| as recently broken. |
| 293 // |alternative_service.host| must not be empty. | 293 // |alternative_service.host| must not be empty. |
| 294 virtual void MarkAlternativeServiceRecentlyBroken( | 294 virtual void MarkAlternativeServiceRecentlyBroken( |
| 295 const AlternativeService& alternative_service) = 0; | 295 const AlternativeService& alternative_service) = 0; |
| 296 | 296 |
| 297 // Returns true iff |alternative_service| is currently broken. | 297 // Returns true iff |alternative_service| is currently broken. |
| 298 // |alternative_service.host| must not be empty. | 298 // |alternative_service.host| must not be empty. |
| 299 virtual bool IsAlternativeServiceBroken( | 299 virtual bool IsAlternativeServiceBroken( |
| 300 const AlternativeService& alternative_service) const = 0; | 300 const AlternativeService& alternative_service) const = 0; |
| 301 | 301 |
| 302 // Returns true iff |alternative_service| was recently broken. | 302 // Returns true iff |alternative_service| was recently broken. |
| 303 // |alternative_service.host| must not be empty. | 303 // |alternative_service.host| must not be empty. |
| 304 virtual bool WasAlternativeServiceRecentlyBroken( | 304 virtual bool WasAlternativeServiceRecentlyBroken( |
| 305 const AlternativeService& alternative_service) = 0; | 305 const AlternativeService& alternative_service) = 0; |
| 306 | 306 |
| 307 // Confirms that |alternative_service| is working. | 307 // Confirms that |alternative_service| is working. |
| 308 // |alternative_service.host| must not be empty. | 308 // |alternative_service.host| must not be empty. |
| 309 virtual void ConfirmAlternativeService( | 309 virtual void ConfirmAlternativeService( |
| 310 const AlternativeService& alternative_service) = 0; | 310 const AlternativeService& alternative_service) = 0; |
| 311 | 311 |
| 312 // Clear all alternative services for |origin|. | 312 // Clear all alternative services for |origin|. |
| 313 virtual void ClearAlternativeServices(const HostPortPair& origin) = 0; | 313 virtual void ClearAlternativeServices(const url::SchemeHostPort& origin) = 0; |
| 314 | 314 |
| 315 // Returns all alternative service mappings. | 315 // Returns all alternative service mappings. |
| 316 // Returned alternative services may have empty hostnames. | 316 // Returned alternative services may have empty hostnames. |
| 317 virtual const AlternativeServiceMap& alternative_service_map() const = 0; | 317 virtual const AlternativeServiceMap& alternative_service_map() const = 0; |
| 318 | 318 |
| 319 // Returns all alternative service mappings as human readable strings. | 319 // Returns all alternative service mappings as human readable strings. |
| 320 // Empty alternative service hostnames will be printed as such. | 320 // Empty alternative service hostnames will be printed as such. |
| 321 virtual std::unique_ptr<base::Value> GetAlternativeServiceInfoAsValue() | 321 virtual std::unique_ptr<base::Value> GetAlternativeServiceInfoAsValue() |
| 322 const = 0; | 322 const = 0; |
| 323 | 323 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 virtual void SetMaxServerConfigsStoredInProperties( | 375 virtual void SetMaxServerConfigsStoredInProperties( |
| 376 size_t max_server_configs_stored_in_properties) = 0; | 376 size_t max_server_configs_stored_in_properties) = 0; |
| 377 | 377 |
| 378 private: | 378 private: |
| 379 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); | 379 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); |
| 380 }; | 380 }; |
| 381 | 381 |
| 382 } // namespace net | 382 } // namespace net |
| 383 | 383 |
| 384 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ | 384 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ |
| OLD | NEW |