| 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_sender_bytes.h" | 7 #include "net/quic/congestion_control/tcp_cubic_sender_bytes.h" |
| 8 #include "net/quic/congestion_control/tcp_cubic_sender_packets.h" | 8 #include "net/quic/congestion_control/tcp_cubic_sender_packets.h" |
| 9 #include "net/quic/quic_flags.h" | 9 #include "net/quic/quic_flags.h" |
| 10 #include "net/quic/quic_protocol.h" | 10 #include "net/quic/quic_protocol.h" |
| 11 | 11 |
| 12 namespace net { | 12 namespace net { |
| 13 | 13 |
| 14 class RttStats; | 14 class RttStats; |
| 15 | 15 |
| 16 // Factory for send side congestion control algorithm. | 16 // Factory for send side congestion control algorithm. |
| 17 SendAlgorithmInterface* SendAlgorithmInterface::Create( | 17 SendAlgorithmInterface* SendAlgorithmInterface::Create( |
| 18 const QuicClock* clock, | 18 const QuicClock* clock, |
| 19 const RttStats* rtt_stats, | 19 const RttStats* rtt_stats, |
| 20 CongestionControlType congestion_control_type, | 20 CongestionControlType congestion_control_type, |
| 21 QuicConnectionStats* stats, | 21 QuicConnectionStats* stats, |
| 22 QuicPacketCount initial_congestion_window) { | 22 QuicPacketCount initial_congestion_window) { |
| 23 const QuicPacketCount max_congestion_window = | 23 QuicPacketCount max_congestion_window = |
| 24 (kDefaultSocketReceiveBuffer * kConservativeReceiveBufferFraction) / | 24 (kDefaultSocketReceiveBuffer * kConservativeReceiveBufferFraction) / |
| 25 kDefaultTCPMSS; | 25 kDefaultTCPMSS; |
| 26 if (FLAGS_quic_ignore_srbf) { |
| 27 max_congestion_window = kDefaultMaxCongestionWindowPackets; |
| 28 } |
| 26 switch (congestion_control_type) { | 29 switch (congestion_control_type) { |
| 27 case kCubic: | 30 case kCubic: |
| 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); |
| 31 case kCubicBytes: | 34 case kCubicBytes: |
| 32 return new TcpCubicSenderBytes( | 35 return new TcpCubicSenderBytes( |
| 33 clock, rtt_stats, false /* don't use Reno */, | 36 clock, rtt_stats, false /* don't use Reno */, |
| 34 initial_congestion_window, max_congestion_window, stats); | 37 initial_congestion_window, max_congestion_window, stats); |
| 35 case kReno: | 38 case kReno: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 46 return new BbrTcpSender(clock, rtt_stats, initial_congestion_window, | 49 return new BbrTcpSender(clock, rtt_stats, initial_congestion_window, |
| 47 max_congestion_window, stats, true); | 50 max_congestion_window, stats, true); |
| 48 #endif | 51 #endif |
| 49 LOG(DFATAL) << "BbrTcpSender is not supported."; | 52 LOG(DFATAL) << "BbrTcpSender is not supported."; |
| 50 return nullptr; | 53 return nullptr; |
| 51 } | 54 } |
| 52 return nullptr; | 55 return nullptr; |
| 53 } | 56 } |
| 54 | 57 |
| 55 } // namespace net | 58 } // namespace net |
| OLD | NEW |