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 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 } | 305 } |
306 SerializedPacket packet = SerializePacket(); | 306 SerializedPacket packet = SerializePacket(); |
307 DCHECK(packet.retransmittable_frames == NULL); | 307 DCHECK(packet.retransmittable_frames == NULL); |
308 return packet; | 308 return packet; |
309 } | 309 } |
310 | 310 |
311 bool QuicPacketCreator::HasPendingFrames() const { | 311 bool QuicPacketCreator::HasPendingFrames() const { |
312 return !queued_frames_.empty(); | 312 return !queued_frames_.empty(); |
313 } | 313 } |
314 | 314 |
| 315 bool QuicPacketCreator::HasPendingRetransmittableFrames() const { |
| 316 return queued_retransmittable_frames_.get() != NULL && |
| 317 !queued_retransmittable_frames_->frames().empty(); |
| 318 } |
| 319 |
315 size_t QuicPacketCreator::ExpansionOnNewFrame() const { | 320 size_t QuicPacketCreator::ExpansionOnNewFrame() const { |
316 // If packet is FEC protected, there's no expansion. | 321 // If packet is FEC protected, there's no expansion. |
317 if (should_fec_protect_) { | 322 if (should_fec_protect_) { |
318 return 0; | 323 return 0; |
319 } | 324 } |
320 // If the last frame in the packet is a stream frame, then it will expand to | 325 // If the last frame in the packet is a stream frame, then it will expand to |
321 // include the stream_length field when a new frame is added. | 326 // include the stream_length field when a new frame is added. |
322 bool has_trailing_stream_frame = | 327 bool has_trailing_stream_frame = |
323 !queued_frames_.empty() && queued_frames_.back().type == STREAM_FRAME; | 328 !queued_frames_.empty() && queued_frames_.back().type == STREAM_FRAME; |
324 return has_trailing_stream_frame ? kQuicStreamPayloadLengthSize : 0; | 329 return has_trailing_stream_frame ? kQuicStreamPayloadLengthSize : 0; |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 if (!is_handshake) { | 508 if (!is_handshake) { |
504 return; | 509 return; |
505 } | 510 } |
506 | 511 |
507 QuicPaddingFrame padding; | 512 QuicPaddingFrame padding; |
508 bool success = AddFrame(QuicFrame(&padding), false); | 513 bool success = AddFrame(QuicFrame(&padding), false); |
509 DCHECK(success); | 514 DCHECK(success); |
510 } | 515 } |
511 | 516 |
512 } // namespace net | 517 } // namespace net |
OLD | NEW |