| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 // Returns the canonical host suffix for |host|, or std::string() if none | 72 // Returns the canonical host suffix for |host|, or std::string() if none |
| 73 // exists. | 73 // exists. |
| 74 std::string GetCanonicalSuffix(const std::string& host); | 74 std::string GetCanonicalSuffix(const std::string& host); |
| 75 | 75 |
| 76 // ----------------------------- | 76 // ----------------------------- |
| 77 // HttpServerProperties methods: | 77 // HttpServerProperties methods: |
| 78 // ----------------------------- | 78 // ----------------------------- |
| 79 | 79 |
| 80 base::WeakPtr<HttpServerProperties> GetWeakPtr() override; | 80 base::WeakPtr<HttpServerProperties> GetWeakPtr() override; |
| 81 void Clear() override; | 81 void Clear() override; |
| 82 bool SupportsRequestPriority(const HostPortPair& server) override; | 82 bool SupportsRequestPriority(const url::SchemeHostPort& server) override; |
| 83 bool GetSupportsSpdy(const HostPortPair& server) override; | 83 bool GetSupportsSpdy(const url::SchemeHostPort& server) override; |
| 84 void SetSupportsSpdy(const HostPortPair& server, bool support_spdy) override; | 84 void SetSupportsSpdy(const url::SchemeHostPort& server, |
| 85 bool support_spdy) override; |
| 85 bool RequiresHTTP11(const HostPortPair& server) override; | 86 bool RequiresHTTP11(const HostPortPair& server) override; |
| 86 void SetHTTP11Required(const HostPortPair& server) override; | 87 void SetHTTP11Required(const HostPortPair& server) override; |
| 87 void MaybeForceHTTP11(const HostPortPair& server, | 88 void MaybeForceHTTP11(const HostPortPair& server, |
| 88 SSLConfig* ssl_config) override; | 89 SSLConfig* ssl_config) override; |
| 89 AlternativeServiceVector GetAlternativeServices( | 90 AlternativeServiceVector GetAlternativeServices( |
| 90 const HostPortPair& origin) override; | 91 const HostPortPair& origin) override; |
| 91 bool SetAlternativeService(const HostPortPair& origin, | 92 bool SetAlternativeService(const HostPortPair& origin, |
| 92 const AlternativeService& alternative_service, | 93 const AlternativeService& alternative_service, |
| 93 base::Time expiration) override; | 94 base::Time expiration) override; |
| 94 bool SetAlternativeServices(const HostPortPair& origin, | 95 bool SetAlternativeServices(const HostPortPair& origin, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 const std::string& server_info) override; | 129 const std::string& server_info) override; |
| 129 const std::string* GetQuicServerInfo(const QuicServerId& server_id) override; | 130 const std::string* GetQuicServerInfo(const QuicServerId& server_id) override; |
| 130 const QuicServerInfoMap& quic_server_info_map() const override; | 131 const QuicServerInfoMap& quic_server_info_map() const override; |
| 131 size_t max_server_configs_stored_in_properties() const override; | 132 size_t max_server_configs_stored_in_properties() const override; |
| 132 void SetMaxServerConfigsStoredInProperties( | 133 void SetMaxServerConfigsStoredInProperties( |
| 133 size_t max_server_configs_stored_in_properties) override; | 134 size_t max_server_configs_stored_in_properties) override; |
| 134 | 135 |
| 135 private: | 136 private: |
| 136 friend class HttpServerPropertiesImplPeer; | 137 friend class HttpServerPropertiesImplPeer; |
| 137 | 138 |
| 138 // |spdy_servers_map_| has flattened representation of servers (host, port) | 139 // |spdy_servers_map_| has flattened representation of servers |
| 139 // that either support or not support SPDY protocol. | 140 // (scheme, host, port) that either support or not support SPDY protocol. |
| 140 typedef base::MRUCache<std::string, bool> SpdyServerHostPortMap; | 141 typedef base::MRUCache<std::string, bool> SpdyServersMap; |
| 141 typedef std::map<HostPortPair, HostPortPair> CanonicalHostMap; | 142 typedef std::map<HostPortPair, HostPortPair> CanonicalHostMap; |
| 142 typedef std::vector<std::string> CanonicalSufficList; | 143 typedef std::vector<std::string> CanonicalSufficList; |
| 143 typedef std::set<HostPortPair> Http11ServerHostPortSet; | 144 typedef std::set<HostPortPair> Http11ServerHostPortSet; |
| 144 | 145 |
| 145 // Linked hash map from AlternativeService to expiration time. This container | 146 // 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 | 147 // is a queue with O(1) enqueue and dequeue, and a hash_map with O(1) lookup |
| 147 // at the same time. | 148 // at the same time. |
| 148 typedef linked_hash_map<AlternativeService, | 149 typedef linked_hash_map<AlternativeService, |
| 149 base::TimeTicks, | 150 base::TimeTicks, |
| 150 AlternativeServiceHash> | 151 AlternativeServiceHash> |
| 151 BrokenAlternativeServices; | 152 BrokenAlternativeServices; |
| 152 // Map to the number of times each alternative service has been marked broken. | 153 // Map to the number of times each alternative service has been marked broken. |
| 153 typedef std::map<AlternativeService, int> RecentlyBrokenAlternativeServices; | 154 typedef std::map<AlternativeService, int> RecentlyBrokenAlternativeServices; |
| 154 | 155 |
| 155 // Return the iterator for |server|, or for its canonical host, or end. | 156 // Return the iterator for |server|, or for its canonical host, or end. |
| 156 AlternativeServiceMap::const_iterator GetAlternateProtocolIterator( | 157 AlternativeServiceMap::const_iterator GetAlternateProtocolIterator( |
| 157 const HostPortPair& server); | 158 const HostPortPair& server); |
| 158 | 159 |
| 159 // Return the canonical host for |server|, or end if none exists. | 160 // Return the canonical host for |server|, or end if none exists. |
| 160 CanonicalHostMap::const_iterator GetCanonicalHost(HostPortPair server) const; | 161 CanonicalHostMap::const_iterator GetCanonicalHost(HostPortPair server) const; |
| 161 | 162 |
| 162 void RemoveCanonicalHost(const HostPortPair& server); | 163 void RemoveCanonicalHost(const HostPortPair& server); |
| 163 void ExpireBrokenAlternateProtocolMappings(); | 164 void ExpireBrokenAlternateProtocolMappings(); |
| 164 void ScheduleBrokenAlternateProtocolMappingsExpiration(); | 165 void ScheduleBrokenAlternateProtocolMappingsExpiration(); |
| 165 | 166 |
| 166 SpdyServerHostPortMap spdy_servers_map_; | 167 SpdyServersMap spdy_servers_map_; |
| 167 Http11ServerHostPortSet http11_servers_; | 168 Http11ServerHostPortSet http11_servers_; |
| 168 | 169 |
| 169 AlternativeServiceMap alternative_service_map_; | 170 AlternativeServiceMap alternative_service_map_; |
| 170 BrokenAlternativeServices broken_alternative_services_; | 171 BrokenAlternativeServices broken_alternative_services_; |
| 171 // Class invariant: Every alternative service in broken_alternative_services_ | 172 // Class invariant: Every alternative service in broken_alternative_services_ |
| 172 // must also be in recently_broken_alternative_services_. | 173 // must also be in recently_broken_alternative_services_. |
| 173 RecentlyBrokenAlternativeServices recently_broken_alternative_services_; | 174 RecentlyBrokenAlternativeServices recently_broken_alternative_services_; |
| 174 | 175 |
| 175 IPAddress last_quic_address_; | 176 IPAddress last_quic_address_; |
| 176 SpdySettingsMap spdy_settings_map_; | 177 SpdySettingsMap spdy_settings_map_; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 187 size_t max_server_configs_stored_in_properties_; | 188 size_t max_server_configs_stored_in_properties_; |
| 188 | 189 |
| 189 base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_; | 190 base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_; |
| 190 | 191 |
| 191 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); | 192 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); |
| 192 }; | 193 }; |
| 193 | 194 |
| 194 } // namespace net | 195 } // namespace net |
| 195 | 196 |
| 196 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ | 197 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ |
| OLD | NEW |