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

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

Issue 1824903002: Change the AlternativeServiceMap with SchemeOriginPair key. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unittests Created 4 years, 9 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 <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
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 SchemeOriginPair& server) override;
83 bool GetSupportsSpdy(const HostPortPair& server) override; 83 bool GetSupportsSpdy(const HostPortPair& server) override;
84 void SetSupportsSpdy(const HostPortPair& server, bool support_spdy) override; 84 void SetSupportsSpdy(const HostPortPair& server, bool support_spdy) override;
85 bool RequiresHTTP11(const HostPortPair& server) override; 85 bool RequiresHTTP11(const HostPortPair& server) override;
86 void SetHTTP11Required(const HostPortPair& server) override; 86 void SetHTTP11Required(const HostPortPair& server) override;
87 void MaybeForceHTTP11(const HostPortPair& server, 87 void MaybeForceHTTP11(const HostPortPair& server,
88 SSLConfig* ssl_config) override; 88 SSLConfig* ssl_config) override;
89 AlternativeServiceVector GetAlternativeServices( 89 AlternativeServiceVector GetAlternativeServices(
90 const HostPortPair& origin) override; 90 const SchemeOriginPair& origin) override;
91 bool SetAlternativeService(const HostPortPair& origin, 91 bool SetAlternativeService(const SchemeOriginPair& origin,
92 const AlternativeService& alternative_service, 92 const AlternativeService& alternative_service,
93 double alternative_probability, 93 double alternative_probability,
94 base::Time expiration) override; 94 base::Time expiration) override;
95 bool SetAlternativeServices(const HostPortPair& origin, 95 bool SetAlternativeServices(const SchemeOriginPair& origin,
96 const AlternativeServiceInfoVector& 96 const AlternativeServiceInfoVector&
97 alternative_service_info_vector) override; 97 alternative_service_info_vector) override;
98 void MarkAlternativeServiceBroken( 98 void MarkAlternativeServiceBroken(
99 const AlternativeService& alternative_service) override; 99 const AlternativeService& alternative_service) override;
100 void MarkAlternativeServiceRecentlyBroken( 100 void MarkAlternativeServiceRecentlyBroken(
101 const AlternativeService& alternative_service) override; 101 const AlternativeService& alternative_service) override;
102 bool IsAlternativeServiceBroken( 102 bool IsAlternativeServiceBroken(
103 const AlternativeService& alternative_service) const override; 103 const AlternativeService& alternative_service) const override;
104 bool WasAlternativeServiceRecentlyBroken( 104 bool WasAlternativeServiceRecentlyBroken(
105 const AlternativeService& alternative_service) override; 105 const AlternativeService& alternative_service) override;
106 void ConfirmAlternativeService( 106 void ConfirmAlternativeService(
107 const AlternativeService& alternative_service) override; 107 const AlternativeService& alternative_service) override;
108 void ClearAlternativeServices(const HostPortPair& origin) override; 108 void ClearAlternativeServices(const SchemeOriginPair& origin) override;
109 const AlternativeServiceMap& alternative_service_map() const override; 109 const AlternativeServiceMap& alternative_service_map() const override;
110 scoped_ptr<base::Value> GetAlternativeServiceInfoAsValue() const override; 110 scoped_ptr<base::Value> GetAlternativeServiceInfoAsValue() const override;
111 void SetAlternativeServiceProbabilityThreshold(double threshold) override; 111 void SetAlternativeServiceProbabilityThreshold(double threshold) override;
112 const SettingsMap& GetSpdySettings( 112 const SettingsMap& GetSpdySettings(
113 const HostPortPair& host_port_pair) override; 113 const HostPortPair& host_port_pair) override;
114 bool SetSpdySetting(const HostPortPair& host_port_pair, 114 bool SetSpdySetting(const HostPortPair& host_port_pair,
115 SpdySettingsIds id, 115 SpdySettingsIds id,
116 SpdySettingsFlags flags, 116 SpdySettingsFlags flags,
117 uint32_t value) override; 117 uint32_t value) override;
118 void ClearSpdySettings(const HostPortPair& host_port_pair) override; 118 void ClearSpdySettings(const HostPortPair& host_port_pair) override;
(...skipping 29 matching lines...) Expand all
148 // at the same time. 148 // at the same time.
149 typedef linked_hash_map<AlternativeService, 149 typedef linked_hash_map<AlternativeService,
150 base::TimeTicks, 150 base::TimeTicks,
151 AlternativeServiceHash> 151 AlternativeServiceHash>
152 BrokenAlternativeServices; 152 BrokenAlternativeServices;
153 // 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.
154 typedef std::map<AlternativeService, int> RecentlyBrokenAlternativeServices; 154 typedef std::map<AlternativeService, int> RecentlyBrokenAlternativeServices;
155 155
156 // 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.
157 AlternativeServiceMap::const_iterator GetAlternateProtocolIterator( 157 AlternativeServiceMap::const_iterator GetAlternateProtocolIterator(
158 const HostPortPair& server); 158 const SchemeOriginPair& server);
159 159
160 // Return the canonical host for |server|, or end if none exists. 160 // Return the canonical host for |server|, or end if none exists.
161 CanonicalHostMap::const_iterator GetCanonicalHost(HostPortPair server) const; 161 CanonicalHostMap::const_iterator GetCanonicalHost(HostPortPair server) const;
162 162
163 void RemoveCanonicalHost(const HostPortPair& server); 163 void RemoveCanonicalHost(const HostPortPair& server);
164 void ExpireBrokenAlternateProtocolMappings(); 164 void ExpireBrokenAlternateProtocolMappings();
165 void ScheduleBrokenAlternateProtocolMappingsExpiration(); 165 void ScheduleBrokenAlternateProtocolMappingsExpiration();
166 166
167 SpdyServerHostPortMap spdy_servers_map_; 167 SpdyServerHostPortMap spdy_servers_map_;
168 Http11ServerHostPortSet http11_servers_; 168 Http11ServerHostPortSet http11_servers_;
169 169
170 AlternativeServiceMap alternative_service_map_; 170 AlternativeServiceMap alternative_service_map_;
171 BrokenAlternativeServices broken_alternative_services_; 171 BrokenAlternativeServices broken_alternative_services_;
172 // Class invariant: Every alternative service in broken_alternative_services_ 172 // Class invariant: Every alternative service in broken_alternative_services_
173 // must also be in recently_broken_alternative_services_. 173 // must also be in recently_broken_alternative_services_.
174 RecentlyBrokenAlternativeServices recently_broken_alternative_services_; 174 RecentlyBrokenAlternativeServices recently_broken_alternative_services_;
175 175
176 IPAddress last_quic_address_; 176 IPAddress last_quic_address_;
177 SpdySettingsMap spdy_settings_map_; 177 SpdySettingsMap spdy_settings_map_;
178 ServerNetworkStatsMap server_network_stats_map_; 178 ServerNetworkStatsMap server_network_stats_map_;
179 // Contains a map of servers which could share the same alternate protocol. 179 // Contains a map of servers which could share the same alternate protocol.
180 // Map from a Canonical host/port (host is some postfix of host names) to an 180 // Map from a Canonical host/port (host is some postfix of host names) to an
181 // actual origin, which has a plausible alternate protocol mapping. 181 // actual origin, which has a plausible alternate protocol mapping.
Ryan Hamilton 2016/03/24 22:23:14 It seems like the key should really be a scheme/ho
Zhongyi Shi 2016/04/04 18:58:36 Done.
182 CanonicalHostMap canonical_host_to_origin_map_; 182 CanonicalHostMap canonical_host_to_origin_map_;
183 // Contains list of suffixes (for exmaple ".c.youtube.com", 183 // Contains list of suffixes (for exmaple ".c.youtube.com",
184 // ".googlevideo.com", ".googleusercontent.com") of canonical hostnames. 184 // ".googlevideo.com", ".googleusercontent.com") of canonical hostnames.
185 CanonicalSufficList canonical_suffixes_; 185 CanonicalSufficList canonical_suffixes_;
186 186
187 double alternative_service_probability_threshold_; 187 double alternative_service_probability_threshold_;
188 188
189 QuicServerInfoMap quic_server_info_map_; 189 QuicServerInfoMap quic_server_info_map_;
190 size_t max_server_configs_stored_in_properties_; 190 size_t max_server_configs_stored_in_properties_;
191 191
192 base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_; 192 base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_;
193 193
194 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); 194 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl);
195 }; 195 };
196 196
197 } // namespace net 197 } // namespace net
198 198
199 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ 199 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698