Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(835)

Side by Side Diff: net/nqe/network_quality_estimator.h

Issue 2857093002: Expose changes in the network quality to the renderers (Closed)
Patch Set: isherman comments Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | net/nqe/network_quality_estimator_test_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 // computed estimates of the HTTP RTT, transport RTT and downstream 104 // computed estimates of the HTTP RTT, transport RTT and downstream
105 // throughput (in kilobits per second), respectively. If an estimate of the 105 // throughput (in kilobits per second), respectively. If an estimate of the
106 // HTTP or transport RTT is unavailable, it will be set to 106 // HTTP or transport RTT is unavailable, it will be set to
107 // nqe::internal::InvalidRTT(). If the throughput estimate is unavailable, 107 // nqe::internal::InvalidRTT(). If the throughput estimate is unavailable,
108 // it will be set to nqe::internal::kInvalidThroughput. 108 // it will be set to nqe::internal::kInvalidThroughput.
109 virtual void OnRTTOrThroughputEstimatesComputed( 109 virtual void OnRTTOrThroughputEstimatesComputed(
110 base::TimeDelta http_rtt, 110 base::TimeDelta http_rtt,
111 base::TimeDelta transport_rtt, 111 base::TimeDelta transport_rtt,
112 int32_t downstream_throughput_kbps) = 0; 112 int32_t downstream_throughput_kbps) = 0;
113 113
114 virtual ~RTTAndThroughputEstimatesObserver() {}
115
114 protected: 116 protected:
115 RTTAndThroughputEstimatesObserver() {} 117 RTTAndThroughputEstimatesObserver() {}
116 virtual ~RTTAndThroughputEstimatesObserver() {}
117 118
118 private: 119 private:
119 DISALLOW_COPY_AND_ASSIGN(RTTAndThroughputEstimatesObserver); 120 DISALLOW_COPY_AND_ASSIGN(RTTAndThroughputEstimatesObserver);
120 }; 121 };
121 122
122 // Observes measurements of round trip time. 123 // Observes measurements of round trip time.
123 class NET_EXPORT_PRIVATE RTTObserver { 124 class NET_EXPORT_PRIVATE RTTObserver {
124 public: 125 public:
125 // Will be called when a new RTT observation is available. The round trip 126 // Will be called when a new RTT observation is available. The round trip
126 // time is specified in milliseconds. The time when the observation was 127 // time is specified in milliseconds. The time when the observation was
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 virtual base::TimeDelta GetRTTEstimateInternal( 440 virtual base::TimeDelta GetRTTEstimateInternal(
440 const std::vector<NetworkQualityObservationSource>& 441 const std::vector<NetworkQualityObservationSource>&
441 disallowed_observation_sources, 442 disallowed_observation_sources,
442 base::TimeTicks start_time, 443 base::TimeTicks start_time,
443 const base::Optional<Statistic>& statistic, 444 const base::Optional<Statistic>& statistic,
444 int percentile) const; 445 int percentile) const;
445 int32_t GetDownlinkThroughputKbpsEstimateInternal( 446 int32_t GetDownlinkThroughputKbpsEstimateInternal(
446 const base::TimeTicks& start_time, 447 const base::TimeTicks& start_time,
447 int percentile) const; 448 int percentile) const;
448 449
450 // Observer list for RTT or throughput estimates. Protected for testing.
451 base::ObserverList<RTTAndThroughputEstimatesObserver>
452 rtt_and_throughput_estimates_observer_list_;
453
449 private: 454 private:
450 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, 455 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest,
451 AdaptiveRecomputationEffectiveConnectionType); 456 AdaptiveRecomputationEffectiveConnectionType);
452 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, StoreObservations); 457 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, StoreObservations);
453 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestAddObservation); 458 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestAddObservation);
454 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, 459 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest,
455 DefaultObservationsOverridden); 460 DefaultObservationsOverridden);
456 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, 461 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest,
457 ObtainAlgorithmToUseFromParams); 462 ObtainAlgorithmToUseFromParams);
458 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ComputedPercentiles); 463 FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, ComputedPercentiles);
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 nqe::internal::NetworkQuality external_estimate_provider_quality_; 741 nqe::internal::NetworkQuality external_estimate_provider_quality_;
737 742
738 // ExternalEstimateProvider that provides network quality using operating 743 // ExternalEstimateProvider that provides network quality using operating
739 // system APIs. May be NULL. 744 // system APIs. May be NULL.
740 const std::unique_ptr<ExternalEstimateProvider> external_estimate_provider_; 745 const std::unique_ptr<ExternalEstimateProvider> external_estimate_provider_;
741 746
742 // Observer list for changes in effective connection type. 747 // Observer list for changes in effective connection type.
743 base::ObserverList<EffectiveConnectionTypeObserver> 748 base::ObserverList<EffectiveConnectionTypeObserver>
744 effective_connection_type_observer_list_; 749 effective_connection_type_observer_list_;
745 750
746 // Observer list for RTT or throughput estimates.
747 base::ObserverList<RTTAndThroughputEstimatesObserver>
748 rtt_and_throughput_estimates_observer_list_;
749
750 // Observer lists for round trip times and throughput measurements. 751 // Observer lists for round trip times and throughput measurements.
751 base::ObserverList<RTTObserver> rtt_observer_list_; 752 base::ObserverList<RTTObserver> rtt_observer_list_;
752 base::ObserverList<ThroughputObserver> throughput_observer_list_; 753 base::ObserverList<ThroughputObserver> throughput_observer_list_;
753 754
754 std::unique_ptr<SocketPerformanceWatcherFactory> watcher_factory_; 755 std::unique_ptr<SocketPerformanceWatcherFactory> watcher_factory_;
755 756
756 // Takes throughput measurements, and passes them back to |this| through the 757 // Takes throughput measurements, and passes them back to |this| through the
757 // provided callback. |this| stores the throughput observations in 758 // provided callback. |this| stores the throughput observations in
758 // |downstream_throughput_kbps_observations_|, which are later used for 759 // |downstream_throughput_kbps_observations_|, which are later used for
759 // estimating the throughput. 760 // estimating the throughput.
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 disallowed_observation_sources_for_transport_; 810 disallowed_observation_sources_for_transport_;
810 811
811 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; 812 base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_;
812 813
813 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); 814 DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator);
814 }; 815 };
815 816
816 } // namespace net 817 } // namespace net
817 818
818 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ 819 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_
OLDNEW
« no previous file with comments | « content/renderer/render_thread_impl.cc ('k') | net/nqe/network_quality_estimator_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698