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_H_ | 5 #ifndef NET_HTTP_HTTP_SERVER_PROPERTIES_H_ |
6 #define NET_HTTP_HTTP_SERVER_PROPERTIES_H_ | 6 #define NET_HTTP_HTTP_SERVER_PROPERTIES_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 return used_quic == other.used_quic && address == other.address; | 176 return used_quic == other.used_quic && address == other.address; |
177 } | 177 } |
178 | 178 |
179 bool used_quic; | 179 bool used_quic; |
180 std::string address; | 180 std::string address; |
181 }; | 181 }; |
182 | 182 |
183 struct NET_EXPORT ServerNetworkStats { | 183 struct NET_EXPORT ServerNetworkStats { |
184 ServerNetworkStats() : bandwidth_estimate(QuicBandwidth::Zero()) {} | 184 ServerNetworkStats() : bandwidth_estimate(QuicBandwidth::Zero()) {} |
185 | 185 |
| 186 bool operator==(const ServerNetworkStats& other) const { |
| 187 return srtt == other.srtt && bandwidth_estimate == other.bandwidth_estimate; |
| 188 } |
| 189 |
| 190 bool operator!=(const ServerNetworkStats& other) const { |
| 191 return !this->operator==(other); |
| 192 } |
| 193 |
186 base::TimeDelta srtt; | 194 base::TimeDelta srtt; |
187 QuicBandwidth bandwidth_estimate; | 195 QuicBandwidth bandwidth_estimate; |
188 }; | 196 }; |
189 | 197 |
190 typedef base::MRUCache<HostPortPair, AlternativeServiceInfo> | 198 typedef base::MRUCache<HostPortPair, AlternativeServiceInfo> |
191 AlternativeServiceMap; | 199 AlternativeServiceMap; |
192 typedef base::MRUCache<HostPortPair, SettingsMap> SpdySettingsMap; | 200 typedef base::MRUCache<HostPortPair, SettingsMap> SpdySettingsMap; |
193 typedef base::MRUCache<HostPortPair, ServerNetworkStats> ServerNetworkStatsMap; | 201 typedef base::MRUCache<HostPortPair, ServerNetworkStats> ServerNetworkStatsMap; |
194 | 202 |
195 extern const char kAlternateProtocolHeader[]; | 203 extern const char kAlternateProtocolHeader[]; |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 virtual void ClearAllSpdySettings() = 0; | 308 virtual void ClearAllSpdySettings() = 0; |
301 | 309 |
302 // Returns all persistent SPDY settings. | 310 // Returns all persistent SPDY settings. |
303 virtual const SpdySettingsMap& spdy_settings_map() const = 0; | 311 virtual const SpdySettingsMap& spdy_settings_map() const = 0; |
304 | 312 |
305 virtual bool GetSupportsQuic(IPAddressNumber* last_address) const = 0; | 313 virtual bool GetSupportsQuic(IPAddressNumber* last_address) const = 0; |
306 | 314 |
307 virtual void SetSupportsQuic(bool used_quic, | 315 virtual void SetSupportsQuic(bool used_quic, |
308 const IPAddressNumber& last_address) = 0; | 316 const IPAddressNumber& last_address) = 0; |
309 | 317 |
310 virtual void SetServerNetworkStats(const HostPortPair& host_port_pair, | 318 // Sets |stats| for |host_port_pair|. Returns true if |stats| is to be |
| 319 // persisted. |
| 320 virtual bool SetServerNetworkStats(const HostPortPair& host_port_pair, |
311 ServerNetworkStats stats) = 0; | 321 ServerNetworkStats stats) = 0; |
312 | 322 |
313 virtual const ServerNetworkStats* GetServerNetworkStats( | 323 virtual const ServerNetworkStats* GetServerNetworkStats( |
314 const HostPortPair& host_port_pair) = 0; | 324 const HostPortPair& host_port_pair) = 0; |
315 | 325 |
316 virtual const ServerNetworkStatsMap& server_network_stats_map() const = 0; | 326 virtual const ServerNetworkStatsMap& server_network_stats_map() const = 0; |
317 | 327 |
318 private: | 328 private: |
319 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); | 329 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); |
320 }; | 330 }; |
321 | 331 |
322 } // namespace net | 332 } // namespace net |
323 | 333 |
324 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ | 334 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ |
OLD | NEW |