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

Side by Side 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, 5 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef NET_QUIC_CORE_QUIC_STREAM_SEND_BUFFER_H_
6 #define NET_QUIC_CORE_QUIC_STREAM_SEND_BUFFER_H_
7
8 #include <deque>
9
10 #include "net/quic/core/frames/quic_stream_frame.h"
11 #include "net/quic/core/quic_iovector.h"
12
13 namespace net {
14
15 class QuicDataWriter;
16
17 // QuicStreamDataSlice comprises information of a piece of stream data.
18 struct QuicStreamDataSlice {
19 QuicStreamDataSlice(UniqueStreamBuffer data,
20 QuicStreamOffset offset,
21 QuicByteCount data_length);
22 QuicStreamDataSlice(const QuicStreamDataSlice& other) = delete;
23 QuicStreamDataSlice(QuicStreamDataSlice&& other) = delete;
24 ~QuicStreamDataSlice();
25
26 // Stream data of this data slice.
27 UniqueStreamBuffer data;
28 // Location of this data slice in the stream.
29 QuicStreamOffset offset;
30 // Length of this data slice in bytes.
31 QuicByteCount data_length;
32 // Length of payload which is waiting for acks.
33 QuicByteCount data_length_waiting_for_acks;
34 };
35
36 // QuicStreamSendBuffer contains a list of QuicStreamDataSlices. New data slices
37 // are added to the tail of the list. Data slices are removed from the head of
38 // the list when they get fully acked. Stream data can be retrieved and acked
39 // across slice boundaries.
40 class QUIC_EXPORT_PRIVATE QuicStreamSendBuffer {
41 public:
42 explicit QuicStreamSendBuffer(QuicBufferAllocator* allocator);
43 QuicStreamSendBuffer(const QuicStreamSendBuffer& other) = delete;
44 QuicStreamSendBuffer(QuicStreamSendBuffer&& other) = delete;
45 ~QuicStreamSendBuffer();
46
47 // Save |data_length| of data starts at |iov_offset| in |iov| to send buffer.
48 void SaveStreamData(QuicIOVector iov,
49 size_t iov_offset,
50 QuicStreamOffset offset,
51 QuicByteCount data_length);
52
53 // Write |data_length| of data starts at |offset|.
54 bool WriteStreamData(QuicStreamOffset offset,
55 QuicByteCount data_length,
56 QuicDataWriter* writer);
57
58 // Called when data [offset, offset + data_length) is acked or removed as
59 // stream is canceled. Removes fully acked data slice from send buffer.
60 void RemoveStreamFrame(QuicStreamOffset offset, QuicByteCount data_length);
61
62 // Number of data slices in send buffer.
63 size_t size() const;
64
65 private:
66 std::deque<QuicStreamDataSlice> send_buffer_;
67
68 QuicBufferAllocator* allocator_;
69 };
70
71 } // namespace net
72
73 #endif // NET_QUIC_CORE_QUIC_STREAM_SEND_BUFFER_H_
OLDNEW
« 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