OLD | NEW |
(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/nqe/socket_watcher.h" |
| 6 |
| 7 #include "base/bind.h" |
| 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/time/time.h" |
| 11 |
| 12 namespace net { |
| 13 |
| 14 namespace nqe { |
| 15 |
| 16 namespace internal { |
| 17 |
| 18 SocketWatcher::SocketWatcher( |
| 19 SocketPerformanceWatcherFactory::Protocol protocol, |
| 20 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| 21 OnUpdatedRTTAvailableCallback updated_rtt_observation_callback) |
| 22 : protocol_(protocol), |
| 23 task_runner_(std::move(task_runner)), |
| 24 updated_rtt_observation_callback_(updated_rtt_observation_callback) {} |
| 25 |
| 26 SocketWatcher::~SocketWatcher() {} |
| 27 |
| 28 bool SocketWatcher::ShouldNotifyUpdatedRTT() const { |
| 29 DCHECK(thread_checker_.CalledOnValidThread()); |
| 30 |
| 31 return true; |
| 32 } |
| 33 |
| 34 void SocketWatcher::OnUpdatedRTTAvailable(const base::TimeDelta& rtt) { |
| 35 DCHECK(thread_checker_.CalledOnValidThread()); |
| 36 |
| 37 task_runner_->PostTask( |
| 38 FROM_HERE, base::Bind(updated_rtt_observation_callback_, protocol_, rtt)); |
| 39 } |
| 40 |
| 41 void SocketWatcher::OnConnectionChanged() { |
| 42 DCHECK(thread_checker_.CalledOnValidThread()); |
| 43 } |
| 44 |
| 45 } // namespace internal |
| 46 |
| 47 } // namespace nqe |
| 48 |
| 49 } // namespace net |
OLD | NEW |