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

Unified Diff: net/base/network_quality_estimator_watcher_factory.cc

Issue 1376473003: Notify NQE of TCP RTT values (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased, addressed sleevi comments Created 4 years, 9 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_watcher_factory.cc
diff --git a/net/base/network_quality_estimator_watcher_factory.cc b/net/base/network_quality_estimator_watcher_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..974b5e090a9cb3401306c8e76d0b41635b5f503c
--- /dev/null
+++ b/net/base/network_quality_estimator_watcher_factory.cc
@@ -0,0 +1,47 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "net/base/network_quality_estimator_watcher_factory.h"
+
+#include "base/location.h"
+#include "base/single_thread_task_runner.h"
+#include "base/time/time.h"
+#include "net/base/network_quality_estimator.h"
+
+namespace net {
+
+NetworkQualityEstimatorWatcherFactory::NetworkQualityEstimatorWatcherFactory(
+ const base::WeakPtr<NetworkQualityEstimator>& network_quality_estimator,
+ const scoped_refptr<base::SingleThreadTaskRunner>& task_runner)
+ : network_quality_estimator_(network_quality_estimator),
+ task_runner_(task_runner) {
+ DCHECK(network_quality_estimator_);
+ DCHECK(task_runner_);
+}
+
+NetworkQualityEstimatorWatcherFactory::
+ ~NetworkQualityEstimatorWatcherFactory() {}
+
+scoped_ptr<SocketPerformanceWatcher>
+NetworkQualityEstimatorWatcherFactory::CreateSocketPerformanceWatcher(
+ const Protocol protocol) {
+ return scoped_ptr<SocketPerformanceWatcher>(
+ new SocketPerformanceWatcher(protocol, this));
+}
+
+void NetworkQualityEstimatorWatcherFactory::OnUpdatedRTTAvailable(
+ const Protocol protocol,
+ const base::TimeDelta& rtt) {
+ task_runner_->PostTask(
+ FROM_HERE, base::Bind(&NetworkQualityEstimator::OnUpdatedRTTAvailable,
+ network_quality_estimator_, protocol, rtt));
+}
+
+void NetworkQualityEstimatorWatcherFactory::OnWatcherReset() {
+ task_runner_->PostTask(FROM_HERE,
+ base::Bind(&NetworkQualityEstimator::OnWatcherReset,
+ network_quality_estimator_));
+}
+
+} // namespace net

Powered by Google App Engine
This is Rietveld 408576698