| 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 <deque> | 8 #include <deque> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 NON_EXPORTED_BASE(public base::NonThreadSafe) { | 44 NON_EXPORTED_BASE(public base::NonThreadSafe) { |
| 45 public: | 45 public: |
| 46 HttpServerPropertiesImpl(); | 46 HttpServerPropertiesImpl(); |
| 47 ~HttpServerPropertiesImpl() override; | 47 ~HttpServerPropertiesImpl() override; |
| 48 | 48 |
| 49 // Initializes |spdy_servers_map_| with the servers (host/port) from | 49 // Initializes |spdy_servers_map_| with the servers (host/port) from |
| 50 // |spdy_servers| that either support SPDY or not. | 50 // |spdy_servers| that either support SPDY or not. |
| 51 void InitializeSpdyServers(std::vector<std::string>* spdy_servers, | 51 void InitializeSpdyServers(std::vector<std::string>* spdy_servers, |
| 52 bool support_spdy); | 52 bool support_spdy); |
| 53 | 53 |
| 54 void InitializeAlternateProtocolServers( | 54 void InitializeAlternativeServiceServers( |
| 55 AlternateProtocolMap* alternate_protocol_servers); | 55 AlternativeServiceMap* alternate_protocol_servers); |
| 56 | 56 |
| 57 void InitializeSpdySettingsServers(SpdySettingsMap* spdy_settings_map); | 57 void InitializeSpdySettingsServers(SpdySettingsMap* spdy_settings_map); |
| 58 | 58 |
| 59 void InitializeSupportsQuic(IPAddressNumber* last_address); | 59 void InitializeSupportsQuic(IPAddressNumber* last_address); |
| 60 | 60 |
| 61 void InitializeServerNetworkStats( | 61 void InitializeServerNetworkStats( |
| 62 ServerNetworkStatsMap* server_network_stats_map); | 62 ServerNetworkStatsMap* server_network_stats_map); |
| 63 | 63 |
| 64 // Get the list of servers (host/port) that support SPDY. The max_size is the | 64 // Get the list of servers (host/port) that support SPDY. The max_size is the |
| 65 // number of MRU servers that support SPDY that are to be returned. | 65 // number of MRU servers that support SPDY that are to be returned. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 94 const AlternativeService& alternative_service) override; | 94 const AlternativeService& alternative_service) override; |
| 95 void MarkAlternativeServiceRecentlyBroken( | 95 void MarkAlternativeServiceRecentlyBroken( |
| 96 const AlternativeService& alternative_service) override; | 96 const AlternativeService& alternative_service) override; |
| 97 bool IsAlternativeServiceBroken( | 97 bool IsAlternativeServiceBroken( |
| 98 const AlternativeService& alternative_service) override; | 98 const AlternativeService& alternative_service) override; |
| 99 bool WasAlternativeServiceRecentlyBroken( | 99 bool WasAlternativeServiceRecentlyBroken( |
| 100 const AlternativeService& alternative_service) override; | 100 const AlternativeService& alternative_service) override; |
| 101 void ConfirmAlternativeService( | 101 void ConfirmAlternativeService( |
| 102 const AlternativeService& alternative_service) override; | 102 const AlternativeService& alternative_service) override; |
| 103 void ClearAlternativeService(const HostPortPair& origin) override; | 103 void ClearAlternativeService(const HostPortPair& origin) override; |
| 104 const AlternateProtocolMap& alternate_protocol_map() const override; | 104 const AlternativeServiceMap& alternative_service_map() const override; |
| 105 void SetAlternateProtocolProbabilityThreshold(double threshold) override; | 105 void SetAlternateProtocolProbabilityThreshold(double threshold) override; |
| 106 const SettingsMap& GetSpdySettings( | 106 const SettingsMap& GetSpdySettings( |
| 107 const HostPortPair& host_port_pair) override; | 107 const HostPortPair& host_port_pair) override; |
| 108 bool SetSpdySetting(const HostPortPair& host_port_pair, | 108 bool SetSpdySetting(const HostPortPair& host_port_pair, |
| 109 SpdySettingsIds id, | 109 SpdySettingsIds id, |
| 110 SpdySettingsFlags flags, | 110 SpdySettingsFlags flags, |
| 111 uint32 value) override; | 111 uint32 value) override; |
| 112 void ClearSpdySettings(const HostPortPair& host_port_pair) override; | 112 void ClearSpdySettings(const HostPortPair& host_port_pair) override; |
| 113 void ClearAllSpdySettings() override; | 113 void ClearAllSpdySettings() override; |
| 114 const SpdySettingsMap& spdy_settings_map() const override; | 114 const SpdySettingsMap& spdy_settings_map() const override; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 132 | 132 |
| 133 // Linked hash map from AlternativeService to expiration time. This container | 133 // Linked hash map from AlternativeService to expiration time. This container |
| 134 // is a queue with O(1) enqueue and dequeue, and a hash_map with O(1) lookup | 134 // is a queue with O(1) enqueue and dequeue, and a hash_map with O(1) lookup |
| 135 // at the same time. | 135 // at the same time. |
| 136 typedef linked_hash_map<AlternativeService, base::TimeTicks> | 136 typedef linked_hash_map<AlternativeService, base::TimeTicks> |
| 137 BrokenAlternativeServices; | 137 BrokenAlternativeServices; |
| 138 // Map to the number of times each alternative service has been marked broken. | 138 // Map to the number of times each alternative service has been marked broken. |
| 139 typedef std::map<AlternativeService, int> RecentlyBrokenAlternativeServices; | 139 typedef std::map<AlternativeService, int> RecentlyBrokenAlternativeServices; |
| 140 | 140 |
| 141 // Return the iterator for |server|, or for its canonical host, or end. | 141 // Return the iterator for |server|, or for its canonical host, or end. |
| 142 AlternateProtocolMap::const_iterator GetAlternateProtocolIterator( | 142 AlternativeServiceMap::const_iterator GetAlternateProtocolIterator( |
| 143 const HostPortPair& server); | 143 const HostPortPair& server); |
| 144 | 144 |
| 145 // Return the canonical host for |server|, or end if none exists. | 145 // Return the canonical host for |server|, or end if none exists. |
| 146 CanonicalHostMap::const_iterator GetCanonicalHost(HostPortPair server) const; | 146 CanonicalHostMap::const_iterator GetCanonicalHost(HostPortPair server) const; |
| 147 | 147 |
| 148 void RemoveCanonicalHost(const HostPortPair& server); | 148 void RemoveCanonicalHost(const HostPortPair& server); |
| 149 void ExpireBrokenAlternateProtocolMappings(); | 149 void ExpireBrokenAlternateProtocolMappings(); |
| 150 void ScheduleBrokenAlternateProtocolMappingsExpiration(); | 150 void ScheduleBrokenAlternateProtocolMappingsExpiration(); |
| 151 | 151 |
| 152 SpdyServerHostPortMap spdy_servers_map_; | 152 SpdyServerHostPortMap spdy_servers_map_; |
| 153 Http11ServerHostPortSet http11_servers_; | 153 Http11ServerHostPortSet http11_servers_; |
| 154 | 154 |
| 155 AlternateProtocolMap alternate_protocol_map_; | 155 AlternativeServiceMap alternative_service_map_; |
| 156 BrokenAlternativeServices broken_alternative_services_; | 156 BrokenAlternativeServices broken_alternative_services_; |
| 157 // Class invariant: Every alternative service in broken_alternative_services_ | 157 // Class invariant: Every alternative service in broken_alternative_services_ |
| 158 // must also be in recently_broken_alternative_services_. | 158 // must also be in recently_broken_alternative_services_. |
| 159 RecentlyBrokenAlternativeServices recently_broken_alternative_services_; | 159 RecentlyBrokenAlternativeServices recently_broken_alternative_services_; |
| 160 | 160 |
| 161 IPAddressNumber last_quic_address_; | 161 IPAddressNumber last_quic_address_; |
| 162 SpdySettingsMap spdy_settings_map_; | 162 SpdySettingsMap spdy_settings_map_; |
| 163 ServerNetworkStatsMap server_network_stats_map_; | 163 ServerNetworkStatsMap server_network_stats_map_; |
| 164 // Contains a map of servers which could share the same alternate protocol. | 164 // Contains a map of servers which could share the same alternate protocol. |
| 165 // Map from a Canonical host/port (host is some postfix of host names) to an | 165 // Map from a Canonical host/port (host is some postfix of host names) to an |
| 166 // actual origin, which has a plausible alternate protocol mapping. | 166 // actual origin, which has a plausible alternate protocol mapping. |
| 167 CanonicalHostMap canonical_host_to_origin_map_; | 167 CanonicalHostMap canonical_host_to_origin_map_; |
| 168 // Contains list of suffixes (for exmaple ".c.youtube.com", | 168 // Contains list of suffixes (for exmaple ".c.youtube.com", |
| 169 // ".googlevideo.com", ".googleusercontent.com") of canonical hostnames. | 169 // ".googlevideo.com", ".googleusercontent.com") of canonical hostnames. |
| 170 CanonicalSufficList canonical_suffixes_; | 170 CanonicalSufficList canonical_suffixes_; |
| 171 | 171 |
| 172 double alternate_protocol_probability_threshold_; | 172 double alternate_protocol_probability_threshold_; |
| 173 | 173 |
| 174 base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_; | 174 base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_; |
| 175 | 175 |
| 176 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); | 176 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); |
| 177 }; | 177 }; |
| 178 | 178 |
| 179 } // namespace net | 179 } // namespace net |
| 180 | 180 |
| 181 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ | 181 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ |
| OLD | NEW |