| 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_STREAM_H_ | 5 #ifndef NET_SPDY_SPDY_STREAM_H_ |
| 6 #define NET_SPDY_SPDY_STREAM_H_ | 6 #define NET_SPDY_SPDY_STREAM_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 // negative, since that would be a flow control violation. | 158 // negative, since that would be a flow control violation. |
| 159 void DecreaseRecvWindowSize(int delta_window_size); | 159 void DecreaseRecvWindowSize(int delta_window_size); |
| 160 | 160 |
| 161 const BoundNetLog& net_log() const { return net_log_; } | 161 const BoundNetLog& net_log() const { return net_log_; } |
| 162 | 162 |
| 163 const linked_ptr<spdy::SpdyHeaderBlock>& spdy_headers() const; | 163 const linked_ptr<spdy::SpdyHeaderBlock>& spdy_headers() const; |
| 164 void set_spdy_headers(const linked_ptr<spdy::SpdyHeaderBlock>& headers); | 164 void set_spdy_headers(const linked_ptr<spdy::SpdyHeaderBlock>& headers); |
| 165 base::Time GetRequestTime() const; | 165 base::Time GetRequestTime() const; |
| 166 void SetRequestTime(base::Time t); | 166 void SetRequestTime(base::Time t); |
| 167 | 167 |
| 168 // TODO(jtl): Can we replace syn_reply_received_ with response_received_? |
| 169 // The following methods are needed when using SCTP without multiple |
| 170 // dictionaries (all SDPY control frames sent on SCTP stream 0), to handle the |
| 171 // case where data arrives ahead of the SYN_REPLY. |
| 172 bool syn_reply_received() { return syn_reply_received_; } |
| 173 void set_syn_reply_received() { syn_reply_received_ = true; } |
| 174 bool metrics_started() { return metrics_started_; } |
| 175 void set_metrics_started() { metrics_started_ = true; } |
| 176 bool close_pending() { return close_pending_; } |
| 177 void set_close_pending() { close_pending_ = true; } |
| 178 |
| 179 // Returns true if the underlying socket's transport protocol is SCTP. |
| 180 bool using_sctp(); |
| 181 |
| 182 // Returns true if the underlying socket's transport protocol is SCTP and SPDY |
| 183 // control frames are being sent on SCTP stream 0. |
| 184 bool using_sctp_control_stream(); |
| 185 |
| 168 // Called by the SpdySession when a response (e.g. a SYN_STREAM or SYN_REPLY) | 186 // Called by the SpdySession when a response (e.g. a SYN_STREAM or SYN_REPLY) |
| 169 // has been received for this stream. Returns a status code. | 187 // has been received for this stream. Returns a status code. |
| 170 int OnResponseReceived(const spdy::SpdyHeaderBlock& response); | 188 int OnResponseReceived(const spdy::SpdyHeaderBlock& response); |
| 171 | 189 |
| 172 // Called by the SpdySession when late-bound headers are received for a | 190 // Called by the SpdySession when late-bound headers are received for a |
| 173 // stream. Returns a status code. | 191 // stream. Returns a status code. |
| 174 int OnHeaders(const spdy::SpdyHeaderBlock& headers); | 192 int OnHeaders(const spdy::SpdyHeaderBlock& headers); |
| 175 | 193 |
| 176 // Called by the SpdySession when response data has been received for this | 194 // Called by the SpdySession when response data has been received for this |
| 177 // stream. This callback may be called multiple times as data arrives | 195 // stream. This callback may be called multiple times as data arrives |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 // The request to send. | 311 // The request to send. |
| 294 linked_ptr<spdy::SpdyHeaderBlock> request_; | 312 linked_ptr<spdy::SpdyHeaderBlock> request_; |
| 295 | 313 |
| 296 // The time at which the request was made that resulted in this response. | 314 // The time at which the request was made that resulted in this response. |
| 297 // For cached responses, this time could be "far" in the past. | 315 // For cached responses, this time could be "far" in the past. |
| 298 base::Time request_time_; | 316 base::Time request_time_; |
| 299 | 317 |
| 300 linked_ptr<spdy::SpdyHeaderBlock> response_; | 318 linked_ptr<spdy::SpdyHeaderBlock> response_; |
| 301 base::Time response_time_; | 319 base::Time response_time_; |
| 302 | 320 |
| 321 // When using SCTP without multiple dictionaries, control frames are sent on |
| 322 // a control stream (SCTP stream 0). In the even of loss, data frames may |
| 323 // arrive prior to the SYN_REPLY. We need to delay processing of data frames |
| 324 // until the SYN_REPLY has been received |
| 325 bool syn_reply_received_; |
| 326 // When DATA can be received prior to the SYN_REPLY, we need to be able to |
| 327 // start metrics on either the SYN_REPLY or the first DATA frame. We also |
| 328 // need to know if it's already been started to avoid starting it a second |
| 329 // time. |
| 330 bool metrics_started_; |
| 331 // If all data has arrived prior to the SYN_REPLY, we need to postpone closing |
| 332 // the stream until the SYN_REPLY arrives. |
| 333 bool close_pending_; |
| 334 |
| 303 State io_state_; | 335 State io_state_; |
| 304 | 336 |
| 305 // Since we buffer the response, we also buffer the response status. | 337 // Since we buffer the response, we also buffer the response status. |
| 306 // Not valid until the stream is closed. | 338 // Not valid until the stream is closed. |
| 307 int response_status_; | 339 int response_status_; |
| 308 | 340 |
| 309 bool cancelled_; | 341 bool cancelled_; |
| 310 bool has_upload_data_; | 342 bool has_upload_data_; |
| 311 | 343 |
| 312 BoundNetLog net_log_; | 344 BoundNetLog net_log_; |
| 313 | 345 |
| 314 base::TimeTicks send_time_; | 346 base::TimeTicks send_time_; |
| 315 base::TimeTicks recv_first_byte_time_; | 347 base::TimeTicks recv_first_byte_time_; |
| 316 base::TimeTicks recv_last_byte_time_; | 348 base::TimeTicks recv_last_byte_time_; |
| 317 int send_bytes_; | 349 int send_bytes_; |
| 318 int recv_bytes_; | 350 int recv_bytes_; |
| 319 // Data received before delegate is attached. | 351 // Data received before delegate is attached. |
| 320 std::vector<scoped_refptr<IOBufferWithSize> > pending_buffers_; | 352 std::vector<scoped_refptr<IOBufferWithSize> > pending_buffers_; |
| 321 | 353 |
| 322 DISALLOW_COPY_AND_ASSIGN(SpdyStream); | 354 DISALLOW_COPY_AND_ASSIGN(SpdyStream); |
| 323 }; | 355 }; |
| 324 | 356 |
| 325 } // namespace net | 357 } // namespace net |
| 326 | 358 |
| 327 #endif // NET_SPDY_SPDY_STREAM_H_ | 359 #endif // NET_SPDY_SPDY_STREAM_H_ |
| OLD | NEW |