OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/quic/congestion_control/tcp_cubic_sender.h" | 5 #include "net/quic/congestion_control/tcp_cubic_sender.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "net/quic/congestion_control/rtt_stats.h" | 10 #include "net/quic/congestion_control/rtt_stats.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 QuicByteCount /*bytes_in_flight*/, | 163 QuicByteCount /*bytes_in_flight*/, |
164 QuicPacketSequenceNumber sequence_number, | 164 QuicPacketSequenceNumber sequence_number, |
165 QuicByteCount bytes, | 165 QuicByteCount bytes, |
166 HasRetransmittableData is_retransmittable) { | 166 HasRetransmittableData is_retransmittable) { |
167 // Only update bytes_in_flight_ for data packets. | 167 // Only update bytes_in_flight_ for data packets. |
168 if (is_retransmittable != HAS_RETRANSMITTABLE_DATA) { | 168 if (is_retransmittable != HAS_RETRANSMITTABLE_DATA) { |
169 return false; | 169 return false; |
170 } | 170 } |
171 | 171 |
172 prr_out_ += bytes; | 172 prr_out_ += bytes; |
173 if (largest_sent_sequence_number_ < sequence_number) { | 173 DCHECK_LT(largest_sent_sequence_number_, sequence_number); |
174 // TODO(rch): Ensure that packets are really sent in order. | 174 largest_sent_sequence_number_ = sequence_number; |
175 // DCHECK_LT(largest_sent_sequence_number_, sequence_number); | |
176 largest_sent_sequence_number_ = sequence_number; | |
177 } | |
178 hybrid_slow_start_.OnPacketSent(sequence_number); | 175 hybrid_slow_start_.OnPacketSent(sequence_number); |
179 return true; | 176 return true; |
180 } | 177 } |
181 | 178 |
182 QuicTime::Delta TcpCubicSender::TimeUntilSend( | 179 QuicTime::Delta TcpCubicSender::TimeUntilSend( |
183 QuicTime /* now */, | 180 QuicTime /* now */, |
184 QuicByteCount bytes_in_flight, | 181 QuicByteCount bytes_in_flight, |
185 HasRetransmittableData has_retransmittable_data) const { | 182 HasRetransmittableData has_retransmittable_data) const { |
186 if (has_retransmittable_data == NO_RETRANSMITTABLE_DATA) { | 183 if (has_retransmittable_data == NO_RETRANSMITTABLE_DATA) { |
187 // For TCP we can always send an ACK immediately. | 184 // For TCP we can always send an ACK immediately. |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 return QuicTime::Delta::Zero(); | 354 return QuicTime::Delta::Zero(); |
358 } | 355 } |
359 return QuicTime::Delta::Infinite(); | 356 return QuicTime::Delta::Infinite(); |
360 } | 357 } |
361 | 358 |
362 CongestionControlType TcpCubicSender::GetCongestionControlType() const { | 359 CongestionControlType TcpCubicSender::GetCongestionControlType() const { |
363 return reno_ ? kReno : kCubic; | 360 return reno_ ? kReno : kCubic; |
364 } | 361 } |
365 | 362 |
366 } // namespace net | 363 } // namespace net |
OLD | NEW |