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

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

Issue 1464153002: Add ConsumeData method to QuicPacketCreator, ConsumeData wraps both CreateStreamFrame and AddFrame.… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@107699435
Patch Set: Created 5 years 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_packet_creator.h ('k') | net/quic/quic_packet_creator_test.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 #include "net/quic/quic_packet_creator.h" 5 #include "net/quic/quic_packet_creator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 // Since the packet creator will not change packet number length mid FEC 230 // Since the packet creator will not change packet number length mid FEC
231 // group, include the size of an FEC group to be safe. 231 // group, include the size of an FEC group to be safe.
232 const QuicPacketNumber current_delta = max_packets_per_fec_group_ + 232 const QuicPacketNumber current_delta = max_packets_per_fec_group_ +
233 packet_number_ + 1 - 233 packet_number_ + 1 -
234 least_packet_awaited_by_peer; 234 least_packet_awaited_by_peer;
235 const uint64 delta = max(current_delta, max_packets_in_flight); 235 const uint64 delta = max(current_delta, max_packets_in_flight);
236 next_packet_number_length_ = 236 next_packet_number_length_ =
237 QuicFramer::GetMinSequenceNumberLength(delta * 4); 237 QuicFramer::GetMinSequenceNumberLength(delta * 4);
238 } 238 }
239 239
240 bool QuicPacketCreator::ConsumeData(QuicStreamId id,
241 QuicIOVector iov,
242 size_t iov_offset,
243 QuicStreamOffset offset,
244 bool fin,
245 bool needs_padding,
246 QuicFrame* frame) {
247 UniqueStreamBuffer buffer;
248 CreateStreamFrame(id, iov, iov_offset, offset, fin, frame, &buffer);
249
250 return AddFrame(*frame,
251 /*save_retransmittable_frames=*/true,
252 needs_padding,
253 std::move(buffer));
254 }
255
240 bool QuicPacketCreator::HasRoomForStreamFrame(QuicStreamId id, 256 bool QuicPacketCreator::HasRoomForStreamFrame(QuicStreamId id,
241 QuicStreamOffset offset) const { 257 QuicStreamOffset offset) const {
242 // TODO(jri): This is a simple safe decision for now, but make 258 // TODO(jri): This is a simple safe decision for now, but make
243 // is_in_fec_group a parameter. Same as with all public methods in 259 // is_in_fec_group a parameter. Same as with all public methods in
244 // QuicPacketCreator. 260 // QuicPacketCreator.
245 return BytesFree() > 261 return BytesFree() >
246 QuicFramer::GetMinStreamFrameSize(id, offset, true, 262 QuicFramer::GetMinStreamFrameSize(id, offset, true,
247 should_fec_protect_ ? IN_FEC_GROUP : 263 should_fec_protect_ ? IN_FEC_GROUP :
248 NOT_IN_FEC_GROUP); 264 NOT_IN_FEC_GROUP);
249 } 265 }
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 if (BytesFree() == 0) { 696 if (BytesFree() == 0) {
681 // Don't pad full packets. 697 // Don't pad full packets.
682 return; 698 return;
683 } 699 }
684 700
685 bool success = AddFrame(QuicFrame(QuicPaddingFrame()), false, false, nullptr); 701 bool success = AddFrame(QuicFrame(QuicPaddingFrame()), false, false, nullptr);
686 DCHECK(success); 702 DCHECK(success);
687 } 703 }
688 704
689 } // namespace net 705 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_packet_creator.h ('k') | net/quic/quic_packet_creator_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698