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

Unified Diff: net/quic/quic_packet_generator.cc

Issue 1397113003: relnote: Refactor stream buffer allocation out into a scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge with TOT 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_generator.h ('k') | net/quic/quic_protocol.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_packet_generator.cc
diff --git a/net/quic/quic_packet_generator.cc b/net/quic/quic_packet_generator.cc
index 1c306c4cc39f9d0ddd4880579225afe7c7208401..eed8ec7d84d62b14f59761158c65795494400146 100644
--- a/net/quic/quic_packet_generator.cc
+++ b/net/quic/quic_packet_generator.cc
@@ -168,7 +168,7 @@ QuicConsumedData QuicPacketGenerator::ConsumeData(
while (delegate_->ShouldGeneratePacket(
HAS_RETRANSMITTABLE_DATA, has_handshake ? IS_HANDSHAKE : NOT_HANDSHAKE)) {
QuicFrame frame;
- scoped_ptr<char[]> buffer;
+ UniqueStreamBuffer buffer;
size_t bytes_consumed = packet_creator_.CreateStreamFrame(
id, iov, total_bytes_consumed, offset + total_bytes_consumed, fin,
&frame, &buffer);
@@ -179,7 +179,7 @@ QuicConsumedData QuicPacketGenerator::ConsumeData(
ack_notifiers_.push_back(notifier);
}
- if (!AddFrame(frame, buffer.get(), has_handshake)) {
+ if (!AddFrame(frame, buffer.Pass(), has_handshake)) {
LOG(DFATAL) << "Failed to add stream frame.";
// Inability to add a STREAM frame creates an unrecoverable hole in a
// the stream, so it's best to close the connection.
@@ -187,8 +187,6 @@ QuicConsumedData QuicPacketGenerator::ConsumeData(
delete notifier;
return QuicConsumedData(0, false);
}
- // When AddFrame succeeds, it takes ownership of the buffer.
- ignore_result(buffer.release());
total_bytes_consumed += bytes_consumed;
fin_consumed = fin && total_bytes_consumed == iov.total_length;
@@ -442,11 +440,11 @@ bool QuicPacketGenerator::AddNextPendingFrame() {
}
bool QuicPacketGenerator::AddFrame(const QuicFrame& frame,
- char* buffer,
+ UniqueStreamBuffer buffer,
bool needs_padding) {
bool success = needs_padding
- ? packet_creator_.AddPaddedSavedFrame(frame, buffer)
- : packet_creator_.AddSavedFrame(frame, buffer);
+ ? packet_creator_.AddPaddedSavedFrame(frame, buffer.Pass())
+ : packet_creator_.AddSavedFrame(frame, buffer.Pass());
if (success && debug_delegate_) {
debug_delegate_->OnFrameAddedToPacket(frame);
}
« no previous file with comments | « net/quic/quic_packet_generator.h ('k') | net/quic/quic_protocol.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698