| OLD | NEW |
| 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 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 header->fec_group = fec_group; | 414 header->fec_group = fec_group; |
| 415 } | 415 } |
| 416 | 416 |
| 417 bool QuicPacketCreator::ShouldRetransmit(const QuicFrame& frame) { | 417 bool QuicPacketCreator::ShouldRetransmit(const QuicFrame& frame) { |
| 418 return frame.type != ACK_FRAME && frame.type != CONGESTION_FEEDBACK_FRAME && | 418 return frame.type != ACK_FRAME && frame.type != CONGESTION_FEEDBACK_FRAME && |
| 419 frame.type != PADDING_FRAME; | 419 frame.type != PADDING_FRAME; |
| 420 } | 420 } |
| 421 | 421 |
| 422 bool QuicPacketCreator::AddFrame(const QuicFrame& frame, | 422 bool QuicPacketCreator::AddFrame(const QuicFrame& frame, |
| 423 bool save_retransmittable_frames) { | 423 bool save_retransmittable_frames) { |
| 424 DVLOG(1) << "Adding frame: " << frame; |
| 424 size_t frame_len = framer_->GetSerializedFrameLength( | 425 size_t frame_len = framer_->GetSerializedFrameLength( |
| 425 frame, BytesFree(), queued_frames_.empty(), true, | 426 frame, BytesFree(), queued_frames_.empty(), true, |
| 426 options()->send_sequence_number_length); | 427 options()->send_sequence_number_length); |
| 427 if (frame_len == 0) { | 428 if (frame_len == 0) { |
| 428 return false; | 429 return false; |
| 429 } | 430 } |
| 430 DCHECK_LT(0u, packet_size_); | 431 DCHECK_LT(0u, packet_size_); |
| 431 MaybeStartFEC(); | 432 MaybeStartFEC(); |
| 432 packet_size_ += frame_len; | 433 packet_size_ += frame_len; |
| 433 // If the last frame in the packet was a stream frame, then once we add the | 434 // If the last frame in the packet was a stream frame, then once we add the |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 if (!is_handshake) { | 472 if (!is_handshake) { |
| 472 return; | 473 return; |
| 473 } | 474 } |
| 474 | 475 |
| 475 QuicPaddingFrame padding; | 476 QuicPaddingFrame padding; |
| 476 bool success = AddFrame(QuicFrame(&padding), false); | 477 bool success = AddFrame(QuicFrame(&padding), false); |
| 477 DCHECK(success); | 478 DCHECK(success); |
| 478 } | 479 } |
| 479 | 480 |
| 480 } // namespace net | 481 } // namespace net |
| OLD | NEW |