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_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 <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 26 matching lines...) Expand all Loading... |
37 void InitializeSpdyServers(std::vector<std::string>* spdy_servers, | 37 void InitializeSpdyServers(std::vector<std::string>* spdy_servers, |
38 bool support_spdy); | 38 bool support_spdy); |
39 | 39 |
40 void InitializeAlternateProtocolServers( | 40 void InitializeAlternateProtocolServers( |
41 AlternateProtocolMap* alternate_protocol_servers); | 41 AlternateProtocolMap* alternate_protocol_servers); |
42 | 42 |
43 void InitializeSpdySettingsServers(SpdySettingsMap* spdy_settings_map); | 43 void InitializeSpdySettingsServers(SpdySettingsMap* spdy_settings_map); |
44 | 44 |
45 void InitializeSupportsQuic(SupportsQuicMap* supports_quic_map); | 45 void InitializeSupportsQuic(SupportsQuicMap* supports_quic_map); |
46 | 46 |
| 47 void InitializeServerNetworkStats( |
| 48 ServerNetworkStatsMap* server_network_stats_map); |
| 49 |
47 // Get the list of servers (host/port) that support SPDY. The max_size is the | 50 // Get the list of servers (host/port) that support SPDY. The max_size is the |
48 // number of MRU servers that support SPDY that are to be returned. | 51 // number of MRU servers that support SPDY that are to be returned. |
49 void GetSpdyServerList(base::ListValue* spdy_server_list, | 52 void GetSpdyServerList(base::ListValue* spdy_server_list, |
50 size_t max_size) const; | 53 size_t max_size) const; |
51 | 54 |
52 // Returns flattened string representation of the |host_port_pair|. Used by | 55 // Returns flattened string representation of the |host_port_pair|. Used by |
53 // unittests. | 56 // unittests. |
54 static std::string GetFlattenedSpdyServer( | 57 static std::string GetFlattenedSpdyServer(const HostPortPair& host_port_pair); |
55 const net::HostPortPair& host_port_pair); | |
56 | 58 |
57 // Debugging to simulate presence of an AlternateProtocol. | 59 // Debugging to simulate presence of an AlternateProtocol. |
58 // If we don't have an alternate protocol in the map for any given host/port | 60 // If we don't have an alternate protocol in the map for any given host/port |
59 // pair, force this ProtocolPortPair. | 61 // pair, force this ProtocolPortPair. |
60 static void ForceAlternateProtocol(const AlternateProtocolInfo& pair); | 62 static void ForceAlternateProtocol(const AlternateProtocolInfo& pair); |
61 static void DisableForcedAlternateProtocol(); | 63 static void DisableForcedAlternateProtocol(); |
62 | 64 |
63 // Returns the canonical host suffix for |server|, or std::string() if none | 65 // Returns the canonical host suffix for |server|, or std::string() if none |
64 // exists. | 66 // exists. |
65 std::string GetCanonicalSuffix(const net::HostPortPair& server); | 67 std::string GetCanonicalSuffix(const HostPortPair& server); |
66 | 68 |
67 // ----------------------------- | 69 // ----------------------------- |
68 // HttpServerProperties methods: | 70 // HttpServerProperties methods: |
69 // ----------------------------- | 71 // ----------------------------- |
70 | 72 |
71 // Gets a weak pointer for this object. | 73 // Gets a weak pointer for this object. |
72 base::WeakPtr<HttpServerProperties> GetWeakPtr() override; | 74 base::WeakPtr<HttpServerProperties> GetWeakPtr() override; |
73 | 75 |
74 // Deletes all data. | 76 // Deletes all data. |
75 void Clear() override; | 77 void Clear() override; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 // Methods for SupportsQuic. | 137 // Methods for SupportsQuic. |
136 SupportsQuic GetSupportsQuic( | 138 SupportsQuic GetSupportsQuic( |
137 const HostPortPair& host_port_pair) const override; | 139 const HostPortPair& host_port_pair) const override; |
138 | 140 |
139 void SetSupportsQuic(const HostPortPair& host_port_pair, | 141 void SetSupportsQuic(const HostPortPair& host_port_pair, |
140 bool used_quic, | 142 bool used_quic, |
141 const std::string& address) override; | 143 const std::string& address) override; |
142 | 144 |
143 const SupportsQuicMap& supports_quic_map() const override; | 145 const SupportsQuicMap& supports_quic_map() const override; |
144 | 146 |
145 // Methods for NetworkStats. | 147 // Methods for ServerNetworkStats. |
146 void SetServerNetworkStats(const HostPortPair& host_port_pair, | 148 void SetServerNetworkStats(const HostPortPair& host_port_pair, |
147 NetworkStats stats) override; | 149 ServerNetworkStats stats) override; |
148 | 150 |
149 const NetworkStats* GetServerNetworkStats( | 151 const ServerNetworkStats* GetServerNetworkStats( |
150 const HostPortPair& host_port_pair) const override; | 152 const HostPortPair& host_port_pair) override; |
| 153 |
| 154 const ServerNetworkStatsMap& server_network_stats_map() const override; |
151 | 155 |
152 private: | 156 private: |
153 // |spdy_servers_map_| has flattened representation of servers (host, port) | 157 // |spdy_servers_map_| has flattened representation of servers (host, port) |
154 // that either support or not support SPDY protocol. | 158 // that either support or not support SPDY protocol. |
155 typedef base::MRUCache<std::string, bool> SpdyServerHostPortMap; | 159 typedef base::MRUCache<std::string, bool> SpdyServerHostPortMap; |
156 typedef std::map<HostPortPair, NetworkStats> ServerNetworkStatsMap; | |
157 typedef std::map<HostPortPair, HostPortPair> CanonicalHostMap; | 160 typedef std::map<HostPortPair, HostPortPair> CanonicalHostMap; |
158 typedef std::vector<std::string> CanonicalSufficList; | 161 typedef std::vector<std::string> CanonicalSufficList; |
159 // List of broken host:ports and the times when they can be expired. | 162 // List of broken host:ports and the times when they can be expired. |
160 struct BrokenAlternateProtocolEntry { | 163 struct BrokenAlternateProtocolEntry { |
161 HostPortPair server; | 164 HostPortPair server; |
162 base::TimeTicks when; | 165 base::TimeTicks when; |
163 }; | 166 }; |
164 typedef std::list<BrokenAlternateProtocolEntry> | 167 typedef std::list<BrokenAlternateProtocolEntry> |
165 BrokenAlternateProtocolList; | 168 BrokenAlternateProtocolList; |
166 // Map from host:port to the number of times alternate protocol has | 169 // Map from host:port to the number of times alternate protocol has |
(...skipping 27 matching lines...) Expand all Loading... |
194 double alternate_protocol_probability_threshold_; | 197 double alternate_protocol_probability_threshold_; |
195 | 198 |
196 base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_; | 199 base::WeakPtrFactory<HttpServerPropertiesImpl> weak_ptr_factory_; |
197 | 200 |
198 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); | 201 DISALLOW_COPY_AND_ASSIGN(HttpServerPropertiesImpl); |
199 }; | 202 }; |
200 | 203 |
201 } // namespace net | 204 } // namespace net |
202 | 205 |
203 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ | 206 #endif // NET_HTTP_HTTP_SERVER_PROPERTIES_IMPL_H_ |
OLD | NEW |