OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_SPDY_SPDY_SESSION_POOL_H_ | 5 #ifndef NET_SPDY_SPDY_SESSION_POOL_H_ |
6 #define NET_SPDY_SPDY_SESSION_POOL_H_ | 6 #define NET_SPDY_SPDY_SESSION_POOL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <list> | 10 #include <list> |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
123 // which share IP address resolutions. | 123 // which share IP address resolutions. |
124 static void enable_ip_pooling(bool value) { g_enable_ip_pooling = value; } | 124 static void enable_ip_pooling(bool value) { g_enable_ip_pooling = value; } |
125 | 125 |
126 // CertDatabase::Observer methods: | 126 // CertDatabase::Observer methods: |
127 virtual void OnUserCertAdded(const X509Certificate* cert); | 127 virtual void OnUserCertAdded(const X509Certificate* cert); |
128 virtual void OnCertTrustChanged(const X509Certificate* cert); | 128 virtual void OnCertTrustChanged(const X509Certificate* cert); |
129 | 129 |
130 private: | 130 private: |
131 friend class SpdySessionPoolPeer; // For testing. | 131 friend class SpdySessionPoolPeer; // For testing. |
132 friend class SpdyNetworkTransactionTest; // For testing. | 132 friend class SpdyNetworkTransactionTest; // For testing. |
133 friend class SpdySessionTest; // For testing. | |
willchan no longer on Chromium
2011/07/17 01:23:45
Rather than add all of these friends, can you just
ramant (doing other things)
2011/07/17 08:12:30
Done.
| |
133 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest, WindowUpdateOverflow); | 134 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionTest, WindowUpdateOverflow); |
135 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, GoAway); | |
136 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, OnSettings); | |
137 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, CancelPendingCreateStream); | |
138 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, SendSettingsOnNewSession); | |
139 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, IPPoolingTest); | |
140 FRIEND_TEST_ALL_PREFIXES(SSLClientSocketPoolTest, IPPooling); | |
134 | 141 |
135 typedef std::list<scoped_refptr<SpdySession> > SpdySessionList; | 142 typedef std::list<scoped_refptr<SpdySession> > SpdySessionList; |
136 typedef std::map<HostPortProxyPair, SpdySessionList*> SpdySessionsMap; | 143 typedef std::map<HostPortProxyPair, SpdySessionList*> SpdySessionsMap; |
137 typedef std::map<IPEndPoint, HostPortProxyPair> SpdyAliasMap; | 144 typedef std::map<IPEndPoint, HostPortProxyPair> SpdyAliasMap; |
138 | 145 |
139 | 146 |
140 scoped_refptr<SpdySession> GetInternal( | 147 scoped_refptr<SpdySession> GetInternal( |
141 const HostPortProxyPair& host_port_proxy_pair, | 148 const HostPortProxyPair& host_port_proxy_pair, |
142 const BoundNetLog& net_log, | 149 const BoundNetLog& net_log, |
143 bool only_use_existing_sessions); | 150 bool only_use_existing_sessions); |
(...skipping 12 matching lines...) Expand all Loading... | |
156 const HostPortProxyPair& host_port_proxy_pair); | 163 const HostPortProxyPair& host_port_proxy_pair); |
157 SpdySessionList* GetSessionList( | 164 SpdySessionList* GetSessionList( |
158 const HostPortProxyPair& host_port_proxy_pair) const; | 165 const HostPortProxyPair& host_port_proxy_pair) const; |
159 void RemoveSessionList(const HostPortProxyPair& host_port_proxy_pair); | 166 void RemoveSessionList(const HostPortProxyPair& host_port_proxy_pair); |
160 | 167 |
161 // Does a DNS cache lookup for |pair|, and returns the |addresses| found. | 168 // Does a DNS cache lookup for |pair|, and returns the |addresses| found. |
162 // Returns true if addresses found, false otherwise. | 169 // Returns true if addresses found, false otherwise. |
163 bool LookupAddresses(const HostPortProxyPair& pair, | 170 bool LookupAddresses(const HostPortProxyPair& pair, |
164 AddressList* addresses) const; | 171 AddressList* addresses) const; |
165 | 172 |
166 // Add a set of |addresses| as IP-equivalent addresses for |pair|. | 173 // Add the addresses from LookupAddresses for |pair| as IP-equivalent |
167 void AddAliases(const AddressList& addresses, const HostPortProxyPair& pair); | 174 // addresses for |pair|. Used by unit tests only. |
willchan no longer on Chromium
2011/07/17 01:23:45
This seems a bit weird, since for LookupAddresses(
ramant (doing other things)
2011/07/17 08:12:30
Done.
| |
175 void AddAliases(const HostPortProxyPair& pair); | |
168 | 176 |
169 // Remove all aliases for |pair| from the aliases table. | 177 // Remove all aliases for |pair| from the aliases table. |
170 void RemoveAliases(const HostPortProxyPair& pair); | 178 void RemoveAliases(const HostPortProxyPair& pair); |
171 | 179 |
172 SpdySettingsStorage spdy_settings_; | 180 SpdySettingsStorage spdy_settings_; |
173 | 181 |
174 // This is our weak session pool - one session per domain. | 182 // This is our weak session pool - one session per domain. |
175 SpdySessionsMap sessions_; | 183 SpdySessionsMap sessions_; |
176 // A map of IPEndPoint aliases for sessions. | 184 // A map of IPEndPoint aliases for sessions. |
177 SpdyAliasMap aliases_; | 185 SpdyAliasMap aliases_; |
178 | 186 |
179 static size_t g_max_sessions_per_domain; | 187 static size_t g_max_sessions_per_domain; |
180 static bool g_force_single_domain; | 188 static bool g_force_single_domain; |
181 static bool g_enable_ip_pooling; | 189 static bool g_enable_ip_pooling; |
182 | 190 |
183 const scoped_refptr<SSLConfigService> ssl_config_service_; | 191 const scoped_refptr<SSLConfigService> ssl_config_service_; |
184 HostResolver* const resolver_; | 192 HostResolver* const resolver_; |
185 | 193 |
186 // Defaults to true. May be controlled via SpdySessionPoolPeer for tests. | 194 // Defaults to true. May be controlled via SpdySessionPoolPeer for tests. |
187 bool verify_domain_authentication_; | 195 bool verify_domain_authentication_; |
188 | 196 |
189 DISALLOW_COPY_AND_ASSIGN(SpdySessionPool); | 197 DISALLOW_COPY_AND_ASSIGN(SpdySessionPool); |
190 }; | 198 }; |
191 | 199 |
192 } // namespace net | 200 } // namespace net |
193 | 201 |
194 #endif // NET_SPDY_SPDY_SESSION_POOL_H_ | 202 #endif // NET_SPDY_SPDY_SESSION_POOL_H_ |
OLD | NEW |