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 #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_ |
OLD | NEW |