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

Unified Diff: net/base/socket_performance_watcher.cc

Issue 1376473003: Notify NQE of TCP RTT values (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed rsleevi comments, using ScopedTracker, added tests for SPW Created 4 years, 10 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/socket_performance_watcher.cc
diff --git a/net/base/socket_performance_watcher.cc b/net/base/socket_performance_watcher.cc
index aa0dab3b03c9476a8d099bde13e15e9b65668850..de61df70fa8bce3a3d4ca568209b2c884a9d365f 100644
--- a/net/base/socket_performance_watcher.cc
+++ b/net/base/socket_performance_watcher.cc
@@ -12,6 +12,8 @@ SocketPerformanceWatcher::SocketPerformanceWatcher(
const SocketPerformanceWatcherFactory::Protocol protocol,
SocketPerformanceWatcherFactory* socket_performance_watcher_factory)
: protocol_(protocol),
+ // Currently using a large value until crbug.com/590300 is fixed.
+ rtt_notification_interval_(base::TimeDelta::FromHours(10)),
socket_performance_watcher_factory_(socket_performance_watcher_factory) {
DCHECK(socket_performance_watcher_factory_);
@@ -27,8 +29,18 @@ SocketPerformanceWatcher::SocketPerformanceWatcher(
SocketPerformanceWatcher::~SocketPerformanceWatcher() {}
void SocketPerformanceWatcher::OnUpdatedRTTAvailable(
- const base::TimeDelta& rtt) const {
+ const base::TimeDelta& rtt) {
+ last_rtt_notification_ = base::TimeTicks::Now();
socket_performance_watcher_factory_->OnUpdatedRTTAvailable(protocol_, rtt);
}
+bool SocketPerformanceWatcher::CanNotifyRTT() const {
+ return base::TimeTicks::Now() - last_rtt_notification_ >=
+ rtt_notification_interval_;
+}
+
+void SocketPerformanceWatcher::Reset() const {
Ryan Sleevi 2016/03/02 19:56:57 Shouldn't you also reset last_rtt_notification_ to
tbansal1 2016/03/03 02:09:08 I was going to replace last_rtt_notification_ with
+ socket_performance_watcher_factory_->OnWatcherReset();
+}
+
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698