Index: net/quic/quic_packet_creator.cc |
diff --git a/net/quic/quic_packet_creator.cc b/net/quic/quic_packet_creator.cc |
index d4324246a952be6fbb5229e34cd2f67dc1ed4df4..794d6b2687f23de62f513dba37dd75907b043439 100644 |
--- a/net/quic/quic_packet_creator.cc |
+++ b/net/quic/quic_packet_creator.cc |
@@ -102,7 +102,6 @@ QuicPacketCreator::QuicPacketCreator(QuicConnectionId connection_id, |
next_packet_number_length_, |
nullptr, |
0, |
- nullptr, |
false, |
false), |
should_fec_protect_next_packet_(false), |
@@ -115,10 +114,7 @@ QuicPacketCreator::QuicPacketCreator(QuicConnectionId connection_id, |
} |
QuicPacketCreator::~QuicPacketCreator() { |
- if (packet_.retransmittable_frames != nullptr) { |
- QuicUtils::DeleteFrames(packet_.retransmittable_frames); |
- delete packet_.retransmittable_frames; |
- } |
+ QuicUtils::DeleteFrames(&packet_.retransmittable_frames); |
if (packet_.packet != nullptr) { |
delete packet_.packet; |
} |
@@ -507,7 +503,7 @@ void QuicPacketCreator::ClearPacket() { |
packet_.original_packet_number = 0; |
packet_.transmission_type = NOT_RETRANSMISSION; |
packet_.packet = nullptr; |
- packet_.retransmittable_frames = nullptr; |
+ DCHECK(packet_.retransmittable_frames.empty()); |
packet_.listeners.clear(); |
} |
@@ -516,8 +512,7 @@ bool QuicPacketCreator::HasPendingFrames() const { |
} |
bool QuicPacketCreator::HasPendingRetransmittableFrames() const { |
- return packet_.retransmittable_frames != nullptr && |
- !packet_.retransmittable_frames->empty(); |
+ return !packet_.retransmittable_frames.empty(); |
} |
size_t QuicPacketCreator::ExpansionOnNewFrame() const { |
@@ -682,7 +677,7 @@ QuicEncryptedPacket* QuicPacketCreator::SerializeVersionNegotiationPacket( |
// TODO(jri): Make this a public method of framer? |
SerializedPacket QuicPacketCreator::NoPacket() { |
return SerializedPacket(kInvalidPathId, 0, PACKET_1BYTE_PACKET_NUMBER, |
- nullptr, 0, nullptr, false, false); |
+ nullptr, 0, false, false); |
} |
void QuicPacketCreator::FillPacketHeader(QuicFecGroupNumber fec_group, |
@@ -738,11 +733,10 @@ bool QuicPacketCreator::AddFrame(const QuicFrame& frame, |
packet_size_ += ExpansionOnNewFrame() + frame_len; |
if (save_retransmittable_frames && ShouldRetransmit(frame)) { |
- if (packet_.retransmittable_frames == nullptr) { |
- packet_.retransmittable_frames = new QuicFrames(); |
- packet_.retransmittable_frames->reserve(2); |
+ if (packet_.retransmittable_frames.empty()) { |
+ packet_.retransmittable_frames.reserve(2); |
} |
- packet_.retransmittable_frames->push_back(frame); |
+ packet_.retransmittable_frames.push_back(frame); |
queued_frames_.push_back(frame); |
if (frame.type == STREAM_FRAME && |
frame.stream_frame->stream_id == kCryptoStreamId) { |