summaryrefslogtreecommitdiff
path: root/chromium/net/quic/congestion_control/loss_detection_interface.cc
blob: 4db56c994357a675f9bda9519b13539bd30a5bce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "net/quic/congestion_control/loss_detection_interface.h"

#include "net/quic/congestion_control/general_loss_algorithm.h"
#include "net/quic/congestion_control/tcp_loss_algorithm.h"
#include "net/quic/congestion_control/time_loss_algorithm.h"
#include "net/quic/quic_flags.h"

namespace net {

// Factory for loss detection algorithm.
LossDetectionInterface* LossDetectionInterface::Create(
    LossDetectionType loss_type) {
  if (FLAGS_quic_general_loss_algorithm) {
    return new GeneralLossAlgorithm(loss_type);
  }
  switch (loss_type) {
    case kNack:
      return new TCPLossAlgorithm();
    case kTime:
      return new TimeLossAlgorithm();
  }
  LOG(DFATAL) << "Unknown loss detection algorithm:" << loss_type;
  return nullptr;
}

}  // namespace net