| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 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 |
| 5 #ifndef NET_NQE_NETWORK_QUALITY_H_ |
| 6 #define NET_NQE_NETWORK_QUALITY_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include "base/gtest_prod_util.h" |
| 11 #include "base/macros.h" |
| 12 #include "base/time/time.h" |
| 13 #include "net/base/net_export.h" |
| 14 |
| 15 namespace net { |
| 16 |
| 17 namespace nqe { |
| 18 |
| 19 namespace internal { |
| 20 |
| 21 // Returns the RTT value to be used when the valid RTT is unavailable. Readers |
| 22 // should discard RTT if it is set to the value returned by |InvalidRTT()|. |
| 23 NET_EXPORT_PRIVATE base::TimeDelta InvalidRTT(); |
| 24 |
| 25 // Throughput is set to |kInvalidThroughput| if a valid value is |
| 26 // unavailable. Readers should discard throughput value if it is set to |
| 27 // |kInvalidThroughput|. |
| 28 const int32_t kInvalidThroughput = 0; |
| 29 |
| 30 // NetworkQuality is used to cache the quality of a network connection. |
| 31 class NET_EXPORT_PRIVATE NetworkQuality { |
| 32 public: |
| 33 NetworkQuality(); |
| 34 // |rtt| is the estimate of the round trip time. |
| 35 // |downstream_throughput_kbps| is the estimate of the downstream |
| 36 // throughput in kilobits per second. |
| 37 NetworkQuality(const base::TimeDelta& rtt, |
| 38 int32_t downstream_throughput_kbps); |
| 39 NetworkQuality(const NetworkQuality& other); |
| 40 ~NetworkQuality(); |
| 41 |
| 42 NetworkQuality& operator=(const NetworkQuality& other); |
| 43 |
| 44 // Returns the estimate of the round trip time at the HTTP layer. |
| 45 const base::TimeDelta& rtt() const { return rtt_; } |
| 46 |
| 47 // Returns the estimate of the downstream throughput in Kbps (Kilobits per |
| 48 // second). |
| 49 int32_t downstream_throughput_kbps() const { |
| 50 return downstream_throughput_kbps_; |
| 51 } |
| 52 |
| 53 private: |
| 54 // Estimated round trip time at the HTTP layer. |
| 55 base::TimeDelta rtt_; |
| 56 |
| 57 // Estimated downstream throughput in kilobits per second. |
| 58 int32_t downstream_throughput_kbps_; |
| 59 }; |
| 60 |
| 61 } // namespace internal |
| 62 |
| 63 } // namespace nqe |
| 64 |
| 65 } // namespace net |
| 66 |
| 67 #endif // NET_NQE_NETWORK_QUALITY_H_ |
| OLD | NEW |