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

Unified Diff: net/quic/test_tools/quic_test_utils.cc

Issue 1421593004: Change QuicFramer::BuildDataPacket to return a length instead of QuicPacket* in order to reduce mem… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@105596142
Patch Set: Created 5 years, 2 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_packet_creator.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/test_tools/quic_test_utils.cc
diff --git a/net/quic/test_tools/quic_test_utils.cc b/net/quic/test_tools/quic_test_utils.cc
index 875162ead9202346c9d2fa762728aad0ec92b68e..1df602e76714df7c249e62962626e72eeac8d11f 100644
--- a/net/quic/test_tools/quic_test_utils.cc
+++ b/net/quic/test_tools/quic_test_utils.cc
@@ -86,11 +86,10 @@ QuicPacket* BuildUnsizedDataPacket(QuicFramer* framer,
const QuicFrames& frames,
size_t packet_size) {
char* buffer = new char[packet_size];
- scoped_ptr<QuicPacket> packet(
- framer->BuildDataPacket(header, frames, buffer, packet_size));
- DCHECK(packet.get() != nullptr);
- // Now I have to re-construct the data packet with data ownership.
- return new QuicPacket(buffer, packet->length(), true,
+ size_t length = framer->BuildDataPacket(header, frames, buffer, packet_size);
+ DCHECK_NE(0u, length);
+ // Re-construct the data packet with data ownership.
+ return new QuicPacket(buffer, length, /* owns_buffer */ true,
header.public_header.connection_id_length,
header.public_header.version_flag,
header.public_header.packet_number_length);
« no previous file with comments | « net/quic/quic_packet_creator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698