| Index: net/quic/quic_frame_list.h
|
| diff --git a/net/quic/quic_frame_list.h b/net/quic/quic_frame_list.h
|
| index 7738686b694e38373e2250207fb63708598613ee..9aad82e388298872ef76af3b6c5b7c2926f47912 100644
|
| --- a/net/quic/quic_frame_list.h
|
| +++ b/net/quic/quic_frame_list.h
|
| @@ -5,8 +5,8 @@
|
| #ifndef NET_QUIC_QUIC_FRAME_LIST_H_
|
| #define NET_QUIC_QUIC_FRAME_LIST_H_
|
|
|
| -#include "net/quic/quic_frame_list.h"
|
| #include "net/quic/quic_protocol.h"
|
| +#include "net/quic/quic_stream_sequencer_buffer_interface.h"
|
|
|
| using base::StringPiece;
|
| using std::string;
|
| @@ -18,7 +18,8 @@ namespace test {
|
| class QuicStreamSequencerPeer;
|
| }
|
|
|
| -class NET_EXPORT_PRIVATE QuicFrameList {
|
| +class NET_EXPORT_PRIVATE QuicFrameList
|
| + : public QuicStreamSequencerBufferInterface {
|
| public:
|
| // A contiguous segment received by a QUIC stream.
|
| struct FrameData {
|
| @@ -33,62 +34,23 @@ class NET_EXPORT_PRIVATE QuicFrameList {
|
|
|
| explicit QuicFrameList();
|
|
|
| - ~QuicFrameList();
|
| -
|
| - // Clear the buffer such that it is in its initial, newly constructed state.
|
| - void Clear() { frame_list_.clear(); }
|
| -
|
| - // Returns true if there is nothing to read in this buffer.
|
| - bool Empty() const { return frame_list_.empty(); }
|
| -
|
| - // Write the supplied data to this buffer. |timestamp| is used for
|
| - // measuring head of line (HOL) blocking. If the write was
|
| - // successful, return the number of bytes written in
|
| - // |bytes_written|. Return QUIC_INVALID_STREAM_DATA if |data|
|
| - // overlaps with existing data. No data will be written. Return
|
| - // QUIC_NO_ERROR, if |data| is duplicated with data written
|
| - // previously, and |bytes_written| = 0
|
| - QuicErrorCode WriteAtOffset(QuicStreamOffset offset,
|
| - StringPiece data,
|
| - QuicTime timestamp,
|
| - size_t* bytes_written);
|
| -
|
| - // Read from this buffer into given iovec array, upto number of iov_len iovec
|
| - // objects.
|
| - // Returns the number of bytes read into iov.
|
| - size_t ReadvAndInvalidate(const struct iovec* iov, size_t iov_len);
|
| -
|
| - // Invalidate all currently readable bytes.
|
| - // Returns the number of bytes invalidated.
|
| - size_t FlushBufferedFrames();
|
| -
|
| - // Returns the readable region of valid data in iovec format. The readable
|
| - // region is the buffer region where there is valid data not yet read by
|
| - // client. ReadAndInvalidate() and WriteAtOffset() change the readable region.
|
| - // The return value of this function is the number of iovec entries
|
| - // filled into in iov. If the region is empty, one iovec entry with 0 length
|
| - // is returned, and the function returns 0. If there are more readable
|
| - // regions than iov_size, the function only processes the first
|
| - // iov_size of them.
|
| - int GetReadableRegions(struct iovec* iov, int iov_len) const;
|
| -
|
| - // Fills in one iovec with the next readable region. |timestamp| is
|
| - // data arrived at the sequencer, and is used for measuring head of
|
| - // line blocking (HOL). Returns false if there is no readable
|
| - // region available.
|
| - bool GetReadableRegion(iovec* iov, QuicTime* timestamp) const;
|
| -
|
| - // Called after GetReadableRegions() to accumulate total_bytes_read_ and free
|
| - // up block when all data in it have been read out.
|
| - // Pre-requisite: bytes_used <= ReadableBytes()
|
| - bool IncreaseTotalReadAndInvalidate(size_t bytes_used);
|
| -
|
| - // Whether there are bytes can be read out (offset == total_bytes_read_)
|
| - bool HasBytesToRead() const;
|
| -
|
| - size_t size() const { return frame_list_.size(); }
|
| -
|
| - QuicStreamOffset total_bytes_read() const { return total_bytes_read_; }
|
| + ~QuicFrameList() override;
|
| +
|
| + // QuicStreamSequencerBufferInterface implementation
|
| + void Clear() override;
|
| + bool Empty() const override;
|
| + QuicErrorCode OnStreamData(QuicStreamOffset offset,
|
| + StringPiece data,
|
| + QuicTime timestamp,
|
| + size_t* bytes_buffered) override;
|
| + size_t Readv(const struct iovec* iov, size_t iov_len) override;
|
| + int GetReadableRegions(struct iovec* iov, int iov_len) const override;
|
| + bool GetReadableRegion(iovec* iov, QuicTime* timestamp) const override;
|
| + bool MarkConsumed(size_t bytes_used) override;
|
| + size_t FlushBufferedFrames() override;
|
| + bool HasBytesToRead() const override;
|
| + QuicStreamOffset BytesConsumed() const override;
|
| + size_t BytesBuffered() const override;
|
|
|
| private:
|
| friend class test::QuicStreamSequencerPeer;
|
| @@ -106,9 +68,13 @@ class NET_EXPORT_PRIVATE QuicFrameList {
|
| list<FrameData>::const_iterator insertion_point) const;
|
|
|
| list<FrameData> frame_list_;
|
| +
|
| + // Number of bytes in buffer.
|
| + size_t num_bytes_buffered_ = 0;
|
| +
|
| QuicStreamOffset total_bytes_read_ = 0;
|
| };
|
|
|
| -} // namespace net_quic
|
| +} // namespace net
|
|
|
| #endif // NET_QUIC_QUIC_FRAME_LIST_H_
|
|
|