| 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_QUIC_QUIC_STREAM_SEQUENCER_H_ | 5 #ifndef NET_QUIC_QUIC_STREAM_SEQUENCER_H_ |
| 6 #define NET_QUIC_QUIC_STREAM_SEQUENCER_H_ | 6 #define NET_QUIC_QUIC_STREAM_SEQUENCER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // Wait until we've seen 'offset' bytes, and then terminate the stream. | 52 // Wait until we've seen 'offset' bytes, and then terminate the stream. |
| 53 // TODO(ianswett): Simplify this method by removing half_close, now that | 53 // TODO(ianswett): Simplify this method by removing half_close, now that |
| 54 // the sequencer is bypassed for stream resets and half_close is always true. | 54 // the sequencer is bypassed for stream resets and half_close is always true. |
| 55 void CloseStreamAtOffset(QuicStreamOffset offset, bool half_close); | 55 void CloseStreamAtOffset(QuicStreamOffset offset, bool half_close); |
| 56 | 56 |
| 57 // Once data is buffered, it's up to the stream to read it when the stream | 57 // Once data is buffered, it's up to the stream to read it when the stream |
| 58 // can handle more data. The following three functions make that possible. | 58 // can handle more data. The following three functions make that possible. |
| 59 | 59 |
| 60 // Fills in up to iov_len iovecs with the next readable regions. Returns the | 60 // Fills in up to iov_len iovecs with the next readable regions. Returns the |
| 61 // number of iovs used. Non-destructive of the underlying data. | 61 // number of iovs used. Non-destructive of the underlying data. |
| 62 int GetReadableRegions(iovec* iov, int iov_len); | 62 int GetReadableRegions(iovec* iov, size_t iov_len); |
| 63 | 63 |
| 64 // Copies the data into the iov_len buffers provided. Returns the number of | 64 // Copies the data into the iov_len buffers provided. Returns the number of |
| 65 // bytes read. Any buffered data no longer in use will be released. | 65 // bytes read. Any buffered data no longer in use will be released. |
| 66 int Readv(const struct iovec* iov, int iov_len); | 66 int Readv(const struct iovec* iov, size_t iov_len); |
| 67 | 67 |
| 68 // Consumes |num_bytes| data. Used in conjunction with |GetReadableRegions| | 68 // Consumes |num_bytes| data. Used in conjunction with |GetReadableRegions| |
| 69 // to do zero-copy reads. | 69 // to do zero-copy reads. |
| 70 void MarkConsumed(size_t num_bytes); | 70 void MarkConsumed(size_t num_bytes); |
| 71 | 71 |
| 72 // Returns true if the sequncer has bytes available for reading. | 72 // Returns true if the sequncer has bytes available for reading. |
| 73 bool HasBytesToRead() const; | 73 bool HasBytesToRead() const; |
| 74 | 74 |
| 75 // Returns true if the sequencer has delivered a half close. | 75 // Returns true if the sequencer has delivered a half close. |
| 76 bool IsHalfClosed() const; | 76 bool IsHalfClosed() const; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 102 // the half_close_ bool. | 102 // the half_close_ bool. |
| 103 QuicStreamOffset close_offset_; | 103 QuicStreamOffset close_offset_; |
| 104 // Only valid if close_offset_ is set. Indicates if it's a half or a full | 104 // Only valid if close_offset_ is set. Indicates if it's a half or a full |
| 105 // close. | 105 // close. |
| 106 bool half_close_; | 106 bool half_close_; |
| 107 }; | 107 }; |
| 108 | 108 |
| 109 } // namespace net | 109 } // namespace net |
| 110 | 110 |
| 111 #endif // NET_QUIC_QUIC_STREAM_SEQUENCER_H_ | 111 #endif // NET_QUIC_QUIC_STREAM_SEQUENCER_H_ |
| OLD | NEW |