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.
5 #include "net/base/network_quality.h"
7 #include "base/logging.h"
11 const int32_t NetworkQuality::kInvalidThroughput
= 0;
13 NetworkQuality::NetworkQuality()
14 : NetworkQuality(InvalidRTT(), kInvalidThroughput
) {
17 NetworkQuality::NetworkQuality(const base::TimeDelta
& rtt
,
18 int32_t downstream_throughput_kbps
)
19 : rtt_(rtt
), downstream_throughput_kbps_(downstream_throughput_kbps
) {
20 DCHECK_GE(rtt_
, base::TimeDelta());
21 DCHECK_GE(downstream_throughput_kbps_
, 0);
24 NetworkQuality::NetworkQuality(const NetworkQuality
& other
)
25 : NetworkQuality(other
.rtt_
, other
.downstream_throughput_kbps_
) {
28 NetworkQuality::~NetworkQuality() {
31 NetworkQuality
& NetworkQuality::operator=(const NetworkQuality
& other
) {
33 downstream_throughput_kbps_
= other
.downstream_throughput_kbps_
;
38 const base::TimeDelta
NetworkQuality::InvalidRTT() {
39 return base::TimeDelta::Max();