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

Unified Diff: net/quic/quic_packet_generator.cc

Issue 15937012: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Small bug fixes Created 7 years, 7 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
Index: net/quic/quic_packet_generator.cc
diff --git a/net/quic/quic_packet_generator.cc b/net/quic/quic_packet_generator.cc
index d0e491ab8ffac9e7769c7352da88d692d672f14c..3d2a6302913fc1ae73c3236bdd6c4d8cdf12f835 100644
--- a/net/quic/quic_packet_generator.cc
+++ b/net/quic/quic_packet_generator.cc
@@ -55,27 +55,25 @@ QuicPacketGenerator::~QuicPacketGenerator() {
void QuicPacketGenerator::SetShouldSendAck(bool also_send_feedback) {
should_send_ack_ = true;
should_send_feedback_ = also_send_feedback;
- SendQueuedData();
+ SendQueuedFrames();
}
void QuicPacketGenerator::AddControlFrame(const QuicFrame& frame) {
queued_control_frames_.push_back(frame);
- SendQueuedData();
+ SendQueuedFrames();
}
QuicConsumedData QuicPacketGenerator::ConsumeData(QuicStreamId id,
StringPiece data,
QuicStreamOffset offset,
bool fin) {
- SendQueuedData();
+ SendQueuedFrames();
size_t total_bytes_consumed = 0;
bool fin_consumed = false;
while (delegate_->CanWrite(NOT_RETRANSMISSION, HAS_RETRANSMITTABLE_DATA)) {
- // TODO(rch) figure out FEC.
- // packet_creator_.MaybeStartFEC();
QuicFrame frame;
size_t bytes_consumed = packet_creator_->CreateStreamFrame(
id, data, offset + total_bytes_consumed, fin, &frame);
@@ -112,8 +110,9 @@ QuicConsumedData QuicPacketGenerator::ConsumeData(QuicStreamId id,
return QuicConsumedData(total_bytes_consumed, fin_consumed);
}
-void QuicPacketGenerator::SendQueuedData() {
- while (HasPendingData() && delegate_->CanWrite(NOT_RETRANSMISSION,
+void QuicPacketGenerator::SendQueuedFrames() {
+ packet_creator_->MaybeStartFEC();
+ while (HasPendingFrames() && delegate_->CanWrite(NOT_RETRANSMISSION,
packet_creator_->HasPendingFrames() ?
HAS_RETRANSMITTABLE_DATA : NO_RETRANSMITTABLE_DATA)) {
if (!AddNextPendingFrame()) {
@@ -133,6 +132,7 @@ void QuicPacketGenerator::SendQueuedData() {
SerializedPacket serialized_fec = packet_creator_->SerializeFec();
DCHECK(serialized_fec.packet);
delegate_->OnSerializedPacket(serialized_fec);
+ packet_creator_->MaybeStartFEC();
}
}
}
@@ -143,14 +143,14 @@ void QuicPacketGenerator::StartBatchOperations() {
void QuicPacketGenerator::FinishBatchOperations() {
should_flush_ = true;
- SendQueuedData();
+ SendQueuedFrames();
}
-bool QuicPacketGenerator::HasQueuedData() const {
- return packet_creator_->HasPendingFrames() || HasPendingData();
+bool QuicPacketGenerator::HasQueuedFrames() const {
+ return packet_creator_->HasPendingFrames() || HasPendingFrames();
}
-bool QuicPacketGenerator::HasPendingData() const {
+bool QuicPacketGenerator::HasPendingFrames() const {
return should_send_ack_ || should_send_feedback_ ||
!queued_control_frames_.empty();
}
@@ -187,7 +187,6 @@ bool QuicPacketGenerator::AddNextPendingFrame() {
}
void QuicPacketGenerator::SerializeAndSendPacket() {
- packet_creator_->MaybeStartFEC();
SerializedPacket serialized_packet = packet_creator_->SerializePacket();
DCHECK(serialized_packet.packet);
delegate_->OnSerializedPacket(serialized_packet);
@@ -196,6 +195,7 @@ void QuicPacketGenerator::SerializeAndSendPacket() {
SerializedPacket serialized_fec = packet_creator_->SerializeFec();
DCHECK(serialized_fec.packet);
delegate_->OnSerializedPacket(serialized_fec);
+ packet_creator_->MaybeStartFEC();
}
}

Powered by Google App Engine
This is Rietveld 408576698