| 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 // Adds |alias| to set of aliases associated with this session. | 265 // Adds |alias| to set of aliases associated with this session. |
| 267 void AddPooledAlias(const HostPortProxyPair& alias); | 266 void AddPooledAlias(const HostPortProxyPair& alias); |
| 268 | 267 |
| 269 // Returns the set of aliases associated with this session. | 268 // Returns the set of aliases associated with this session. |
| 270 const std::set<HostPortProxyPair>& pooled_aliases() const { | 269 const std::set<HostPortProxyPair>& pooled_aliases() const { |
| 271 return pooled_aliases_; | 270 return pooled_aliases_; |
| 272 } | 271 } |
| 273 | 272 |
| 274 int GetProtocolVersion() const; | 273 int GetProtocolVersion() const; |
| 275 | 274 |
| 276 // LayeredPool implementation. | |
| 277 virtual bool CloseOneIdleConnection() OVERRIDE; | |
| 278 | |
| 279 private: | 275 private: |
| 280 friend class base::RefCounted<SpdySession>; | 276 friend class base::RefCounted<SpdySession>; |
| 281 | 277 |
| 282 // Allow tests to access our innards for testing purposes. | 278 // Allow tests to access our innards for testing purposes. |
| 283 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, Ping); | 279 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, Ping); |
| 284 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, FailedPing); | 280 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, FailedPing); |
| 285 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, GetActivePushStream); | 281 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, GetActivePushStream); |
| 286 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, CloseOneIdleConnection); | |
| 287 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, Ping); | 282 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, Ping); |
| 288 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, FailedPing); | 283 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, FailedPing); |
| 289 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, GetActivePushStream); | 284 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, GetActivePushStream); |
| 290 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, CloseOneIdleConnection); | |
| 291 | 285 |
| 292 struct PendingCreateStream { | 286 struct PendingCreateStream { |
| 293 PendingCreateStream(const GURL& url, RequestPriority priority, | 287 PendingCreateStream(const GURL& url, RequestPriority priority, |
| 294 scoped_refptr<SpdyStream>* spdy_stream, | 288 scoped_refptr<SpdyStream>* spdy_stream, |
| 295 const BoundNetLog& stream_net_log, | 289 const BoundNetLog& stream_net_log, |
| 296 const CompletionCallback& callback) | 290 const CompletionCallback& callback) |
| 297 : url(&url), | 291 : url(&url), |
| 298 priority(priority), | 292 priority(priority), |
| 299 spdy_stream(spdy_stream), | 293 spdy_stream(spdy_stream), |
| 300 stream_net_log(&stream_net_log), | 294 stream_net_log(&stream_net_log), |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 | 696 |
| 703 const int status_; | 697 const int status_; |
| 704 const std::string description_; | 698 const std::string description_; |
| 705 | 699 |
| 706 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySessionCloseParameter); | 700 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySessionCloseParameter); |
| 707 }; | 701 }; |
| 708 | 702 |
| 709 } // namespace net | 703 } // namespace net |
| 710 | 704 |
| 711 #endif // NET_SPDY_SPDY_SESSION_H_ | 705 #endif // NET_SPDY_SPDY_SESSION_H_ |
| OLD | NEW |