OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 17 matching lines...) Expand all Loading... |
28 typedef std::pair<HostPortPair, ProxyServer> HostPortProxyPair; | 28 typedef std::pair<HostPortPair, ProxyServer> HostPortProxyPair; |
29 | 29 |
30 class BoundNetLog; | 30 class BoundNetLog; |
31 class ClientSocketHandle; | 31 class ClientSocketHandle; |
32 class HttpNetworkSession; | 32 class HttpNetworkSession; |
33 class SpdySession; | 33 class SpdySession; |
34 | 34 |
35 // This is a very simple pool for open SpdySessions. | 35 // This is a very simple pool for open SpdySessions. |
36 // TODO(mbelshe): Make this production ready. | 36 // TODO(mbelshe): Make this production ready. |
37 class SpdySessionPool | 37 class SpdySessionPool |
38 : public NetworkChangeNotifier::Observer, | 38 : public NetworkChangeNotifier::IPAddressObserver, |
39 public SSLConfigService::Observer { | 39 public SSLConfigService::Observer { |
40 public: | 40 public: |
41 explicit SpdySessionPool(SSLConfigService* ssl_config_service); | 41 explicit SpdySessionPool(SSLConfigService* ssl_config_service); |
42 virtual ~SpdySessionPool(); | 42 virtual ~SpdySessionPool(); |
43 | 43 |
44 // Either returns an existing SpdySession or creates a new SpdySession for | 44 // Either returns an existing SpdySession or creates a new SpdySession for |
45 // use. | 45 // use. |
46 scoped_refptr<SpdySession> Get( | 46 scoped_refptr<SpdySession> Get( |
47 const HostPortProxyPair& host_port_proxy_pair, | 47 const HostPortProxyPair& host_port_proxy_pair, |
48 const BoundNetLog& net_log); | 48 const BoundNetLog& net_log); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 // by SpdySession, because otherwise session->state_ is not set to CLOSED. | 86 // by SpdySession, because otherwise session->state_ is not set to CLOSED. |
87 void Remove(const scoped_refptr<SpdySession>& session); | 87 void Remove(const scoped_refptr<SpdySession>& session); |
88 | 88 |
89 // Creates a Value summary of the state of the spdy session pool. The caller | 89 // Creates a Value summary of the state of the spdy session pool. The caller |
90 // responsible for deleting the returned value. | 90 // responsible for deleting the returned value. |
91 Value* SpdySessionPoolInfoToValue() const; | 91 Value* SpdySessionPoolInfoToValue() const; |
92 | 92 |
93 SpdySettingsStorage* mutable_spdy_settings() { return &spdy_settings_; } | 93 SpdySettingsStorage* mutable_spdy_settings() { return &spdy_settings_; } |
94 const SpdySettingsStorage& spdy_settings() const { return spdy_settings_; } | 94 const SpdySettingsStorage& spdy_settings() const { return spdy_settings_; } |
95 | 95 |
96 // NetworkChangeNotifier::Observer methods: | 96 // NetworkChangeNotifier::IPAddressObserver methods: |
97 | 97 |
98 // We flush all idle sessions and release references to the active ones so | 98 // We flush all idle sessions and release references to the active ones so |
99 // they won't get re-used. The active ones will either complete successfully | 99 // they won't get re-used. The active ones will either complete successfully |
100 // or error out due to the IP address change. | 100 // or error out due to the IP address change. |
101 virtual void OnIPAddressChanged(); | 101 virtual void OnIPAddressChanged(); |
102 | 102 |
103 // SSLConfigService::Observer methods: | 103 // SSLConfigService::Observer methods: |
104 | 104 |
105 // We perform the same flushing as described above when SSL settings change. | 105 // We perform the same flushing as described above when SSL settings change. |
106 virtual void OnSSLConfigChanged(); | 106 virtual void OnSSLConfigChanged(); |
(...skipping 27 matching lines...) Expand all Loading... |
134 static bool g_force_single_domain; | 134 static bool g_force_single_domain; |
135 | 135 |
136 const scoped_refptr<SSLConfigService> ssl_config_service_; | 136 const scoped_refptr<SSLConfigService> ssl_config_service_; |
137 | 137 |
138 DISALLOW_COPY_AND_ASSIGN(SpdySessionPool); | 138 DISALLOW_COPY_AND_ASSIGN(SpdySessionPool); |
139 }; | 139 }; |
140 | 140 |
141 } // namespace net | 141 } // namespace net |
142 | 142 |
143 #endif // NET_SPDY_SPDY_SESSION_POOL_H_ | 143 #endif // NET_SPDY_SPDY_SESSION_POOL_H_ |
OLD | NEW |