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

Unified Diff: net/base/network_quality_estimator.h

Issue 1831383002: Add SocketWatcherFactory as a helper class to NQE (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
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..5ff9bd7354027850bc243ddd1c4351cbc40cb11c 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
@@ -258,7 +257,9 @@ class NET_EXPORT_PRIVATE NetworkQualityEstimator
TestExternalEstimateProvider);
FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest,
TestExternalEstimateProviderMergeEstimates);
- FRIEND_TEST_ALL_PREFIXES(NetworkQualityEstimatorTest, TestObservers);
+
+ class SocketWatcher;
+ class SocketWatcherFactory;
// 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,12 @@ class NET_EXPORT_PRIVATE NetworkQualityEstimator
base::ObserverList<RTTObserver> rtt_observer_list_;
base::ObserverList<ThroughputObserver> throughput_observer_list_;
+ scoped_ptr<SocketPerformanceWatcherFactory> watcher_factory_;
+
base::ThreadChecker thread_checker_;
+ base::WeakPtrFactory<NetworkQualityEstimator> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(NetworkQualityEstimator);
};
« no previous file with comments | « ios/chrome/browser/browser_state/chrome_browser_state_io_data.cc ('k') | net/base/network_quality_estimator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698