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

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

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 #ifndef NET_NQE_CACHED_NETWORK_QUALITY_H_ 5 #ifndef NET_NQE_CACHED_NETWORK_QUALITY_H_
6 #define NET_NQE_CACHED_NETWORK_QUALITY_H_ 6 #define NET_NQE_CACHED_NETWORK_QUALITY_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "net/base/net_export.h" 10 #include "net/base/net_export.h"
11 #include "net/nqe/network_quality.h" 11 #include "net/nqe/network_quality.h"
12 12
13 namespace net { 13 namespace net {
14 14
15 namespace nqe { 15 namespace nqe {
16 16
17 namespace internal { 17 namespace internal {
18 18
19 // CachedNetworkQuality stores the quality of a previously seen network. 19 // CachedNetworkQuality stores the quality of a previously seen network.
20 // Cached entries are stored in LRU order, and older entries may be evicted.
RyanSturm 2016/07/12 18:45:38 This seems like a detail of the manager, not the e
tbansal1 2016/07/12 19:40:18 Moved to NetworkQualitiesManager file.
20 class NET_EXPORT_PRIVATE CachedNetworkQuality { 21 class NET_EXPORT_PRIVATE CachedNetworkQuality {
21 public: 22 public:
22 explicit CachedNetworkQuality(const NetworkQuality& network_quality); 23 CachedNetworkQuality();
24
25 // |last_update_time| is the time when the |network_quality| was computed.
26 CachedNetworkQuality(base::TimeTicks last_update_time,
27 const NetworkQuality& network_quality);
23 CachedNetworkQuality(const CachedNetworkQuality& other); 28 CachedNetworkQuality(const CachedNetworkQuality& other);
24 ~CachedNetworkQuality(); 29 ~CachedNetworkQuality();
25 30
26 // Returns the network quality associated with this cached entry. 31 // Returns the network quality associated with this cached entry.
27 const NetworkQuality& network_quality() const { return network_quality_; } 32 const NetworkQuality& network_quality() const { return network_quality_; }
28 33
34 CachedNetworkQuality& operator=(const CachedNetworkQuality& other);
35
29 // Returns true if this cache entry was updated before 36 // Returns true if this cache entry was updated before
30 // |cached_network_quality|. 37 // |cached_network_quality|.
31 bool OlderThan(const CachedNetworkQuality& cached_network_quality) const; 38 bool OlderThan(const CachedNetworkQuality& cached_network_quality) const;
32 39
40 base::TimeTicks last_update_time() { return last_update_time_; }
41
42 const NetworkQuality& network_quality() { return network_quality_; }
43
44 private:
33 // Time when this cache entry was last updated. 45 // Time when this cache entry was last updated.
34 const base::TimeTicks last_update_time_; 46 base::TimeTicks last_update_time_;
35 47
36 // Quality of this cached network. 48 // Quality of this cached network.
37 const NetworkQuality network_quality_; 49 NetworkQuality network_quality_;
38
39 private:
40 DISALLOW_ASSIGN(CachedNetworkQuality);
41 }; 50 };
42 51
43 } // namespace internal 52 } // namespace internal
44 53
45 } // namespace nqe 54 } // namespace nqe
46 55
47 } // namespace net 56 } // namespace net
48 57
49 #endif // NET_NQE_CACHED_NETWORK_QUALITY_H_ 58 #endif // NET_NQE_CACHED_NETWORK_QUALITY_H_
OLDNEW
« no previous file with comments | « net/net.gypi ('k') | net/nqe/cached_network_quality.cc » ('j') | net/nqe/network_id.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698