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

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

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 #include "net/nqe/network_quality.h"
6
7 namespace net {
8
9 namespace nqe {
10
11 namespace internal {
12
13 base::TimeDelta InvalidRTT() {
14 return base::TimeDelta::Max();
15 }
16
17 NetworkQuality::NetworkQuality()
18 : NetworkQuality(InvalidRTT(), kInvalidThroughput) {}
19
20 NetworkQuality::NetworkQuality(const base::TimeDelta& rtt,
21 int32_t downstream_throughput_kbps)
22 : rtt_(rtt), downstream_throughput_kbps_(downstream_throughput_kbps) {
23 DCHECK_GE(rtt_, base::TimeDelta());
24 DCHECK_GE(downstream_throughput_kbps_, 0);
25 }
26
27 NetworkQuality::NetworkQuality(const NetworkQuality& other)
28 : NetworkQuality(other.rtt_, other.downstream_throughput_kbps_) {}
29
30 NetworkQuality::~NetworkQuality() {}
31
32 NetworkQuality& NetworkQuality::operator=(const NetworkQuality& other) {
33 rtt_ = other.rtt_;
34 downstream_throughput_kbps_ = other.downstream_throughput_kbps_;
35 return *this;
36 }
37
38 CachedNetworkQuality::CachedNetworkQuality(
39 const NetworkQuality& network_quality)
40 : last_update_time_(base::TimeTicks::Now()),
41 network_quality_(network_quality) {}
42
43 CachedNetworkQuality::CachedNetworkQuality(const CachedNetworkQuality& other)
44 : last_update_time_(other.last_update_time_),
45 network_quality_(other.network_quality_) {}
46
47 CachedNetworkQuality::~CachedNetworkQuality() {}
48
49 bool CachedNetworkQuality::OlderThan(
50 const CachedNetworkQuality& cached_network_quality) const {
51 return last_update_time_ < cached_network_quality.last_update_time_;
52 }
53
54 } // namespace internal
55
56 } // namespace nqe
57
58 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698