| 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 <deque> | 8 #include <deque> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 public: | 53 public: |
| 54 // Delegate handles protocol specific behavior of spdy stream. | 54 // Delegate handles protocol specific behavior of spdy stream. |
| 55 class NET_EXPORT_PRIVATE Delegate { | 55 class NET_EXPORT_PRIVATE Delegate { |
| 56 public: | 56 public: |
| 57 Delegate() {} | 57 Delegate() {} |
| 58 | 58 |
| 59 // Called when SYN frame has been sent. | 59 // Called when SYN frame has been sent. |
| 60 // Returns true if no more data to be sent after SYN frame. | 60 // Returns true if no more data to be sent after SYN frame. |
| 61 virtual SpdySendStatus OnSendHeadersComplete() = 0; | 61 virtual SpdySendStatus OnSendHeadersComplete() = 0; |
| 62 | 62 |
| 63 // Called when stream is ready to send data. | 63 // Called when the stream is ready to send body data. The |
| 64 // Returns network error code. OK when it successfully sent data. | 64 // delegate must call QueueStreamData() on the stream, either |
| 65 // ERR_IO_PENDING when performing operation asynchronously. | 65 // immediately or asynchronously (e.g., if the data to be send has |
| 66 virtual int OnSendBody() = 0; | 66 // to be read asynchronously). |
| 67 // |
| 68 // Called only when OnSendHeadersComplete() or |
| 69 // OnSendBodyComplete() returns MORE_DATA_TO_SEND. |
| 70 virtual void OnSendBody() = 0; |
| 67 | 71 |
| 68 // Called when body data has been sent. |bytes_sent| is the number | 72 // Called when body data has been sent. |bytes_sent| is the number |
| 69 // of bytes that has been sent (may be zero). Must return whether | 73 // of bytes that has been sent (may be zero). Must return whether |
| 70 // there's more body data to send. | 74 // there's more body data to send. |
| 71 virtual SpdySendStatus OnSendBodyComplete(size_t bytes_sent) = 0; | 75 virtual SpdySendStatus OnSendBodyComplete(size_t bytes_sent) = 0; |
| 72 | 76 |
| 73 // Called when the SYN_STREAM, SYN_REPLY, or HEADERS frames are received. | 77 // Called when the SYN_STREAM, SYN_REPLY, or HEADERS frames are received. |
| 74 // Normal streams will receive a SYN_REPLY and optional HEADERS frames. | 78 // Normal streams will receive a SYN_REPLY and optional HEADERS frames. |
| 75 // Pushed streams will receive a SYN_STREAM and optional HEADERS frames. | 79 // Pushed streams will receive a SYN_STREAM and optional HEADERS frames. |
| 76 // Because a stream may have a SYN_* frame and multiple HEADERS frames, | 80 // Because a stream may have a SYN_* frame and multiple HEADERS frames, |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 // When OnFrameWriteComplete() is called, these variables are set. | 461 // When OnFrameWriteComplete() is called, these variables are set. |
| 458 SpdyFrameType just_completed_frame_type_; | 462 SpdyFrameType just_completed_frame_type_; |
| 459 size_t just_completed_frame_size_; | 463 size_t just_completed_frame_size_; |
| 460 | 464 |
| 461 DISALLOW_COPY_AND_ASSIGN(SpdyStream); | 465 DISALLOW_COPY_AND_ASSIGN(SpdyStream); |
| 462 }; | 466 }; |
| 463 | 467 |
| 464 } // namespace net | 468 } // namespace net |
| 465 | 469 |
| 466 #endif // NET_SPDY_SPDY_STREAM_H_ | 470 #endif // NET_SPDY_SPDY_STREAM_H_ |
| OLD | NEW |