OLD | NEW |
1 // Copyright (c) 2011 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 <deque> | 9 #include <deque> |
10 #include <list> | 10 #include <list> |
11 #include <map> | 11 #include <map> |
12 #include <queue> | 12 #include <queue> |
13 #include <string> | 13 #include <string> |
14 | 14 |
15 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
16 #include "base/memory/linked_ptr.h" | 16 #include "base/memory/linked_ptr.h" |
17 #include "base/memory/ref_counted.h" | 17 #include "base/memory/ref_counted.h" |
| 18 #include "base/memory/weak_ptr.h" |
18 #include "base/task.h" | 19 #include "base/task.h" |
19 #include "net/base/io_buffer.h" | 20 #include "net/base/io_buffer.h" |
20 #include "net/base/load_states.h" | 21 #include "net/base/load_states.h" |
21 #include "net/base/net_errors.h" | 22 #include "net/base/net_errors.h" |
22 #include "net/base/net_log.h" | 23 #include "net/base/net_log.h" |
23 #include "net/base/request_priority.h" | 24 #include "net/base/request_priority.h" |
24 #include "net/base/ssl_config_service.h" | 25 #include "net/base/ssl_config_service.h" |
25 #include "net/base/upload_data_stream.h" | 26 #include "net/base/upload_data_stream.h" |
26 #include "net/socket/client_socket_handle.h" | 27 #include "net/socket/client_socket_handle.h" |
27 #include "net/socket/stream_socket.h" | 28 #include "net/socket/stream_socket.h" |
(...skipping 10 matching lines...) Expand all Loading... |
38 // ACKs quickly from TCP (because TCP tries to only ACK every other packet). | 39 // ACKs quickly from TCP (because TCP tries to only ACK every other packet). |
39 const int kMss = 1430; | 40 const int kMss = 1430; |
40 const int kMaxSpdyFrameChunkSize = (2 * kMss) - spdy::SpdyFrame::kHeaderSize; | 41 const int kMaxSpdyFrameChunkSize = (2 * kMss) - spdy::SpdyFrame::kHeaderSize; |
41 | 42 |
42 class BoundNetLog; | 43 class BoundNetLog; |
43 class SpdySettingsStorage; | 44 class SpdySettingsStorage; |
44 class SpdyStream; | 45 class SpdyStream; |
45 class SSLInfo; | 46 class SSLInfo; |
46 | 47 |
47 class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>, | 48 class NET_EXPORT SpdySession : public base::RefCounted<SpdySession>, |
48 public spdy::SpdyFramerVisitorInterface { | 49 public spdy::SpdyFramerVisitorInterface, |
| 50 public LayeredPool { |
49 public: | 51 public: |
50 // Create a new SpdySession. | 52 // Create a new SpdySession. |
51 // |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 |
52 // the proxy configuration settings that it's using. | 54 // the proxy configuration settings that it's using. |
53 // |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 |
54 // strictly be greater than |this|. | 56 // strictly be greater than |this|. |
55 // |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 |
56 // network events to. | 58 // network events to. |
57 SpdySession(const HostPortProxyPair& host_port_proxy_pair, | 59 SpdySession(const HostPortProxyPair& host_port_proxy_pair, |
58 SpdySessionPool* spdy_session_pool, | 60 SpdySessionPool* spdy_session_pool, |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 size_t num_active_streams() const { return active_streams_.size(); } | 223 size_t num_active_streams() const { return active_streams_.size(); } |
222 size_t num_unclaimed_pushed_streams() const { | 224 size_t num_unclaimed_pushed_streams() const { |
223 return unclaimed_pushed_streams_.size(); | 225 return unclaimed_pushed_streams_.size(); |
224 } | 226 } |
225 | 227 |
226 const BoundNetLog& net_log() const { return net_log_; } | 228 const BoundNetLog& net_log() const { return net_log_; } |
227 | 229 |
228 int GetPeerAddress(AddressList* address) const; | 230 int GetPeerAddress(AddressList* address) const; |
229 int GetLocalAddress(IPEndPoint* address) const; | 231 int GetLocalAddress(IPEndPoint* address) const; |
230 | 232 |
| 233 // LayeredPool methods: |
| 234 virtual bool CloseOneIdleConnection() OVERRIDE; |
| 235 |
231 private: | 236 private: |
232 friend class base::RefCounted<SpdySession>; | 237 friend class base::RefCounted<SpdySession>; |
233 // Allow tests to access our innards for testing purposes. | 238 // Allow tests to access our innards for testing purposes. |
234 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, Ping); | 239 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, Ping); |
235 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, FailedPing); | 240 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, FailedPing); |
236 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, GetActivePushStream); | 241 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, GetActivePushStream); |
237 | 242 |
238 struct PendingCreateStream { | 243 struct PendingCreateStream { |
239 PendingCreateStream(const GURL& url, RequestPriority priority, | 244 PendingCreateStream(const GURL& url, RequestPriority priority, |
240 scoped_refptr<SpdyStream>* spdy_stream, | 245 scoped_refptr<SpdyStream>* spdy_stream, |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 const spdy::SpdyControlFlags flags_; | 617 const spdy::SpdyControlFlags flags_; |
613 const spdy::SpdyStreamId id_; | 618 const spdy::SpdyStreamId id_; |
614 const spdy::SpdyStreamId associated_stream_; | 619 const spdy::SpdyStreamId associated_stream_; |
615 | 620 |
616 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySynParameter); | 621 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySynParameter); |
617 }; | 622 }; |
618 | 623 |
619 } // namespace net | 624 } // namespace net |
620 | 625 |
621 #endif // NET_SPDY_SPDY_SESSION_H_ | 626 #endif // NET_SPDY_SPDY_SESSION_H_ |
OLD | NEW |