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