summaryrefslogtreecommitdiffstats
path: root/net/base/network_quality.h
blob: 315616f1c8458574d7e3df6c3fb1bbfec53c96d5 (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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright 2015 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.

#ifndef NET_BASE_NETWORK_QUALITY_H_
#define NET_BASE_NETWORK_QUALITY_H_

#include <stdint.h>

#include "base/time/time.h"
#include "net/base/net_export.h"

namespace net {

// API that is used to report the network quality of a network connection as
// estimated by the NetworkQualityEstimator.
class NET_EXPORT_PRIVATE NetworkQuality {
 public:
  NetworkQuality();
  // |rtt| is the estimate of the round trip time.
  // |downstream_throughput_kbps| is the estimate of the downstream throughput.
  NetworkQuality(const base::TimeDelta& rtt,
                 int32_t downstream_throughput_kbps);
  NetworkQuality(const NetworkQuality& other);
  ~NetworkQuality();

  NetworkQuality& operator=(const NetworkQuality& other);

  // Returns the estimate of the round trip time.
  const base::TimeDelta& rtt() const { return rtt_; }

  // Returns the estimate of the downstream throughput in Kbps (Kilo bits per
  // second).
  int32_t downstream_throughput_kbps() const {
    return downstream_throughput_kbps_;
  }

 private:
  // Estimated round trip time.
  base::TimeDelta rtt_;

  // Estimated downstream throughput in Kbps.
  int32_t downstream_throughput_kbps_;
};

}  // namespace net

#endif  // NET_BASE_NETWORK_QUALITY_H_