| 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_IMPL_H_ | 5 #ifndef NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ |
| 6 #define NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ | 6 #define NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 size_t max_size) const; | 48 size_t max_size) const; |
| 49 | 49 |
| 50 // Returns flattened string representation of the |host_port_pair|. Used by | 50 // Returns flattened string representation of the |host_port_pair|. Used by |
| 51 // unittests. | 51 // unittests. |
| 52 static std::string GetFlattenedSpdyServer( | 52 static std::string GetFlattenedSpdyServer( |
| 53 const net::HostPortPair& host_port_pair); | 53 const net::HostPortPair& host_port_pair); |
| 54 | 54 |
| 55 // Debugging to simulate presence of an AlternateProtocol. | 55 // Debugging to simulate presence of an AlternateProtocol. |
| 56 // If we don't have an alternate protocol in the map for any given host/port | 56 // If we don't have an alternate protocol in the map for any given host/port |
| 57 // pair, force this ProtocolPortPair. | 57 // pair, force this ProtocolPortPair. |
| 58 static void ForceAlternateProtocol(const PortAlternateProtocolPair& pair); | 58 static void ForceAlternateProtocol(const AlternateProtocolInfo& pair); |
| 59 static void DisableForcedAlternateProtocol(); | 59 static void DisableForcedAlternateProtocol(); |
| 60 | 60 |
| 61 // Returns the canonical host suffix for |server|, or std::string() if none | 61 // Returns the canonical host suffix for |server|, or std::string() if none |
| 62 // exists. | 62 // exists. |
| 63 std::string GetCanonicalSuffix(const net::HostPortPair& server); | 63 std::string GetCanonicalSuffix(const net::HostPortPair& server); |
| 64 | 64 |
| 65 // ----------------------------- | 65 // ----------------------------- |
| 66 // HttpServerProperties methods: | 66 // HttpServerProperties methods: |
| 67 // ----------------------------- | 67 // ----------------------------- |
| 68 | 68 |
| 69 // Gets a weak pointer for this object. | 69 // Gets a weak pointer for this object. |
| 70 virtual base::WeakPtr<HttpServerProperties> GetWeakPtr() OVERRIDE; | 70 virtual base::WeakPtr<HttpServerProperties> GetWeakPtr() OVERRIDE; |
| 71 | 71 |
| 72 // Deletes all data. | 72 // Deletes all data. |
| 73 virtual void Clear() OVERRIDE; | 73 virtual void Clear() OVERRIDE; |
| 74 | 74 |
| 75 // Returns true if |server| supports SPDY. | 75 // Returns true if |server| supports SPDY. |
| 76 virtual bool SupportsSpdy(const HostPortPair& server) OVERRIDE; | 76 virtual bool SupportsSpdy(const HostPortPair& server) OVERRIDE; |
| 77 | 77 |
| 78 // Add |server| into the persistent store. | 78 // Add |server| into the persistent store. |
| 79 virtual void SetSupportsSpdy(const HostPortPair& server, | 79 virtual void SetSupportsSpdy(const HostPortPair& server, |
| 80 bool support_spdy) OVERRIDE; | 80 bool support_spdy) OVERRIDE; |
| 81 | 81 |
| 82 // Returns true if |server| has an Alternate-Protocol header. | 82 // Returns true if |server| has an Alternate-Protocol header. |
| 83 virtual bool HasAlternateProtocol(const HostPortPair& server) OVERRIDE; | 83 virtual bool HasAlternateProtocol(const HostPortPair& server) OVERRIDE; |
| 84 | 84 |
| 85 // Returns the Alternate-Protocol and port for |server|. | 85 // Returns the Alternate-Protocol and port for |server|. |
| 86 // HasAlternateProtocol(server) must be true. | 86 // HasAlternateProtocol(server) must be true. |
| 87 virtual PortAlternateProtocolPair GetAlternateProtocol( | 87 virtual AlternateProtocolInfo GetAlternateProtocol( |
| 88 const HostPortPair& server) OVERRIDE; | 88 const HostPortPair& server) OVERRIDE; |
| 89 | 89 |
| 90 // Sets the Alternate-Protocol for |server|. | 90 // Sets the Alternate-Protocol for |server|. |
| 91 virtual void SetAlternateProtocol( | 91 virtual void SetAlternateProtocol( |
| 92 const HostPortPair& server, | 92 const HostPortPair& server, |
| 93 uint16 alternate_port, | 93 uint16 alternate_port, |
| 94 AlternateProtocol alternate_protocol) OVERRIDE; | 94 AlternateProtocol alternate_protocol, |
| 95 double probability) OVERRIDE; |
| 95 | 96 |
| 96 // Sets the Alternate-Protocol for |server| to be BROKEN. | 97 // Sets the Alternate-Protocol for |server| to be BROKEN. |
| 97 virtual void SetBrokenAlternateProtocol(const HostPortPair& server) OVERRIDE; | 98 virtual void SetBrokenAlternateProtocol(const HostPortPair& server) OVERRIDE; |
| 98 | 99 |
| 99 // Returns true if Alternate-Protocol for |server| was recently BROKEN. | 100 // Returns true if Alternate-Protocol for |server| was recently BROKEN. |
| 100 virtual bool WasAlternateProtocolRecentlyBroken( | 101 virtual bool WasAlternateProtocolRecentlyBroken( |
| 101 const HostPortPair& server) OVERRIDE; | 102 const HostPortPair& server) OVERRIDE; |
| 102 | 103 |
| 103 // Confirms that Alternate-Protocol for |server| is working. | 104 // Confirms that Alternate-Protocol for |server| is working. |
| 104 virtual void ConfirmAlternateProtocol(const HostPortPair& server) OVERRIDE; | 105 virtual void ConfirmAlternateProtocol(const HostPortPair& server) OVERRIDE; |
| 105 | 106 |
| 106 // Clears the Alternate-Protocol for |server|. | 107 // Clears the Alternate-Protocol for |server|. |
| 107 virtual void ClearAlternateProtocol(const HostPortPair& server) OVERRIDE; | 108 virtual void ClearAlternateProtocol(const HostPortPair& server) OVERRIDE; |
| 108 | 109 |
| 109 // Returns all Alternate-Protocol mappings. | 110 // Returns all Alternate-Protocol mappings. |
| 110 virtual const AlternateProtocolMap& alternate_protocol_map() const OVERRIDE; | 111 virtual const AlternateProtocolMap& alternate_protocol_map() const OVERRIDE; |
| 111 | 112 |
| 112 virtual void SetAlternateProtocolExperiment( | 113 virtual void SetAlternateProtocolExperiment( |
| 113 AlternateProtocolExperiment experiment) OVERRIDE; | 114 AlternateProtocolExperiment experiment) OVERRIDE; |
| 114 | 115 |
| 116 virtual void SetAlternateProtocolProbabilityThreshold( |
| 117 double threshold) OVERRIDE; |
| 118 |
| 115 virtual AlternateProtocolExperiment GetAlternateProtocolExperiment() | 119 virtual AlternateProtocolExperiment GetAlternateProtocolExperiment() |
| 116 const OVERRIDE; | 120 const OVERRIDE; |
| 117 | 121 |
| 118 // Gets a reference to the SettingsMap stored for a host. | 122 // Gets a reference to the SettingsMap stored for a host. |
| 119 // If no settings are stored, returns an empty SettingsMap. | 123 // If no settings are stored, returns an empty SettingsMap. |
| 120 virtual const SettingsMap& GetSpdySettings( | 124 virtual const SettingsMap& GetSpdySettings( |
| 121 const HostPortPair& host_port_pair) OVERRIDE; | 125 const HostPortPair& host_port_pair) OVERRIDE; |
| 122 | 126 |
| 123 // Saves an individual SPDY setting for a host. Returns true if SPDY setting | 127 // Saves an individual SPDY setting for a host. Returns true if SPDY setting |
| 124 // is to be persisted. | 128 // is to be persisted. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 SpdySettingsMap spdy_settings_map_; | 181 SpdySettingsMap spdy_settings_map_; |
| 178 ServerNetworkStatsMap server_network_stats_map_; | 182 ServerNetworkStatsMap server_network_stats_map_; |
| 179 // Contains a map of servers which could share the same alternate protocol. | 183 // Contains a map of servers which could share the same alternate protocol. |
| 180 // Map from a Canonical host/port (host is some postfix of host names) to an | 184 // Map from a Canonical host/port (host is some postfix of host names) to an |
| 181 // actual origin, which has a plausible alternate protocol mapping. | 185 // actual origin, which has a plausible alternate protocol mapping. |
| 182 CanonicalHostMap canonical_host_to_origin_map_; | 186 CanonicalHostMap canonical_host_to_origin_map_; |
| 183 // Contains list of suffixes (for exmaple ".c.youtube.com", | 187 // Contains list of suffixes (for exmaple ".c.youtube.com", |
| 184 // ".googlevideo.com", ".googleusercontent.com") of canoncial hostnames. | 188 // ".googlevideo.com", ".googleusercontent.com") of canoncial hostnames. |
| 185 CanonicalSufficList canoncial_suffixes_; | 189 CanonicalSufficList canoncial_suffixes_; |
| 186 | 190 |
| 191 double alternate_protocol_probability_threshold_; |
| 192 |
| 187 base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_; | 193 base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_; |
| 188 | 194 |
| 189 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); | 195 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); |
| 190 }; | 196 }; |
| 191 | 197 |
| 192 } // namespace net | 198 } // namespace net |
| 193 | 199 |
| 194 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ | 200 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ |
| OLD | NEW |