| 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 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include <deque> | 11 #include <deque> |
| 12 #include <map> | 12 #include <map> |
| 13 #include <set> | 13 #include <set> |
| 14 #include <string> | 14 #include <string> |
| 15 | 15 |
| 16 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
| 19 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
| 20 #include "base/memory/weak_ptr.h" | 20 #include "base/memory/weak_ptr.h" |
| 21 #include "base/time/time.h" | 21 #include "base/time/time.h" |
| 22 #include "net/base/host_port_pair.h" |
| 22 #include "net/base/io_buffer.h" | 23 #include "net/base/io_buffer.h" |
| 23 #include "net/base/load_states.h" | 24 #include "net/base/load_states.h" |
| 24 #include "net/base/net_errors.h" | 25 #include "net/base/net_errors.h" |
| 25 #include "net/base/net_export.h" | 26 #include "net/base/net_export.h" |
| 26 #include "net/base/request_priority.h" | 27 #include "net/base/request_priority.h" |
| 27 #include "net/socket/client_socket_handle.h" | 28 #include "net/socket/client_socket_handle.h" |
| 28 #include "net/socket/client_socket_pool.h" | 29 #include "net/socket/client_socket_pool.h" |
| 29 #include "net/socket/next_proto.h" | 30 #include "net/socket/next_proto.h" |
| 30 #include "net/socket/ssl_client_socket.h" | 31 #include "net/socket/ssl_client_socket.h" |
| 31 #include "net/socket/stream_socket.h" | 32 #include "net/socket/stream_socket.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 const int kYieldAfterBytesRead = 32 * 1024; | 67 const int kYieldAfterBytesRead = 32 * 1024; |
| 67 const int kYieldAfterDurationMilliseconds = 20; | 68 const int kYieldAfterDurationMilliseconds = 20; |
| 68 | 69 |
| 69 // First and last valid stream IDs. As we always act as the client, | 70 // First and last valid stream IDs. As we always act as the client, |
| 70 // start at 1 for the first stream id. | 71 // start at 1 for the first stream id. |
| 71 const SpdyStreamId kFirstStreamId = 1; | 72 const SpdyStreamId kFirstStreamId = 1; |
| 72 const SpdyStreamId kLastStreamId = 0x7fffffff; | 73 const SpdyStreamId kLastStreamId = 0x7fffffff; |
| 73 | 74 |
| 74 class BoundNetLog; | 75 class BoundNetLog; |
| 75 struct LoadTimingInfo; | 76 struct LoadTimingInfo; |
| 77 class ProxyDelegate; |
| 76 class SpdyStream; | 78 class SpdyStream; |
| 77 class SSLInfo; | 79 class SSLInfo; |
| 78 class TransportSecurityState; | 80 class TransportSecurityState; |
| 79 | 81 |
| 80 // NOTE: There's an enum of the same name (also with numeric suffixes) | 82 // NOTE: There's an enum of the same name (also with numeric suffixes) |
| 81 // in histograms.xml. Be sure to add new values there also. | 83 // in histograms.xml. Be sure to add new values there also. |
| 82 enum SpdyProtocolErrorDetails { | 84 enum SpdyProtocolErrorDetails { |
| 83 // SpdyFramer::SpdyError mappings. | 85 // SpdyFramer::SpdyError mappings. |
| 84 SPDY_ERROR_NO_ERROR = 0, | 86 SPDY_ERROR_NO_ERROR = 0, |
| 85 SPDY_ERROR_INVALID_CONTROL_FRAME = 1, | 87 SPDY_ERROR_INVALID_CONTROL_FRAME = 1, |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 TransportSecurityState* transport_security_state, | 240 TransportSecurityState* transport_security_state, |
| 239 bool verify_domain_authentication, | 241 bool verify_domain_authentication, |
| 240 bool enable_sending_initial_data, | 242 bool enable_sending_initial_data, |
| 241 bool enable_compression, | 243 bool enable_compression, |
| 242 bool enable_ping_based_connection_checking, | 244 bool enable_ping_based_connection_checking, |
| 243 NextProto default_protocol, | 245 NextProto default_protocol, |
| 244 size_t session_max_recv_window_size, | 246 size_t session_max_recv_window_size, |
| 245 size_t stream_max_recv_window_size, | 247 size_t stream_max_recv_window_size, |
| 246 size_t initial_max_concurrent_streams, | 248 size_t initial_max_concurrent_streams, |
| 247 TimeFunc time_func, | 249 TimeFunc time_func, |
| 248 const HostPortPair& trusted_spdy_proxy, | 250 ProxyDelegate* proxy_delegate, |
| 249 NetLog* net_log); | 251 NetLog* net_log); |
| 250 | 252 |
| 251 ~SpdySession() override; | 253 ~SpdySession() override; |
| 252 | 254 |
| 253 const HostPortPair& host_port_pair() const { | 255 const HostPortPair& host_port_pair() const { |
| 254 return spdy_session_key_.host_port_proxy_pair().first; | 256 return spdy_session_key_.host_port_proxy_pair().first; |
| 255 } | 257 } |
| 256 const HostPortProxyPair& host_port_proxy_pair() const { | 258 const HostPortProxyPair& host_port_proxy_pair() const { |
| 257 return spdy_session_key_.host_port_proxy_pair(); | 259 return spdy_session_key_.host_port_proxy_pair(); |
| 258 } | 260 } |
| (...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1179 // we could adjust it to send fewer pings perhaps. | 1181 // we could adjust it to send fewer pings perhaps. |
| 1180 base::TimeDelta connection_at_risk_of_loss_time_; | 1182 base::TimeDelta connection_at_risk_of_loss_time_; |
| 1181 | 1183 |
| 1182 // The amount of time that we are willing to tolerate with no activity (of any | 1184 // The amount of time that we are willing to tolerate with no activity (of any |
| 1183 // form), while there is a ping in flight, before we declare the connection to | 1185 // form), while there is a ping in flight, before we declare the connection to |
| 1184 // be hung. TODO(rtenneti): When hung, instead of resetting connection, race | 1186 // be hung. TODO(rtenneti): When hung, instead of resetting connection, race |
| 1185 // to build a new connection, and see if that completes before we (finally) | 1187 // to build a new connection, and see if that completes before we (finally) |
| 1186 // get a PING response (http://crbug.com/127812). | 1188 // get a PING response (http://crbug.com/127812). |
| 1187 base::TimeDelta hung_interval_; | 1189 base::TimeDelta hung_interval_; |
| 1188 | 1190 |
| 1189 // This SPDY proxy is allowed to push resources from origins that are | 1191 // The |proxy_delegate_| verifies that a given proxy is a trusted SPDY proxy, |
| 1190 // different from those of their associated streams. | 1192 // which is allowed to push resources from origins that are different from |
| 1191 HostPortPair trusted_spdy_proxy_; | 1193 // those of their associated streams. May be nullptr. |
| 1194 ProxyDelegate* proxy_delegate_; |
| 1192 | 1195 |
| 1193 TimeFunc time_func_; | 1196 TimeFunc time_func_; |
| 1194 | 1197 |
| 1195 // Should priority-based dependency information be sent in stream header | 1198 // Should priority-based dependency information be sent in stream header |
| 1196 // frames. | 1199 // frames. |
| 1197 bool send_priority_dependency_; | 1200 bool send_priority_dependency_; |
| 1198 | 1201 |
| 1199 // Used for posting asynchronous IO tasks. We use this even though | 1202 // Used for posting asynchronous IO tasks. We use this even though |
| 1200 // SpdySession is refcounted because we don't need to keep the SpdySession | 1203 // SpdySession is refcounted because we don't need to keep the SpdySession |
| 1201 // alive if the last reference is within a RunnableMethod. Just revoke the | 1204 // alive if the last reference is within a RunnableMethod. Just revoke the |
| 1202 // method. | 1205 // method. |
| 1203 base::WeakPtrFactory<SpdySession> weak_factory_; | 1206 base::WeakPtrFactory<SpdySession> weak_factory_; |
| 1204 }; | 1207 }; |
| 1205 | 1208 |
| 1206 } // namespace net | 1209 } // namespace net |
| 1207 | 1210 |
| 1208 #endif // NET_SPDY_SPDY_SESSION_H_ | 1211 #endif // NET_SPDY_SPDY_SESSION_H_ |
| OLD | NEW |