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

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

Issue 851503003: Update from https://crrev.com/311076 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « net/http/http_server_properties.cc ('k') | net/http/http_server_properties_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <string> 10 #include <string>
10 #include <vector> 11 #include <vector>
11 12
12 #include "base/basictypes.h" 13 #include "base/basictypes.h"
13 #include "base/containers/hash_tables.h" 14 #include "base/containers/hash_tables.h"
14 #include "base/gtest_prod_util.h" 15 #include "base/gtest_prod_util.h"
15 #include "base/threading/non_thread_safe.h" 16 #include "base/threading/non_thread_safe.h"
16 #include "base/values.h" 17 #include "base/values.h"
17 #include "net/base/host_port_pair.h" 18 #include "net/base/host_port_pair.h"
18 #include "net/base/net_export.h" 19 #include "net/base/net_export.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 76
76 // Deletes all data. 77 // Deletes all data.
77 void Clear() override; 78 void Clear() override;
78 79
79 // Returns true if |server| supports SPDY. 80 // Returns true if |server| supports SPDY.
80 bool SupportsSpdy(const HostPortPair& server) override; 81 bool SupportsSpdy(const HostPortPair& server) override;
81 82
82 // Add |server| into the persistent store. 83 // Add |server| into the persistent store.
83 void SetSupportsSpdy(const HostPortPair& server, bool support_spdy) override; 84 void SetSupportsSpdy(const HostPortPair& server, bool support_spdy) override;
84 85
86 // Returns true if |server| has required HTTP/1.1 via HTTP/2 error code.
87 bool RequiresHTTP11(const HostPortPair& server) override;
88
89 // Require HTTP/1.1 on subsequent connections. Not persisted.
90 void SetHTTP11Required(const HostPortPair& server) override;
91
92 // Modify SSLConfig to force HTTP/1.1 if necessary.
93 void MaybeForceHTTP11(const HostPortPair& server,
94 SSLConfig* ssl_config) override;
95
85 // Returns true if |server| has an Alternate-Protocol header. 96 // Returns true if |server| has an Alternate-Protocol header.
86 bool HasAlternateProtocol(const HostPortPair& server) override; 97 bool HasAlternateProtocol(const HostPortPair& server) override;
87 98
88 // Returns the Alternate-Protocol and port for |server|. 99 // Returns the Alternate-Protocol and port for |server|.
89 // HasAlternateProtocol(server) must be true. 100 // HasAlternateProtocol(server) must be true.
90 AlternateProtocolInfo GetAlternateProtocol( 101 AlternateProtocolInfo GetAlternateProtocol(
91 const HostPortPair& server) override; 102 const HostPortPair& server) override;
92 103
93 // Sets the Alternate-Protocol for |server|. 104 // Sets the Alternate-Protocol for |server|.
94 void SetAlternateProtocol(const HostPortPair& server, 105 void SetAlternateProtocol(const HostPortPair& server,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 const HostPortPair& host_port_pair) override; 163 const HostPortPair& host_port_pair) override;
153 164
154 const ServerNetworkStatsMap& server_network_stats_map() const override; 165 const ServerNetworkStatsMap& server_network_stats_map() const override;
155 166
156 private: 167 private:
157 // |spdy_servers_map_| has flattened representation of servers (host, port) 168 // |spdy_servers_map_| has flattened representation of servers (host, port)
158 // that either support or not support SPDY protocol. 169 // that either support or not support SPDY protocol.
159 typedef base::MRUCache<std::string, bool> SpdyServerHostPortMap; 170 typedef base::MRUCache<std::string, bool> SpdyServerHostPortMap;
160 typedef std::map<HostPortPair, HostPortPair> CanonicalHostMap; 171 typedef std::map<HostPortPair, HostPortPair> CanonicalHostMap;
161 typedef std::vector<std::string> CanonicalSufficList; 172 typedef std::vector<std::string> CanonicalSufficList;
173 typedef std::set<HostPortPair> Http11ServerHostPortSet;
162 // List of broken host:ports and the times when they can be expired. 174 // List of broken host:ports and the times when they can be expired.
163 struct BrokenAlternateProtocolEntry { 175 struct BrokenAlternateProtocolEntry {
164 HostPortPair server; 176 HostPortPair server;
165 base::TimeTicks when; 177 base::TimeTicks when;
166 }; 178 };
167 typedef std::list<BrokenAlternateProtocolEntry> 179 typedef std::list<BrokenAlternateProtocolEntry>
168 BrokenAlternateProtocolList; 180 BrokenAlternateProtocolList;
169 // Map from host:port to the number of times alternate protocol has 181 // Map from host:port to the number of times alternate protocol has
170 // been marked broken. 182 // been marked broken.
171 typedef std::map<HostPortPair, int> BrokenAlternateProtocolMap; 183 typedef std::map<HostPortPair, int> BrokenAlternateProtocolMap;
172 184
173 // Return the canonical host for |server|, or end if none exists. 185 // Return the canonical host for |server|, or end if none exists.
174 CanonicalHostMap::const_iterator GetCanonicalHost(HostPortPair server) const; 186 CanonicalHostMap::const_iterator GetCanonicalHost(HostPortPair server) const;
175 187
176 void RemoveCanonicalHost(const HostPortPair& server); 188 void RemoveCanonicalHost(const HostPortPair& server);
177 void ExpireBrokenAlternateProtocolMappings(); 189 void ExpireBrokenAlternateProtocolMappings();
178 void ScheduleBrokenAlternateProtocolMappingsExpiration(); 190 void ScheduleBrokenAlternateProtocolMappingsExpiration();
179 191
180 SpdyServerHostPortMap spdy_servers_map_; 192 SpdyServerHostPortMap spdy_servers_map_;
193 Http11ServerHostPortSet http11_servers_;
181 194
182 AlternateProtocolMap alternate_protocol_map_; 195 AlternateProtocolMap alternate_protocol_map_;
183 BrokenAlternateProtocolList broken_alternate_protocol_list_; 196 BrokenAlternateProtocolList broken_alternate_protocol_list_;
184 BrokenAlternateProtocolMap broken_alternate_protocol_map_; 197 BrokenAlternateProtocolMap broken_alternate_protocol_map_;
185 198
186 SpdySettingsMap spdy_settings_map_; 199 SpdySettingsMap spdy_settings_map_;
187 SupportsQuicMap supports_quic_map_; 200 SupportsQuicMap supports_quic_map_;
188 ServerNetworkStatsMap server_network_stats_map_; 201 ServerNetworkStatsMap server_network_stats_map_;
189 // Contains a map of servers which could share the same alternate protocol. 202 // Contains a map of servers which could share the same alternate protocol.
190 // Map from a Canonical host/port (host is some postfix of host names) to an 203 // Map from a Canonical host/port (host is some postfix of host names) to an
191 // actual origin, which has a plausible alternate protocol mapping. 204 // actual origin, which has a plausible alternate protocol mapping.
192 CanonicalHostMap canonical_host_to_origin_map_; 205 CanonicalHostMap canonical_host_to_origin_map_;
193 // Contains list of suffixes (for exmaple ".c.youtube.com", 206 // Contains list of suffixes (for exmaple ".c.youtube.com",
194 // ".googlevideo.com", ".googleusercontent.com") of canonical hostnames. 207 // ".googlevideo.com", ".googleusercontent.com") of canonical hostnames.
195 CanonicalSufficList canonical_suffixes_; 208 CanonicalSufficList canonical_suffixes_;
196 209
197 double alternate_protocol_probability_threshold_; 210 double alternate_protocol_probability_threshold_;
198 211
199 base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_; 212 base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_;
200 213
201 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); 214 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl);
202 }; 215 };
203 216
204 } // namespace net 217 } // namespace net
205 218
206 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ 219 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_
OLDNEW
« no previous file with comments | « net/http/http_server_properties.cc ('k') | net/http/http_server_properties_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698