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 28 matching lines...) Expand all Loading... |
39 // somewhat arbitrary, but is reasonably small and ensures that we elicit | 39 // somewhat arbitrary, but is reasonably small and ensures that we elicit |
40 // ACKs quickly from TCP (because TCP tries to only ACK every other packet). | 40 // ACKs quickly from TCP (because TCP tries to only ACK every other packet). |
41 const int kMss = 1430; | 41 const int kMss = 1430; |
42 const int kMaxSpdyFrameChunkSize = (2 * kMss) - spdy::SpdyFrame::kHeaderSize; | 42 const int kMaxSpdyFrameChunkSize = (2 * kMss) - spdy::SpdyFrame::kHeaderSize; |
43 | 43 |
44 class BoundNetLog; | 44 class BoundNetLog; |
45 class SpdyStream; | 45 class SpdyStream; |
46 class SSLInfo; | 46 class SSLInfo; |
47 | 47 |
48 class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>, | 48 class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>, |
49 public spdy::BufferedSpdyFramerVisitorInterface { | 49 public spdy::BufferedSpdyFramerVisitorInterface, |
| 50 public LayeredPool { |
50 public: | 51 public: |
51 // Create a new SpdySession. | 52 // Create a new SpdySession. |
52 // |host_port_proxy_pair| is the host/port that this session connects to, and | 53 // |host_port_proxy_pair| is the host/port that this session connects to, and |
53 // the proxy configuration settings that it's using. | 54 // the proxy configuration settings that it's using. |
54 // |spdy_session_pool| is the SpdySessionPool that owns us. Its lifetime must | 55 // |spdy_session_pool| is the SpdySessionPool that owns us. Its lifetime must |
55 // strictly be greater than |this|. | 56 // strictly be greater than |this|. |
56 // |session| is the HttpNetworkSession. |net_log| is the NetLog that we log | 57 // |session| is the HttpNetworkSession. |net_log| is the NetLog that we log |
57 // network events to. | 58 // network events to. |
58 SpdySession(const HostPortProxyPair& host_port_proxy_pair, | 59 SpdySession(const HostPortProxyPair& host_port_proxy_pair, |
59 SpdySessionPool* spdy_session_pool, | 60 SpdySessionPool* spdy_session_pool, |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 // Adds |alias| to set of aliases associated with this session. | 276 // Adds |alias| to set of aliases associated with this session. |
276 void AddPooledAlias(const HostPortProxyPair& alias); | 277 void AddPooledAlias(const HostPortProxyPair& alias); |
277 | 278 |
278 // Returns the set of aliases associated with this session. | 279 // Returns the set of aliases associated with this session. |
279 const std::set<HostPortProxyPair>& pooled_aliases() const { | 280 const std::set<HostPortProxyPair>& pooled_aliases() const { |
280 return pooled_aliases_; | 281 return pooled_aliases_; |
281 } | 282 } |
282 | 283 |
283 int GetProtocolVersion() const; | 284 int GetProtocolVersion() const; |
284 | 285 |
| 286 // LayeredPool implementation. |
| 287 virtual bool CloseOneIdleConnection() OVERRIDE; |
| 288 |
285 private: | 289 private: |
286 friend class base::RefCounted<SpdySession>; | 290 friend class base::RefCounted<SpdySession>; |
287 | 291 |
288 // Allow tests to access our innards for testing purposes. | 292 // Allow tests to access our innards for testing purposes. |
289 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, Ping); | 293 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, Ping); |
290 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, FailedPing); | 294 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, FailedPing); |
291 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, GetActivePushStream); | 295 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, GetActivePushStream); |
| 296 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, CloseOneIdleConnection); |
292 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, Ping); | 297 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, Ping); |
293 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, FailedPing); | 298 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, FailedPing); |
294 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, GetActivePushStream); | 299 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, GetActivePushStream); |
| 300 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, CloseOneIdleConnection); |
295 | 301 |
296 struct PendingCreateStream { | 302 struct PendingCreateStream { |
297 PendingCreateStream(const GURL& url, RequestPriority priority, | 303 PendingCreateStream(const GURL& url, RequestPriority priority, |
298 scoped_refptr<SpdyStream>* spdy_stream, | 304 scoped_refptr<SpdyStream>* spdy_stream, |
299 const BoundNetLog& stream_net_log, | 305 const BoundNetLog& stream_net_log, |
300 const CompletionCallback& callback) | 306 const CompletionCallback& callback) |
301 : url(&url), | 307 : url(&url), |
302 priority(priority), | 308 priority(priority), |
303 spdy_stream(spdy_stream), | 309 spdy_stream(spdy_stream), |
304 stream_net_log(&stream_net_log), | 310 stream_net_log(&stream_net_log), |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 | 726 |
721 const int status_; | 727 const int status_; |
722 const std::string description_; | 728 const std::string description_; |
723 | 729 |
724 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySessionCloseParameter); | 730 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySessionCloseParameter); |
725 }; | 731 }; |
726 | 732 |
727 } // namespace net | 733 } // namespace net |
728 | 734 |
729 #endif // NET_SPDY_SPDY_SESSION_H_ | 735 #endif // NET_SPDY_SPDY_SESSION_H_ |
OLD | NEW |