We started redesigning GpuMemoryBuffer interface to handle multiple buffers [0].
[chromium-blink-merge.git] / net / quic / congestion_control / send_algorithm_interface.cc
blobab3fe36935e9ce479da132f4e642fc8c93b74ac2
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_flags.h"
10 #include "net/quic/quic_protocol.h"
12 namespace net {
14 class RttStats;
16 // Factory for send side congestion control algorithm.
17 SendAlgorithmInterface* SendAlgorithmInterface::Create(
18 const QuicClock* clock,
19 const RttStats* rtt_stats,
20 CongestionControlType congestion_control_type,
21 QuicConnectionStats* stats,
22 QuicPacketCount initial_congestion_window) {
23 const QuicPacketCount max_congestion_window =
24 FLAGS_quic_limit_max_cwnd_to_receive_buffer
25 ? (kDefaultSocketReceiveBuffer * kUsableRecieveBufferFraction) /
26 kDefaultTCPMSS
27 : kMaxTcpCongestionWindow;
28 switch (congestion_control_type) {
29 case kCubic:
30 return new TcpCubicSender(clock, rtt_stats, false /* don't use Reno */,
31 initial_congestion_window,
32 max_congestion_window, stats);
33 case kCubicBytes:
34 return new TcpCubicBytesSender(
35 clock, rtt_stats, false /* don't use Reno */,
36 initial_congestion_window, max_congestion_window, stats);
37 case kReno:
38 return new TcpCubicSender(clock, rtt_stats, true /* use Reno */,
39 initial_congestion_window,
40 max_congestion_window, stats);
41 case kRenoBytes:
42 return new TcpCubicBytesSender(clock, rtt_stats, true /* use Reno */,
43 initial_congestion_window,
44 max_congestion_window, stats);
45 case kBBR:
46 // TODO(rtenneti): Enable BbrTcpSender.
47 #if 0
48 return new BbrTcpSender(clock, rtt_stats, initial_congestion_window,
49 max_congestion_window, stats);
50 #endif
51 LOG(DFATAL) << "BbrTcpSender is not supported.";
52 return nullptr;
54 return nullptr;
57 } // namespace net