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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 address(address) {} | 122 address(address) {} |
123 | 123 |
124 bool Equals(const SupportsQuic& other) const { | 124 bool Equals(const SupportsQuic& other) const { |
125 return used_quic == other.used_quic && address == other.address; | 125 return used_quic == other.used_quic && address == other.address; |
126 } | 126 } |
127 | 127 |
128 bool used_quic; | 128 bool used_quic; |
129 std::string address; | 129 std::string address; |
130 }; | 130 }; |
131 | 131 |
| 132 struct NET_EXPORT ServerNetworkStats { |
| 133 ServerNetworkStats() : bandwidth_estimate(QuicBandwidth::Zero()) {} |
| 134 |
| 135 base::TimeDelta srtt; |
| 136 QuicBandwidth bandwidth_estimate; |
| 137 }; |
| 138 |
132 typedef base::MRUCache< | 139 typedef base::MRUCache< |
133 HostPortPair, AlternateProtocolInfo> AlternateProtocolMap; | 140 HostPortPair, AlternateProtocolInfo> AlternateProtocolMap; |
134 typedef base::MRUCache<HostPortPair, SettingsMap> SpdySettingsMap; | 141 typedef base::MRUCache<HostPortPair, SettingsMap> SpdySettingsMap; |
135 typedef std::map<HostPortPair, SupportsQuic> SupportsQuicMap; | 142 typedef std::map<HostPortPair, SupportsQuic> SupportsQuicMap; |
| 143 typedef base::MRUCache<HostPortPair, ServerNetworkStats> ServerNetworkStatsMap; |
136 | 144 |
137 extern const char kAlternateProtocolHeader[]; | 145 extern const char kAlternateProtocolHeader[]; |
138 | 146 |
139 // The interface for setting/retrieving the HTTP server properties. | 147 // The interface for setting/retrieving the HTTP server properties. |
140 // Currently, this class manages servers': | 148 // Currently, this class manages servers': |
141 // * SPDY support (based on NPN results) | 149 // * SPDY support (based on NPN results) |
142 // * Alternate-Protocol support | 150 // * Alternate-Protocol support |
143 // * Spdy Settings (like CWND ID field) | 151 // * Spdy Settings (like CWND ID field) |
144 class NET_EXPORT HttpServerProperties { | 152 class NET_EXPORT HttpServerProperties { |
145 public: | 153 public: |
146 struct NetworkStats { | |
147 NetworkStats() : bandwidth_estimate(QuicBandwidth::Zero()) {} | |
148 | |
149 base::TimeDelta srtt; | |
150 QuicBandwidth bandwidth_estimate; | |
151 }; | |
152 | |
153 HttpServerProperties() {} | 154 HttpServerProperties() {} |
154 virtual ~HttpServerProperties() {} | 155 virtual ~HttpServerProperties() {} |
155 | 156 |
156 // Gets a weak pointer for this object. | 157 // Gets a weak pointer for this object. |
157 virtual base::WeakPtr<HttpServerProperties> GetWeakPtr() = 0; | 158 virtual base::WeakPtr<HttpServerProperties> GetWeakPtr() = 0; |
158 | 159 |
159 // Deletes all data. | 160 // Deletes all data. |
160 virtual void Clear() = 0; | 161 virtual void Clear() = 0; |
161 | 162 |
162 // Returns true if |server| supports SPDY. | 163 // Returns true if |server| supports SPDY. |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 virtual SupportsQuic GetSupportsQuic( | 231 virtual SupportsQuic GetSupportsQuic( |
231 const HostPortPair& host_port_pair) const = 0; | 232 const HostPortPair& host_port_pair) const = 0; |
232 | 233 |
233 virtual void SetSupportsQuic(const HostPortPair& host_port_pair, | 234 virtual void SetSupportsQuic(const HostPortPair& host_port_pair, |
234 bool used_quic, | 235 bool used_quic, |
235 const std::string& address) = 0; | 236 const std::string& address) = 0; |
236 | 237 |
237 virtual const SupportsQuicMap& supports_quic_map() const = 0; | 238 virtual const SupportsQuicMap& supports_quic_map() const = 0; |
238 | 239 |
239 virtual void SetServerNetworkStats(const HostPortPair& host_port_pair, | 240 virtual void SetServerNetworkStats(const HostPortPair& host_port_pair, |
240 NetworkStats stats) = 0; | 241 ServerNetworkStats stats) = 0; |
241 | 242 |
242 virtual const NetworkStats* GetServerNetworkStats( | 243 virtual const ServerNetworkStats* GetServerNetworkStats( |
243 const HostPortPair& host_port_pair) const = 0; | 244 const HostPortPair& host_port_pair) = 0; |
| 245 |
| 246 virtual const ServerNetworkStatsMap& server_network_stats_map() const = 0; |
244 | 247 |
245 private: | 248 private: |
246 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); | 249 DISALLOW_COPY_AND_ASSIGN(HttpServerProperties); |
247 }; | 250 }; |
248 | 251 |
249 } // namespace net | 252 } // namespace net |
250 | 253 |
251 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ | 254 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_H_ |
OLD | NEW |