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

Unified Diff: net/quic/quic_packet_creator.cc

Issue 1667003002: Replace QuicEncryptedPacket's fields with equivalents in SerializedPacket. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@113395732
Patch Set: Created 4 years, 10 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 68ce339b9fcbb9b599131b0039decd6f2a33ac41..daa1730c01473ca96af796e4993390cd9206217a 100644
--- a/net/quic/quic_packet_creator.cc
+++ b/net/quic/quic_packet_creator.cc
@@ -102,6 +102,7 @@ QuicPacketCreator::QuicPacketCreator(QuicConnectionId connection_id,
next_packet_number_length_,
nullptr,
0,
+ 0,
false,
false),
should_fec_protect_next_packet_(false),
@@ -115,9 +116,6 @@ QuicPacketCreator::QuicPacketCreator(QuicConnectionId connection_id,
QuicPacketCreator::~QuicPacketCreator() {
QuicUtils::DeleteFrames(&packet_.retransmittable_frames);
- if (packet_.packet != nullptr) {
- delete packet_.packet;
- }
}
void QuicPacketCreator::OnBuiltFecProtectedPayload(
@@ -476,7 +474,7 @@ void QuicPacketCreator::Flush() {
}
void QuicPacketCreator::OnSerializedPacket() {
- if (packet_.packet == nullptr) {
+ if (packet_.encrypted_buffer == nullptr) {
QUIC_BUG << "Failed to SerializePacket. fec_policy:" << fec_send_policy()
<< " should_fec_protect_:" << should_fec_protect_next_packet_;
delegate_->CloseConnection(QUIC_FAILED_TO_SERIALIZE_PACKET, false);
@@ -502,7 +500,8 @@ void QuicPacketCreator::ClearPacket() {
packet_.is_fec_packet = false;
packet_.original_packet_number = 0;
packet_.transmission_type = NOT_RETRANSMISSION;
- packet_.packet = nullptr;
+ packet_.encrypted_buffer = nullptr;
+ packet_.encrypted_length = 0;
DCHECK(packet_.retransmittable_frames.empty());
packet_.listeners.clear();
}
@@ -624,8 +623,8 @@ void QuicPacketCreator::SerializePacket(char* encrypted_buffer,
packet_size_ = 0;
queued_frames_.clear();
packet_.entropy_hash = QuicFramer::GetPacketEntropyHash(header);
- packet_.packet =
- new QuicEncryptedPacket(encrypted_buffer, encrypted_length, false);
+ packet_.encrypted_buffer = encrypted_buffer;
+ packet_.encrypted_length = encrypted_length;
}
void QuicPacketCreator::SerializeFec(char* buffer, size_t buffer_len) {
@@ -660,7 +659,8 @@ void QuicPacketCreator::SerializeFec(char* buffer, size_t buffer_len) {
return;
}
packet_.entropy_hash = QuicFramer::GetPacketEntropyHash(header);
- packet_.packet = new QuicEncryptedPacket(buffer, encrypted_length, false);
+ packet_.encrypted_buffer = buffer;
+ packet_.encrypted_length = encrypted_length;
packet_.is_fec_packet = true;
}
@@ -677,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, false, false);
+ nullptr, 0, 0, false, false);
}
void QuicPacketCreator::FillPacketHeader(QuicFecGroupNumber fec_group,
« 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