| 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
|
|
|