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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 // | 80 // |
81 // Returns the new SpdySession. Note that the SpdySession begins reading from | 81 // Returns the new SpdySession. Note that the SpdySession begins reading from |
82 // |connection| on a subsequent event loop iteration, so it may be closed | 82 // |connection| on a subsequent event loop iteration, so it may be closed |
83 // immediately afterwards if the first read of |connection| fails. | 83 // immediately afterwards if the first read of |connection| fails. |
84 base::WeakPtr<SpdySession> CreateAvailableSessionFromSocket( | 84 base::WeakPtr<SpdySession> CreateAvailableSessionFromSocket( |
85 const SpdySessionKey& key, | 85 const SpdySessionKey& key, |
86 std::unique_ptr<ClientSocketHandle> connection, | 86 std::unique_ptr<ClientSocketHandle> connection, |
87 const NetLogWithSource& net_log, | 87 const NetLogWithSource& net_log, |
88 bool is_secure); | 88 bool is_secure); |
89 | 89 |
90 // Return an available session for |key| that has an unclaimed push stream for | 90 // If |url| is not empty and there is a session for |key| that has an |
91 // |url| if such exists and |url| is not empty, or else an available session | 91 // unclaimed push stream for |url|, return it. |
92 // for |key| if such exists, or else nullptr. | 92 // Otherwise if there is an available session for |key|, return it. |
| 93 // Otherwise if there is a session to pool to based on IP address: |
| 94 // * if |enable_ip_based_pooling == true|, |
| 95 // then mark it as available for |key| and return it; |
| 96 // * if |enable_ip_based_pooling == false|, |
| 97 // then remove it from the available sessions, and return nullptr. |
| 98 // Otherwise return nullptr. |
93 base::WeakPtr<SpdySession> FindAvailableSession( | 99 base::WeakPtr<SpdySession> FindAvailableSession( |
94 const SpdySessionKey& key, | 100 const SpdySessionKey& key, |
95 const GURL& url, | 101 const GURL& url, |
| 102 bool enable_ip_based_pooling, |
96 const NetLogWithSource& net_log); | 103 const NetLogWithSource& net_log); |
97 | 104 |
98 // Remove all mappings and aliases for the given session, which must | 105 // Remove all mappings and aliases for the given session, which must |
99 // still be available. Except for in tests, this must be called by | 106 // still be available. Except for in tests, this must be called by |
100 // the given session itself. | 107 // the given session itself. |
101 void MakeSessionUnavailable( | 108 void MakeSessionUnavailable( |
102 const base::WeakPtr<SpdySession>& available_session); | 109 const base::WeakPtr<SpdySession>& available_session); |
103 | 110 |
104 // Removes an unavailable session from the pool. Except for in | 111 // Removes an unavailable session from the pool. Except for in |
105 // tests, this must be called by the given session itself. | 112 // tests, this must be called by the given session itself. |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 // resources from origins that are different from those of their associated | 253 // resources from origins that are different from those of their associated |
247 // streams. May be nullptr. | 254 // streams. May be nullptr. |
248 ProxyDelegate* proxy_delegate_; | 255 ProxyDelegate* proxy_delegate_; |
249 | 256 |
250 DISALLOW_COPY_AND_ASSIGN(SpdySessionPool); | 257 DISALLOW_COPY_AND_ASSIGN(SpdySessionPool); |
251 }; | 258 }; |
252 | 259 |
253 } // namespace net | 260 } // namespace net |
254 | 261 |
255 #endif // NET_SPDY_SPDY_SESSION_POOL_H_ | 262 #endif // NET_SPDY_SPDY_SESSION_POOL_H_ |
OLD | NEW |