Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(482)

Side by Side Diff: net/http/http_server_properties_impl.h

Issue 665083009: ABANDONED Handle multiple AlternateProtocols for each HostPortPair. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Work on pref load/save and on Job. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // Require HTTP/1.1 on subsequent connections. Not persisted. 89 // Require HTTP/1.1 on subsequent connections. Not persisted.
90 void SetHTTP11Required(const HostPortPair& server) override; 90 void SetHTTP11Required(const HostPortPair& server) override;
91 91
92 // Modify SSLConfig to force HTTP/1.1 if necessary. 92 // Modify SSLConfig to force HTTP/1.1 if necessary.
93 void MaybeForceHTTP11(const HostPortPair& server, 93 void MaybeForceHTTP11(const HostPortPair& server,
94 SSLConfig* ssl_config) override; 94 SSLConfig* ssl_config) override;
95 95
96 // Returns true if |server| has an Alternate-Protocol header. 96 // Returns true if |server| has an Alternate-Protocol header.
97 bool HasAlternateProtocol(const HostPortPair& server) override; 97 bool HasAlternateProtocol(const HostPortPair& server) override;
98 98
99 // Returns the Alternate-Protocol and port for |server|. 99 // Returns the Alternate-Protocols for |server|.
100 // HasAlternateProtocol(server) must be true. 100 // HasAlternateProtocol(server) must be true.
101 AlternateProtocolInfo GetAlternateProtocol( 101 const AlternateProtocols& GetAlternateProtocols(
102 const HostPortPair& server) override; 102 const HostPortPair& server) override;
103 103
104 // Sets the Alternate-Protocol for |server|. 104 // Adds an Alternate-Protocol for |server|.
105 void SetAlternateProtocol(const HostPortPair& server, 105 void AddAlternateProtocol(const HostPortPair& server,
106 uint16 alternate_port, 106 uint16 alternate_port,
107 AlternateProtocol alternate_protocol, 107 AlternateProtocol alternate_protocol,
108 double probability) override; 108 double probability) override;
109 109
110 // Sets the Alternate-Protocol for |server| to be BROKEN. 110 // Sets a given Alternate-Protocol for |server| to be BROKEN.
111 void SetBrokenAlternateProtocol(const HostPortPair& server) override; 111 void SetBrokenAlternateProtocol(
112 const HostPortPair& server,
113 const AlternateProtocolInfo& broken_alternate_protocol) override;
112 114
113 // Returns true if Alternate-Protocol for |server| was recently BROKEN. 115 // Returns true if given Alternate-Protocol for |server| was recently BROKEN.
114 bool WasAlternateProtocolRecentlyBroken(const HostPortPair& server) override; 116 bool WasAlternateProtocolRecentlyBroken(
117 const HostPortPair& server,
118 const AlternateProtocolInfo& alternate_protocol) override;
115 119
116 // Confirms that Alternate-Protocol for |server| is working. 120 // Confirms that given Alternate-Protocol for |server| is working.
117 void ConfirmAlternateProtocol(const HostPortPair& server) override; 121 void ConfirmAlternateProtocol(
122 const HostPortPair& server,
123 const AlternateProtocolInfo& alternate_protocol) override;
118 124
119 // Clears the Alternate-Protocol for |server|. 125 // Clears all Alternate-Protocols for |server|.
120 void ClearAlternateProtocol(const HostPortPair& server) override; 126 void ClearAlternateProtocol(const HostPortPair& server) override;
121 127
128 // Clears all Alternate-Protocols that are not broken for |server|.
129 void ClearNonBrokenAlternateProtocols(const HostPortPair& server) override;
130
131 // Removes an Alternate-Protocol for |server|.
132 void RemoveAlternateProtocol(
133 const HostPortPair& server,
134 const AlternateProtocolInfo& alternate_protocol) override;
135
122 // Returns all Alternate-Protocol mappings. 136 // Returns all Alternate-Protocol mappings.
123 const AlternateProtocolMap& alternate_protocol_map() const override; 137 const AlternateProtocolMap& alternate_protocol_map() const override;
124 138
125 void SetAlternateProtocolProbabilityThreshold(double threshold) override; 139 void SetAlternateProtocolProbabilityThreshold(double threshold) override;
126 140
127 // Gets a reference to the SettingsMap stored for a host. 141 // Gets a reference to the SettingsMap stored for a host.
128 // If no settings are stored, returns an empty SettingsMap. 142 // If no settings are stored, returns an empty SettingsMap.
129 const SettingsMap& GetSpdySettings( 143 const SettingsMap& GetSpdySettings(
130 const HostPortPair& host_port_pair) override; 144 const HostPortPair& host_port_pair) override;
131 145
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 180
167 private: 181 private:
168 // |spdy_servers_map_| has flattened representation of servers (host, port) 182 // |spdy_servers_map_| has flattened representation of servers (host, port)
169 // that either support or not support SPDY protocol. 183 // that either support or not support SPDY protocol.
170 typedef base::MRUCache<std::string, bool> SpdyServerHostPortMap; 184 typedef base::MRUCache<std::string, bool> SpdyServerHostPortMap;
171 typedef std::map<HostPortPair, HostPortPair> CanonicalHostMap; 185 typedef std::map<HostPortPair, HostPortPair> CanonicalHostMap;
172 typedef std::vector<std::string> CanonicalSufficList; 186 typedef std::vector<std::string> CanonicalSufficList;
173 typedef std::set<HostPortPair> Http11ServerHostPortSet; 187 typedef std::set<HostPortPair> Http11ServerHostPortSet;
174 // List of broken host:ports and the times when they can be expired. 188 // List of broken host:ports and the times when they can be expired.
175 struct BrokenAlternateProtocolEntry { 189 struct BrokenAlternateProtocolEntry {
176 HostPortPair server; 190 BrokenAlternateProtocolEntry(const AlternativeService& altsvc,
191 base::TimeTicks when)
192 : altsvc(altsvc), when(when) {}
193
194 AlternativeService altsvc;
177 base::TimeTicks when; 195 base::TimeTicks when;
178 }; 196 };
179 typedef std::list<BrokenAlternateProtocolEntry> 197 typedef std::list<BrokenAlternateProtocolEntry>
180 BrokenAlternateProtocolList; 198 BrokenAlternateProtocolList;
181 // Map from host:port to the number of times alternate protocol has 199 // Map from host:port to the number of times alternate protocol has
182 // been marked broken. 200 // been marked broken.
183 typedef std::map<HostPortPair, int> BrokenAlternateProtocolMap; 201 typedef std::map<AlternativeService, int> BrokenAlternateProtocolMap;
184 202
185 // Return the iterator for |server|, or for its canonical host, or end. 203 // Return the iterator for |server|, or for its canonical host, or end.
186 AlternateProtocolMap::const_iterator GetAlternateProtocolIterator( 204 AlternateProtocolMap::const_iterator GetAlternateProtocolIterator(
187 const HostPortPair& server); 205 const HostPortPair& server);
188 206
189 // Return the canonical host for |server|, or end if none exists. 207 // Return the canonical host for |server|, or end if none exists.
190 CanonicalHostMap::const_iterator GetCanonicalHost(HostPortPair server) const; 208 CanonicalHostMap::const_iterator GetCanonicalHost(HostPortPair server) const;
191 209
192 void RemoveCanonicalHost(const HostPortPair& server); 210 void RemoveCanonicalHost(const HostPortPair& server);
193 void ExpireBrokenAlternateProtocolMappings(); 211 void ExpireBrokenAlternateProtocolMappings();
(...skipping 20 matching lines...) Expand all
214 double alternate_protocol_probability_threshold_; 232 double alternate_protocol_probability_threshold_;
215 233
216 base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_; 234 base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_;
217 235
218 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); 236 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl);
219 }; 237 };
220 238
221 } // namespace net 239 } // namespace net
222 240
223 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ 241 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698