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_H_ | 5 #ifndef NET_SPDY_SPDY_SESSION_H_ |
6 #define NET_SPDY_SPDY_SESSION_H_ | 6 #define NET_SPDY_SPDY_SESSION_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <list> | 10 #include <list> |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 // somewhat arbitrary, but is reasonably small and ensures that we elicit | 43 // somewhat arbitrary, but is reasonably small and ensures that we elicit |
44 // ACKs quickly from TCP (because TCP tries to only ACK every other packet). | 44 // ACKs quickly from TCP (because TCP tries to only ACK every other packet). |
45 const int kMss = 1430; | 45 const int kMss = 1430; |
46 const int kMaxSpdyFrameChunkSize = (2 * kMss) - SpdyFrame::kHeaderSize; | 46 const int kMaxSpdyFrameChunkSize = (2 * kMss) - SpdyFrame::kHeaderSize; |
47 | 47 |
48 class BoundNetLog; | 48 class BoundNetLog; |
49 class SpdyStream; | 49 class SpdyStream; |
50 class SSLInfo; | 50 class SSLInfo; |
51 | 51 |
52 class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>, | 52 class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>, |
53 public BufferedSpdyFramerVisitorInterface { | 53 public BufferedSpdyFramerVisitorInterface, |
| 54 public LayeredPool { |
54 public: | 55 public: |
55 // Create a new SpdySession. | 56 // Create a new SpdySession. |
56 // |host_port_proxy_pair| is the host/port that this session connects to, and | 57 // |host_port_proxy_pair| is the host/port that this session connects to, and |
57 // the proxy configuration settings that it's using. | 58 // the proxy configuration settings that it's using. |
58 // |spdy_session_pool| is the SpdySessionPool that owns us. Its lifetime must | 59 // |spdy_session_pool| is the SpdySessionPool that owns us. Its lifetime must |
59 // strictly be greater than |this|. | 60 // strictly be greater than |this|. |
60 // |session| is the HttpNetworkSession. |net_log| is the NetLog that we log | 61 // |session| is the HttpNetworkSession. |net_log| is the NetLog that we log |
61 // network events to. | 62 // network events to. |
62 SpdySession(const HostPortProxyPair& host_port_proxy_pair, | 63 SpdySession(const HostPortProxyPair& host_port_proxy_pair, |
63 SpdySessionPool* spdy_session_pool, | 64 SpdySessionPool* spdy_session_pool, |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 // Adds |alias| to set of aliases associated with this session. | 262 // Adds |alias| to set of aliases associated with this session. |
262 void AddPooledAlias(const HostPortProxyPair& alias); | 263 void AddPooledAlias(const HostPortProxyPair& alias); |
263 | 264 |
264 // Returns the set of aliases associated with this session. | 265 // Returns the set of aliases associated with this session. |
265 const std::set<HostPortProxyPair>& pooled_aliases() const { | 266 const std::set<HostPortProxyPair>& pooled_aliases() const { |
266 return pooled_aliases_; | 267 return pooled_aliases_; |
267 } | 268 } |
268 | 269 |
269 int GetProtocolVersion() const; | 270 int GetProtocolVersion() const; |
270 | 271 |
| 272 // LayeredPool implementation. |
| 273 virtual bool CloseOneIdleConnection() OVERRIDE; |
| 274 |
271 private: | 275 private: |
272 friend class base::RefCounted<SpdySession>; | 276 friend class base::RefCounted<SpdySession>; |
273 | 277 |
274 // Allow tests to access our innards for testing purposes. | 278 // Allow tests to access our innards for testing purposes. |
275 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, Ping); | 279 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, Ping); |
276 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, FailedPing); | 280 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, FailedPing); |
277 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, GetActivePushStream); | 281 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, GetActivePushStream); |
| 282 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, CloseOneIdleConnection); |
278 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, Ping); | 283 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, Ping); |
279 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, FailedPing); | 284 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, FailedPing); |
280 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, GetActivePushStream); | 285 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, GetActivePushStream); |
| 286 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, CloseOneIdleConnection); |
281 | 287 |
282 struct PendingCreateStream { | 288 struct PendingCreateStream { |
283 PendingCreateStream(const GURL& url, RequestPriority priority, | 289 PendingCreateStream(const GURL& url, RequestPriority priority, |
284 scoped_refptr<SpdyStream>* spdy_stream, | 290 scoped_refptr<SpdyStream>* spdy_stream, |
285 const BoundNetLog& stream_net_log, | 291 const BoundNetLog& stream_net_log, |
286 const CompletionCallback& callback) | 292 const CompletionCallback& callback) |
287 : url(&url), | 293 : url(&url), |
288 priority(priority), | 294 priority(priority), |
289 spdy_stream(spdy_stream), | 295 spdy_stream(spdy_stream), |
290 stream_net_log(&stream_net_log), | 296 stream_net_log(&stream_net_log), |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 | 694 |
689 const int status_; | 695 const int status_; |
690 const std::string description_; | 696 const std::string description_; |
691 | 697 |
692 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySessionCloseParameter); | 698 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySessionCloseParameter); |
693 }; | 699 }; |
694 | 700 |
695 } // namespace net | 701 } // namespace net |
696 | 702 |
697 #endif // NET_SPDY_SPDY_SESSION_H_ | 703 #endif // NET_SPDY_SPDY_SESSION_H_ |
OLD | NEW |