| Index: net/base/socket_performance_watcher.cc
|
| diff --git a/net/base/socket_performance_watcher.cc b/net/base/socket_performance_watcher.cc
|
| index aa0dab3b03c9476a8d099bde13e15e9b65668850..3c0212ff0786f58d0cbd61f341f53d2849abc015 100644
|
| --- a/net/base/socket_performance_watcher.cc
|
| +++ b/net/base/socket_performance_watcher.cc
|
| @@ -9,9 +9,10 @@
|
| namespace net {
|
|
|
| SocketPerformanceWatcher::SocketPerformanceWatcher(
|
| - const SocketPerformanceWatcherFactory::Protocol protocol,
|
| + SocketPerformanceWatcherFactory::Protocol protocol,
|
| SocketPerformanceWatcherFactory* socket_performance_watcher_factory)
|
| : protocol_(protocol),
|
| + rtt_notification_received_count_(0),
|
| socket_performance_watcher_factory_(socket_performance_watcher_factory) {
|
| DCHECK(socket_performance_watcher_factory_);
|
|
|
| @@ -27,8 +28,29 @@ SocketPerformanceWatcher::SocketPerformanceWatcher(
|
| SocketPerformanceWatcher::~SocketPerformanceWatcher() {}
|
|
|
| void SocketPerformanceWatcher::OnUpdatedRTTAvailable(
|
| - const base::TimeDelta& rtt) const {
|
| + const base::TimeDelta& rtt) {
|
| + DCHECK(thread_checker_.CalledOnValidThread());
|
| +
|
| + rtt_notification_received_count_++;
|
| socket_performance_watcher_factory_->OnUpdatedRTTAvailable(protocol_, rtt);
|
| }
|
|
|
| +bool SocketPerformanceWatcher::ShouldNotifyUpdatedRTT() const {
|
| + DCHECK(thread_checker_.CalledOnValidThread());
|
| +
|
| + // Currently using a small value until crbug.com/590300 is fixed. TCP/QUIC
|
| + // start with a hard-coded RTT estimate, and converge to a more accurate value
|
| + // as more packets are received. This means that SPW should receive frequent
|
| + // RTT notifications when the TCP/QUIC connection has just started, and less
|
| + // frequent notification afterwards.
|
| + return rtt_notification_received_count_ < 1;
|
| +}
|
| +
|
| +void SocketPerformanceWatcher::Reset() {
|
| + DCHECK(thread_checker_.CalledOnValidThread());
|
| +
|
| + rtt_notification_received_count_ = 0;
|
| + socket_performance_watcher_factory_->OnWatcherReset();
|
| +}
|
| +
|
| } // namespace net
|
|
|