| 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_NQE_NETWORK_QUALITY_ESTIMATOR_H_ | 5 #ifndef NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ |
| 6 #define NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ | 6 #define NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 const std::map<std::string, std::string>& variation_params, | 163 const std::map<std::string, std::string>& variation_params, |
| 164 bool use_local_host_requests_for_tests, | 164 bool use_local_host_requests_for_tests, |
| 165 bool use_smaller_responses_for_tests); | 165 bool use_smaller_responses_for_tests); |
| 166 | 166 |
| 167 ~NetworkQualityEstimator() override; | 167 ~NetworkQualityEstimator() override; |
| 168 | 168 |
| 169 // Returns the effective type of the current connection. Virtualized for | 169 // Returns the effective type of the current connection. Virtualized for |
| 170 // testing. | 170 // testing. |
| 171 virtual EffectiveConnectionType GetEffectiveConnectionType() const; | 171 virtual EffectiveConnectionType GetEffectiveConnectionType() const; |
| 172 | 172 |
| 173 // Returns the effective type of the current connection based on only the |
| 174 // samples observed after |start_time|. Virtualized for testing. |
| 175 virtual EffectiveConnectionType GetRecentEffectiveConnectionType( |
| 176 const base::TimeTicks& start_time) const; |
| 177 |
| 173 // Adds |observer| to the list of effective connection type observers. Must be | 178 // Adds |observer| to the list of effective connection type observers. Must be |
| 174 // called on the IO thread. | 179 // called on the IO thread. |
| 175 void AddEffectiveConnectionTypeObserver( | 180 void AddEffectiveConnectionTypeObserver( |
| 176 EffectiveConnectionTypeObserver* observer); | 181 EffectiveConnectionTypeObserver* observer); |
| 177 | 182 |
| 178 // Removes |observer| from the list of effective connection type observers. | 183 // Removes |observer| from the list of effective connection type observers. |
| 179 // Must be called on the IO thread. | 184 // Must be called on the IO thread. |
| 180 void RemoveEffectiveConnectionTypeObserver( | 185 void RemoveEffectiveConnectionTypeObserver( |
| 181 EffectiveConnectionTypeObserver* observer); | 186 EffectiveConnectionTypeObserver* observer); |
| 182 | 187 |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 // the field trial parameters. For each effective connection type, a model | 414 // the field trial parameters. For each effective connection type, a model |
| 410 // (currently composed of a RTT threshold and a downlink throughput threshold) | 415 // (currently composed of a RTT threshold and a downlink throughput threshold) |
| 411 // is provided by the field trial. | 416 // is provided by the field trial. |
| 412 void ObtainEffectiveConnectionTypeModelParams( | 417 void ObtainEffectiveConnectionTypeModelParams( |
| 413 const std::map<std::string, std::string>& variation_params); | 418 const std::map<std::string, std::string>& variation_params); |
| 414 | 419 |
| 415 // Adds the default median RTT and downstream throughput estimate for the | 420 // Adds the default median RTT and downstream throughput estimate for the |
| 416 // current connection type to the observation buffer. | 421 // current connection type to the observation buffer. |
| 417 void AddDefaultEstimates(); | 422 void AddDefaultEstimates(); |
| 418 | 423 |
| 419 // Returns the effective type of the current connection based on only the | |
| 420 // samples observed after |start_time|. | |
| 421 EffectiveConnectionType GetRecentEffectiveConnectionType( | |
| 422 const base::TimeTicks& start_time) const; | |
| 423 | |
| 424 // Returns an estimate of network quality at the specified |percentile|. | 424 // Returns an estimate of network quality at the specified |percentile|. |
| 425 // |disallowed_observation_sources| is the list of observation sources that | 425 // |disallowed_observation_sources| is the list of observation sources that |
| 426 // should be excluded when computing the percentile. | 426 // should be excluded when computing the percentile. |
| 427 // Only the observations later than |start_time| are taken into account. | 427 // Only the observations later than |start_time| are taken into account. |
| 428 // |percentile| must be between 0 and 100 (both inclusive) with higher | 428 // |percentile| must be between 0 and 100 (both inclusive) with higher |
| 429 // percentiles indicating less performant networks. For example, if | 429 // percentiles indicating less performant networks. For example, if |
| 430 // |percentile| is 90, then the network is expected to be faster than the | 430 // |percentile| is 90, then the network is expected to be faster than the |
| 431 // returned estimate with 0.9 probability. Similarly, network is expected to | 431 // returned estimate with 0.9 probability. Similarly, network is expected to |
| 432 // be slower than the returned estimate with 0.1 probability. | 432 // be slower than the returned estimate with 0.1 probability. |
| 433 base::TimeDelta GetRTTEstimateInternal( | 433 base::TimeDelta GetRTTEstimateInternal( |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 base::ThreadChecker thread_checker_; | 597 base::ThreadChecker thread_checker_; |
| 598 | 598 |
| 599 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; | 599 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; |
| 600 | 600 |
| 601 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); | 601 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); |
| 602 }; | 602 }; |
| 603 | 603 |
| 604 } // namespace net | 604 } // namespace net |
| 605 | 605 |
| 606 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ | 606 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ |
| OLD | NEW |