Roll src/third_party/WebKit eac3800:0237a66 (svn 202606:202607)
[chromium-blink-merge.git] / net / quic / congestion_control / send_algorithm_interface.cc
blobd1b0ec578659ed6284202781c25c7d6a24c696e9
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
3 // found in the LICENSE file.
5 #include "net/quic/congestion_control/send_algorithm_interface.h"
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/quic_protocol.h"
11 namespace net {
13 class RttStats;
15 // Factory for send side congestion control algorithm.
16 SendAlgorithmInterface* SendAlgorithmInterface::Create(
17 const QuicClock* clock,
18 const RttStats* rtt_stats,
19 CongestionControlType congestion_control_type,
20 QuicConnectionStats* stats,
21 QuicPacketCount initial_congestion_window) {
22 const QuicPacketCount max_congestion_window =
23 (kDefaultSocketReceiveBuffer * kConservativeReceiveBufferFraction) /
24 kDefaultTCPMSS;
25 switch (congestion_control_type) {
26 case kCubic:
27 return new TcpCubicSender(clock, rtt_stats, false /* don't use Reno */,
28 initial_congestion_window,
29 max_congestion_window, stats);
30 case kCubicBytes:
31 return new TcpCubicBytesSender(
32 clock, rtt_stats, false /* don't use Reno */,
33 initial_congestion_window, max_congestion_window, stats);
34 case kReno:
35 return new TcpCubicSender(clock, rtt_stats, true /* use Reno */,
36 initial_congestion_window,
37 max_congestion_window, stats);
38 case kRenoBytes:
39 return new TcpCubicBytesSender(clock, rtt_stats, true /* use Reno */,
40 initial_congestion_window,
41 max_congestion_window, stats);
42 case kBBR:
43 // TODO(rtenneti): Enable BbrTcpSender.
44 #if 0
45 return new BbrTcpSender(clock, rtt_stats, initial_congestion_window,
46 max_congestion_window, stats, true);
47 #endif
48 LOG(DFATAL) << "BbrTcpSender is not supported.";
49 return nullptr;
51 return nullptr;
54 } // namespace net