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 { | |
55 public: | 54 public: |
56 // Create a new SpdySession. | 55 // Create a new SpdySession. |
57 // |host_port_proxy_pair| is the host/port that this session connects to, and | 56 // |host_port_proxy_pair| is the host/port that this session connects to, and |
58 // the proxy configuration settings that it's using. | 57 // the proxy configuration settings that it's using. |
59 // |spdy_session_pool| is the SpdySessionPool that owns us. Its lifetime must | 58 // |spdy_session_pool| is the SpdySessionPool that owns us. Its lifetime must |
60 // strictly be greater than |this|. | 59 // strictly be greater than |this|. |
61 // |session| is the HttpNetworkSession. |net_log| is the NetLog that we log | 60 // |session| is the HttpNetworkSession. |net_log| is the NetLog that we log |
62 // network events to. | 61 // network events to. |
63 SpdySession(const HostPortProxyPair& host_port_proxy_pair, | 62 SpdySession(const HostPortProxyPair& host_port_proxy_pair, |
64 SpdySessionPool* spdy_session_pool, | 63 SpdySessionPool* spdy_session_pool, |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 // Adds |alias| to set of aliases associated with this session. | 261 // Adds |alias| to set of aliases associated with this session. |
263 void AddPooledAlias(const HostPortProxyPair& alias); | 262 void AddPooledAlias(const HostPortProxyPair& alias); |
264 | 263 |
265 // Returns the set of aliases associated with this session. | 264 // Returns the set of aliases associated with this session. |
266 const std::set<HostPortProxyPair>& pooled_aliases() const { | 265 const std::set<HostPortProxyPair>& pooled_aliases() const { |
267 return pooled_aliases_; | 266 return pooled_aliases_; |
268 } | 267 } |
269 | 268 |
270 int GetProtocolVersion() const; | 269 int GetProtocolVersion() const; |
271 | 270 |
272 // LayeredPool implementation. | |
273 virtual bool CloseOneIdleConnection() OVERRIDE; | |
274 | |
275 private: | 271 private: |
276 friend class base::RefCounted<SpdySession>; | 272 friend class base::RefCounted<SpdySession>; |
277 | 273 |
278 // Allow tests to access our innards for testing purposes. | 274 // Allow tests to access our innards for testing purposes. |
279 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, Ping); | 275 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, Ping); |
280 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, FailedPing); | 276 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, FailedPing); |
281 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, GetActivePushStream); | 277 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, GetActivePushStream); |
282 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, CloseOneIdleConnection); | |
283 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, Ping); | 278 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, Ping); |
284 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, FailedPing); | 279 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, FailedPing); |
285 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, GetActivePushStream); | 280 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, GetActivePushStream); |
286 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, CloseOneIdleConnection); | |
287 | 281 |
288 struct PendingCreateStream { | 282 struct PendingCreateStream { |
289 PendingCreateStream(const GURL& url, RequestPriority priority, | 283 PendingCreateStream(const GURL& url, RequestPriority priority, |
290 scoped_refptr<SpdyStream>* spdy_stream, | 284 scoped_refptr<SpdyStream>* spdy_stream, |
291 const BoundNetLog& stream_net_log, | 285 const BoundNetLog& stream_net_log, |
292 const CompletionCallback& callback) | 286 const CompletionCallback& callback) |
293 : url(&url), | 287 : url(&url), |
294 priority(priority), | 288 priority(priority), |
295 spdy_stream(spdy_stream), | 289 spdy_stream(spdy_stream), |
296 stream_net_log(&stream_net_log), | 290 stream_net_log(&stream_net_log), |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 | 688 |
695 const int status_; | 689 const int status_; |
696 const std::string description_; | 690 const std::string description_; |
697 | 691 |
698 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySessionCloseParameter); | 692 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySessionCloseParameter); |
699 }; | 693 }; |
700 | 694 |
701 } // namespace net | 695 } // namespace net |
702 | 696 |
703 #endif // NET_SPDY_SPDY_SESSION_H_ | 697 #endif // NET_SPDY_SPDY_SESSION_H_ |
OLD | NEW |