OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_NQE_NETWORK_QUALITY_H_ | 5 #ifndef NET_NQE_NETWORK_QUALITY_H_ |
6 #define NET_NQE_NETWORK_QUALITY_H_ | 6 #define NET_NQE_NETWORK_QUALITY_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "net/base/net_export.h" | 13 #include "net/base/net_export.h" |
14 | 14 |
15 namespace net { | 15 namespace net { |
16 namespace nqe { | 16 namespace nqe { |
17 namespace internal { | 17 namespace internal { |
18 | 18 |
19 // RTT and throughput values are set to |INVALID_RTT_THROUGHPUT| if a valid | |
20 // value is unavailable. | |
21 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.net | |
22 enum RttThroughputValues { | |
23 // Invalid value. | |
24 INVALID_RTT_THROUGHPUT = -1, | |
25 }; | |
26 | |
27 // Returns the RTT value to be used when the valid RTT is unavailable. Readers | 19 // Returns the RTT value to be used when the valid RTT is unavailable. Readers |
28 // should discard RTT if it is set to the value returned by |InvalidRTT()|. | 20 // should discard RTT if it is set to the value returned by |InvalidRTT()|. |
29 // TODO(tbansal): Remove this method, and replace all calls by | |
30 // |INVALID_RTT_THROUGHPUT|. | |
31 NET_EXPORT_PRIVATE base::TimeDelta InvalidRTT(); | 21 NET_EXPORT_PRIVATE base::TimeDelta InvalidRTT(); |
32 | 22 |
33 // Throughput is set to |kInvalidThroughput| if a valid value is | 23 // Throughput is set to |kInvalidThroughput| if a valid value is |
34 // unavailable. Readers should discard throughput value if it is set to | 24 // unavailable. Readers should discard throughput value if it is set to |
35 // |kInvalidThroughput|. | 25 // |kInvalidThroughput|. |
36 // TODO(tbansal): Remove this variable, and replace all calls by | 26 const int32_t kInvalidThroughput = 0; |
37 // |INVALID_RTT_THROUGHPUT|. | |
38 const int32_t kInvalidThroughput = INVALID_RTT_THROUGHPUT; | |
39 | 27 |
40 // NetworkQuality is used to cache the quality of a network connection. | 28 // NetworkQuality is used to cache the quality of a network connection. |
41 class NET_EXPORT_PRIVATE NetworkQuality { | 29 class NET_EXPORT_PRIVATE NetworkQuality { |
42 public: | 30 public: |
43 NetworkQuality(); | 31 NetworkQuality(); |
44 // |http_rtt| is the estimate of the round trip time at the HTTP layer. | 32 // |http_rtt| is the estimate of the round trip time at the HTTP layer. |
45 // |transport_rtt| is the estimate of the round trip time at the transport | 33 // |transport_rtt| is the estimate of the round trip time at the transport |
46 // layer. |downstream_throughput_kbps| is the estimate of the downstream | 34 // layer. |downstream_throughput_kbps| is the estimate of the downstream |
47 // throughput in kilobits per second. | 35 // throughput in kilobits per second. |
48 NetworkQuality(const base::TimeDelta& http_rtt, | 36 NetworkQuality(const base::TimeDelta& http_rtt, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 | 78 |
91 // Estimated downstream throughput in kilobits per second. | 79 // Estimated downstream throughput in kilobits per second. |
92 int32_t downstream_throughput_kbps_; | 80 int32_t downstream_throughput_kbps_; |
93 }; | 81 }; |
94 | 82 |
95 } // namespace internal | 83 } // namespace internal |
96 } // namespace nqe | 84 } // namespace nqe |
97 } // namespace net | 85 } // namespace net |
98 | 86 |
99 #endif // NET_NQE_NETWORK_QUALITY_H_ | 87 #endif // NET_NQE_NETWORK_QUALITY_H_ |
OLD | NEW |