| Index: net/nqe/socket_watcher.h
|
| diff --git a/net/nqe/socket_watcher.h b/net/nqe/socket_watcher.h
|
| index 09b8a39379e7b74c0a2a4a45c63d1b5968cf547c..991f5eef79518d2870ae5dfe861e502c90b1c817 100644
|
| --- a/net/nqe/socket_watcher.h
|
| +++ b/net/nqe/socket_watcher.h
|
| @@ -5,10 +5,15 @@
|
| #ifndef NET_NQE_SOCKET_WATCHER_H_
|
| #define NET_NQE_SOCKET_WATCHER_H_
|
|
|
| +#include <memory>
|
| +
|
| #include "base/callback.h"
|
| #include "base/memory/ref_counted.h"
|
| #include "base/memory/weak_ptr.h"
|
| #include "base/threading/thread_checker.h"
|
| +#include "base/time/tick_clock.h"
|
| +#include "base/time/time.h"
|
| +#include "net/base/net_export.h"
|
| #include "net/socket/socket_performance_watcher.h"
|
| #include "net/socket/socket_performance_watcher_factory.h"
|
|
|
| @@ -30,13 +35,15 @@ namespace nqe {
|
| namespace internal {
|
|
|
| // SocketWatcher implements SocketPerformanceWatcher, and is not thread-safe.
|
| -class SocketWatcher : public SocketPerformanceWatcher {
|
| +class NET_EXPORT_PRIVATE SocketWatcher : public SocketPerformanceWatcher {
|
| public:
|
| // Creates a SocketWatcher which can be used to watch a socket that uses
|
| // |protocol| as the transport layer protocol. The socket watcher will call
|
| // |updated_rtt_observation_callback| on |task_runner| every time a new RTT
|
| - // observation is available.
|
| + // observation is available. |min_notification_interval| is the minimum
|
| + // interval betweeen consecutive notifications to this socket watcher.
|
| SocketWatcher(SocketPerformanceWatcherFactory::Protocol protocol,
|
| + base::TimeDelta min_notification_interval,
|
| scoped_refptr<base::SingleThreadTaskRunner> task_runner,
|
| OnUpdatedRTTAvailableCallback updated_rtt_observation_callback);
|
|
|
| @@ -47,6 +54,8 @@ class SocketWatcher : public SocketPerformanceWatcher {
|
| void OnUpdatedRTTAvailable(const base::TimeDelta& rtt) override;
|
| void OnConnectionChanged() override;
|
|
|
| + void SetTickClockForTesting(std::unique_ptr<base::TickClock> tick_clock);
|
| +
|
| private:
|
| // Transport layer protocol used by the socket that |this| is watching.
|
| const SocketPerformanceWatcherFactory::Protocol protocol_;
|
| @@ -56,6 +65,14 @@ class SocketWatcher : public SocketPerformanceWatcher {
|
| // Called every time a new RTT observation is available.
|
| OnUpdatedRTTAvailableCallback updated_rtt_observation_callback_;
|
|
|
| + // Minimum interval betweeen consecutive incoming notifications.
|
| + const base::TimeDelta rtt_notifications_minimum_interval_;
|
| +
|
| + // Time when this was last notified of updated RTT.
|
| + base::TimeTicks last_rtt_notification_;
|
| +
|
| + std::unique_ptr<base::TickClock> tick_clock_;
|
| +
|
| base::ThreadChecker thread_checker_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(SocketWatcher);
|
|
|