| 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/prr_sender.h" | 10 #include "net/quic/congestion_control/prr_sender.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 const uint32 kDefaultNumConnections = 2; // N-connection emulation. | 27 const uint32 kDefaultNumConnections = 2; // N-connection emulation. |
| 28 } // namespace | 28 } // namespace |
| 29 | 29 |
| 30 TcpCubicSender::TcpCubicSender(const QuicClock* clock, | 30 TcpCubicSender::TcpCubicSender(const QuicClock* clock, |
| 31 const RttStats* rtt_stats, | 31 const RttStats* rtt_stats, |
| 32 bool reno, | 32 bool reno, |
| 33 QuicPacketCount initial_tcp_congestion_window, | 33 QuicPacketCount initial_tcp_congestion_window, |
| 34 QuicPacketCount max_tcp_congestion_window, | 34 QuicPacketCount max_tcp_congestion_window, |
| 35 QuicConnectionStats* stats) | 35 QuicConnectionStats* stats) |
| 36 : hybrid_slow_start_(clock), | 36 : hybrid_slow_start_(clock), |
| 37 cubic_(clock, stats), | 37 cubic_(clock), |
| 38 rtt_stats_(rtt_stats), | 38 rtt_stats_(rtt_stats), |
| 39 stats_(stats), | 39 stats_(stats), |
| 40 reno_(reno), | 40 reno_(reno), |
| 41 num_connections_(kDefaultNumConnections), | 41 num_connections_(kDefaultNumConnections), |
| 42 congestion_window_count_(0), | 42 congestion_window_count_(0), |
| 43 largest_sent_sequence_number_(0), | 43 largest_sent_sequence_number_(0), |
| 44 largest_acked_sequence_number_(0), | 44 largest_acked_sequence_number_(0), |
| 45 largest_sent_at_last_cutback_(0), | 45 largest_sent_at_last_cutback_(0), |
| 46 congestion_window_(initial_tcp_congestion_window), | 46 congestion_window_(initial_tcp_congestion_window), |
| 47 previous_congestion_window_(0), | 47 previous_congestion_window_(0), |
| 48 slowstart_threshold_(max_tcp_congestion_window), | 48 slowstart_threshold_(max_tcp_congestion_window), |
| 49 previous_slowstart_threshold_(0), | 49 previous_slowstart_threshold_(0), |
| 50 last_cutback_exited_slowstart_(false), | 50 last_cutback_exited_slowstart_(false), |
| 51 max_tcp_congestion_window_(max_tcp_congestion_window), | 51 max_tcp_congestion_window_(max_tcp_congestion_window), |
| 52 clock_(clock) {} | 52 clock_(clock) { |
| 53 } |
| 53 | 54 |
| 54 TcpCubicSender::~TcpCubicSender() { | 55 TcpCubicSender::~TcpCubicSender() { |
| 55 UMA_HISTOGRAM_COUNTS("Net.QuicSession.FinalTcpCwnd", congestion_window_); | 56 UMA_HISTOGRAM_COUNTS("Net.QuicSession.FinalTcpCwnd", congestion_window_); |
| 56 } | 57 } |
| 57 | 58 |
| 58 void TcpCubicSender::SetFromConfig(const QuicConfig& config, | 59 void TcpCubicSender::SetFromConfig(const QuicConfig& config, |
| 59 bool is_server, | 60 bool is_server, |
| 60 bool using_pacing) { | 61 bool using_pacing) { |
| 61 if (is_server) { | 62 if (is_server) { |
| 62 if (config.HasReceivedConnectionOptions() && | 63 if (config.HasReceivedConnectionOptions() && |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 congestion_window_ = previous_congestion_window_; | 366 congestion_window_ = previous_congestion_window_; |
| 366 slowstart_threshold_ = previous_slowstart_threshold_; | 367 slowstart_threshold_ = previous_slowstart_threshold_; |
| 367 previous_congestion_window_ = 0; | 368 previous_congestion_window_ = 0; |
| 368 } | 369 } |
| 369 | 370 |
| 370 CongestionControlType TcpCubicSender::GetCongestionControlType() const { | 371 CongestionControlType TcpCubicSender::GetCongestionControlType() const { |
| 371 return reno_ ? kReno : kCubic; | 372 return reno_ ? kReno : kCubic; |
| 372 } | 373 } |
| 373 | 374 |
| 374 } // namespace net | 375 } // namespace net |
| OLD | NEW |