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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 // This does not use a unordered_map or hash_map for code simplicity (key just | 365 // This does not use a unordered_map or hash_map for code simplicity (key just |
366 // implements operator<, rather than hash and equality) and because the map is | 366 // implements operator<, rather than hash and equality) and because the map is |
367 // tiny. | 367 // tiny. |
368 typedef std::map<NetworkID, nqe::internal::CachedNetworkQuality> | 368 typedef std::map<NetworkID, nqe::internal::CachedNetworkQuality> |
369 CachedNetworkQualities; | 369 CachedNetworkQualities; |
370 | 370 |
371 // Algorithms supported by network quality estimator for computing effective | 371 // Algorithms supported by network quality estimator for computing effective |
372 // connection type. | 372 // connection type. |
373 enum class EffectiveConnectionTypeAlgorithm { | 373 enum class EffectiveConnectionTypeAlgorithm { |
374 HTTP_RTT_AND_DOWNSTREAM_THROUGHOUT = 0, | 374 HTTP_RTT_AND_DOWNSTREAM_THROUGHOUT = 0, |
| 375 TRANSPORT_RTT_OR_DOWNSTREAM_THROUGHOUT, |
375 EFFECTIVE_CONNECTION_TYPE_ALGORITHM_LAST | 376 EFFECTIVE_CONNECTION_TYPE_ALGORITHM_LAST |
376 }; | 377 }; |
377 | 378 |
378 // Map from algorithm names to EffectiveConnectionTypeAlgorithm. | 379 // Map from algorithm names to EffectiveConnectionTypeAlgorithm. |
379 const std::map<std::string, EffectiveConnectionTypeAlgorithm> | 380 const std::map<std::string, EffectiveConnectionTypeAlgorithm> |
380 algorithm_name_to_enum_; | 381 algorithm_name_to_enum_; |
381 | 382 |
382 // The default algorithm to be used if the algorithm value is not available | 383 // The default algorithm to be used if the algorithm value is not available |
383 // through field trial parameters. | 384 // through field trial parameters. |
384 static const EffectiveConnectionTypeAlgorithm | 385 static const EffectiveConnectionTypeAlgorithm |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 void RecordAccuracyAfterMainFrame(base::TimeDelta measuring_duration) const; | 479 void RecordAccuracyAfterMainFrame(base::TimeDelta measuring_duration) const; |
479 | 480 |
480 // Returns the effective type of the current connection based on only the | 481 // Returns the effective type of the current connection based on only the |
481 // samples observed after |start_time|. Uses HTTP RTT and downstream | 482 // samples observed after |start_time|. Uses HTTP RTT and downstream |
482 // throughput to compute the effective connection type, and requires both of | 483 // throughput to compute the effective connection type, and requires both of |
483 // them to have a valid value. | 484 // them to have a valid value. |
484 EffectiveConnectionType | 485 EffectiveConnectionType |
485 GetRecentEffectiveConnectionTypeHttpRTTAndDownstreamThroughput( | 486 GetRecentEffectiveConnectionTypeHttpRTTAndDownstreamThroughput( |
486 const base::TimeTicks& start_time) const; | 487 const base::TimeTicks& start_time) const; |
487 | 488 |
| 489 // Returns the effective type of the current connection based on only the |
| 490 // samples observed after |start_time|. Uses transport RTT and downstream |
| 491 // throughput to compute the effective connection type, and requires at least |
| 492 // one of them to have a valid value. |
| 493 EffectiveConnectionType |
| 494 GetRecentEffectiveConnectionTypeTransportRTTOrDownstreamThroughput( |
| 495 const base::TimeTicks& start_time) const; |
| 496 |
488 // Values of external estimate provider status. This enum must remain | 497 // Values of external estimate provider status. This enum must remain |
489 // synchronized with the enum of the same name in | 498 // synchronized with the enum of the same name in |
490 // metrics/histograms/histograms.xml. | 499 // metrics/histograms/histograms.xml. |
491 enum NQEExternalEstimateProviderStatus { | 500 enum NQEExternalEstimateProviderStatus { |
492 EXTERNAL_ESTIMATE_PROVIDER_STATUS_NOT_AVAILABLE, | 501 EXTERNAL_ESTIMATE_PROVIDER_STATUS_NOT_AVAILABLE, |
493 EXTERNAL_ESTIMATE_PROVIDER_STATUS_AVAILABLE, | 502 EXTERNAL_ESTIMATE_PROVIDER_STATUS_AVAILABLE, |
494 EXTERNAL_ESTIMATE_PROVIDER_STATUS_QUERIED, | 503 EXTERNAL_ESTIMATE_PROVIDER_STATUS_QUERIED, |
495 EXTERNAL_ESTIMATE_PROVIDER_STATUS_QUERY_SUCCESSFUL, | 504 EXTERNAL_ESTIMATE_PROVIDER_STATUS_QUERY_SUCCESSFUL, |
496 EXTERNAL_ESTIMATE_PROVIDER_STATUS_CALLBACK, | 505 EXTERNAL_ESTIMATE_PROVIDER_STATUS_CALLBACK, |
497 EXTERNAL_ESTIMATE_PROVIDER_STATUS_RTT_AVAILABLE, | 506 EXTERNAL_ESTIMATE_PROVIDER_STATUS_RTT_AVAILABLE, |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 base::ThreadChecker thread_checker_; | 618 base::ThreadChecker thread_checker_; |
610 | 619 |
611 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; | 620 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; |
612 | 621 |
613 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); | 622 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); |
614 }; | 623 }; |
615 | 624 |
616 } // namespace net | 625 } // namespace net |
617 | 626 |
618 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ | 627 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ |
OLD | NEW |