Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1560)

Side by Side Diff: net/nqe/network_quality.h

Issue 2417643007: Expose RTT and throughput estimates from Cronet (Closed)
Patch Set: Removed annotation Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
19 // Returns the RTT value to be used when the valid RTT is unavailable. Readers 27 // Returns the RTT value to be used when the valid RTT is unavailable. Readers
20 // should discard RTT if it is set to the value returned by |InvalidRTT()|. 28 // 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|.
21 NET_EXPORT_PRIVATE base::TimeDelta InvalidRTT(); 31 NET_EXPORT_PRIVATE base::TimeDelta InvalidRTT();
22 32
23 // Throughput is set to |kInvalidThroughput| if a valid value is 33 // Throughput is set to |kInvalidThroughput| if a valid value is
24 // unavailable. Readers should discard throughput value if it is set to 34 // unavailable. Readers should discard throughput value if it is set to
25 // |kInvalidThroughput|. 35 // |kInvalidThroughput|.
26 const int32_t kInvalidThroughput = 0; 36 // TODO(tbansal): Remove this variable, and replace all calls by
37 // |INVALID_RTT_THROUGHPUT|.
38 const int32_t kInvalidThroughput = INVALID_RTT_THROUGHPUT;
27 39
28 // NetworkQuality is used to cache the quality of a network connection. 40 // NetworkQuality is used to cache the quality of a network connection.
29 class NET_EXPORT_PRIVATE NetworkQuality { 41 class NET_EXPORT_PRIVATE NetworkQuality {
30 public: 42 public:
31 NetworkQuality(); 43 NetworkQuality();
32 // |http_rtt| is the estimate of the round trip time at the HTTP layer. 44 // |http_rtt| is the estimate of the round trip time at the HTTP layer.
33 // |transport_rtt| is the estimate of the round trip time at the transport 45 // |transport_rtt| is the estimate of the round trip time at the transport
34 // layer. |downstream_throughput_kbps| is the estimate of the downstream 46 // layer. |downstream_throughput_kbps| is the estimate of the downstream
35 // throughput in kilobits per second. 47 // throughput in kilobits per second.
36 NetworkQuality(const base::TimeDelta& http_rtt, 48 NetworkQuality(const base::TimeDelta& http_rtt,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 90
79 // Estimated downstream throughput in kilobits per second. 91 // Estimated downstream throughput in kilobits per second.
80 int32_t downstream_throughput_kbps_; 92 int32_t downstream_throughput_kbps_;
81 }; 93 };
82 94
83 } // namespace internal 95 } // namespace internal
84 } // namespace nqe 96 } // namespace nqe
85 } // namespace net 97 } // namespace net
86 98
87 #endif // NET_NQE_NETWORK_QUALITY_H_ 99 #endif // NET_NQE_NETWORK_QUALITY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698