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

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

Issue 839143002: Roll Chrome into Mojo. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Rebase Created 5 years, 11 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_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 "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "net/quic/crypto/quic_random.h" 9 #include "net/quic/crypto/quic_random.h"
10 #include "net/quic/quic_ack_notifier.h" 10 #include "net/quic/quic_ack_notifier.h"
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 254
255 bool set_fin = fin && bytes_consumed == data_size; // Last frame. 255 bool set_fin = fin && bytes_consumed == data_size; // Last frame.
256 IOVector frame_data; 256 IOVector frame_data;
257 frame_data.AppendIovecAtMostBytes(data.iovec(), data.Size(), 257 frame_data.AppendIovecAtMostBytes(data.iovec(), data.Size(),
258 bytes_consumed); 258 bytes_consumed);
259 DCHECK_EQ(frame_data.TotalBufferSize(), bytes_consumed); 259 DCHECK_EQ(frame_data.TotalBufferSize(), bytes_consumed);
260 *frame = QuicFrame(new QuicStreamFrame(id, set_fin, offset, frame_data)); 260 *frame = QuicFrame(new QuicStreamFrame(id, set_fin, offset, frame_data));
261 return bytes_consumed; 261 return bytes_consumed;
262 } 262 }
263 263
264 size_t QuicPacketCreator::CreateStreamFrameWithNotifier(
265 QuicStreamId id,
266 const IOVector& data,
267 QuicStreamOffset offset,
268 bool fin,
269 QuicAckNotifier* notifier,
270 QuicFrame* frame) {
271 size_t bytes_consumed = CreateStreamFrame(id, data, offset, fin, frame);
272
273 // The frame keeps track of the QuicAckNotifier until it is serialized into
274 // a packet. At that point the notifier is informed of the sequence number
275 // of the packet that this frame was eventually sent in.
276 frame->stream_frame->notifier = notifier;
277
278 return bytes_consumed;
279 }
280
281 SerializedPacket QuicPacketCreator::ReserializeAllFrames( 264 SerializedPacket QuicPacketCreator::ReserializeAllFrames(
282 const QuicFrames& frames, 265 const QuicFrames& frames,
283 QuicSequenceNumberLength original_length) { 266 QuicSequenceNumberLength original_length) {
284 DCHECK(fec_group_.get() == nullptr); 267 DCHECK(fec_group_.get() == nullptr);
285 const QuicSequenceNumberLength saved_length = sequence_number_length_; 268 const QuicSequenceNumberLength saved_length = sequence_number_length_;
286 const QuicSequenceNumberLength saved_next_length = 269 const QuicSequenceNumberLength saved_next_length =
287 next_sequence_number_length_; 270 next_sequence_number_length_;
288 const bool saved_should_fec_protect = should_fec_protect_; 271 const bool saved_should_fec_protect = should_fec_protect_;
289 272
290 // Temporarily set the sequence number length and stop FEC protection. 273 // Temporarily set the sequence number length and stop FEC protection.
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 if (!is_handshake) { 510 if (!is_handshake) {
528 return; 511 return;
529 } 512 }
530 513
531 QuicPaddingFrame padding; 514 QuicPaddingFrame padding;
532 bool success = AddFrame(QuicFrame(&padding), false); 515 bool success = AddFrame(QuicFrame(&padding), false);
533 DCHECK(success); 516 DCHECK(success);
534 } 517 }
535 518
536 } // namespace net 519 } // 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