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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "net/base/network_quality_estimator_watcher_factory.h"
6
7 #include "base/location.h"
8 #include "base/single_thread_task_runner.h"
9 #include "base/time/time.h"
10 #include "net/base/network_quality_estimator.h"
11
12 namespace net {
13
14 NetworkQualityEstimatorWatcherFactory::NetworkQualityEstimatorWatcherFactory(
15 const base::WeakPtr<NetworkQualityEstimator>& network_quality_estimator,
16 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner)
17 : network_quality_estimator_(network_quality_estimator),
18 task_runner_(task_runner) {
19 DCHECK(network_quality_estimator_);
20 DCHECK(task_runner_);
21 }
22
23 NetworkQualityEstimatorWatcherFactory::
24 ~NetworkQualityEstimatorWatcherFactory() {}
25
26 scoped_ptr<SocketPerformanceWatcher>
27 NetworkQualityEstimatorWatcherFactory::CreateSocketPerformanceWatcher(
28 const Protocol protocol) {
29 return scoped_ptr<SocketPerformanceWatcher>(
30 new SocketPerformanceWatcher(protocol, this));
31 }
32
33 void NetworkQualityEstimatorWatcherFactory::OnUpdatedRTTAvailable(
34 const Protocol protocol,
35 const base::TimeDelta& rtt) {
36 task_runner_->PostTask(
37 FROM_HERE, base::Bind(&NetworkQualityEstimator::OnUpdatedRTTAvailable,
38 network_quality_estimator_, protocol, rtt));
39 }
40
41 void NetworkQualityEstimatorWatcherFactory::OnWatcherReset() {
42 task_runner_->PostTask(FROM_HERE,
43 base::Bind(&NetworkQualityEstimator::OnWatcherReset,
44 network_quality_estimator_));
45 }
46
47 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698