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/weak_ptr.h" |
17 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.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" |
(...skipping 11 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::size(); | 41 const int kMaxSpdyFrameChunkSize = (2 * kMss) - spdy::SpdyFrame::size(); |
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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 size_t num_active_streams() const { return active_streams_.size(); } | 219 size_t num_active_streams() const { return active_streams_.size(); } |
218 size_t num_unclaimed_pushed_streams() const { | 220 size_t num_unclaimed_pushed_streams() const { |
219 return unclaimed_pushed_streams_.size(); | 221 return unclaimed_pushed_streams_.size(); |
220 } | 222 } |
221 | 223 |
222 const BoundNetLog& net_log() const { return net_log_; } | 224 const BoundNetLog& net_log() const { return net_log_; } |
223 | 225 |
224 int GetPeerAddress(AddressList* address) const; | 226 int GetPeerAddress(AddressList* address) const; |
225 int GetLocalAddress(IPEndPoint* address) const; | 227 int GetLocalAddress(IPEndPoint* address) const; |
226 | 228 |
| 229 // LayeredPool methods: |
| 230 virtual bool CloseOneIdleConnection(); |
| 231 |
227 private: | 232 private: |
228 friend class base::RefCounted<SpdySession>; | 233 friend class base::RefCounted<SpdySession>; |
229 // Allow tests to access our innards for testing purposes. | 234 // Allow tests to access our innards for testing purposes. |
230 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, Ping); | 235 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, Ping); |
231 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, GetActivePushStream); | 236 FRIEND_TEST_ALL_PREFIXES(SpdySessionTest, GetActivePushStream); |
232 | 237 |
233 struct PendingCreateStream { | 238 struct PendingCreateStream { |
234 PendingCreateStream(const GURL& url, RequestPriority priority, | 239 PendingCreateStream(const GURL& url, RequestPriority priority, |
235 scoped_refptr<SpdyStream>* spdy_stream, | 240 scoped_refptr<SpdyStream>* spdy_stream, |
236 const BoundNetLog& stream_net_log, | 241 const BoundNetLog& stream_net_log, |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 const spdy::SpdyControlFlags flags_; | 612 const spdy::SpdyControlFlags flags_; |
608 const spdy::SpdyStreamId id_; | 613 const spdy::SpdyStreamId id_; |
609 const spdy::SpdyStreamId associated_stream_; | 614 const spdy::SpdyStreamId associated_stream_; |
610 | 615 |
611 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySynParameter); | 616 DISALLOW_COPY_AND_ASSIGN(NetLogSpdySynParameter); |
612 }; | 617 }; |
613 | 618 |
614 } // namespace net | 619 } // namespace net |
615 | 620 |
616 #endif // NET_SPDY_SPDY_SESSION_H_ | 621 #endif // NET_SPDY_SPDY_SESSION_H_ |
OLD | NEW |