Chromium Code Reviews| 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 13 matching lines...) Expand all Loading... | |
| 24 class ListValue; | 24 class ListValue; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace net { | 27 namespace net { |
| 28 | 28 |
| 29 // The implementation for setting/retrieving the HTTP server properties. | 29 // The implementation for setting/retrieving the HTTP server properties. |
| 30 class NET_EXPORT HttpServerPropertiesImpl | 30 class NET_EXPORT HttpServerPropertiesImpl |
| 31 : public HttpServerProperties, | 31 : public HttpServerProperties, |
| 32 NON_EXPORTED_BASE(public base::NonThreadSafe) { | 32 NON_EXPORTED_BASE(public base::NonThreadSafe) { |
| 33 public: | 33 public: |
| 34 typedef base::MRUCache< | |
| 35 HostPortPair, PortAlternateProtocolPair> CachedAlternateProtocolMap; | |
| 36 | |
| 34 HttpServerPropertiesImpl(); | 37 HttpServerPropertiesImpl(); |
| 35 virtual ~HttpServerPropertiesImpl(); | 38 virtual ~HttpServerPropertiesImpl(); |
| 36 | 39 |
| 37 // Initializes |spdy_servers_table_| with the servers (host/port) from | 40 // Initializes |spdy_servers_table_| with the servers (host/port) from |
| 38 // |spdy_servers| that either support SPDY or not. | 41 // |spdy_servers| that either support SPDY or not. |
| 39 void InitializeSpdyServers(std::vector<std::string>* spdy_servers, | 42 void InitializeSpdyServers(std::vector<std::string>* spdy_servers, |
| 40 bool support_spdy); | 43 bool support_spdy); |
| 41 | 44 |
| 42 void InitializeAlternateProtocolServers( | 45 void InitializeAlternateProtocolServers( |
| 43 AlternateProtocolMap* alternate_protocol_servers); | 46 AlternateProtocolMap* alternate_protocol_servers); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 97 // Sets the Alternate-Protocol for |server|. | 100 // Sets the Alternate-Protocol for |server|. |
| 98 virtual void SetAlternateProtocol( | 101 virtual void SetAlternateProtocol( |
| 99 const HostPortPair& server, | 102 const HostPortPair& server, |
| 100 uint16 alternate_port, | 103 uint16 alternate_port, |
| 101 AlternateProtocol alternate_protocol) OVERRIDE; | 104 AlternateProtocol alternate_protocol) OVERRIDE; |
| 102 | 105 |
| 103 // Sets the Alternate-Protocol for |server| to be BROKEN. | 106 // Sets the Alternate-Protocol for |server| to be BROKEN. |
| 104 virtual void SetBrokenAlternateProtocol(const HostPortPair& server) OVERRIDE; | 107 virtual void SetBrokenAlternateProtocol(const HostPortPair& server) OVERRIDE; |
| 105 | 108 |
| 106 // Returns all Alternate-Protocol mappings. | 109 // Returns all Alternate-Protocol mappings. |
| 107 virtual const AlternateProtocolMap& alternate_protocol_map() const OVERRIDE; | 110 virtual AlternateProtocolMap GetAlternateProtocolMap() const OVERRIDE; |
| 108 | 111 |
| 109 // Gets a reference to the SettingsMap stored for a host. | 112 // Gets a reference to the SettingsMap stored for a host. |
| 110 // If no settings are stored, returns an empty SettingsMap. | 113 // If no settings are stored, returns an empty SettingsMap. |
| 111 virtual const SettingsMap& GetSpdySettings( | 114 virtual const SettingsMap& GetSpdySettings( |
| 112 const HostPortPair& host_port_pair) const OVERRIDE; | 115 const HostPortPair& host_port_pair) const OVERRIDE; |
| 113 | 116 |
| 114 // Saves an individual SPDY setting for a host. Returns true if SPDY setting | 117 // Saves an individual SPDY setting for a host. Returns true if SPDY setting |
| 115 // is to be persisted. | 118 // is to be persisted. |
| 116 virtual bool SetSpdySetting(const HostPortPair& host_port_pair, | 119 virtual bool SetSpdySetting(const HostPortPair& host_port_pair, |
| 117 SpdySettingsIds id, | 120 SpdySettingsIds id, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 152 typedef base::hash_map<std::string, bool> SpdyServerHostPortTable; | 155 typedef base::hash_map<std::string, bool> SpdyServerHostPortTable; |
| 153 typedef std::map<HostPortPair, NetworkStats> ServerNetworkStatsMap; | 156 typedef std::map<HostPortPair, NetworkStats> ServerNetworkStatsMap; |
| 154 typedef std::map<HostPortPair, HostPortPair> CanonicalHostMap; | 157 typedef std::map<HostPortPair, HostPortPair> CanonicalHostMap; |
| 155 typedef std::vector<std::string> CanonicalSufficList; | 158 typedef std::vector<std::string> CanonicalSufficList; |
| 156 | 159 |
| 157 // Return the canonical host for |server|, or end if none exists. | 160 // Return the canonical host for |server|, or end if none exists. |
| 158 CanonicalHostMap::const_iterator GetCanonicalHost(HostPortPair server) const; | 161 CanonicalHostMap::const_iterator GetCanonicalHost(HostPortPair server) const; |
| 159 | 162 |
| 160 SpdyServerHostPortTable spdy_servers_table_; | 163 SpdyServerHostPortTable spdy_servers_table_; |
| 161 | 164 |
| 162 AlternateProtocolMap alternate_protocol_map_; | 165 scoped_ptr<CachedAlternateProtocolMap> alternate_protocol_map_; |
|
Ryan Hamilton
2014/03/05 00:19:20
Is the idea here that the actual map we're keeping
ramant (doing other things)
2014/03/05 15:11:11
Used the MRUCache for AlternateProtocolMap.
Will
| |
| 163 SpdySettingsMap spdy_settings_map_; | 166 SpdySettingsMap spdy_settings_map_; |
| 164 ServerNetworkStatsMap server_network_stats_map_; | 167 ServerNetworkStatsMap server_network_stats_map_; |
| 165 scoped_ptr<CachedPipelineCapabilityMap> pipeline_capability_map_; | 168 scoped_ptr<CachedPipelineCapabilityMap> pipeline_capability_map_; |
| 166 // Contains a map of servers which could share the same alternate protocol. | 169 // Contains a map of servers which could share the same alternate protocol. |
| 167 // Map from a Canonical host/port (host is some postfix of host names) to an | 170 // Map from a Canonical host/port (host is some postfix of host names) to an |
| 168 // actual origin, which has a plausible alternate protocol mapping. | 171 // actual origin, which has a plausible alternate protocol mapping. |
| 169 CanonicalHostMap canonical_host_to_origin_map_; | 172 CanonicalHostMap canonical_host_to_origin_map_; |
| 170 // Contains list of suffixes (for exmaple ".c.youtube.com", | 173 // Contains list of suffixes (for exmaple ".c.youtube.com", |
| 171 // ".googlevideo.com") of canoncial hostnames. | 174 // ".googlevideo.com") of canoncial hostnames. |
| 172 CanonicalSufficList canoncial_suffixes_; | 175 CanonicalSufficList canoncial_suffixes_; |
| 173 | 176 |
| 174 base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_; | 177 base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_; |
| 175 | 178 |
| 176 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); | 179 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); |
| 177 }; | 180 }; |
| 178 | 181 |
| 179 } // namespace net | 182 } // namespace net |
| 180 | 183 |
| 181 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ | 184 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ |
| OLD | NEW |