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) - spdy::SpdyFrame::kHeaderSize; | 46 const int kMaxSpdyFrameChunkSize = (2 * kMss) - spdy::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 spdy::BufferedSpdyFramerVisitorInterface, | 53 public spdy::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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 // Adds |alias| to set of aliases associated with this session. | 259 // Adds |alias| to set of aliases associated with this session. |
261 void AddPooledAlias(const HostPortProxyPair& alias); | 260 void AddPooledAlias(const HostPortProxyPair& alias); |
262 | 261 |
263 // Returns the set of aliases associated with this session. | 262 // Returns the set of aliases associated with this session. |
264 const std::set<HostPortProxyPair>& pooled_aliases() const { | 263 const std::set<HostPortProxyPair>& pooled_aliases() const { |
265 return pooled_aliases_; | 264 return pooled_aliases_; |
266 } | 265 } |
267 | 266 |
268 int GetProtocolVersion() const; | 267 int GetProtocolVersion() const; |
269 | 268 |
270 // LayeredPool implementation. | |
271 virtual bool CloseOneIdleConnection() OVERRIDE; | |
272 | |
273 private: | 269 private: |
274 friend class base::RefCounted<SpdySession>; | 270 friend class base::RefCounted<SpdySession>; |
275 | 271 |
276 // Allow tests to access our innards for testing purposes. | 272 // Allow tests to access our innards for testing purposes. |
277 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, Ping); | 273 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, Ping); |
278 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, FailedPing); | 274 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, FailedPing); |
279 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, GetActivePushStream); | 275 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, GetActivePushStream); |
280 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy2Test, CloseOneIdleConnection); | |
281 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, Ping); | 276 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, Ping); |
282 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, FailedPing); | 277 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, FailedPing); |
283 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, GetActivePushStream); | 278 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, GetActivePushStream); |
284 FRIEND_TEST_ALL_PREFIXES(SpdySessionSpdy3Test, CloseOneIdleConnection); | |
285 | 279 |
286 struct PendingCreateStream { | 280 struct PendingCreateStream { |
287 PendingCreateStream(const GURL& url, RequestPriority priority, | 281 PendingCreateStream(const GURL& url, RequestPriority priority, |
288 scoped_refptr<SpdyStream>* spdy_stream, | 282 scoped_refptr<SpdyStream>* spdy_stream, |
289 const BoundNetLog& stream_net_log, | 283 const BoundNetLog& stream_net_log, |
290 const CompletionCallback& callback) | 284 const CompletionCallback& callback) |
291 : url(&url), | 285 : url(&url), |
292 priority(priority), | 286 priority(priority), |
293 spdy_stream(spdy_stream), | 287 spdy_stream(spdy_stream), |
294 stream_net_log(&stream_net_log), | 288 stream_net_log(&stream_net_log), |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
693 | 687 |
694 const int status_; | 688 const int status_; |
695 const std::string description_; | 689 const std::string description_; |
696 | 690 |
697 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySessionCloseParameter); | 691 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySessionCloseParameter); |
698 }; | 692 }; |
699 | 693 |
700 } // namespace net | 694 } // namespace net |
701 | 695 |
702 #endif // NET_SPDY_SPDY_SESSION_H_ | 696 #endif // NET_SPDY_SPDY_SESSION_H_ |
OLD | NEW |