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