• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2017 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef NET_NQE_RTT_THROUGHPUT_ESTIMATES_OBSERVER_H_
6 #define NET_NQE_RTT_THROUGHPUT_ESTIMATES_OBSERVER_H_
7 
8 #include <stdint.h>
9 
10 #include "base/compiler_specific.h"
11 #include "base/time/time.h"
12 #include "net/base/net_export.h"
13 
14 namespace net {
15 
16 // Observes changes in the network quality.
17 class NET_EXPORT_PRIVATE RTTAndThroughputEstimatesObserver {
18  public:
19   // Notifies the observer when estimated HTTP RTT, estimated transport RTT or
20   // estimated downstream throughput is computed. NetworkQualityEstimator
21   // computes the RTT and throughput estimates at regular intervals.
22   // Additionally, when there is a change in the connection type of the
23   // device, then the estimates are immediately computed.
24   //
25   // |http_rtt|, |transport_rtt| and |downstream_throughput_kbps| are the
26   // computed estimates of the HTTP RTT, transport RTT and downstream
27   // throughput (in kilobits per second), respectively. If an estimate of the
28   // HTTP or transport RTT is unavailable, it will be set to
29   // nqe::internal::InvalidRTT(). If the throughput estimate is unavailable,
30   // it will be set to nqe::internal::INVALID_RTT_THROUGHPUT.
31   virtual void OnRTTOrThroughputEstimatesComputed(
32       base::TimeDelta http_rtt,
33       base::TimeDelta transport_rtt,
34       int32_t downstream_throughput_kbps) = 0;
35 
36   RTTAndThroughputEstimatesObserver(const RTTAndThroughputEstimatesObserver&) =
37       delete;
38   RTTAndThroughputEstimatesObserver& operator=(
39       const RTTAndThroughputEstimatesObserver&) = delete;
40 
41   virtual ~RTTAndThroughputEstimatesObserver() = default;
42 
43  protected:
44   RTTAndThroughputEstimatesObserver() = default;
45 };
46 
47 }  // namespace net
48 
49 #endif  // NET_NQE_RTT_THROUGHPUT_ESTIMATES_OBSERVER_H_
50