| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/nqe/socket_watcher_factory.h" | 5 #include "net/nqe/socket_watcher_factory.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" |
| 7 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 8 #include "net/nqe/socket_watcher.h" | 9 #include "net/nqe/socket_watcher.h" |
| 9 | 10 |
| 10 namespace net { | 11 namespace net { |
| 11 | 12 |
| 12 namespace nqe { | 13 namespace nqe { |
| 13 | 14 |
| 14 namespace internal { | 15 namespace internal { |
| 15 | 16 |
| 16 SocketWatcherFactory::SocketWatcherFactory( | 17 SocketWatcherFactory::SocketWatcherFactory( |
| 17 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 18 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| 18 OnUpdatedRTTAvailableCallback updated_rtt_observation_callback) | 19 base::TimeDelta min_notification_interval, |
| 20 OnUpdatedRTTAvailableCallback updated_rtt_observation_callback, |
| 21 base::TickClock* tick_clock) |
| 19 : task_runner_(std::move(task_runner)), | 22 : task_runner_(std::move(task_runner)), |
| 20 updated_rtt_observation_callback_(updated_rtt_observation_callback) {} | 23 min_notification_interval_(min_notification_interval), |
| 24 updated_rtt_observation_callback_(updated_rtt_observation_callback), |
| 25 tick_clock_(tick_clock) { |
| 26 DCHECK(tick_clock_); |
| 27 } |
| 21 | 28 |
| 22 SocketWatcherFactory::~SocketWatcherFactory() {} | 29 SocketWatcherFactory::~SocketWatcherFactory() {} |
| 23 | 30 |
| 24 std::unique_ptr<SocketPerformanceWatcher> | 31 std::unique_ptr<SocketPerformanceWatcher> |
| 25 SocketWatcherFactory::CreateSocketPerformanceWatcher(const Protocol protocol) { | 32 SocketWatcherFactory::CreateSocketPerformanceWatcher(const Protocol protocol) { |
| 26 return std::unique_ptr<SocketPerformanceWatcher>(new SocketWatcher( | 33 return base::MakeUnique<SocketWatcher>( |
| 27 protocol, task_runner_, updated_rtt_observation_callback_)); | 34 protocol, min_notification_interval_, task_runner_, |
| 35 updated_rtt_observation_callback_, tick_clock_); |
| 28 } | 36 } |
| 29 | 37 |
| 30 } // namespace internal | 38 } // namespace internal |
| 31 | 39 |
| 32 } // namespace nqe | 40 } // namespace nqe |
| 33 | 41 |
| 34 } // namespace net | 42 } // namespace net |
| OLD | NEW |