OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_BASE_NETWORK_QUALITY_ESTIMATOR_H_ | 5 #ifndef NET_BASE_NETWORK_QUALITY_ESTIMATOR_H_ |
6 #define NET_BASE_NETWORK_QUALITY_ESTIMATOR_H_ | 6 #define NET_BASE_NETWORK_QUALITY_ESTIMATOR_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 // should not be null. | 159 // should not be null. |
160 virtual bool GetRecentMedianDownlinkThroughputKbps( | 160 virtual bool GetRecentMedianDownlinkThroughputKbps( |
161 const base::TimeTicks& begin_timestamp, | 161 const base::TimeTicks& begin_timestamp, |
162 int32_t* kbps) const; | 162 int32_t* kbps) const; |
163 | 163 |
164 // SocketPerformanceWatcherFactory implementation: | 164 // SocketPerformanceWatcherFactory implementation: |
165 scoped_ptr<SocketPerformanceWatcher> CreateSocketPerformanceWatcher( | 165 scoped_ptr<SocketPerformanceWatcher> CreateSocketPerformanceWatcher( |
166 const Protocol protocol) override; | 166 const Protocol protocol) override; |
167 void OnUpdatedRTTAvailable(const Protocol protocol, | 167 void OnUpdatedRTTAvailable(const Protocol protocol, |
168 const base::TimeDelta& rtt) override; | 168 const base::TimeDelta& rtt) override; |
| 169 void WatcherReset() override; |
169 | 170 |
170 // Adds |rtt_observer| to the list of round trip time observers. Must be | 171 // Adds |rtt_observer| to the list of round trip time observers. Must be |
171 // called on the IO thread. | 172 // called on the IO thread. |
172 void AddRTTObserver(RTTObserver* rtt_observer); | 173 void AddRTTObserver(RTTObserver* rtt_observer); |
173 | 174 |
174 // Removes |rtt_observer| from the list of round trip time observers if it | 175 // Removes |rtt_observer| from the list of round trip time observers if it |
175 // is on the list of observers. Must be called on the IO thread. | 176 // is on the list of observers. Must be called on the IO thread. |
176 void RemoveRTTObserver(RTTObserver* rtt_observer); | 177 void RemoveRTTObserver(RTTObserver* rtt_observer); |
177 | 178 |
178 // Adds |throughput_observer| to the list of throughput observers. Must be | 179 // Adds |throughput_observer| to the list of throughput observers. Must be |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ComputedPercentiles); | 246 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ComputedPercentiles); |
246 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestCaching); | 247 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestCaching); |
247 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, | 248 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, |
248 TestLRUCacheMaximumSize); | 249 TestLRUCacheMaximumSize); |
249 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestGetMedianRTTSince); | 250 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestGetMedianRTTSince); |
250 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, | 251 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, |
251 TestExternalEstimateProvider); | 252 TestExternalEstimateProvider); |
252 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, | 253 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, |
253 TestExternalEstimateProviderMergeEstimates); | 254 TestExternalEstimateProviderMergeEstimates); |
254 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestObservers); | 255 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestObservers); |
| 256 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestTcpSocketRtt); |
255 | 257 |
256 // NetworkQuality is used to cache the quality of a network connection. | 258 // NetworkQuality is used to cache the quality of a network connection. |
257 class NET_EXPORT_PRIVATE NetworkQuality { | 259 class NET_EXPORT_PRIVATE NetworkQuality { |
258 public: | 260 public: |
259 NetworkQuality(); | 261 NetworkQuality(); |
260 // |rtt| is the estimate of the round trip time. | 262 // |rtt| is the estimate of the round trip time. |
261 // |downstream_throughput_kbps| is the estimate of the downstream | 263 // |downstream_throughput_kbps| is the estimate of the downstream |
262 // throughput in kilobits per second. | 264 // throughput in kilobits per second. |
263 NetworkQuality(const base::TimeDelta& rtt, | 265 NetworkQuality(const base::TimeDelta& rtt, |
264 int32_t downstream_throughput_kbps); | 266 int32_t downstream_throughput_kbps); |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 base::ObserverList<ThroughputObserver> throughput_observer_list_; | 598 base::ObserverList<ThroughputObserver> throughput_observer_list_; |
597 | 599 |
598 base::ThreadChecker thread_checker_; | 600 base::ThreadChecker thread_checker_; |
599 | 601 |
600 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); | 602 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); |
601 }; | 603 }; |
602 | 604 |
603 } // namespace net | 605 } // namespace net |
604 | 606 |
605 #endif // NET_BASE_NETWORK_QUALITY_ESTIMATOR_H_ | 607 #endif // NET_BASE_NETWORK_QUALITY_ESTIMATOR_H_ |
OLD | NEW |