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

Unified Diff: net/quic/quic_packet_generator.cc

Issue 1464153002: Add ConsumeData method to QuicPacketCreator, ConsumeData wraps both CreateStreamFrame and AddFrame.… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@107699435
Patch Set: Created 5 years, 1 month 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_test.cc ('k') | net/quic/test_tools/quic_packet_creator_peer.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 12ebcfb0e5a750a01027638bc0bade9faa167749..f95180a95a8983fd80a088211fa2e2f7cb742b68 100644
--- a/net/quic/quic_packet_generator.cc
+++ b/net/quic/quic_packet_generator.cc
@@ -151,23 +151,24 @@ QuicConsumedData QuicPacketGenerator::ConsumeData(
return QuicConsumedData(0, false);
}
- int frames_created = 0;
while (delegate_->ShouldGeneratePacket(
HAS_RETRANSMITTABLE_DATA, has_handshake ? IS_HANDSHAKE : NOT_HANDSHAKE)) {
QuicFrame frame;
- UniqueStreamBuffer buffer;
- size_t bytes_consumed = packet_creator_.CreateStreamFrame(
- id, iov, total_bytes_consumed, offset + total_bytes_consumed, fin,
- &frame, &buffer);
- ++frames_created;
-
- if (!AddFrame(frame, buffer.Pass(), has_handshake)) {
- LOG(DFATAL) << "Failed to add stream frame.";
+ if (!packet_creator_.ConsumeData(id, iov, total_bytes_consumed,
+ offset + total_bytes_consumed, fin,
+ has_handshake, &frame)) {
+ LOG(DFATAL) << "Created but failed to add a stream frame.";
// Inability to add a STREAM frame creates an unrecoverable hole in a
// the stream, so it's best to close the connection.
delegate_->CloseConnection(QUIC_INTERNAL_ERROR, false);
return QuicConsumedData(0, false);
}
+ DCHECK(frame.stream_frame);
+ size_t bytes_consumed = frame.stream_frame->data.length();
+ if (debug_delegate_ != nullptr) {
+ debug_delegate_->OnFrameAddedToPacket(frame);
+ }
+
if (listener != nullptr) {
ack_listeners_.push_back(AckListenerWrapper(listener, bytes_consumed));
}
« no previous file with comments | « net/quic/quic_packet_creator_test.cc ('k') | net/quic/test_tools/quic_packet_creator_peer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698