Index: net/base/network_quality.cc |
diff --git a/net/base/network_quality.cc b/net/base/network_quality.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8213d966391595f220cbdb7eb143fe103d2f5e9c |
--- /dev/null |
+++ b/net/base/network_quality.cc |
@@ -0,0 +1,47 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "net/base/network_quality.h" |
+ |
+#include "base/logging.h" |
+ |
+namespace { |
+ |
+// If two double values are within |kDelta| of each other, they are assumed to |
+// be equal. |
+const double kDelta = 0.001; |
+ |
+} // namespace |
+ |
+namespace net { |
+ |
+NetworkQuality::NetworkQuality(const base::TimeDelta& rtt, |
+ double rtt_confidence, |
+ uint64_t throughput_kbps, |
+ double throughput_kbps_confidence) |
+ : rtt_(rtt), |
+ rtt_confidence_(rtt_confidence), |
+ throughput_kbps_(throughput_kbps), |
+ throughput_kbps_confidence_(throughput_kbps_confidence) { |
+ DCHECK_GE(rtt_, base::TimeDelta()); |
+ DCHECK_GE(rtt_confidence_, 0 - kDelta); |
+ DCHECK_LE(rtt_confidence_, 1 + kDelta); |
+ |
+ DCHECK_GE(throughput_kbps_, 0U); |
+ DCHECK_GE(throughput_kbps_confidence_, 0 - kDelta); |
+ DCHECK_LE(throughput_kbps_confidence_, 1 + kDelta); |
+} |
+ |
+NetworkQuality::~NetworkQuality() { |
+} |
+ |
+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.
|
+ return rtt_; |
+} |
+ |
+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
|
+ return throughput_kbps_; |
+} |
+ |
+} // namespace net |