| 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/send_algorithm_interface.h" | 5 #include "net/quic/congestion_control/send_algorithm_interface.h" |
| 6 | 6 |
| 7 #include "net/quic/congestion_control/tcp_cubic_bytes_sender.h" | |
| 8 #include "net/quic/congestion_control/tcp_cubic_sender.h" | |
| 9 #include "net/quic/congestion_control/tcp_cubic_sender_bytes.h" | 7 #include "net/quic/congestion_control/tcp_cubic_sender_bytes.h" |
| 10 #include "net/quic/congestion_control/tcp_cubic_sender_packets.h" | 8 #include "net/quic/congestion_control/tcp_cubic_sender_packets.h" |
| 11 #include "net/quic/quic_flags.h" | 9 #include "net/quic/quic_flags.h" |
| 12 #include "net/quic/quic_protocol.h" | 10 #include "net/quic/quic_protocol.h" |
| 13 | 11 |
| 14 namespace net { | 12 namespace net { |
| 15 | 13 |
| 16 class RttStats; | 14 class RttStats; |
| 17 | 15 |
| 18 // Factory for send side congestion control algorithm. | 16 // Factory for send side congestion control algorithm. |
| 19 SendAlgorithmInterface* SendAlgorithmInterface::Create( | 17 SendAlgorithmInterface* SendAlgorithmInterface::Create( |
| 20 const QuicClock* clock, | 18 const QuicClock* clock, |
| 21 const RttStats* rtt_stats, | 19 const RttStats* rtt_stats, |
| 22 CongestionControlType congestion_control_type, | 20 CongestionControlType congestion_control_type, |
| 23 QuicConnectionStats* stats, | 21 QuicConnectionStats* stats, |
| 24 QuicPacketCount initial_congestion_window) { | 22 QuicPacketCount initial_congestion_window) { |
| 25 const QuicPacketCount max_congestion_window = | 23 const QuicPacketCount max_congestion_window = |
| 26 (kDefaultSocketReceiveBuffer * kConservativeReceiveBufferFraction) / | 24 (kDefaultSocketReceiveBuffer * kConservativeReceiveBufferFraction) / |
| 27 kDefaultTCPMSS; | 25 kDefaultTCPMSS; |
| 28 switch (congestion_control_type) { | 26 switch (congestion_control_type) { |
| 29 case kCubic: | 27 case kCubic: |
| 30 if (FLAGS_quic_use_new_tcp_sender) { | 28 return new TcpCubicSenderPackets( |
| 31 return new TcpCubicSenderPackets( | 29 clock, rtt_stats, false /* don't use Reno */, |
| 32 clock, rtt_stats, false /* don't use Reno */, | 30 initial_congestion_window, max_congestion_window, stats); |
| 33 initial_congestion_window, max_congestion_window, stats); | |
| 34 } | |
| 35 return new TcpCubicSender(clock, rtt_stats, false /* don't use Reno */, | |
| 36 initial_congestion_window, | |
| 37 max_congestion_window, stats); | |
| 38 case kCubicBytes: | 31 case kCubicBytes: |
| 39 if (FLAGS_quic_use_new_tcp_sender) { | 32 return new TcpCubicSenderBytes( |
| 40 return new TcpCubicSenderBytes( | |
| 41 clock, rtt_stats, false /* don't use Reno */, | |
| 42 initial_congestion_window, max_congestion_window, stats); | |
| 43 } | |
| 44 return new TcpCubicBytesSender( | |
| 45 clock, rtt_stats, false /* don't use Reno */, | 33 clock, rtt_stats, false /* don't use Reno */, |
| 46 initial_congestion_window, max_congestion_window, stats); | 34 initial_congestion_window, max_congestion_window, stats); |
| 47 case kReno: | 35 case kReno: |
| 48 if (FLAGS_quic_use_new_tcp_sender) { | 36 return new TcpCubicSenderPackets(clock, rtt_stats, true /* use Reno */, |
| 49 return new TcpCubicSenderPackets(clock, rtt_stats, true /* use Reno */, | |
| 50 initial_congestion_window, | |
| 51 max_congestion_window, stats); | |
| 52 } | |
| 53 return new TcpCubicSender(clock, rtt_stats, true /* use Reno */, | |
| 54 initial_congestion_window, | |
| 55 max_congestion_window, stats); | |
| 56 case kRenoBytes: | |
| 57 if (FLAGS_quic_use_new_tcp_sender) { | |
| 58 return new TcpCubicSenderBytes(clock, rtt_stats, true /* use Reno */, | |
| 59 initial_congestion_window, | 37 initial_congestion_window, |
| 60 max_congestion_window, stats); | 38 max_congestion_window, stats); |
| 61 } | 39 case kRenoBytes: |
| 62 return new TcpCubicBytesSender(clock, rtt_stats, true /* use Reno */, | 40 return new TcpCubicSenderBytes(clock, rtt_stats, true /* use Reno */, |
| 63 initial_congestion_window, | 41 initial_congestion_window, |
| 64 max_congestion_window, stats); | 42 max_congestion_window, stats); |
| 65 case kBBR: | 43 case kBBR: |
| 66 // TODO(rtenneti): Enable BbrTcpSender. | 44 // TODO(rtenneti): Enable BbrTcpSender. |
| 67 #if 0 | 45 #if 0 |
| 68 return new BbrTcpSender(clock, rtt_stats, initial_congestion_window, | 46 return new BbrTcpSender(clock, rtt_stats, initial_congestion_window, |
| 69 max_congestion_window, stats, true); | 47 max_congestion_window, stats, true); |
| 70 #endif | 48 #endif |
| 71 LOG(DFATAL) << "BbrTcpSender is not supported."; | 49 LOG(DFATAL) << "BbrTcpSender is not supported."; |
| 72 return nullptr; | 50 return nullptr; |
| 73 } | 51 } |
| 74 return nullptr; | 52 return nullptr; |
| 75 } | 53 } |
| 76 | 54 |
| 77 } // namespace net | 55 } // namespace net |
| OLD | NEW |