Chromium Code Reviews| Index: net/base/network_quality_estimator.h |
| diff --git a/net/base/network_quality_estimator.h b/net/base/network_quality_estimator.h |
| index 32e1a3ef8a8b41672fed1eba59c03f43d94dec1a..fc805915a45c8d0bbddc2b2c9a17547f9c5d5da6 100644 |
| --- a/net/base/network_quality_estimator.h |
| +++ b/net/base/network_quality_estimator.h |
| @@ -17,15 +17,19 @@ |
| #include "base/macros.h" |
| #include "base/memory/ref_counted.h" |
| #include "base/memory/scoped_ptr.h" |
| +#include "base/memory/weak_ptr.h" |
| #include "base/observer_list.h" |
| #include "base/threading/thread_checker.h" |
| #include "base/time/time.h" |
| #include "net/base/external_estimate_provider.h" |
| #include "net/base/net_export.h" |
| #include "net/base/network_change_notifier.h" |
| -#include "net/base/socket_performance_watcher.h" |
| #include "net/base/socket_performance_watcher_factory.h" |
| +namespace base { |
| +class SingleThreadTaskRunner; |
| +} // namespace base |
| + |
| namespace net { |
| class URLRequest; |
| @@ -40,8 +44,7 @@ class URLRequest; |
| // observed traffic characteristics. |
| class NET_EXPORT_PRIVATE NetworkQualityEstimator |
| : public NetworkChangeNotifier::ConnectionTypeObserver, |
| - public ExternalEstimateProvider::UpdatedEstimateDelegate, |
| - public SocketPerformanceWatcherFactory { |
| + public ExternalEstimateProvider::UpdatedEstimateDelegate { |
| public: |
| // On Android, a Java counterpart will be generated for this enum. |
| // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.net |
| @@ -168,12 +171,6 @@ class NET_EXPORT_PRIVATE NetworkQualityEstimator |
| const base::TimeTicks& begin_timestamp, |
| int32_t* kbps) const; |
| - // SocketPerformanceWatcherFactory implementation: |
| - scoped_ptr<SocketPerformanceWatcher> CreateSocketPerformanceWatcher( |
| - const Protocol protocol) override; |
| - void OnUpdatedRTTAvailable(const Protocol protocol, |
| - const base::TimeDelta& rtt) override; |
| - |
| // Adds |rtt_observer| to the list of round trip time observers. Must be |
| // called on the IO thread. |
| void AddRTTObserver(RTTObserver* rtt_observer); |
| @@ -190,6 +187,8 @@ class NET_EXPORT_PRIVATE NetworkQualityEstimator |
| // is on the list of observers. Must be called on the IO thread. |
| void RemoveThroughputObserver(ThroughputObserver* throughput_observer); |
| + SocketPerformanceWatcherFactory* GetSocketPerformanceWatcherFactory(); |
| + |
| protected: |
| // NetworkID is used to uniquely identify a network. |
| // For the purpose of network quality estimation and caching, a network is |
| @@ -239,6 +238,9 @@ class NET_EXPORT_PRIVATE NetworkQualityEstimator |
| void OnUpdatedEstimateAvailable() override; |
| private: |
| + class SocketWatcher; |
| + class SocketWatcherDelegate; |
| + class SocketWatcherFactory; |
|
Ryan Sleevi
2016/04/04 17:30:09
If this is because you need to access internal met
tbansal1
2016/04/04 18:35:46
It was for forward declaration. Moved it to after
|
| FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, StoreObservations); |
| FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestKbpsRTTUpdates); |
| FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestAddObservation); |
| @@ -258,7 +260,6 @@ class NET_EXPORT_PRIVATE NetworkQualityEstimator |
| TestExternalEstimateProvider); |
| FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, |
| TestExternalEstimateProviderMergeEstimates); |
| - FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestObservers); |
| // NetworkQuality is used to cache the quality of a network connection. |
| class NET_EXPORT_PRIVATE NetworkQuality { |
| @@ -498,6 +499,10 @@ class NET_EXPORT_PRIVATE NetworkQualityEstimator |
| // should discard RTT if it is set to the value returned by |InvalidRTT()|. |
| static const base::TimeDelta InvalidRTT(); |
| + // Notifies |this| of a new transport layer RTT. |
| + void OnUpdatedRTTAvailable(SocketPerformanceWatcherFactory::Protocol protocol, |
| + const base::TimeDelta& rtt); |
| + |
| // Queries the external estimate provider for the latest network quality |
| // estimates, and adds those estimates to the current observation buffer. |
| void QueryExternalEstimateProvider(); |
| @@ -610,8 +615,14 @@ class NET_EXPORT_PRIVATE NetworkQualityEstimator |
| base::ObserverList<RTTObserver> rtt_observer_list_; |
| base::ObserverList<ThroughputObserver> throughput_observer_list_; |
| + scoped_ptr<SocketPerformanceWatcherFactory> watcher_factory_; |
| + |
| + scoped_ptr<SocketWatcherDelegate> delegate_; |
| + |
| base::ThreadChecker thread_checker_; |
| + base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator); |
| }; |