1 // Copyright 2015 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 #ifndef NET_BASE_NETWORK_QUALITY_H_
6 #define NET_BASE_NETWORK_QUALITY_H_
10 #include "base/time/time.h"
11 #include "net/base/net_export.h"
15 // API that is used to report the network quality of a network connection as
16 // estimated by the NetworkQualityEstimator.
17 class NET_EXPORT_PRIVATE NetworkQuality
{
19 // Throughput is set to |kInvalidThroughput| if a valid value is unavailable.
20 // Readers should discard throughput value if it is set to
21 // |kInvalidThroughput|.
22 static const int32_t kInvalidThroughput
;
25 // |rtt| is the estimate of the round trip time.
26 // |downstream_throughput_kbps| is the estimate of the downstream throughput.
27 NetworkQuality(const base::TimeDelta
& rtt
,
28 int32_t downstream_throughput_kbps
);
29 NetworkQuality(const NetworkQuality
& other
);
32 NetworkQuality
& operator=(const NetworkQuality
& other
);
34 // Returns the RTT value to be used when the valid RTT is unavailable. Readers
35 // should discard RTT if it is set to the value returned by |InvalidRTT()|.
36 static const base::TimeDelta
InvalidRTT();
38 // Returns the estimate of the round trip time.
39 const base::TimeDelta
& rtt() const { return rtt_
; }
41 // Returns the estimate of the downstream throughput in Kbps (Kilo bits per
43 int32_t downstream_throughput_kbps() const {
44 return downstream_throughput_kbps_
;
48 // Estimated round trip time.
51 // Estimated downstream throughput in Kbps.
52 int32_t downstream_throughput_kbps_
;
57 #endif // NET_BASE_NETWORK_QUALITY_H_