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

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

Issue 612323013: QUIC - (no behavior change) s/NULL/nullptr/g in .../quic/... (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « net/quic/quic_network_transaction_unittest.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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // Returns true if there are retransmittable frames pending to be serialized. 118 // Returns true if there are retransmittable frames pending to be serialized.
119 bool HasPendingRetransmittableFrames() const; 119 bool HasPendingRetransmittableFrames() const;
120 120
121 // Returns whether FEC protection is currently enabled. Note: Enabled does not 121 // Returns whether FEC protection is currently enabled. Note: Enabled does not
122 // mean that an FEC group is currently active; i.e., IsFecProtected() may 122 // mean that an FEC group is currently active; i.e., IsFecProtected() may
123 // still return false. 123 // still return false.
124 bool IsFecEnabled() const; 124 bool IsFecEnabled() const;
125 125
126 // Returns true if subsequent packets will be FEC protected. Note: True does 126 // Returns true if subsequent packets will be FEC protected. Note: True does
127 // not mean that an FEC packet is currently under construction; i.e., 127 // not mean that an FEC packet is currently under construction; i.e.,
128 // fec_group_.get() may still be NULL, until MaybeStartFec() is called. 128 // fec_group_.get() may still be nullptr, until MaybeStartFec() is called.
129 bool IsFecProtected() const; 129 bool IsFecProtected() const;
130 130
131 // Returns the number of bytes which are available to be used by additional 131 // Returns the number of bytes which are available to be used by additional
132 // frames in the packet. Since stream frames are slightly smaller when they 132 // frames in the packet. Since stream frames are slightly smaller when they
133 // are the last frame in a packet, this method will return a different 133 // are the last frame in a packet, this method will return a different
134 // value than max_packet_size - PacketSize(), in this case. 134 // value than max_packet_size - PacketSize(), in this case.
135 size_t BytesFree() const; 135 size_t BytesFree() const;
136 136
137 // Returns the number of bytes that the packet will expand by if a new frame 137 // Returns the number of bytes that the packet will expand by if a new frame
138 // is added to the packet. If the last frame was a stream frame, it will 138 // is added to the packet. If the last frame was a stream frame, it will
139 // expand slightly when a new frame is added, and this method returns the 139 // expand slightly when a new frame is added, and this method returns the
140 // amount of expected expansion. If the packet is in an FEC group, no 140 // amount of expected expansion. If the packet is in an FEC group, no
141 // expansion happens and this method always returns zero. 141 // expansion happens and this method always returns zero.
142 size_t ExpansionOnNewFrame() const; 142 size_t ExpansionOnNewFrame() const;
143 143
144 // Returns the number of bytes in the current packet, including the header, 144 // Returns the number of bytes in the current packet, including the header,
145 // if serialized with the current frames. Adding a frame to the packet 145 // if serialized with the current frames. Adding a frame to the packet
146 // may change the serialized length of existing frames, as per the comment 146 // may change the serialized length of existing frames, as per the comment
147 // in BytesFree. 147 // in BytesFree.
148 size_t PacketSize() const; 148 size_t PacketSize() const;
149 149
150 // TODO(jri): AddSavedFrame calls AddFrame, which only saves the frame 150 // TODO(jri): AddSavedFrame calls AddFrame, which only saves the frame
151 // if it is a stream frame, not other types of frames. Fix this API; 151 // if it is a stream frame, not other types of frames. Fix this API;
152 // add a AddNonSavedFrame method. 152 // add a AddNonSavedFrame method.
153 // Adds |frame| to the packet creator's list of frames to be serialized. 153 // Adds |frame| to the packet creator's list of frames to be serialized.
154 // Returns false if the frame doesn't fit into the current packet. 154 // Returns false if the frame doesn't fit into the current packet.
155 bool AddSavedFrame(const QuicFrame& frame); 155 bool AddSavedFrame(const QuicFrame& frame);
156 156
157 // Serializes all frames which have been added and adds any which should be 157 // Serializes all frames which have been added and adds any which should be
158 // retransmitted to |retransmittable_frames| if it's not NULL. All frames must 158 // retransmitted to |retransmittable_frames| if it's not nullptr. All frames
159 // fit into a single packet. Sets the entropy hash of the serialized 159 // must fit into a single packet. Sets the entropy hash of the serialized
160 // packet to a random bool and returns that value as a member of 160 // packet to a random bool and returns that value as a member of
161 // SerializedPacket. Also, sets |serialized_frames| in the SerializedPacket 161 // SerializedPacket. Also, sets |serialized_frames| in the SerializedPacket to
162 // to the corresponding RetransmittableFrames if any frames are to be 162 // the corresponding RetransmittableFrames if any frames are to be
163 // retransmitted. 163 // retransmitted.
164 SerializedPacket SerializePacket(); 164 SerializedPacket SerializePacket();
165 165
166 // Packetize FEC data. All frames must fit into a single packet. Also, sets 166 // Packetize FEC data. All frames must fit into a single packet. Also, sets
167 // the entropy hash of the serialized packet to a random bool and returns 167 // the entropy hash of the serialized packet to a random bool and returns
168 // that value as a member of SerializedPacket. 168 // that value as a member of SerializedPacket.
169 SerializedPacket SerializeFec(); 169 SerializedPacket SerializeFec();
170 170
171 // Creates a packet with connection close frame. Caller owns the created 171 // Creates a packet with connection close frame. Caller owns the created
172 // packet. Also, sets the entropy hash of the serialized packet to a random 172 // packet. Also, sets the entropy hash of the serialized packet to a random
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 void set_next_sequence_number_length(QuicSequenceNumberLength length) { 207 void set_next_sequence_number_length(QuicSequenceNumberLength length) {
208 next_sequence_number_length_ = length; 208 next_sequence_number_length_ = length;
209 } 209 }
210 210
211 size_t max_packet_length() const { 211 size_t max_packet_length() const {
212 return max_packet_length_; 212 return max_packet_length_;
213 } 213 }
214 214
215 void set_max_packet_length(size_t length) { 215 void set_max_packet_length(size_t length) {
216 // |max_packet_length_| should not be changed mid-packet or mid-FEC group. 216 // |max_packet_length_| should not be changed mid-packet or mid-FEC group.
217 DCHECK(fec_group_.get() == NULL && queued_frames_.empty()); 217 DCHECK(fec_group_.get() == nullptr && queued_frames_.empty());
218 max_packet_length_ = length; 218 max_packet_length_ = length;
219 } 219 }
220 220
221 // Returns current max number of packets covered by an FEC group. 221 // Returns current max number of packets covered by an FEC group.
222 size_t max_packets_per_fec_group() const { 222 size_t max_packets_per_fec_group() const {
223 return max_packets_per_fec_group_; 223 return max_packets_per_fec_group_;
224 } 224 }
225 225
226 // Sets creator's max number of packets covered by an FEC group. 226 // Sets creator's max number of packets covered by an FEC group.
227 // Note: While there are no constraints on |max_packets_per_fec_group|, 227 // Note: While there are no constraints on |max_packets_per_fec_group|,
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 mutable size_t packet_size_; 287 mutable size_t packet_size_;
288 QuicFrames queued_frames_; 288 QuicFrames queued_frames_;
289 scoped_ptr<RetransmittableFrames> queued_retransmittable_frames_; 289 scoped_ptr<RetransmittableFrames> queued_retransmittable_frames_;
290 290
291 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator); 291 DISALLOW_COPY_AND_ASSIGN(QuicPacketCreator);
292 }; 292 };
293 293
294 } // namespace net 294 } // namespace net
295 295
296 #endif // NET_QUIC_QUIC_PACKET_CREATOR_H_ 296 #endif // NET_QUIC_QUIC_PACKET_CREATOR_H_
OLDNEW
« no previous file with comments | « net/quic/quic_network_transaction_unittest.cc ('k') | net/quic/quic_packet_creator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698