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

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

Issue 1942893002: Split NQE to multiple files (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
(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 <string>
11
12 #include "base/gtest_prod_util.h"
13 #include "base/macros.h"
14 #include "base/time/time.h"
15 #include "net/base/net_export.h"
16
17 namespace net {
18
19 namespace nqe {
20
21 namespace internal {
22
23 // Returns the RTT value to be used when the valid RTT is unavailable. Readers
24 // should discard RTT if it is set to the value returned by |InvalidRTT()|.
25 NET_EXPORT_PRIVATE base::TimeDelta InvalidRTT();
26
27 // Throughput is set to |kInvalidThroughput| if a valid value is
28 // unavailable. Readers should discard throughput value if it is set to
29 // |kInvalidThroughput|.
30 const int32_t kInvalidThroughput = 0;
bengr 2016/05/03 21:59:45 Why doesn't have a corresponding method? E.g., Inv
tbansal1 2016/05/04 22:07:24 Method was required for RTT because there can't be
31
32 // NetworkQuality is used to cache the quality of a network connection.
33 class NET_EXPORT_PRIVATE NetworkQuality {
34 public:
35 NetworkQuality();
36 // |rtt| is the estimate of the round trip time.
37 // |downstream_throughput_kbps| is the estimate of the downstream
38 // throughput in kilobits per second.
39 NetworkQuality(const base::TimeDelta& rtt,
40 int32_t downstream_throughput_kbps);
bengr 2016/05/03 21:59:45 You use int32_t and int64_t in different parts of
tbansal1 2016/05/04 22:07:24 I do not see int64_t anywhere in this CL. It migh
41 NetworkQuality(const NetworkQuality& other);
42 ~NetworkQuality();
43
44 NetworkQuality& operator=(const NetworkQuality& other);
45
46 // Returns the estimate of the round trip time.
47 const base::TimeDelta& rtt() const { return rtt_; }
bengr 2016/05/03 21:59:45 Which RTT is this?
tbansal1 2016/05/04 22:07:24 Fixed. NetworkQuality structure needs to be expand
48
49 // Returns the estimate of the downstream throughput in Kbps (Kilobits per
50 // second).
51 int32_t downstream_throughput_kbps() const {
52 return downstream_throughput_kbps_;
53 }
54
55 private:
56 // Estimated round trip time.
bengr 2016/05/03 21:59:45 Again, which RTT?
tbansal1 2016/05/04 22:07:24 Done.
57 base::TimeDelta rtt_;
58
59 // Estimated downstream throughput in kilobits per second.
60 int32_t downstream_throughput_kbps_;
61 };
62
63 // CachedNetworkQuality stores the quality of a previously seen network.
64 class NET_EXPORT_PRIVATE CachedNetworkQuality {
65 public:
66 explicit CachedNetworkQuality(const NetworkQuality& network_quality);
67 CachedNetworkQuality(const CachedNetworkQuality& other);
68 ~CachedNetworkQuality();
69
70 // Returns the network quality associated with this cached entry.
71 const NetworkQuality& network_quality() const { return network_quality_; }
72
73 // Returns true if this cache entry was updated before
74 // |cached_network_quality|.
75 bool OlderThan(const CachedNetworkQuality& cached_network_quality) const;
76
77 // Time when this cache entry was last updated.
78 const base::TimeTicks last_update_time_;
79
80 // Quality of this cached network.
81 const NetworkQuality network_quality_;
82
83 private:
84 DISALLOW_ASSIGN(CachedNetworkQuality);
85 };
86
87 } // namespace internal
88
89 } // namespace nqe
90
91 } // namespace net
92
93 #endif // NET_NQE_NETWORK_QUALITY_H_
OLDNEW
« no previous file with comments | « net/net.gypi ('k') | net/nqe/network_quality.cc » ('j') | net/nqe/network_quality_observation.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698