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

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

Issue 2128793003: Factor out NetworkID and caching mechanism from n_q_e.{h,cc} (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 5 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
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/cached_network_quality.h" 5 #include "net/nqe/cached_network_quality.h"
6 6
7 namespace net { 7 namespace net {
8 8
9 namespace nqe { 9 namespace nqe {
10 10
11 namespace internal { 11 namespace internal {
12 12
13 CachedNetworkQuality::CachedNetworkQuality() {}
14
13 CachedNetworkQuality::CachedNetworkQuality( 15 CachedNetworkQuality::CachedNetworkQuality(
16 base::TimeTicks last_update_time,
14 const NetworkQuality& network_quality) 17 const NetworkQuality& network_quality)
15 : last_update_time_(base::TimeTicks::Now()), 18 : last_update_time_(last_update_time), network_quality_(network_quality) {}
16 network_quality_(network_quality) {}
17 19
18 CachedNetworkQuality::CachedNetworkQuality(const CachedNetworkQuality& other) 20 CachedNetworkQuality::CachedNetworkQuality(const CachedNetworkQuality& other)
19 : last_update_time_(other.last_update_time_), 21 : last_update_time_(other.last_update_time_),
20 network_quality_(other.network_quality_) {} 22 network_quality_(other.network_quality_) {}
21 23
22 CachedNetworkQuality::~CachedNetworkQuality() {} 24 CachedNetworkQuality::~CachedNetworkQuality() {}
23 25
26 CachedNetworkQuality& CachedNetworkQuality::operator=(
27 const CachedNetworkQuality& other) {
28 last_update_time_ = other.last_update_time_;
29 network_quality_ = other.network_quality_;
30 return *this;
31 }
32
24 bool CachedNetworkQuality::OlderThan( 33 bool CachedNetworkQuality::OlderThan(
25 const CachedNetworkQuality& cached_network_quality) const { 34 const CachedNetworkQuality& cached_network_quality) const {
26 return last_update_time_ < cached_network_quality.last_update_time_; 35 return last_update_time_ < cached_network_quality.last_update_time_;
27 } 36 }
28 37
29 } // namespace internal 38 } // namespace internal
30 39
31 } // namespace nqe 40 } // namespace nqe
32 41
33 } // namespace net 42 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698