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 <deque> | 8 #include <deque> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 const ServerNetworkStatsMap& server_network_stats_map() const override; | 110 const ServerNetworkStatsMap& server_network_stats_map() const override; |
| 111 | 111 |
| 112 private: | 112 private: |
| 113 // |spdy_servers_map_| has flattened representation of servers (host, port) | 113 // |spdy_servers_map_| has flattened representation of servers (host, port) |
| 114 // that either support or not support SPDY protocol. | 114 // that either support or not support SPDY protocol. |
| 115 typedef base::MRUCache<std::string, bool> SpdyServerHostPortMap; | 115 typedef base::MRUCache<std::string, bool> SpdyServerHostPortMap; |
| 116 typedef std::map<HostPortPair, HostPortPair> CanonicalHostMap; | 116 typedef std::map<HostPortPair, HostPortPair> CanonicalHostMap; |
| 117 typedef std::vector<std::string> CanonicalSufficList; | 117 typedef std::vector<std::string> CanonicalSufficList; |
| 118 typedef std::set<HostPortPair> Http11ServerHostPortSet; | 118 typedef std::set<HostPortPair> Http11ServerHostPortSet; |
| 119 | 119 |
| 120 // Server, port, and AlternateProtocol: an entity that can be broken. (Once | 120 // Broken alternative service with expiration time. |
| 121 // we use AlternativeService, the same AltSvc can be broken for one server but | 121 struct BrokenAlternateProtocolEntryWithTime { |
| 122 // not for another depending on what certificate it can offer.) | 122 BrokenAlternateProtocolEntryWithTime(const AlternativeService& altsvc, |
| 123 struct BrokenAlternateProtocolEntry { | 123 base::TimeTicks when) |
| 124 BrokenAlternateProtocolEntry(const BrokenAlternateProtocolEntry&) = default; | 124 : altsvc(altsvc), when(when) {} |
| 125 BrokenAlternateProtocolEntry(const HostPortPair& server, | |
| 126 uint16 port, | |
| 127 AlternateProtocol protocol) | |
| 128 : server(server), port(port), protocol(protocol) {} | |
| 129 | 125 |
| 130 bool operator<(const BrokenAlternateProtocolEntry& other) const { | 126 AlternativeService altsvc; |
|
Ryan Hamilton
2015/03/06 23:01:12
The style guide is not a fan of abbreviations. How
Bence
2015/03/08 18:09:04
I would argue that altsvc is a standard abbrevatia
Ryan Hamilton
2015/03/09 13:48:50
I ping'd sleevi to get a second opinion. He like y
| |
| 131 if (!server.Equals(other.server)) | |
| 132 return server < other.server; | |
| 133 if (port != other.port) | |
| 134 return port < other.port; | |
| 135 return protocol < other.protocol; | |
| 136 } | |
| 137 | |
| 138 HostPortPair server; | |
| 139 uint16 port; | |
| 140 AlternateProtocol protocol; | |
| 141 }; | |
| 142 // BrokenAlternateProtocolEntry with expiration time. | |
| 143 struct BrokenAlternateProtocolEntryWithTime { | |
| 144 BrokenAlternateProtocolEntryWithTime( | |
| 145 const BrokenAlternateProtocolEntry& broken_alternate_protocol_entry, | |
| 146 base::TimeTicks when) | |
| 147 : broken_alternate_protocol_entry(broken_alternate_protocol_entry), | |
| 148 when(when) {} | |
| 149 | |
| 150 BrokenAlternateProtocolEntry broken_alternate_protocol_entry; | |
| 151 base::TimeTicks when; | 127 base::TimeTicks when; |
| 152 }; | 128 }; |
| 153 // Deque of BrokenAlternateProtocolEntryWithTime items, ordered by expiration | 129 // Deque of BrokenAlternateProtocolEntryWithTime items, ordered by expiration |
| 154 // time. | 130 // time. |
| 155 typedef std::deque<BrokenAlternateProtocolEntryWithTime> | 131 typedef std::deque<BrokenAlternateProtocolEntryWithTime> |
| 156 BrokenAlternateProtocolList; | 132 BrokenAlternateProtocolList; |
| 157 // Map from (server, alternate protocol and port) to the number of | 133 // Map from (server, alternate protocol and port) to the number of |
| 158 // times that alternate protocol has been marked broken for that server. | 134 // times that alternate protocol has been marked broken for that server. |
| 159 typedef std::map<BrokenAlternateProtocolEntry, int> | 135 typedef std::map<AlternativeService, int> BrokenAlternateProtocolMap; |
| 160 BrokenAlternateProtocolMap; | |
| 161 | 136 |
| 162 // Return the iterator for |server|, or for its canonical host, or end. | 137 // Return the iterator for |server|, or for its canonical host, or end. |
| 163 AlternateProtocolMap::const_iterator GetAlternateProtocolIterator( | 138 AlternateProtocolMap::const_iterator GetAlternateProtocolIterator( |
| 164 const HostPortPair& server); | 139 const HostPortPair& server); |
| 165 | 140 |
| 166 // Return the canonical host for |server|, or end if none exists. | 141 // Return the canonical host for |server|, or end if none exists. |
| 167 CanonicalHostMap::const_iterator GetCanonicalHost(HostPortPair server) const; | 142 CanonicalHostMap::const_iterator GetCanonicalHost(HostPortPair server) const; |
| 168 | 143 |
| 169 void RemoveCanonicalHost(const HostPortPair& server); | 144 void RemoveCanonicalHost(const HostPortPair& server); |
| 170 void ExpireBrokenAlternateProtocolMappings(); | 145 void ExpireBrokenAlternateProtocolMappings(); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 191 double alternate_protocol_probability_threshold_; | 166 double alternate_protocol_probability_threshold_; |
| 192 | 167 |
| 193 base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_; | 168 base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_; |
| 194 | 169 |
| 195 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); | 170 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); |
| 196 }; | 171 }; |
| 197 | 172 |
| 198 } // namespace net | 173 } // namespace net |
| 199 | 174 |
| 200 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ | 175 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ |
| OLD | NEW |