Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(665)

Unified Diff: net/quic/core/quic_stream_send_buffer.h

Issue 2963763003: In QUIC, send data is copied to streams rather than frames. Protected by FLAGS_quic_reloadable_flag… (Closed)
Patch Set: Rebase Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/core/quic_stream_frame_data_producer.h ('k') | net/quic/core/quic_stream_send_buffer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/core/quic_stream_send_buffer.h
diff --git a/net/quic/core/quic_stream_send_buffer.h b/net/quic/core/quic_stream_send_buffer.h
new file mode 100644
index 0000000000000000000000000000000000000000..15345213b314a8afb619acafdba3f7fb1655496c
--- /dev/null
+++ b/net/quic/core/quic_stream_send_buffer.h
@@ -0,0 +1,73 @@
+// Copyright (c) 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NET_QUIC_CORE_QUIC_STREAM_SEND_BUFFER_H_
+#define NET_QUIC_CORE_QUIC_STREAM_SEND_BUFFER_H_
+
+#include <deque>
+
+#include "net/quic/core/frames/quic_stream_frame.h"
+#include "net/quic/core/quic_iovector.h"
+
+namespace net {
+
+class QuicDataWriter;
+
+// QuicStreamDataSlice comprises information of a piece of stream data.
+struct QuicStreamDataSlice {
+ QuicStreamDataSlice(UniqueStreamBuffer data,
+ QuicStreamOffset offset,
+ QuicByteCount data_length);
+ QuicStreamDataSlice(const QuicStreamDataSlice& other) = delete;
+ QuicStreamDataSlice(QuicStreamDataSlice&& other) = delete;
+ ~QuicStreamDataSlice();
+
+ // Stream data of this data slice.
+ UniqueStreamBuffer data;
+ // Location of this data slice in the stream.
+ QuicStreamOffset offset;
+ // Length of this data slice in bytes.
+ QuicByteCount data_length;
+ // Length of payload which is waiting for acks.
+ QuicByteCount data_length_waiting_for_acks;
+};
+
+// QuicStreamSendBuffer contains a list of QuicStreamDataSlices. New data slices
+// are added to the tail of the list. Data slices are removed from the head of
+// the list when they get fully acked. Stream data can be retrieved and acked
+// across slice boundaries.
+class QUIC_EXPORT_PRIVATE QuicStreamSendBuffer {
+ public:
+ explicit QuicStreamSendBuffer(QuicBufferAllocator* allocator);
+ QuicStreamSendBuffer(const QuicStreamSendBuffer& other) = delete;
+ QuicStreamSendBuffer(QuicStreamSendBuffer&& other) = delete;
+ ~QuicStreamSendBuffer();
+
+ // Save |data_length| of data starts at |iov_offset| in |iov| to send buffer.
+ void SaveStreamData(QuicIOVector iov,
+ size_t iov_offset,
+ QuicStreamOffset offset,
+ QuicByteCount data_length);
+
+ // Write |data_length| of data starts at |offset|.
+ bool WriteStreamData(QuicStreamOffset offset,
+ QuicByteCount data_length,
+ QuicDataWriter* writer);
+
+ // Called when data [offset, offset + data_length) is acked or removed as
+ // stream is canceled. Removes fully acked data slice from send buffer.
+ void RemoveStreamFrame(QuicStreamOffset offset, QuicByteCount data_length);
+
+ // Number of data slices in send buffer.
+ size_t size() const;
+
+ private:
+ std::deque<QuicStreamDataSlice> send_buffer_;
+
+ QuicBufferAllocator* allocator_;
+};
+
+} // namespace net
+
+#endif // NET_QUIC_CORE_QUIC_STREAM_SEND_BUFFER_H_
« no previous file with comments | « net/quic/core/quic_stream_frame_data_producer.h ('k') | net/quic/core/quic_stream_send_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698