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 24 matching lines...) Expand all Loading... |
35 // Initializes |spdy_servers_map_| with the servers (host/port) from | 35 // Initializes |spdy_servers_map_| with the servers (host/port) from |
36 // |spdy_servers| that either support SPDY or not. | 36 // |spdy_servers| that either support SPDY or not. |
37 void InitializeSpdyServers(std::vector<std::string>* spdy_servers, | 37 void InitializeSpdyServers(std::vector<std::string>* spdy_servers, |
38 bool support_spdy); | 38 bool support_spdy); |
39 | 39 |
40 void InitializeAlternateProtocolServers( | 40 void InitializeAlternateProtocolServers( |
41 AlternateProtocolMap* alternate_protocol_servers); | 41 AlternateProtocolMap* alternate_protocol_servers); |
42 | 42 |
43 void InitializeSpdySettingsServers(SpdySettingsMap* spdy_settings_map); | 43 void InitializeSpdySettingsServers(SpdySettingsMap* spdy_settings_map); |
44 | 44 |
| 45 void InitializeSupportsQuic(SupportsQuicMap* supports_quic_map); |
| 46 |
45 // Get the list of servers (host/port) that support SPDY. The max_size is the | 47 // Get the list of servers (host/port) that support SPDY. The max_size is the |
46 // number of MRU servers that support SPDY that are to be returned. | 48 // number of MRU servers that support SPDY that are to be returned. |
47 void GetSpdyServerList(base::ListValue* spdy_server_list, | 49 void GetSpdyServerList(base::ListValue* spdy_server_list, |
48 size_t max_size) const; | 50 size_t max_size) const; |
49 | 51 |
50 // Returns flattened string representation of the |host_port_pair|. Used by | 52 // Returns flattened string representation of the |host_port_pair|. Used by |
51 // unittests. | 53 // unittests. |
52 static std::string GetFlattenedSpdyServer( | 54 static std::string GetFlattenedSpdyServer( |
53 const net::HostPortPair& host_port_pair); | 55 const net::HostPortPair& host_port_pair); |
54 | 56 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 135 |
134 // Clears all entries in |spdy_settings_map_| for a host. | 136 // Clears all entries in |spdy_settings_map_| for a host. |
135 virtual void ClearSpdySettings(const HostPortPair& host_port_pair) OVERRIDE; | 137 virtual void ClearSpdySettings(const HostPortPair& host_port_pair) OVERRIDE; |
136 | 138 |
137 // Clears all entries in |spdy_settings_map_|. | 139 // Clears all entries in |spdy_settings_map_|. |
138 virtual void ClearAllSpdySettings() OVERRIDE; | 140 virtual void ClearAllSpdySettings() OVERRIDE; |
139 | 141 |
140 // Returns all persistent SPDY settings. | 142 // Returns all persistent SPDY settings. |
141 virtual const SpdySettingsMap& spdy_settings_map() const OVERRIDE; | 143 virtual const SpdySettingsMap& spdy_settings_map() const OVERRIDE; |
142 | 144 |
| 145 // Methods for SupportsQuic. |
| 146 virtual SupportsQuic GetSupportsQuic( |
| 147 const HostPortPair& host_port_pair) const OVERRIDE; |
| 148 |
| 149 virtual void SetSupportsQuic(const HostPortPair& host_port_pair, |
| 150 bool used_quic, |
| 151 const std::string& address) OVERRIDE; |
| 152 |
| 153 virtual const SupportsQuicMap& supports_quic_map() const OVERRIDE; |
| 154 |
| 155 // Methods for NetworkStats. |
143 virtual void SetServerNetworkStats(const HostPortPair& host_port_pair, | 156 virtual void SetServerNetworkStats(const HostPortPair& host_port_pair, |
144 NetworkStats stats) OVERRIDE; | 157 NetworkStats stats) OVERRIDE; |
145 | 158 |
146 virtual const NetworkStats* GetServerNetworkStats( | 159 virtual const NetworkStats* GetServerNetworkStats( |
147 const HostPortPair& host_port_pair) const OVERRIDE; | 160 const HostPortPair& host_port_pair) const OVERRIDE; |
148 | 161 |
149 private: | 162 private: |
150 // |spdy_servers_map_| has flattened representation of servers (host, port) | 163 // |spdy_servers_map_| has flattened representation of servers (host, port) |
151 // that either support or not support SPDY protocol. | 164 // that either support or not support SPDY protocol. |
152 typedef base::MRUCache<std::string, bool> SpdyServerHostPortMap; | 165 typedef base::MRUCache<std::string, bool> SpdyServerHostPortMap; |
(...skipping 19 matching lines...) Expand all Loading... |
172 void ScheduleBrokenAlternateProtocolMappingsExpiration(); | 185 void ScheduleBrokenAlternateProtocolMappingsExpiration(); |
173 | 186 |
174 SpdyServerHostPortMap spdy_servers_map_; | 187 SpdyServerHostPortMap spdy_servers_map_; |
175 | 188 |
176 AlternateProtocolMap alternate_protocol_map_; | 189 AlternateProtocolMap alternate_protocol_map_; |
177 BrokenAlternateProtocolList broken_alternate_protocol_list_; | 190 BrokenAlternateProtocolList broken_alternate_protocol_list_; |
178 BrokenAlternateProtocolMap broken_alternate_protocol_map_; | 191 BrokenAlternateProtocolMap broken_alternate_protocol_map_; |
179 AlternateProtocolExperiment alternate_protocol_experiment_; | 192 AlternateProtocolExperiment alternate_protocol_experiment_; |
180 | 193 |
181 SpdySettingsMap spdy_settings_map_; | 194 SpdySettingsMap spdy_settings_map_; |
| 195 SupportsQuicMap supports_quic_map_; |
182 ServerNetworkStatsMap server_network_stats_map_; | 196 ServerNetworkStatsMap server_network_stats_map_; |
183 // Contains a map of servers which could share the same alternate protocol. | 197 // Contains a map of servers which could share the same alternate protocol. |
184 // Map from a Canonical host/port (host is some postfix of host names) to an | 198 // Map from a Canonical host/port (host is some postfix of host names) to an |
185 // actual origin, which has a plausible alternate protocol mapping. | 199 // actual origin, which has a plausible alternate protocol mapping. |
186 CanonicalHostMap canonical_host_to_origin_map_; | 200 CanonicalHostMap canonical_host_to_origin_map_; |
187 // Contains list of suffixes (for exmaple ".c.youtube.com", | 201 // Contains list of suffixes (for exmaple ".c.youtube.com", |
188 // ".googlevideo.com", ".googleusercontent.com") of canoncial hostnames. | 202 // ".googlevideo.com", ".googleusercontent.com") of canoncial hostnames. |
189 CanonicalSufficList canoncial_suffixes_; | 203 CanonicalSufficList canoncial_suffixes_; |
190 | 204 |
191 double alternate_protocol_probability_threshold_; | 205 double alternate_protocol_probability_threshold_; |
192 | 206 |
193 base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_; | 207 base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_; |
194 | 208 |
195 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); | 209 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); |
196 }; | 210 }; |
197 | 211 |
198 } // namespace net | 212 } // namespace net |
199 | 213 |
200 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ | 214 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ |
OLD | NEW |