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 <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 // First and last valid stream IDs. As we always act as the client, | 64 // First and last valid stream IDs. As we always act as the client, |
65 // start at 1 for the first stream id. | 65 // start at 1 for the first stream id. |
66 const SpdyStreamId kFirstStreamId = 1; | 66 const SpdyStreamId kFirstStreamId = 1; |
67 const SpdyStreamId kLastStreamId = 0x7fffffff; | 67 const SpdyStreamId kLastStreamId = 0x7fffffff; |
68 | 68 |
69 class BoundNetLog; | 69 class BoundNetLog; |
70 struct LoadTimingInfo; | 70 struct LoadTimingInfo; |
71 class SpdyStream; | 71 class SpdyStream; |
72 class SSLInfo; | 72 class SSLInfo; |
73 class TransportSecurityState; | |
74 | 73 |
75 // NOTE: There's an enum of the same name (also with numeric suffixes) | 74 // NOTE: There's an enum of the same name (also with numeric suffixes) |
76 // in histograms.xml. Be sure to add new values there also. | 75 // in histograms.xml. Be sure to add new values there also. |
77 enum SpdyProtocolErrorDetails { | 76 enum SpdyProtocolErrorDetails { |
78 // SpdyFramer::SpdyError mappings. | 77 // SpdyFramer::SpdyError mappings. |
79 SPDY_ERROR_NO_ERROR = 0, | 78 SPDY_ERROR_NO_ERROR = 0, |
80 SPDY_ERROR_INVALID_CONTROL_FRAME = 1, | 79 SPDY_ERROR_INVALID_CONTROL_FRAME = 1, |
81 SPDY_ERROR_CONTROL_PAYLOAD_TOO_LARGE = 2, | 80 SPDY_ERROR_CONTROL_PAYLOAD_TOO_LARGE = 2, |
82 SPDY_ERROR_ZLIB_INIT_FAILURE = 3, | 81 SPDY_ERROR_ZLIB_INIT_FAILURE = 3, |
83 SPDY_ERROR_UNSUPPORTED_VERSION = 4, | 82 SPDY_ERROR_UNSUPPORTED_VERSION = 4, |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 // TODO(akalin): Use base::TickClock when it becomes available. | 215 // TODO(akalin): Use base::TickClock when it becomes available. |
217 typedef base::TimeTicks (*TimeFunc)(void); | 216 typedef base::TimeTicks (*TimeFunc)(void); |
218 | 217 |
219 // How we handle flow control (version-dependent). | 218 // How we handle flow control (version-dependent). |
220 enum FlowControlState { | 219 enum FlowControlState { |
221 FLOW_CONTROL_NONE, | 220 FLOW_CONTROL_NONE, |
222 FLOW_CONTROL_STREAM, | 221 FLOW_CONTROL_STREAM, |
223 FLOW_CONTROL_STREAM_AND_SESSION | 222 FLOW_CONTROL_STREAM_AND_SESSION |
224 }; | 223 }; |
225 | 224 |
226 // Returns true if |hostname| can be pooled into an existing connection | |
227 // associated with |ssl_info|. | |
228 static bool CanPool(TransportSecurityState* transport_security_state, | |
229 const SSLInfo& ssl_info, | |
230 const std::string& old_hostname, | |
231 const std::string& new_hostname); | |
232 | |
233 // Create a new SpdySession. | 225 // Create a new SpdySession. |
234 // |spdy_session_key| is the host/port that this session connects to, privacy | 226 // |spdy_session_key| is the host/port that this session connects to, privacy |
235 // and proxy configuration settings that it's using. | 227 // and proxy configuration settings that it's using. |
236 // |session| is the HttpNetworkSession. |net_log| is the NetLog that we log | 228 // |session| is the HttpNetworkSession. |net_log| is the NetLog that we log |
237 // network events to. | 229 // network events to. |
238 SpdySession(const SpdySessionKey& spdy_session_key, | 230 SpdySession(const SpdySessionKey& spdy_session_key, |
239 const base::WeakPtr<HttpServerProperties>& http_server_properties, | 231 const base::WeakPtr<HttpServerProperties>& http_server_properties, |
240 TransportSecurityState* transport_security_state, | |
241 bool verify_domain_authentication, | 232 bool verify_domain_authentication, |
242 bool enable_sending_initial_data, | 233 bool enable_sending_initial_data, |
243 bool enable_compression, | 234 bool enable_compression, |
244 bool enable_ping_based_connection_checking, | 235 bool enable_ping_based_connection_checking, |
245 NextProto default_protocol, | 236 NextProto default_protocol, |
246 size_t stream_initial_recv_window_size, | 237 size_t stream_initial_recv_window_size, |
247 size_t initial_max_concurrent_streams, | 238 size_t initial_max_concurrent_streams, |
248 size_t max_concurrent_streams_limit, | 239 size_t max_concurrent_streams_limit, |
249 TimeFunc time_func, | 240 TimeFunc time_func, |
250 const HostPortPair& trusted_spdy_proxy, | 241 const HostPortPair& trusted_spdy_proxy, |
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 | 956 |
966 // Set set of SpdySessionKeys for which this session has serviced | 957 // Set set of SpdySessionKeys for which this session has serviced |
967 // requests. | 958 // requests. |
968 std::set<SpdySessionKey> pooled_aliases_; | 959 std::set<SpdySessionKey> pooled_aliases_; |
969 | 960 |
970 // |pool_| owns us, therefore its lifetime must exceed ours. We set | 961 // |pool_| owns us, therefore its lifetime must exceed ours. We set |
971 // this to NULL after we are removed from the pool. | 962 // this to NULL after we are removed from the pool. |
972 SpdySessionPool* pool_; | 963 SpdySessionPool* pool_; |
973 const base::WeakPtr<HttpServerProperties> http_server_properties_; | 964 const base::WeakPtr<HttpServerProperties> http_server_properties_; |
974 | 965 |
975 TransportSecurityState* transport_security_state_; | |
976 | |
977 // The socket handle for this session. | 966 // The socket handle for this session. |
978 scoped_ptr<ClientSocketHandle> connection_; | 967 scoped_ptr<ClientSocketHandle> connection_; |
979 | 968 |
980 // The read buffer used to read data from the socket. | 969 // The read buffer used to read data from the socket. |
981 scoped_refptr<IOBuffer> read_buffer_; | 970 scoped_refptr<IOBuffer> read_buffer_; |
982 | 971 |
983 SpdyStreamId stream_hi_water_mark_; // The next stream id to use. | 972 SpdyStreamId stream_hi_water_mark_; // The next stream id to use. |
984 | 973 |
985 // Queue, for each priority, of pending stream requests that have | 974 // Queue, for each priority, of pending stream requests that have |
986 // not yet been satisfied. | 975 // not yet been satisfied. |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1168 // Used for posting asynchronous IO tasks. We use this even though | 1157 // Used for posting asynchronous IO tasks. We use this even though |
1169 // SpdySession is refcounted because we don't need to keep the SpdySession | 1158 // SpdySession is refcounted because we don't need to keep the SpdySession |
1170 // alive if the last reference is within a RunnableMethod. Just revoke the | 1159 // alive if the last reference is within a RunnableMethod. Just revoke the |
1171 // method. | 1160 // method. |
1172 base::WeakPtrFactory<SpdySession> weak_factory_; | 1161 base::WeakPtrFactory<SpdySession> weak_factory_; |
1173 }; | 1162 }; |
1174 | 1163 |
1175 } // namespace net | 1164 } // namespace net |
1176 | 1165 |
1177 #endif // NET_SPDY_SPDY_SESSION_H_ | 1166 #endif // NET_SPDY_SPDY_SESSION_H_ |
OLD | NEW |