OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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> |
11 #include <map> | 11 #include <map> |
(...skipping 27 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 // FlowControl provides the ability for unit tests to either enable or disable | 52 // FlowControl provides the ability for unit tests to either enable or disable |
52 // flow control (independent of NPN protocol negotiated). If | 53 // flow control (independent of NPN protocol negotiated). If |
53 // |use_flow_control_| is set to kFlowControlBasedOnNPN then flow control is | 54 // |use_flow_control_| is set to kFlowControlBasedOnNPN then flow control is |
54 // determined by the NPN protocol negotiated with the server. | 55 // determined by the NPN protocol negotiated with the server. |
55 enum FlowControl { | 56 enum FlowControl { |
56 kFlowControlBasedOnNPN = 0, | 57 kFlowControlBasedOnNPN = 0, |
57 kDisableFlowControl = 1, | 58 kDisableFlowControl = 1, |
58 kEnableFlowControl = 2, | 59 kEnableFlowControl = 2, |
59 }; | 60 }; |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 | 272 |
272 const BoundNetLog& net_log() const { return net_log_; } | 273 const BoundNetLog& net_log() const { return net_log_; } |
273 | 274 |
274 int GetPeerAddress(AddressList* address) const; | 275 int GetPeerAddress(AddressList* address) const; |
275 int GetLocalAddress(IPEndPoint* address) const; | 276 int GetLocalAddress(IPEndPoint* address) const; |
276 | 277 |
277 // Returns true if a request for a resource in |origin| requires a | 278 // Returns true if a request for a resource in |origin| requires a |
278 // SPDY CREDENTIAL frame to be sent first, with an origin bound certificate. | 279 // SPDY CREDENTIAL frame to be sent first, with an origin bound certificate. |
279 bool NeedsCredentials(const HostPortPair& origin) const; | 280 bool NeedsCredentials(const HostPortPair& origin) const; |
280 | 281 |
| 282 // LayeredPool implementation. |
| 283 virtual bool CloseOneIdleConnection() OVERRIDE; |
| 284 |
281 private: | 285 private: |
282 friend class base::RefCounted<SpdySession>; | 286 friend class base::RefCounted<SpdySession>; |
283 | 287 |
284 // Allow tests to access our innards for testing purposes. | 288 // Allow tests to access our innards for testing purposes. |
285 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, Ping); | 289 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, Ping); |
286 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, FailedPing); | 290 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, FailedPing); |
287 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, GetActivePushStream); | 291 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, GetActivePushStream); |
288 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, Ping); | 292 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, Ping); |
289 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, FailedPing); | 293 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, FailedPing); |
290 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, GetActivePushStream); | 294 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, GetActivePushStream); |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 | 710 |
707 const int status_; | 711 const int status_; |
708 const std::string description_; | 712 const std::string description_; |
709 | 713 |
710 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySessionCloseParameter); | 714 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySessionCloseParameter); |
711 }; | 715 }; |
712 | 716 |
713 } // namespace net | 717 } // namespace net |
714 | 718 |
715 #endif // NET_SPDY_SPDY_SESSION_H_ | 719 #endif // NET_SPDY_SPDY_SESSION_H_ |
OLD | NEW |