| 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 #include "net/nqe/network_quality.h" | 5 #include "net/nqe/network_quality.h" |
| 6 | 6 |
| 7 namespace net { | 7 namespace net { |
| 8 namespace nqe { | 8 namespace nqe { |
| 9 namespace internal { | 9 namespace internal { |
| 10 | 10 |
| 11 base::TimeDelta InvalidRTT() { | 11 base::TimeDelta InvalidRTT() { |
| 12 return base::TimeDelta::Max(); | 12 return base::TimeDelta::FromMilliseconds(INVALID_RTT_THROUGHPUT); |
| 13 } | 13 } |
| 14 | 14 |
| 15 NetworkQuality::NetworkQuality() | 15 NetworkQuality::NetworkQuality() |
| 16 : NetworkQuality(InvalidRTT(), InvalidRTT(), kInvalidThroughput) {} | 16 : NetworkQuality(InvalidRTT(), InvalidRTT(), kInvalidThroughput) {} |
| 17 | 17 |
| 18 NetworkQuality::NetworkQuality(const base::TimeDelta& http_rtt, | 18 NetworkQuality::NetworkQuality(const base::TimeDelta& http_rtt, |
| 19 const base::TimeDelta& transport_rtt, | 19 const base::TimeDelta& transport_rtt, |
| 20 int32_t downstream_throughput_kbps) | 20 int32_t downstream_throughput_kbps) |
| 21 : http_rtt_(http_rtt), | 21 : http_rtt_(http_rtt), |
| 22 transport_rtt_(transport_rtt), | 22 transport_rtt_(transport_rtt), |
| 23 downstream_throughput_kbps_(downstream_throughput_kbps) { | 23 downstream_throughput_kbps_(downstream_throughput_kbps) { |
| 24 DCHECK_GE(downstream_throughput_kbps_, 0); | 24 DCHECK_GE(downstream_throughput_kbps_, kInvalidThroughput); |
| 25 } | 25 } |
| 26 | 26 |
| 27 NetworkQuality::NetworkQuality(const NetworkQuality& other) | 27 NetworkQuality::NetworkQuality(const NetworkQuality& other) |
| 28 : NetworkQuality(other.http_rtt_, | 28 : NetworkQuality(other.http_rtt_, |
| 29 other.transport_rtt_, | 29 other.transport_rtt_, |
| 30 other.downstream_throughput_kbps_) {} | 30 other.downstream_throughput_kbps_) {} |
| 31 | 31 |
| 32 NetworkQuality::~NetworkQuality() {} | 32 NetworkQuality::~NetworkQuality() {} |
| 33 | 33 |
| 34 NetworkQuality& NetworkQuality::operator=(const NetworkQuality& other) { | 34 NetworkQuality& NetworkQuality::operator=(const NetworkQuality& other) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 51 other.transport_rtt() == InvalidRTT() || | 51 other.transport_rtt() == InvalidRTT() || |
| 52 transport_rtt() <= other.transport_rtt()) && | 52 transport_rtt() <= other.transport_rtt()) && |
| 53 (downstream_throughput_kbps() == kInvalidThroughput || | 53 (downstream_throughput_kbps() == kInvalidThroughput || |
| 54 other.downstream_throughput_kbps() == kInvalidThroughput || | 54 other.downstream_throughput_kbps() == kInvalidThroughput || |
| 55 downstream_throughput_kbps() >= other.downstream_throughput_kbps()); | 55 downstream_throughput_kbps() >= other.downstream_throughput_kbps()); |
| 56 } | 56 } |
| 57 | 57 |
| 58 } // namespace internal | 58 } // namespace internal |
| 59 } // namespace nqe | 59 } // namespace nqe |
| 60 } // namespace net | 60 } // namespace net |
| OLD | NEW |