| 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_STREAM_H_ | 5 #ifndef NET_SPDY_SPDY_STREAM_H_ |
| 6 #define NET_SPDY_SPDY_STREAM_H_ | 6 #define NET_SPDY_SPDY_STREAM_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 | 366 |
| 367 // Only one send can be in flight at a time, except for push | 367 // Only one send can be in flight at a time, except for push |
| 368 // streams, which must not send anything. | 368 // streams, which must not send anything. |
| 369 | 369 |
| 370 // Sends the request headers. The delegate is called back via | 370 // Sends the request headers. The delegate is called back via |
| 371 // OnRequestHeadersSent() when the request headers have completed | 371 // OnRequestHeadersSent() when the request headers have completed |
| 372 // sending. |send_status| must be MORE_DATA_TO_SEND for | 372 // sending. |send_status| must be MORE_DATA_TO_SEND for |
| 373 // bidirectional streams; for request/response streams, it must be | 373 // bidirectional streams; for request/response streams, it must be |
| 374 // MORE_DATA_TO_SEND if the request has data to upload, or | 374 // MORE_DATA_TO_SEND if the request has data to upload, or |
| 375 // NO_MORE_DATA_TO_SEND if not. | 375 // NO_MORE_DATA_TO_SEND if not. |
| 376 int SendRequestHeaders(std::unique_ptr<SpdyHeaderBlock> request_headers, | 376 int SendRequestHeaders(SpdyHeaderBlock request_headers, |
| 377 SpdySendStatus send_status); | 377 SpdySendStatus send_status); |
| 378 | 378 |
| 379 // Sends a DATA frame. The delegate will be notified via | 379 // Sends a DATA frame. The delegate will be notified via |
| 380 // OnDataSent() when the send is complete. |send_status| must be | 380 // OnDataSent() when the send is complete. |send_status| must be |
| 381 // MORE_DATA_TO_SEND for bidirectional streams; for request/response | 381 // MORE_DATA_TO_SEND for bidirectional streams; for request/response |
| 382 // streams, it must be MORE_DATA_TO_SEND if there is more data to | 382 // streams, it must be MORE_DATA_TO_SEND if there is more data to |
| 383 // upload, or NO_MORE_DATA_TO_SEND if not. | 383 // upload, or NO_MORE_DATA_TO_SEND if not. |
| 384 void SendData(IOBuffer* data, int length, SpdySendStatus send_status); | 384 void SendData(IOBuffer* data, int length, SpdySendStatus send_status); |
| 385 | 385 |
| 386 // Fills SSL info in |ssl_info| and returns true when SSL is in use. | 386 // Fills SSL info in |ssl_info| and returns true when SSL is in use. |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 // FIN states received prior to the delegate being attached have not yet been | 470 // FIN states received prior to the delegate being attached have not yet been |
| 471 // read. While buffered by |pending_recv_data_| it's not until | 471 // read. While buffered by |pending_recv_data_| it's not until |
| 472 // PushedStreamReplay() is invoked that reads are considered | 472 // PushedStreamReplay() is invoked that reads are considered |
| 473 // to have occurred, driving the state machine forward. | 473 // to have occurred, driving the state machine forward. |
| 474 void PushedStreamReplay(); | 474 void PushedStreamReplay(); |
| 475 | 475 |
| 476 // Produces the SYN_STREAM frame for the stream. The stream must | 476 // Produces the SYN_STREAM frame for the stream. The stream must |
| 477 // already be activated. | 477 // already be activated. |
| 478 std::unique_ptr<SpdySerializedFrame> ProduceSynStreamFrame(); | 478 std::unique_ptr<SpdySerializedFrame> ProduceSynStreamFrame(); |
| 479 | 479 |
| 480 // Produce the initial HEADER frame for the stream with the given | |
| 481 // block. The stream must already be activated. | |
| 482 std::unique_ptr<SpdySerializedFrame> ProduceHeaderFrame( | |
| 483 std::unique_ptr<SpdyHeaderBlock> header_block); | |
| 484 | |
| 485 // Queues the send for next frame of the remaining data in | 480 // Queues the send for next frame of the remaining data in |
| 486 // |pending_send_data_|. Must be called only when | 481 // |pending_send_data_|. Must be called only when |
| 487 // |pending_send_data_| is set. | 482 // |pending_send_data_| is set. |
| 488 void QueueNextDataFrame(); | 483 void QueueNextDataFrame(); |
| 489 | 484 |
| 490 // Merge the given headers into |response_headers_| and calls | 485 // Merge the given headers into |response_headers_| and calls |
| 491 // OnResponseHeadersUpdated() on the delegate (if attached). | 486 // OnResponseHeadersUpdated() on the delegate (if attached). |
| 492 // Returns a status code; if it is an error, the stream was closed | 487 // Returns a status code; if it is an error, the stream was closed |
| 493 // by this function. | 488 // by this function. |
| 494 int MergeWithResponseHeaders(const SpdyHeaderBlock& new_response_headers); | 489 int MergeWithResponseHeaders(const SpdyHeaderBlock& new_response_headers); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 523 | 518 |
| 524 const base::WeakPtr<SpdySession> session_; | 519 const base::WeakPtr<SpdySession> session_; |
| 525 | 520 |
| 526 // The transaction should own the delegate. | 521 // The transaction should own the delegate. |
| 527 SpdyStream::Delegate* delegate_; | 522 SpdyStream::Delegate* delegate_; |
| 528 | 523 |
| 529 // The headers for the request to send. | 524 // The headers for the request to send. |
| 530 // | 525 // |
| 531 // TODO(akalin): Hang onto this only until we send it. This | 526 // TODO(akalin): Hang onto this only until we send it. This |
| 532 // necessitates stashing the URL separately. | 527 // necessitates stashing the URL separately. |
| 533 std::unique_ptr<SpdyHeaderBlock> request_headers_; | 528 bool request_headers_valid_; |
| 529 SpdyHeaderBlock request_headers_; |
| 534 | 530 |
| 535 // Data waiting to be sent, and the close state of the local endpoint | 531 // Data waiting to be sent, and the close state of the local endpoint |
| 536 // after the data is fully written. | 532 // after the data is fully written. |
| 537 scoped_refptr<DrainableIOBuffer> pending_send_data_; | 533 scoped_refptr<DrainableIOBuffer> pending_send_data_; |
| 538 SpdySendStatus pending_send_status_; | 534 SpdySendStatus pending_send_status_; |
| 539 | 535 |
| 540 // Data waiting to be received, and the close state of the remote endpoint | 536 // Data waiting to be received, and the close state of the remote endpoint |
| 541 // after the data is fully read. Specifically, data received before the | 537 // after the data is fully read. Specifically, data received before the |
| 542 // delegate is attached must be buffered and later replayed. A remote FIN | 538 // delegate is attached must be buffered and later replayed. A remote FIN |
| 543 // is represented by a final, zero-length buffer. | 539 // is represented by a final, zero-length buffer. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 bool write_handler_guard_; | 577 bool write_handler_guard_; |
| 582 | 578 |
| 583 base::WeakPtrFactory<SpdyStream> weak_ptr_factory_; | 579 base::WeakPtrFactory<SpdyStream> weak_ptr_factory_; |
| 584 | 580 |
| 585 DISALLOW_COPY_AND_ASSIGN(SpdyStream); | 581 DISALLOW_COPY_AND_ASSIGN(SpdyStream); |
| 586 }; | 582 }; |
| 587 | 583 |
| 588 } // namespace net | 584 } // namespace net |
| 589 | 585 |
| 590 #endif // NET_SPDY_SPDY_STREAM_H_ | 586 #endif // NET_SPDY_SPDY_STREAM_H_ |
| OLD | NEW |