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 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 class NET_EXPORT SpdySessionPool | 42 class NET_EXPORT SpdySessionPool |
43 : public NetworkChangeNotifier::IPAddressObserver, | 43 : public NetworkChangeNotifier::IPAddressObserver, |
44 public SSLConfigService::Observer, | 44 public SSLConfigService::Observer, |
45 public CertDatabase::Observer { | 45 public CertDatabase::Observer { |
46 public: | 46 public: |
47 typedef base::TimeTicks (*TimeFunc)(void); | 47 typedef base::TimeTicks (*TimeFunc)(void); |
48 | 48 |
49 // |default_protocol| may be kProtoUnknown (e.g., if SPDY is | 49 // |default_protocol| may be kProtoUnknown (e.g., if SPDY is |
50 // disabled), in which case it's set to a default value. Otherwise, | 50 // disabled), in which case it's set to a default value. Otherwise, |
51 // it must be a SPDY protocol. | 51 // it must be a SPDY protocol. |
52 SpdySessionPool( | 52 SpdySessionPool(HostResolver* host_resolver, |
53 HostResolver* host_resolver, | 53 SSLConfigService* ssl_config_service, |
54 SSLConfigService* ssl_config_service, | 54 HttpServerProperties* http_server_properties, |
55 const base::WeakPtr<HttpServerProperties>& http_server_properties, | 55 TransportSecurityState* transport_security_state, |
56 TransportSecurityState* transport_security_state, | 56 bool enable_ping_based_connection_checking, |
57 bool enable_ping_based_connection_checking, | 57 bool enable_priority_dependencies, |
58 bool enable_priority_dependencies, | 58 NextProto default_protocol, |
59 NextProto default_protocol, | 59 size_t session_max_recv_window_size, |
60 size_t session_max_recv_window_size, | 60 size_t stream_max_recv_window_size, |
61 size_t stream_max_recv_window_size, | 61 SpdySessionPool::TimeFunc time_func, |
62 SpdySessionPool::TimeFunc time_func, | 62 ProxyDelegate* proxy_delegate); |
63 ProxyDelegate* proxy_delegate); | |
64 ~SpdySessionPool() override; | 63 ~SpdySessionPool() override; |
65 | 64 |
66 // In the functions below, a session is "available" if this pool has | 65 // In the functions below, a session is "available" if this pool has |
67 // a reference to it and there is some SpdySessionKey for which | 66 // a reference to it and there is some SpdySessionKey for which |
68 // FindAvailableSession() will return it. A session is "unavailable" | 67 // FindAvailableSession() will return it. A session is "unavailable" |
69 // if this pool has a reference to it but it won't be returned by | 68 // if this pool has a reference to it but it won't be returned by |
70 // FindAvailableSession() for any SpdySessionKey; for example, this | 69 // FindAvailableSession() for any SpdySessionKey; for example, this |
71 // can happen when a session receives a GOAWAY frame and is still | 70 // can happen when a session receives a GOAWAY frame and is still |
72 // processing existing streams. | 71 // processing existing streams. |
73 | 72 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 // (Un)register a SpdySession with an unclaimed pushed stream for |url|, so | 125 // (Un)register a SpdySession with an unclaimed pushed stream for |url|, so |
127 // that the right SpdySession can be served by FindAvailableSession. | 126 // that the right SpdySession can be served by FindAvailableSession. |
128 void RegisterUnclaimedPushedStream(GURL url, | 127 void RegisterUnclaimedPushedStream(GURL url, |
129 base::WeakPtr<SpdySession> spdy_session); | 128 base::WeakPtr<SpdySession> spdy_session); |
130 void UnregisterUnclaimedPushedStream(const GURL& url, | 129 void UnregisterUnclaimedPushedStream(const GURL& url, |
131 SpdySession* spdy_session); | 130 SpdySession* spdy_session); |
132 | 131 |
133 // Creates a Value summary of the state of the spdy session pool. | 132 // Creates a Value summary of the state of the spdy session pool. |
134 std::unique_ptr<base::Value> SpdySessionPoolInfoToValue() const; | 133 std::unique_ptr<base::Value> SpdySessionPoolInfoToValue() const; |
135 | 134 |
136 base::WeakPtr<HttpServerProperties> http_server_properties() { | 135 HttpServerProperties* http_server_properties() { |
137 return http_server_properties_; | 136 return http_server_properties_; |
138 } | 137 } |
139 | 138 |
140 // NetworkChangeNotifier::IPAddressObserver methods: | 139 // NetworkChangeNotifier::IPAddressObserver methods: |
141 | 140 |
142 // We flush all idle sessions and release references to the active ones so | 141 // We flush all idle sessions and release references to the active ones so |
143 // they won't get re-used. The active ones will either complete successfully | 142 // they won't get re-used. The active ones will either complete successfully |
144 // or error out due to the IP address change. | 143 // or error out due to the IP address change. |
145 void OnIPAddressChanged() override; | 144 void OnIPAddressChanged() override; |
146 | 145 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 WeakSessionList GetCurrentSessions() const; | 189 WeakSessionList GetCurrentSessions() const; |
191 | 190 |
192 // Close only the currently existing SpdySessions with |error|. Let | 191 // Close only the currently existing SpdySessions with |error|. Let |
193 // any new ones created while this method is running continue to | 192 // any new ones created while this method is running continue to |
194 // live. If |idle_only| is true only idle sessions are closed. | 193 // live. If |idle_only| is true only idle sessions are closed. |
195 void CloseCurrentSessionsHelper( | 194 void CloseCurrentSessionsHelper( |
196 Error error, | 195 Error error, |
197 const std::string& description, | 196 const std::string& description, |
198 bool idle_only); | 197 bool idle_only); |
199 | 198 |
200 const base::WeakPtr<HttpServerProperties> http_server_properties_; | 199 HttpServerProperties* http_server_properties_; |
201 | 200 |
202 TransportSecurityState* transport_security_state_; | 201 TransportSecurityState* transport_security_state_; |
203 | 202 |
204 // The set of all sessions. This is a superset of the sessions in | 203 // The set of all sessions. This is a superset of the sessions in |
205 // |available_sessions_|. | 204 // |available_sessions_|. |
206 // | 205 // |
207 // |sessions_| owns all its SpdySession objects. | 206 // |sessions_| owns all its SpdySession objects. |
208 SessionSet sessions_; | 207 SessionSet sessions_; |
209 | 208 |
210 // This is a map of available sessions by key. A session may appear | 209 // This is a map of available sessions by key. A session may appear |
(...skipping 27 matching lines...) Expand all Loading... |
238 // resources from origins that are different from those of their associated | 237 // resources from origins that are different from those of their associated |
239 // streams. May be nullptr. | 238 // streams. May be nullptr. |
240 ProxyDelegate* proxy_delegate_; | 239 ProxyDelegate* proxy_delegate_; |
241 | 240 |
242 DISALLOW_COPY_AND_ASSIGN(SpdySessionPool); | 241 DISALLOW_COPY_AND_ASSIGN(SpdySessionPool); |
243 }; | 242 }; |
244 | 243 |
245 } // namespace net | 244 } // namespace net |
246 | 245 |
247 #endif // NET_SPDY_SPDY_SESSION_POOL_H_ | 246 #endif // NET_SPDY_SPDY_SESSION_POOL_H_ |
OLD | NEW |