| 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_NETWORK_QUALITY_STORE_H_ | 5 #ifndef NET_NQE_NETWORK_QUALITY_STORE_H_ |
| 6 #define NET_NQE_NETWORK_QUALITY_STORE_H_ | 6 #define NET_NQE_NETWORK_QUALITY_STORE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 nqe::internal::CachedNetworkQuality* cached_network_quality); | 60 nqe::internal::CachedNetworkQuality* cached_network_quality); |
| 61 | 61 |
| 62 // Adds and removes |observer| from the list of cache observers. The | 62 // Adds and removes |observer| from the list of cache observers. The |
| 63 // observers are notified on the same thread on which it was added. Addition | 63 // observers are notified on the same thread on which it was added. Addition |
| 64 // and removal of the observer must happen on the same thread. | 64 // and removal of the observer must happen on the same thread. |
| 65 void AddNetworkQualitiesCacheObserver( | 65 void AddNetworkQualitiesCacheObserver( |
| 66 NetworkQualitiesCacheObserver* observer); | 66 NetworkQualitiesCacheObserver* observer); |
| 67 void RemoveNetworkQualitiesCacheObserver( | 67 void RemoveNetworkQualitiesCacheObserver( |
| 68 NetworkQualitiesCacheObserver* observer); | 68 NetworkQualitiesCacheObserver* observer); |
| 69 | 69 |
| 70 // Returns true if network quality for |network_id| can be cached. |
| 71 bool EligibleForCaching(const NetworkID& network_id) const; |
| 72 |
| 70 // If |disable_offline_check| is set to true, the offline check is disabled | 73 // If |disable_offline_check| is set to true, the offline check is disabled |
| 71 // when storing the network quality. | 74 // when storing the network quality. |
| 72 void DisableOfflineCheckForTesting(bool disable_offline_check); | 75 void DisableOfflineCheckForTesting(bool disable_offline_check); |
| 73 | 76 |
| 74 private: | 77 private: |
| 75 // Maximum size of the store that holds network quality estimates. | 78 // Maximum size of the store that holds network quality estimates. |
| 76 // A smaller size may reduce the cache hit rate due to frequent evictions. | 79 // A smaller size may reduce the cache hit rate due to frequent evictions. |
| 77 // A larger size may affect performance. | 80 // A larger size may affect performance. |
| 78 static const size_t kMaximumNetworkQualityCacheSize = 10; | 81 static const size_t kMaximumNetworkQualityCacheSize = 10; |
| 79 | 82 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 107 DISALLOW_COPY_AND_ASSIGN(NetworkQualityStore); | 110 DISALLOW_COPY_AND_ASSIGN(NetworkQualityStore); |
| 108 }; | 111 }; |
| 109 | 112 |
| 110 } // namespace internal | 113 } // namespace internal |
| 111 | 114 |
| 112 } // namespace nqe | 115 } // namespace nqe |
| 113 | 116 |
| 114 } // namespace net | 117 } // namespace net |
| 115 | 118 |
| 116 #endif // NET_NQE_NETWORK_QUALITY_STORE_H_ | 119 #endif // NET_NQE_NETWORK_QUALITY_STORE_H_ |
| OLD | NEW |