| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 void Clear() override; | 81 void Clear() override; |
| 82 bool SupportsRequestPriority(const url::SchemeHostPort& server) override; | 82 bool SupportsRequestPriority(const url::SchemeHostPort& server) override; |
| 83 bool GetSupportsSpdy(const url::SchemeHostPort& server) override; | 83 bool GetSupportsSpdy(const url::SchemeHostPort& server) override; |
| 84 void SetSupportsSpdy(const url::SchemeHostPort& server, | 84 void SetSupportsSpdy(const url::SchemeHostPort& server, |
| 85 bool support_spdy) override; | 85 bool support_spdy) override; |
| 86 bool RequiresHTTP11(const HostPortPair& server) override; | 86 bool RequiresHTTP11(const HostPortPair& server) override; |
| 87 void SetHTTP11Required(const HostPortPair& server) override; | 87 void SetHTTP11Required(const HostPortPair& server) override; |
| 88 void MaybeForceHTTP11(const HostPortPair& server, | 88 void MaybeForceHTTP11(const HostPortPair& server, |
| 89 SSLConfig* ssl_config) override; | 89 SSLConfig* ssl_config) override; |
| 90 AlternativeServiceVector GetAlternativeServices( | 90 AlternativeServiceVector GetAlternativeServices( |
| 91 const HostPortPair& origin) override; | 91 const url::SchemeHostPort& origin) override; |
| 92 bool SetAlternativeService(const HostPortPair& origin, | 92 bool SetAlternativeService(const url::SchemeHostPort& origin, |
| 93 const AlternativeService& alternative_service, | 93 const AlternativeService& alternative_service, |
| 94 base::Time expiration) override; | 94 base::Time expiration) override; |
| 95 bool SetAlternativeServices(const HostPortPair& origin, | 95 bool SetAlternativeServices(const url::SchemeHostPort& origin, |
| 96 const AlternativeServiceInfoVector& | 96 const AlternativeServiceInfoVector& |
| 97 alternative_service_info_vector) override; | 97 alternative_service_info_vector) override; |
| 98 void MarkAlternativeServiceBroken( | 98 void MarkAlternativeServiceBroken( |
| 99 const AlternativeService& alternative_service) override; | 99 const AlternativeService& alternative_service) override; |
| 100 void MarkAlternativeServiceRecentlyBroken( | 100 void MarkAlternativeServiceRecentlyBroken( |
| 101 const AlternativeService& alternative_service) override; | 101 const AlternativeService& alternative_service) override; |
| 102 bool IsAlternativeServiceBroken( | 102 bool IsAlternativeServiceBroken( |
| 103 const AlternativeService& alternative_service) const override; | 103 const AlternativeService& alternative_service) const override; |
| 104 bool WasAlternativeServiceRecentlyBroken( | 104 bool WasAlternativeServiceRecentlyBroken( |
| 105 const AlternativeService& alternative_service) override; | 105 const AlternativeService& alternative_service) override; |
| 106 void ConfirmAlternativeService( | 106 void ConfirmAlternativeService( |
| 107 const AlternativeService& alternative_service) override; | 107 const AlternativeService& alternative_service) override; |
| 108 void ClearAlternativeServices(const HostPortPair& origin) override; | 108 void ClearAlternativeServices(const url::SchemeHostPort& origin) override; |
| 109 const AlternativeServiceMap& alternative_service_map() const override; | 109 const AlternativeServiceMap& alternative_service_map() const override; |
| 110 scoped_ptr<base::Value> GetAlternativeServiceInfoAsValue() const override; | 110 scoped_ptr<base::Value> GetAlternativeServiceInfoAsValue() const override; |
| 111 const SettingsMap& GetSpdySettings( | 111 const SettingsMap& GetSpdySettings( |
| 112 const url::SchemeHostPort& server) override; | 112 const url::SchemeHostPort& server) override; |
| 113 bool SetSpdySetting(const url::SchemeHostPort& server, | 113 bool SetSpdySetting(const url::SchemeHostPort& server, |
| 114 SpdySettingsIds id, | 114 SpdySettingsIds id, |
| 115 SpdySettingsFlags flags, | 115 SpdySettingsFlags flags, |
| 116 uint32_t value) override; | 116 uint32_t value) override; |
| 117 void ClearSpdySettings(const url::SchemeHostPort& server) override; | 117 void ClearSpdySettings(const url::SchemeHostPort& server) override; |
| 118 void ClearAllSpdySettings() override; | 118 void ClearAllSpdySettings() override; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 131 size_t max_server_configs_stored_in_properties() const override; | 131 size_t max_server_configs_stored_in_properties() const override; |
| 132 void SetMaxServerConfigsStoredInProperties( | 132 void SetMaxServerConfigsStoredInProperties( |
| 133 size_t max_server_configs_stored_in_properties) override; | 133 size_t max_server_configs_stored_in_properties) override; |
| 134 | 134 |
| 135 private: | 135 private: |
| 136 friend class HttpServerPropertiesImplPeer; | 136 friend class HttpServerPropertiesImplPeer; |
| 137 | 137 |
| 138 // |spdy_servers_map_| has flattened representation of servers | 138 // |spdy_servers_map_| has flattened representation of servers |
| 139 // (scheme, host, port) that either support or not support SPDY protocol. | 139 // (scheme, host, port) that either support or not support SPDY protocol. |
| 140 typedef base::MRUCache<std::string, bool> SpdyServersMap; | 140 typedef base::MRUCache<std::string, bool> SpdyServersMap; |
| 141 typedef std::map<HostPortPair, HostPortPair> CanonicalHostMap; | 141 typedef std::map<url::SchemeHostPort, url::SchemeHostPort> CanonicalHostMap; |
| 142 typedef std::vector<std::string> CanonicalSufficList; | 142 typedef std::vector<std::string> CanonicalSufficList; |
| 143 typedef std::set<HostPortPair> Http11ServerHostPortSet; | 143 typedef std::set<HostPortPair> Http11ServerHostPortSet; |
| 144 | 144 |
| 145 // Linked hash map from AlternativeService to expiration time. This container | 145 // Linked hash map from AlternativeService to expiration time. This container |
| 146 // is a queue with O(1) enqueue and dequeue, and a hash_map with O(1) lookup | 146 // is a queue with O(1) enqueue and dequeue, and a hash_map with O(1) lookup |
| 147 // at the same time. | 147 // at the same time. |
| 148 typedef linked_hash_map<AlternativeService, | 148 typedef linked_hash_map<AlternativeService, |
| 149 base::TimeTicks, | 149 base::TimeTicks, |
| 150 AlternativeServiceHash> | 150 AlternativeServiceHash> |
| 151 BrokenAlternativeServices; | 151 BrokenAlternativeServices; |
| 152 // Map to the number of times each alternative service has been marked broken. | 152 // Map to the number of times each alternative service has been marked broken. |
| 153 typedef std::map<AlternativeService, int> RecentlyBrokenAlternativeServices; | 153 typedef std::map<AlternativeService, int> RecentlyBrokenAlternativeServices; |
| 154 | 154 |
| 155 // Return the iterator for |server|, or for its canonical host, or end. | 155 // Return the iterator for |server|, or for its canonical host, or end. |
| 156 AlternativeServiceMap::const_iterator GetAlternateProtocolIterator( | 156 AlternativeServiceMap::const_iterator GetAlternateProtocolIterator( |
| 157 const HostPortPair& server); | 157 const url::SchemeHostPort& server); |
| 158 | 158 |
| 159 // Return the canonical host for |server|, or end if none exists. | 159 // Return the canonical host for |server|, or end if none exists. |
| 160 CanonicalHostMap::const_iterator GetCanonicalHost(HostPortPair server) const; | 160 CanonicalHostMap::const_iterator GetCanonicalHost( |
| 161 const url::SchemeHostPort& server) const; |
| 161 | 162 |
| 162 void RemoveCanonicalHost(const HostPortPair& server); | 163 // Remove the cononical host for |server| if |server| is the value in the map. |
| 164 void RemoveCanonicalHost(const url::SchemeHostPort& server); |
| 163 void ExpireBrokenAlternateProtocolMappings(); | 165 void ExpireBrokenAlternateProtocolMappings(); |
| 164 void ScheduleBrokenAlternateProtocolMappingsExpiration(); | 166 void ScheduleBrokenAlternateProtocolMappingsExpiration(); |
| 165 | 167 |
| 166 SpdyServersMap spdy_servers_map_; | 168 SpdyServersMap spdy_servers_map_; |
| 167 Http11ServerHostPortSet http11_servers_; | 169 Http11ServerHostPortSet http11_servers_; |
| 168 | 170 |
| 169 AlternativeServiceMap alternative_service_map_; | 171 AlternativeServiceMap alternative_service_map_; |
| 170 BrokenAlternativeServices broken_alternative_services_; | 172 BrokenAlternativeServices broken_alternative_services_; |
| 171 // Class invariant: Every alternative service in broken_alternative_services_ | 173 // Class invariant: Every alternative service in broken_alternative_services_ |
| 172 // must also be in recently_broken_alternative_services_. | 174 // must also be in recently_broken_alternative_services_. |
| 173 RecentlyBrokenAlternativeServices recently_broken_alternative_services_; | 175 RecentlyBrokenAlternativeServices recently_broken_alternative_services_; |
| 174 | 176 |
| 175 IPAddress last_quic_address_; | 177 IPAddress last_quic_address_; |
| 176 SpdySettingsMap spdy_settings_map_; | 178 SpdySettingsMap spdy_settings_map_; |
| 177 ServerNetworkStatsMap server_network_stats_map_; | 179 ServerNetworkStatsMap server_network_stats_map_; |
| 178 // Contains a map of servers which could share the same alternate protocol. | 180 // Contains a map of servers which could share the same alternate protocol. |
| 179 // Map from a Canonical host/port (host is some postfix of host names) to an | 181 // Map from a Canonical scheme/host/port (host is some postfix of host names) |
| 180 // actual origin, which has a plausible alternate protocol mapping. | 182 // to an actual origin, which has a plausible alternate protocol mapping. |
| 181 CanonicalHostMap canonical_host_to_origin_map_; | 183 CanonicalHostMap canonical_host_to_origin_map_; |
| 182 // Contains list of suffixes (for exmaple ".c.youtube.com", | 184 // Contains list of suffixes (for exmaple ".c.youtube.com", |
| 183 // ".googlevideo.com", ".googleusercontent.com") of canonical hostnames. | 185 // ".googlevideo.com", ".googleusercontent.com") of canonical hostnames. |
| 184 CanonicalSufficList canonical_suffixes_; | 186 CanonicalSufficList canonical_suffixes_; |
| 185 | 187 |
| 186 QuicServerInfoMap quic_server_info_map_; | 188 QuicServerInfoMap quic_server_info_map_; |
| 187 size_t max_server_configs_stored_in_properties_; | 189 size_t max_server_configs_stored_in_properties_; |
| 188 | 190 |
| 189 base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_; | 191 base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_; |
| 190 | 192 |
| 191 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); | 193 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); |
| 192 }; | 194 }; |
| 193 | 195 |
| 194 } // namespace net | 196 } // namespace net |
| 195 | 197 |
| 196 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ | 198 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ |
| OLD | NEW |