| 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_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "net/quic/congestion_control/prr_sender.h" | 10 #include "net/quic/congestion_control/prr_sender.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 } | 190 } |
| 191 ++stats_->tcp_loss_events; | 191 ++stats_->tcp_loss_events; |
| 192 last_cutback_exited_slowstart_ = InSlowStart(); | 192 last_cutback_exited_slowstart_ = InSlowStart(); |
| 193 if (InSlowStart()) { | 193 if (InSlowStart()) { |
| 194 ++stats_->slowstart_packets_lost; | 194 ++stats_->slowstart_packets_lost; |
| 195 } | 195 } |
| 196 | 196 |
| 197 prr_.OnPacketLost(bytes_in_flight); | 197 prr_.OnPacketLost(bytes_in_flight); |
| 198 | 198 |
| 199 // TODO(jri): Separate out all of slow start into a separate class. | 199 // TODO(jri): Separate out all of slow start into a separate class. |
| 200 if (slow_start_large_reduction_) { | 200 if (slow_start_large_reduction_ && InSlowStart()) { |
| 201 DCHECK_LT(1u, congestion_window_); | 201 DCHECK_LT(1u, congestion_window_); |
| 202 congestion_window_ = congestion_window_ - 1; | 202 congestion_window_ = congestion_window_ - 1; |
| 203 } else if (reno_) { | 203 } else if (reno_) { |
| 204 congestion_window_ = congestion_window_ * RenoBeta(); | 204 congestion_window_ = congestion_window_ * RenoBeta(); |
| 205 } else { | 205 } else { |
| 206 congestion_window_ = | 206 congestion_window_ = |
| 207 cubic_.CongestionWindowAfterPacketLoss(congestion_window_); | 207 cubic_.CongestionWindowAfterPacketLoss(congestion_window_); |
| 208 } | 208 } |
| 209 // Enforce a minimum congestion window. | 209 // Enforce a minimum congestion window. |
| 210 if (congestion_window_ < min_congestion_window_) { | 210 if (congestion_window_ < min_congestion_window_) { |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 slowstart_threshold_ = initial_max_tcp_congestion_window_; | 391 slowstart_threshold_ = initial_max_tcp_congestion_window_; |
| 392 last_cutback_exited_slowstart_ = false; | 392 last_cutback_exited_slowstart_ = false; |
| 393 max_tcp_congestion_window_ = initial_max_tcp_congestion_window_; | 393 max_tcp_congestion_window_ = initial_max_tcp_congestion_window_; |
| 394 } | 394 } |
| 395 | 395 |
| 396 CongestionControlType TcpCubicSender::GetCongestionControlType() const { | 396 CongestionControlType TcpCubicSender::GetCongestionControlType() const { |
| 397 return reno_ ? kReno : kCubic; | 397 return reno_ ? kReno : kCubic; |
| 398 } | 398 } |
| 399 | 399 |
| 400 } // namespace net | 400 } // namespace net |
| OLD | NEW |