Chromium Code Reviews| 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 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 const int kMaxSpdyFrameChunkSize = (2 * kMss) - 8; | 68 const int kMaxSpdyFrameChunkSize = (2 * kMss) - 8; |
| 69 | 69 |
| 70 // Default value of SETTINGS_INITIAL_WINDOW_SIZE per protocol specification. | 70 // Default value of SETTINGS_INITIAL_WINDOW_SIZE per protocol specification. |
| 71 // A session is always created with this initial window size. | 71 // A session is always created with this initial window size. |
| 72 const int32_t kDefaultInitialWindowSize = 65535; | 72 const int32_t kDefaultInitialWindowSize = 65535; |
| 73 | 73 |
| 74 // Maximum number of concurrent streams we will create, unless the server | 74 // Maximum number of concurrent streams we will create, unless the server |
| 75 // sends a SETTINGS frame with a different value. | 75 // sends a SETTINGS frame with a different value. |
| 76 const size_t kInitialMaxConcurrentStreams = 100; | 76 const size_t kInitialMaxConcurrentStreams = 100; |
| 77 | 77 |
| 78 // Specifies the maximum HPACK dynamic table size the server is allowed to set. | |
| 79 const int kMaxHeaderTableSize = 64 * 1024; | |
| 80 | |
| 81 // Specifies the maximum concurrent streams server could send (via push). | |
| 82 const int kMaxConcurrentPushedStreams = 1000; | |
| 83 | |
| 84 // If more than this many bytes have been read or more than that many | 78 // If more than this many bytes have been read or more than that many |
| 85 // milliseconds have passed, return ERR_IO_PENDING from ReadLoop. | 79 // milliseconds have passed, return ERR_IO_PENDING from ReadLoop. |
| 86 const int kYieldAfterBytesRead = 32 * 1024; | 80 const int kYieldAfterBytesRead = 32 * 1024; |
| 87 const int kYieldAfterDurationMilliseconds = 20; | 81 const int kYieldAfterDurationMilliseconds = 20; |
| 88 | 82 |
| 89 // First and last valid stream IDs. As we always act as the client, | 83 // First and last valid stream IDs. As we always act as the client, |
| 90 // start at 1 for the first stream id. | 84 // start at 1 for the first stream id. |
| 91 const SpdyStreamId kFirstStreamId = 1; | 85 const SpdyStreamId kFirstStreamId = 1; |
| 92 const SpdyStreamId kLastStreamId = 0x7fffffff; | 86 const SpdyStreamId kLastStreamId = 0x7fffffff; |
| 93 | 87 |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 300 // |spdy_session_key| is the host/port that this session connects to, privacy | 294 // |spdy_session_key| is the host/port that this session connects to, privacy |
| 301 // and proxy configuration settings that it's using. | 295 // and proxy configuration settings that it's using. |
| 302 // |session| is the HttpNetworkSession. |net_log| is the NetLog that we log | 296 // |session| is the HttpNetworkSession. |net_log| is the NetLog that we log |
| 303 // network events to. | 297 // network events to. |
| 304 SpdySession(const SpdySessionKey& spdy_session_key, | 298 SpdySession(const SpdySessionKey& spdy_session_key, |
| 305 HttpServerProperties* http_server_properties, | 299 HttpServerProperties* http_server_properties, |
| 306 TransportSecurityState* transport_security_state, | 300 TransportSecurityState* transport_security_state, |
| 307 bool enable_sending_initial_data, | 301 bool enable_sending_initial_data, |
| 308 bool enable_ping_based_connection_checking, | 302 bool enable_ping_based_connection_checking, |
| 309 size_t session_max_recv_window_size, | 303 size_t session_max_recv_window_size, |
| 310 size_t stream_max_recv_window_size, | 304 const SettingsMap& settings, |
| 311 TimeFunc time_func, | 305 TimeFunc time_func, |
| 312 ServerPushDelegate* push_delegate, | 306 ServerPushDelegate* push_delegate, |
| 313 ProxyDelegate* proxy_delegate, | 307 ProxyDelegate* proxy_delegate, |
| 314 NetLog* net_log); | 308 NetLog* net_log); |
| 315 | 309 |
| 316 ~SpdySession() override; | 310 ~SpdySession() override; |
| 317 | 311 |
| 318 const HostPortPair& host_port_pair() const { | 312 const HostPortPair& host_port_pair() const { |
| 319 return spdy_session_key_.host_port_proxy_pair().first; | 313 return spdy_session_key_.host_port_proxy_pair().first; |
| 320 } | 314 } |
| (...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1087 AvailabilityState availability_state_; | 1081 AvailabilityState availability_state_; |
| 1088 ReadState read_state_; | 1082 ReadState read_state_; |
| 1089 WriteState write_state_; | 1083 WriteState write_state_; |
| 1090 | 1084 |
| 1091 // If the session is closing (i.e., |availability_state_| is STATE_DRAINING), | 1085 // If the session is closing (i.e., |availability_state_| is STATE_DRAINING), |
| 1092 // then |error_on_close_| holds the error with which it was closed, which | 1086 // then |error_on_close_| holds the error with which it was closed, which |
| 1093 // may be OK (upon a polite GOAWAY) or an error < ERR_IO_PENDING otherwise. | 1087 // may be OK (upon a polite GOAWAY) or an error < ERR_IO_PENDING otherwise. |
| 1094 // Initialized to OK. | 1088 // Initialized to OK. |
| 1095 Error error_on_close_; | 1089 Error error_on_close_; |
| 1096 | 1090 |
| 1091 // Settings that are sent in the initial SETTINGS frame | |
| 1092 // (if |enable_sending_initial_data_| is true), | |
| 1093 // and also control SpdySession parameters like initial receive window size | |
| 1094 // and maximum HPACK dynamic table size. | |
| 1095 const SettingsMap settings_; | |
|
Ryan Hamilton
2016/12/27 22:32:43
nit: perhaps this should be initial_settings_?
Bence
2016/12/28 00:53:24
Done.
| |
| 1096 | |
| 1097 // Limits | 1097 // Limits |
| 1098 size_t max_concurrent_streams_; | 1098 size_t max_concurrent_streams_; |
| 1099 size_t max_concurrent_pushed_streams_; | 1099 size_t max_concurrent_pushed_streams_; |
| 1100 | 1100 |
| 1101 // Some statistics counters for the session. | 1101 // Some statistics counters for the session. |
| 1102 int streams_initiated_count_; | 1102 int streams_initiated_count_; |
| 1103 int streams_pushed_count_; | 1103 int streams_pushed_count_; |
| 1104 int streams_pushed_and_claimed_count_; | 1104 int streams_pushed_and_claimed_count_; |
| 1105 int streams_abandoned_count_; | 1105 int streams_abandoned_count_; |
| 1106 | 1106 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1144 // When bytes are consumed, SpdyIOBuffer destructor calls back to SpdySession, | 1144 // When bytes are consumed, SpdyIOBuffer destructor calls back to SpdySession, |
| 1145 // and this member keeps count of them until the corresponding WINDOW_UPDATEs | 1145 // and this member keeps count of them until the corresponding WINDOW_UPDATEs |
| 1146 // are sent. Zero unless session flow control is turned on. | 1146 // are sent. Zero unless session flow control is turned on. |
| 1147 int32_t session_unacked_recv_window_bytes_; | 1147 int32_t session_unacked_recv_window_bytes_; |
| 1148 | 1148 |
| 1149 // Initial send window size for this session's streams. Can be | 1149 // Initial send window size for this session's streams. Can be |
| 1150 // changed by an arriving SETTINGS frame. Newly created streams use | 1150 // changed by an arriving SETTINGS frame. Newly created streams use |
| 1151 // this value for the initial send window size. | 1151 // this value for the initial send window size. |
| 1152 int32_t stream_initial_send_window_size_; | 1152 int32_t stream_initial_send_window_size_; |
| 1153 | 1153 |
| 1154 // The maximum HPACK dynamic table size the server is allowed to set. | |
| 1155 uint32_t max_header_table_size_; | |
| 1156 | |
| 1154 // Initial receive window size for this session's streams. There are | 1157 // Initial receive window size for this session's streams. There are |
| 1155 // plans to add a command line switch that would cause a SETTINGS | 1158 // plans to add a command line switch that would cause a SETTINGS |
| 1156 // frame with window size announcement to be sent on startup. Newly | 1159 // frame with window size announcement to be sent on startup. Newly |
| 1157 // created streams will use this value for the initial receive | 1160 // created streams will use this value for the initial receive |
| 1158 // window size. | 1161 // window size. |
| 1159 int32_t stream_max_recv_window_size_; | 1162 int32_t stream_max_recv_window_size_; |
| 1160 | 1163 |
| 1161 // A queue of stream IDs that have been send-stalled at some point | 1164 // A queue of stream IDs that have been send-stalled at some point |
| 1162 // in the past. | 1165 // in the past. |
| 1163 std::deque<SpdyStreamId> stream_send_unstall_queue_[NUM_PRIORITIES]; | 1166 std::deque<SpdyStreamId> stream_send_unstall_queue_[NUM_PRIORITIES]; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1202 // Used for posting asynchronous IO tasks. We use this even though | 1205 // Used for posting asynchronous IO tasks. We use this even though |
| 1203 // SpdySession is refcounted because we don't need to keep the SpdySession | 1206 // SpdySession is refcounted because we don't need to keep the SpdySession |
| 1204 // alive if the last reference is within a RunnableMethod. Just revoke the | 1207 // alive if the last reference is within a RunnableMethod. Just revoke the |
| 1205 // method. | 1208 // method. |
| 1206 base::WeakPtrFactory<SpdySession> weak_factory_; | 1209 base::WeakPtrFactory<SpdySession> weak_factory_; |
| 1207 }; | 1210 }; |
| 1208 | 1211 |
| 1209 } // namespace net | 1212 } // namespace net |
| 1210 | 1213 |
| 1211 #endif // NET_SPDY_SPDY_SESSION_H_ | 1214 #endif // NET_SPDY_SPDY_SESSION_H_ |
| OLD | NEW |