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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 // unittests. | 58 // unittests. |
59 static std::string GetFlattenedSpdyServer( | 59 static std::string GetFlattenedSpdyServer( |
60 const net::HostPortPair& host_port_pair); | 60 const net::HostPortPair& host_port_pair); |
61 | 61 |
62 // Debugging to simulate presence of an AlternateProtocol. | 62 // Debugging to simulate presence of an AlternateProtocol. |
63 // If we don't have an alternate protocol in the map for any given host/port | 63 // If we don't have an alternate protocol in the map for any given host/port |
64 // pair, force this ProtocolPortPair. | 64 // pair, force this ProtocolPortPair. |
65 static void ForceAlternateProtocol(const PortAlternateProtocolPair& pair); | 65 static void ForceAlternateProtocol(const PortAlternateProtocolPair& pair); |
66 static void DisableForcedAlternateProtocol(); | 66 static void DisableForcedAlternateProtocol(); |
67 | 67 |
| 68 // Returns the canonical host suffix for |server|, or std::string() if none |
| 69 // exists. |
| 70 std::string HttpServerPropertiesImpl::GetCanonicalSuffix( |
| 71 const net::HostPortPair& server); |
| 72 |
68 // Changes the number of host/port pairs we remember pipelining capability | 73 // Changes the number of host/port pairs we remember pipelining capability |
69 // for. A larger number means we're more likely to be able to pipeline | 74 // for. A larger number means we're more likely to be able to pipeline |
70 // immediately if a host is known good, but uses more memory. This function | 75 // immediately if a host is known good, but uses more memory. This function |
71 // can only be called if |pipeline_capability_map_| is empty. | 76 // can only be called if |pipeline_capability_map_| is empty. |
72 void SetNumPipelinedHostsToRemember(int max_size); | 77 void SetNumPipelinedHostsToRemember(int max_size); |
73 | 78 |
74 // ----------------------------- | 79 // ----------------------------- |
75 // HttpServerProperties methods: | 80 // HttpServerProperties methods: |
76 // ----------------------------- | 81 // ----------------------------- |
77 | 82 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 116 |
112 // Confirms that Alternate-Protocol for |server| is working. | 117 // Confirms that Alternate-Protocol for |server| is working. |
113 virtual void ConfirmAlternateProtocol(const HostPortPair& server) OVERRIDE; | 118 virtual void ConfirmAlternateProtocol(const HostPortPair& server) OVERRIDE; |
114 | 119 |
115 // Clears the Alternate-Protocol for |server|. | 120 // Clears the Alternate-Protocol for |server|. |
116 virtual void ClearAlternateProtocol(const HostPortPair& server) OVERRIDE; | 121 virtual void ClearAlternateProtocol(const HostPortPair& server) OVERRIDE; |
117 | 122 |
118 // Returns all Alternate-Protocol mappings. | 123 // Returns all Alternate-Protocol mappings. |
119 virtual const AlternateProtocolMap& alternate_protocol_map() const OVERRIDE; | 124 virtual const AlternateProtocolMap& alternate_protocol_map() const OVERRIDE; |
120 | 125 |
| 126 virtual void SetAlternateProtocolExperiment( |
| 127 AlternateProtocolExperiment experiment) OVERRIDE; |
| 128 |
| 129 virtual AlternateProtocolExperiment GetAlternateProtocolExperiment() |
| 130 const OVERRIDE; |
| 131 |
121 // Gets a reference to the SettingsMap stored for a host. | 132 // Gets a reference to the SettingsMap stored for a host. |
122 // If no settings are stored, returns an empty SettingsMap. | 133 // If no settings are stored, returns an empty SettingsMap. |
123 virtual const SettingsMap& GetSpdySettings( | 134 virtual const SettingsMap& GetSpdySettings( |
124 const HostPortPair& host_port_pair) OVERRIDE; | 135 const HostPortPair& host_port_pair) OVERRIDE; |
125 | 136 |
126 // Saves an individual SPDY setting for a host. Returns true if SPDY setting | 137 // Saves an individual SPDY setting for a host. Returns true if SPDY setting |
127 // is to be persisted. | 138 // is to be persisted. |
128 virtual bool SetSpdySetting(const HostPortPair& host_port_pair, | 139 virtual bool SetSpdySetting(const HostPortPair& host_port_pair, |
129 SpdySettingsIds id, | 140 SpdySettingsIds id, |
130 SpdySettingsFlags flags, | 141 SpdySettingsFlags flags, |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 CanonicalHostMap::const_iterator GetCanonicalHost(HostPortPair server) const; | 191 CanonicalHostMap::const_iterator GetCanonicalHost(HostPortPair server) const; |
181 | 192 |
182 void ExpireBrokenAlternateProtocolMappings(); | 193 void ExpireBrokenAlternateProtocolMappings(); |
183 void ScheduleBrokenAlternateProtocolMappingsExpiration(); | 194 void ScheduleBrokenAlternateProtocolMappingsExpiration(); |
184 | 195 |
185 SpdyServerHostPortMap spdy_servers_map_; | 196 SpdyServerHostPortMap spdy_servers_map_; |
186 | 197 |
187 AlternateProtocolMap alternate_protocol_map_; | 198 AlternateProtocolMap alternate_protocol_map_; |
188 BrokenAlternateProtocolList broken_alternate_protocol_list_; | 199 BrokenAlternateProtocolList broken_alternate_protocol_list_; |
189 BrokenAlternateProtocolMap broken_alternate_protocol_map_; | 200 BrokenAlternateProtocolMap broken_alternate_protocol_map_; |
| 201 AlternateProtocolExperiment alternate_protocol_experiment_; |
190 | 202 |
191 SpdySettingsMap spdy_settings_map_; | 203 SpdySettingsMap spdy_settings_map_; |
192 ServerNetworkStatsMap server_network_stats_map_; | 204 ServerNetworkStatsMap server_network_stats_map_; |
193 scoped_ptr<CachedPipelineCapabilityMap> pipeline_capability_map_; | 205 scoped_ptr<CachedPipelineCapabilityMap> pipeline_capability_map_; |
194 // Contains a map of servers which could share the same alternate protocol. | 206 // Contains a map of servers which could share the same alternate protocol. |
195 // Map from a Canonical host/port (host is some postfix of host names) to an | 207 // Map from a Canonical host/port (host is some postfix of host names) to an |
196 // actual origin, which has a plausible alternate protocol mapping. | 208 // actual origin, which has a plausible alternate protocol mapping. |
197 CanonicalHostMap canonical_host_to_origin_map_; | 209 CanonicalHostMap canonical_host_to_origin_map_; |
198 // Contains list of suffixes (for exmaple ".c.youtube.com", | 210 // Contains list of suffixes (for exmaple ".c.youtube.com", |
199 // ".googlevideo.com") of canoncial hostnames. | 211 // ".googlevideo.com") of canoncial hostnames. |
200 CanonicalSufficList canoncial_suffixes_; | 212 CanonicalSufficList canoncial_suffixes_; |
201 | 213 |
202 base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_; | 214 base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_; |
203 | 215 |
204 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); | 216 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); |
205 }; | 217 }; |
206 | 218 |
207 } // namespace net | 219 } // namespace net |
208 | 220 |
209 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ | 221 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ |
OLD | NEW |