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

Side by Side Diff: net/quic/quic_packet_creator.h

Issue 300683008: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_framer_test.cc ('k') | net/quic/quic_packet_creator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // Accumulates frames for the next packet until more frames no longer fit or 5 // Accumulates frames for the next packet until more frames no longer fit or
6 // it's time to create a packet from them. Also provides packet creation of 6 // it's time to create a packet from them. Also provides packet creation of
7 // FEC packets based on previously created packets. 7 // FEC packets based on previously created packets.
8 8
9 #ifndef NET_QUIC_QUIC_PACKET_CREATOR_H_ 9 #ifndef NET_QUIC_QUIC_PACKET_CREATOR_H_
10 #define NET_QUIC_QUIC_PACKET_CREATOR_H_ 10 #define NET_QUIC_QUIC_PACKET_CREATOR_H_
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 void UpdateSequenceNumberLength( 86 void UpdateSequenceNumberLength(
87 QuicPacketSequenceNumber least_packet_awaited_by_peer, 87 QuicPacketSequenceNumber least_packet_awaited_by_peer,
88 QuicByteCount congestion_window); 88 QuicByteCount congestion_window);
89 89
90 // The overhead the framing will add for a packet with one frame. 90 // The overhead the framing will add for a packet with one frame.
91 static size_t StreamFramePacketOverhead( 91 static size_t StreamFramePacketOverhead(
92 QuicVersion version, 92 QuicVersion version,
93 QuicConnectionIdLength connection_id_length, 93 QuicConnectionIdLength connection_id_length,
94 bool include_version, 94 bool include_version,
95 QuicSequenceNumberLength sequence_number_length, 95 QuicSequenceNumberLength sequence_number_length,
96 QuicStreamOffset offset,
96 InFecGroup is_in_fec_group); 97 InFecGroup is_in_fec_group);
97 98
98 bool HasRoomForStreamFrame(QuicStreamId id, QuicStreamOffset offset) const; 99 bool HasRoomForStreamFrame(QuicStreamId id, QuicStreamOffset offset) const;
99 100
100 // Converts a raw payload to a frame which fits into the currently open 101 // Converts a raw payload to a frame which fits into the currently open
101 // packet if there is one. Returns the number of bytes consumed from data. 102 // packet if there is one. Returns the number of bytes consumed from data.
102 // If data is empty and fin is true, the expected behavior is to consume the 103 // If data is empty and fin is true, the expected behavior is to consume the
103 // fin but return 0. 104 // fin but return 0.
104 size_t CreateStreamFrame(QuicStreamId id, 105 size_t CreateStreamFrame(QuicStreamId id,
105 const IOVector& data, 106 const IOVector& data,
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 215
215 Options* options() { 216 Options* options() {
216 return &options_; 217 return &options_;
217 } 218 }
218 219
219 private: 220 private:
220 friend class test::QuicPacketCreatorPeer; 221 friend class test::QuicPacketCreatorPeer;
221 222
222 static bool ShouldRetransmit(const QuicFrame& frame); 223 static bool ShouldRetransmit(const QuicFrame& frame);
223 224
224 // Starts a new FEC group with the next serialized packet, if FEC is enabled 225 // Updates sequence number length on a packet or FEC group boundary.
225 // and there is not already an FEC group open. 226 // Also starts an FEC group if FEC protection is on and there is not already
226 InFecGroup MaybeStartFec(); 227 // an FEC group open.
228 InFecGroup MaybeUpdateLengthsAndStartFec();
227 229
228 void FillPacketHeader(QuicFecGroupNumber fec_group, 230 void FillPacketHeader(QuicFecGroupNumber fec_group,
229 bool fec_flag, 231 bool fec_flag,
230 QuicPacketHeader* header); 232 QuicPacketHeader* header);
231 233
232 // Allows a frame to be added without creating retransmittable frames. 234 // Allows a frame to be added without creating retransmittable frames.
233 // Particularly useful for retransmits using SerializeAllFrames(). 235 // Particularly useful for retransmits using SerializeAllFrames().
234 bool AddFrame(const QuicFrame& frame, bool save_retransmittable_frames); 236 bool AddFrame(const QuicFrame& frame, bool save_retransmittable_frames);
235 237
236 // Adds a padding frame to the current packet only if the current packet 238 // Adds a padding frame to the current packet only if the current packet
(...skipping 25 matching lines...) Expand all
262 mutable size_t packet_size_; 264 mutable size_t packet_size_;
263 QuicFrames queued_frames_; 265 QuicFrames queued_frames_;
264 scoped_ptr<RetransmittableFrames> queued_retransmittable_frames_; 266 scoped_ptr<RetransmittableFrames> queued_retransmittable_frames_;
265 267
266 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator); 268 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator);
267 }; 269 };
268 270
269 } // namespace net 271 } // namespace net
270 272
271 #endif // NET_QUIC_QUIC_PACKET_CREATOR_H_ 273 #endif // NET_QUIC_QUIC_PACKET_CREATOR_H_
OLDNEW
« no previous file with comments | « net/quic/quic_framer_test.cc ('k') | net/quic/quic_packet_creator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698