rtt_throughput_estimates_observer.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. // Copyright 2017 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.
  4. #ifndef NET_NQE_RTT_THROUGHPUT_ESTIMATES_OBSERVER_H_
  5. #define NET_NQE_RTT_THROUGHPUT_ESTIMATES_OBSERVER_H_
  6. #include <stdint.h>
  7. #include "base/compiler_specific.h"
  8. #include "base/time/time.h"
  9. #include "net/base/net_export.h"
  10. namespace net {
  11. // Observes changes in the network quality.
  12. class NET_EXPORT_PRIVATE RTTAndThroughputEstimatesObserver {
  13. public:
  14. // Notifies the observer when estimated HTTP RTT, estimated transport RTT or
  15. // estimated downstream throughput is computed. NetworkQualityEstimator
  16. // computes the RTT and throughput estimates at regular intervals.
  17. // Additionally, when there is a change in the connection type of the
  18. // device, then the estimates are immediately computed.
  19. //
  20. // |http_rtt|, |transport_rtt| and |downstream_throughput_kbps| are the
  21. // computed estimates of the HTTP RTT, transport RTT and downstream
  22. // throughput (in kilobits per second), respectively. If an estimate of the
  23. // HTTP or transport RTT is unavailable, it will be set to
  24. // nqe::internal::InvalidRTT(). If the throughput estimate is unavailable,
  25. // it will be set to nqe::internal::INVALID_RTT_THROUGHPUT.
  26. virtual void OnRTTOrThroughputEstimatesComputed(
  27. base::TimeDelta http_rtt,
  28. base::TimeDelta transport_rtt,
  29. int32_t downstream_throughput_kbps) = 0;
  30. RTTAndThroughputEstimatesObserver(const RTTAndThroughputEstimatesObserver&) =
  31. delete;
  32. RTTAndThroughputEstimatesObserver& operator=(
  33. const RTTAndThroughputEstimatesObserver&) = delete;
  34. virtual ~RTTAndThroughputEstimatesObserver() = default;
  35. protected:
  36. RTTAndThroughputEstimatesObserver() = default;
  37. };
  38. } // namespace net
  39. #endif // NET_NQE_RTT_THROUGHPUT_ESTIMATES_OBSERVER_H_