OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 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 #include "net/base/network_quality.h" | |
6 | |
7 #include "base/logging.h" | |
8 | |
9 namespace { | |
10 | |
11 // If two double values are within |kDelta| of each other, they are assumed to | |
12 // be equal. | |
13 const double kDelta = 0.001; | |
14 | |
15 } // namespace | |
16 | |
17 namespace net { | |
18 | |
19 NetworkQuality::NetworkQuality(const base::TimeDelta& rtt, | |
20 double rtt_confidence, | |
21 uint64_t throughput_kbps, | |
22 double throughput_kbps_confidence) | |
23 : rtt_(rtt), | |
24 rtt_confidence_(rtt_confidence), | |
25 throughput_kbps_(throughput_kbps), | |
26 throughput_kbps_confidence_(throughput_kbps_confidence) { | |
27 DCHECK_GE(rtt_, base::TimeDelta()); | |
28 DCHECK_GE(rtt_confidence_, 0 - kDelta); | |
29 DCHECK_LE(rtt_confidence_, 1 + kDelta); | |
30 | |
31 DCHECK_GE(throughput_kbps_, 0U); | |
32 DCHECK_GE(throughput_kbps_confidence_, 0 - kDelta); | |
33 DCHECK_LE(throughput_kbps_confidence_, 1 + kDelta); | |
34 } | |
35 | |
36 NetworkQuality::~NetworkQuality() { | |
37 } | |
38 | |
39 base::TimeDelta NetworkQuality::GetRtt() const { | |
bengr
2015/06/05 20:44:13
Inline this simply as rtt()
tbansal1
2015/06/05 23:45:56
Done.
| |
40 return rtt_; | |
41 } | |
42 | |
43 uint64_t NetworkQuality::GetThroughputKbps() const { | |
bengr
2015/06/05 20:44:13
Inline and rename downlink_throughput_kpps(). Rena
tbansal1
2015/06/05 23:45:56
Done. Will change to int32_t in next CL. Added TOD
| |
44 return throughput_kbps_; | |
45 } | |
46 | |
47 } // namespace net | |
OLD | NEW |