diff options
Diffstat (limited to 'net/quic/quic_stream_sequencer.h')
-rw-r--r-- | net/quic/quic_stream_sequencer.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/net/quic/quic_stream_sequencer.h b/net/quic/quic_stream_sequencer.h index 04a47f0..acd7ada 100644 --- a/net/quic/quic_stream_sequencer.h +++ b/net/quic/quic_stream_sequencer.h @@ -9,6 +9,7 @@ #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" +#include "net/base/iovec.h" #include "net/quic/quic_protocol.h" using std::map; @@ -56,6 +57,18 @@ class NET_EXPORT_PRIVATE QuicStreamSequencer { // Once data is buffered, it's up to the stream to read it when the stream // can handle more data. The following three functions make that possible. + // Fills in up to iov_len iovecs with the next readable regions. Returns the + // number of iovs used. Non-destructive of the underlying data. + int GetReadableRegions(iovec* iov, int iov_len); + + // Copies the data into the iov_len buffers provided. Returns the number of + // bytes read. Any buffered data no longer in use will be released. + int Readv(const struct iovec* iov, int iov_len); + + // Consumes |num_bytes| data. Used in conjunction with |GetReadableRegions| + // to do zero-copy reads. + void MarkConsumed(size_t num_bytes); + // Returns true if the sequncer has bytes available for reading. bool HasBytesToRead() const; @@ -68,14 +81,16 @@ class NET_EXPORT_PRIVATE QuicStreamSequencer { // Returns true if the sequencer has received this frame before. bool IsDuplicate(const QuicStreamFrame& frame) const; + // Calls |ProcessRawData| on |stream_| for each buffered frame that may + // be processed. + void FlushBufferedFrames(); + private: friend class test::QuicStreamSequencerPeer; // TODO(alyssar) use something better than strings. typedef map<QuicStreamOffset, string> FrameMap; - void FlushBufferedFrames(); - bool MaybeCloseStream(); ReliableQuicStream* stream_; // The stream which owns this sequencer. |