| 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_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> |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
| 15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "net/base/cert_database.h" | 17 #include "net/base/cert_database.h" |
| 18 #include "net/base/host_port_pair.h" | 18 #include "net/base/host_port_pair.h" |
| 19 #include "net/base/ip_endpoint.h" | 19 #include "net/base/ip_endpoint.h" |
| 20 #include "net/base/net_errors.h" | 20 #include "net/base/net_errors.h" |
| 21 #include "net/base/net_export.h" | 21 #include "net/base/net_export.h" |
| 22 #include "net/base/network_change_notifier.h" | 22 #include "net/base/network_change_notifier.h" |
| 23 #include "net/base/ssl_config_service.h" | 23 #include "net/base/ssl_config_service.h" |
| 24 #include "net/proxy/proxy_config.h" | 24 #include "net/proxy/proxy_config.h" |
| 25 #include "net/proxy/proxy_server.h" | 25 #include "net/proxy/proxy_server.h" |
| 26 #include "net/spdy/spdy_settings_storage.h" | |
| 27 | 26 |
| 28 namespace net { | 27 namespace net { |
| 29 | 28 |
| 30 class AddressList; | 29 class AddressList; |
| 31 class BoundNetLog; | 30 class BoundNetLog; |
| 32 class ClientSocketHandle; | 31 class ClientSocketHandle; |
| 33 class HostResolver; | 32 class HostResolver; |
| 34 class HttpServerProperties; | 33 class HttpServerProperties; |
| 35 class SpdySession; | 34 class SpdySession; |
| 36 | 35 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 void CloseIdleSessions(); | 104 void CloseIdleSessions(); |
| 106 | 105 |
| 107 // Removes a SpdySession from the SpdySessionPool. This should only be called | 106 // Removes a SpdySession from the SpdySessionPool. This should only be called |
| 108 // by SpdySession, because otherwise session->state_ is not set to CLOSED. | 107 // by SpdySession, because otherwise session->state_ is not set to CLOSED. |
| 109 void Remove(const scoped_refptr<SpdySession>& session); | 108 void Remove(const scoped_refptr<SpdySession>& session); |
| 110 | 109 |
| 111 // Creates a Value summary of the state of the spdy session pool. The caller | 110 // Creates a Value summary of the state of the spdy session pool. The caller |
| 112 // responsible for deleting the returned value. | 111 // responsible for deleting the returned value. |
| 113 base::Value* SpdySessionPoolInfoToValue() const; | 112 base::Value* SpdySessionPoolInfoToValue() const; |
| 114 | 113 |
| 115 SpdySettingsStorage* mutable_spdy_settings() { return &spdy_settings_; } | |
| 116 const SpdySettingsStorage& spdy_settings() const { return spdy_settings_; } | |
| 117 | |
| 118 HttpServerProperties* http_server_properties() { | 114 HttpServerProperties* http_server_properties() { |
| 119 return http_server_properties_; | 115 return http_server_properties_; |
| 120 } | 116 } |
| 121 | 117 |
| 122 // NetworkChangeNotifier::IPAddressObserver methods: | 118 // NetworkChangeNotifier::IPAddressObserver methods: |
| 123 | 119 |
| 124 // We flush all idle sessions and release references to the active ones so | 120 // We flush all idle sessions and release references to the active ones so |
| 125 // they won't get re-used. The active ones will either complete successfully | 121 // they won't get re-used. The active ones will either complete successfully |
| 126 // or error out due to the IP address change. | 122 // or error out due to the IP address change. |
| 127 virtual void OnIPAddressChanged() OVERRIDE; | 123 virtual void OnIPAddressChanged() OVERRIDE; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 void AddAlias(const addrinfo* address, const HostPortProxyPair& pair); | 184 void AddAlias(const addrinfo* address, const HostPortProxyPair& pair); |
| 189 | 185 |
| 190 // Remove all aliases for |pair| from the aliases table. | 186 // Remove all aliases for |pair| from the aliases table. |
| 191 void RemoveAliases(const HostPortProxyPair& pair); | 187 void RemoveAliases(const HostPortProxyPair& pair); |
| 192 | 188 |
| 193 // Removes |session| from the session list associated with |pair|. | 189 // Removes |session| from the session list associated with |pair|. |
| 194 // Returns true if the session was removed, false otherwise. | 190 // Returns true if the session was removed, false otherwise. |
| 195 bool RemoveFromSessionList(const scoped_refptr<SpdySession>& session, | 191 bool RemoveFromSessionList(const scoped_refptr<SpdySession>& session, |
| 196 const HostPortProxyPair& pair); | 192 const HostPortProxyPair& pair); |
| 197 | 193 |
| 198 SpdySettingsStorage spdy_settings_; | |
| 199 HttpServerProperties* const http_server_properties_; | 194 HttpServerProperties* const http_server_properties_; |
| 200 | 195 |
| 201 // This is our weak session pool - one session per domain. | 196 // This is our weak session pool - one session per domain. |
| 202 SpdySessionsMap sessions_; | 197 SpdySessionsMap sessions_; |
| 203 // A map of IPEndPoint aliases for sessions. | 198 // A map of IPEndPoint aliases for sessions. |
| 204 SpdyAliasMap aliases_; | 199 SpdyAliasMap aliases_; |
| 205 | 200 |
| 206 static size_t g_max_sessions_per_domain; | 201 static size_t g_max_sessions_per_domain; |
| 207 static bool g_force_single_domain; | 202 static bool g_force_single_domain; |
| 208 static bool g_enable_ip_pooling; | 203 static bool g_enable_ip_pooling; |
| 209 | 204 |
| 210 const scoped_refptr<SSLConfigService> ssl_config_service_; | 205 const scoped_refptr<SSLConfigService> ssl_config_service_; |
| 211 HostResolver* const resolver_; | 206 HostResolver* const resolver_; |
| 212 | 207 |
| 213 // Defaults to true. May be controlled via SpdySessionPoolPeer for tests. | 208 // Defaults to true. May be controlled via SpdySessionPoolPeer for tests. |
| 214 bool verify_domain_authentication_; | 209 bool verify_domain_authentication_; |
| 215 | 210 |
| 216 DISALLOW_COPY_AND_ASSIGN(SpdySessionPool); | 211 DISALLOW_COPY_AND_ASSIGN(SpdySessionPool); |
| 217 }; | 212 }; |
| 218 | 213 |
| 219 } // namespace net | 214 } // namespace net |
| 220 | 215 |
| 221 #endif // NET_SPDY_SPDY_SESSION_POOL_H_ | 216 #endif // NET_SPDY_SPDY_SESSION_POOL_H_ |
| OLD | NEW |