| 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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<url::SchemeHostPort, AlternativeServiceInfoVector> | 207 typedef base::MRUCache<url::SchemeHostPort, AlternativeServiceInfoVector> |
| 208 AlternativeServiceMap; | 208 AlternativeServiceMap; |
| 209 typedef base::MRUCache<HostPortPair, SettingsMap> SpdySettingsMap; | 209 typedef base::MRUCache<url::SchemeHostPort, SettingsMap> SpdySettingsMap; |
| 210 typedef base::MRUCache<HostPortPair, ServerNetworkStats> ServerNetworkStatsMap; | 210 typedef base::MRUCache<url::SchemeHostPort, ServerNetworkStats> |
| 211 ServerNetworkStatsMap; |
| 211 typedef base::MRUCache<QuicServerId, std::string> QuicServerInfoMap; | 212 typedef base::MRUCache<QuicServerId, std::string> QuicServerInfoMap; |
| 212 | 213 |
| 213 // Persist 5 QUIC Servers. This is mainly used by cronet. | 214 // Persist 5 QUIC Servers. This is mainly used by cronet. |
| 214 const int kMaxQuicServersToPersist = 5; | 215 const int kMaxQuicServersToPersist = 5; |
| 215 | 216 |
| 216 extern const char kAlternateProtocolHeader[]; | 217 extern const char kAlternateProtocolHeader[]; |
| 217 extern const char kAlternativeServiceHeader[]; | 218 extern const char kAlternativeServiceHeader[]; |
| 218 | 219 |
| 219 // The interface for setting/retrieving the HTTP server properties. | 220 // The interface for setting/retrieving the HTTP server properties. |
| 220 // Currently, this class manages servers': | 221 // Currently, this class manages servers': |
| (...skipping 13 matching lines...) Expand all Loading... |
| 234 virtual base::WeakPtr<HttpServerProperties> GetWeakPtr() = 0; | 235 virtual base::WeakPtr<HttpServerProperties> GetWeakPtr() = 0; |
| 235 | 236 |
| 236 // Deletes all data. | 237 // Deletes all data. |
| 237 virtual void Clear() = 0; | 238 virtual void Clear() = 0; |
| 238 | 239 |
| 239 // Returns true if |server| supports a network protocol which honors | 240 // Returns true if |server| supports a network protocol which honors |
| 240 // request prioritization. | 241 // request prioritization. |
| 241 virtual bool SupportsRequestPriority(const url::SchemeHostPort& server) = 0; | 242 virtual bool SupportsRequestPriority(const url::SchemeHostPort& server) = 0; |
| 242 | 243 |
| 243 // Returns the value set by SetSupportsSpdy(). If not set, returns false. | 244 // Returns the value set by SetSupportsSpdy(). If not set, returns false. |
| 244 virtual bool GetSupportsSpdy(const HostPortPair& server) = 0; | 245 virtual bool GetSupportsSpdy(const url::SchemeHostPort& server) = 0; |
| 245 | 246 |
| 246 // Add |server| into the persistent store. Should only be called from IO | 247 // Add |server| into the persistent store. Should only be called from IO |
| 247 // thread. | 248 // thread. |
| 248 virtual void SetSupportsSpdy(const HostPortPair& server, | 249 virtual void SetSupportsSpdy(const url::SchemeHostPort& server, |
| 249 bool support_spdy) = 0; | 250 bool support_spdy) = 0; |
| 250 | 251 |
| 251 // Returns true if |server| has required HTTP/1.1 via HTTP/2 error code. | 252 // Returns true if |server| has required HTTP/1.1 via HTTP/2 error code. |
| 252 virtual bool RequiresHTTP11(const HostPortPair& server) = 0; | 253 virtual bool RequiresHTTP11(const HostPortPair& server) = 0; |
| 253 | 254 |
| 254 // Require HTTP/1.1 on subsequent connections. Not persisted. | 255 // Require HTTP/1.1 on subsequent connections. Not persisted. |
| 255 virtual void SetHTTP11Required(const HostPortPair& server) = 0; | 256 virtual void SetHTTP11Required(const HostPortPair& server) = 0; |
| 256 | 257 |
| 257 // Modify SSLConfig to force HTTP/1.1. | 258 // Modify SSLConfig to force HTTP/1.1. |
| 258 static void ForceHTTP11(SSLConfig* ssl_config); | 259 static void ForceHTTP11(SSLConfig* ssl_config); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 // Returned alternative services may have empty hostnames. | 316 // Returned alternative services may have empty hostnames. |
| 316 virtual const AlternativeServiceMap& alternative_service_map() const = 0; | 317 virtual const AlternativeServiceMap& alternative_service_map() const = 0; |
| 317 | 318 |
| 318 // Returns all alternative service mappings as human readable strings. | 319 // Returns all alternative service mappings as human readable strings. |
| 319 // Empty alternative service hostnames will be printed as such. | 320 // Empty alternative service hostnames will be printed as such. |
| 320 virtual scoped_ptr<base::Value> GetAlternativeServiceInfoAsValue() const = 0; | 321 virtual scoped_ptr<base::Value> GetAlternativeServiceInfoAsValue() const = 0; |
| 321 | 322 |
| 322 // Gets a reference to the SettingsMap stored for a host. | 323 // Gets a reference to the SettingsMap stored for a host. |
| 323 // If no settings are stored, returns an empty SettingsMap. | 324 // If no settings are stored, returns an empty SettingsMap. |
| 324 virtual const SettingsMap& GetSpdySettings( | 325 virtual const SettingsMap& GetSpdySettings( |
| 325 const HostPortPair& host_port_pair) = 0; | 326 const url::SchemeHostPort& origin) = 0; |
| 326 | 327 |
| 327 // Saves an individual SPDY setting for a host. Returns true if SPDY setting | 328 // Saves an individual SPDY setting for a host. Returns true if SPDY setting |
| 328 // is to be persisted. | 329 // is to be persisted. |
| 329 virtual bool SetSpdySetting(const HostPortPair& host_port_pair, | 330 virtual bool SetSpdySetting(const url::SchemeHostPort& origin, |
| 330 SpdySettingsIds id, | 331 SpdySettingsIds id, |
| 331 SpdySettingsFlags flags, | 332 SpdySettingsFlags flags, |
| 332 uint32_t value) = 0; | 333 uint32_t value) = 0; |
| 333 | 334 |
| 334 // Clears all SPDY settings for a host. | 335 // Clears all SPDY settings for a host. |
| 335 virtual void ClearSpdySettings(const HostPortPair& host_port_pair) = 0; | 336 virtual void ClearSpdySettings(const url::SchemeHostPort& origin) = 0; |
| 336 | 337 |
| 337 // Clears all SPDY settings for all hosts. | 338 // Clears all SPDY settings for all hosts. |
| 338 virtual void ClearAllSpdySettings() = 0; | 339 virtual void ClearAllSpdySettings() = 0; |
| 339 | 340 |
| 340 // Returns all persistent SPDY settings. | 341 // Returns all persistent SPDY settings. |
| 341 virtual const SpdySettingsMap& spdy_settings_map() const = 0; | 342 virtual const SpdySettingsMap& spdy_settings_map() const = 0; |
| 342 | 343 |
| 343 virtual bool GetSupportsQuic(IPAddress* last_address) const = 0; | 344 virtual bool GetSupportsQuic(IPAddress* last_address) const = 0; |
| 344 | 345 |
| 345 virtual void SetSupportsQuic(bool used_quic, | 346 virtual void SetSupportsQuic(bool used_quic, |
| 346 const IPAddress& last_address) = 0; | 347 const IPAddress& last_address) = 0; |
| 347 | 348 |
| 348 // Sets |stats| for |host_port_pair|. | 349 // Sets |stats| for |origin|. |
| 349 virtual void SetServerNetworkStats(const HostPortPair& host_port_pair, | 350 virtual void SetServerNetworkStats(const url::SchemeHostPort& origin, |
| 350 ServerNetworkStats stats) = 0; | 351 ServerNetworkStats stats) = 0; |
| 351 | 352 |
| 352 virtual const ServerNetworkStats* GetServerNetworkStats( | 353 virtual const ServerNetworkStats* GetServerNetworkStats( |
| 353 const HostPortPair& host_port_pair) = 0; | 354 const url::SchemeHostPort& origin) = 0; |
| 354 | 355 |
| 355 virtual const ServerNetworkStatsMap& server_network_stats_map() const = 0; | 356 virtual const ServerNetworkStatsMap& server_network_stats_map() const = 0; |
| 356 | 357 |
| 357 // Save QuicServerInfo (in std::string form) for the given |server_id|. | 358 // Save QuicServerInfo (in std::string form) for the given |server_id|. |
| 358 // Returns true if the value has changed otherwise it returns false. | 359 // Returns true if the value has changed otherwise it returns false. |
| 359 virtual bool SetQuicServerInfo(const QuicServerId& server_id, | 360 virtual bool SetQuicServerInfo(const QuicServerId& server_id, |
| 360 const std::string& server_info) = 0; | 361 const std::string& server_info) = 0; |
| 361 | 362 |
| 362 // Get QuicServerInfo (in std::string form) for the given |server_id|. | 363 // Get QuicServerInfo (in std::string form) for the given |server_id|. |
| 363 virtual const std::string* GetQuicServerInfo( | 364 virtual const std::string* GetQuicServerInfo( |
| 364 const QuicServerId& server_id) = 0; | 365 const QuicServerId& server_id) = 0; |
| 365 | 366 |
| 366 // Returns all persistent QuicServerInfo objects. | 367 // Returns all persistent QuicServerInfo objects. |
| 367 virtual const QuicServerInfoMap& quic_server_info_map() const = 0; | 368 virtual const QuicServerInfoMap& quic_server_info_map() const = 0; |
| 368 | 369 |
| 369 // Returns the number of server configs (QuicServerInfo objects) persisted. | 370 // Returns the number of server configs (QuicServerInfo objects) persisted. |
| 370 virtual size_t max_server_configs_stored_in_properties() const = 0; | 371 virtual size_t max_server_configs_stored_in_properties() const = 0; |
| 371 | 372 |
| 372 // Sets the number of server configs (QuicServerInfo objects) to be persisted. | 373 // Sets the number of server configs (QuicServerInfo objects) to be persisted. |
| 373 virtual void SetMaxServerConfigsStoredInProperties( | 374 virtual void SetMaxServerConfigsStoredInProperties( |
| 374 size_t max_server_configs_stored_in_properties) = 0; | 375 size_t max_server_configs_stored_in_properties) = 0; |
| 375 | 376 |
| 376 private: | 377 private: |
| 377 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); | 378 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); |
| 378 }; | 379 }; |
| 379 | 380 |
| 380 } // namespace net | 381 } // namespace net |
| 381 | 382 |
| 382 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ | 383 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ |
| OLD | NEW |