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

Unified Diff: net/quic/quic_packet_creator.cc

Issue 1666553002: Make QUIC's SerializedPacket contain QuicFrames, rather than a pointer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@113205205
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_connection_test.cc ('k') | net/quic/quic_packet_creator_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « net/quic/quic_connection_test.cc ('k') | net/quic/quic_packet_creator_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698