Chromium Code Reviews| 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 #ifndef NET_NQE_SOCKET_WATCHER_FACTORY_H_ | |
| 6 #define NET_NQE_SOCKET_WATCHER_FACTORY_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "base/callback.h" | |
| 11 #include "base/memory/ref_counted.h" | |
| 12 #include "base/memory/weak_ptr.h" | |
| 13 #include "base/threading/thread_checker.h" | |
| 14 #include "net/socket/socket_performance_watcher.h" | |
| 15 #include "net/socket/socket_performance_watcher_factory.h" | |
| 16 | |
| 17 namespace base { | |
| 18 class SingleThreadTaskRunner; | |
| 19 class TimeDelta; | |
| 20 } // namespace base | |
| 21 | |
| 22 namespace net { | |
| 23 | |
| 24 namespace { | |
| 25 typedef base::Callback<void(SocketPerformanceWatcherFactory::Protocol protocol, | |
| 26 const base::TimeDelta& rtt)> | |
| 27 OnUpdatedRTTAvailableCallback; | |
| 28 } | |
| 29 | |
| 30 namespace nqe { | |
| 31 | |
| 32 namespace internal { | |
| 33 | |
| 34 // SocketWatcherFactory implements SocketPerformanceWatcherFactory. | |
| 35 // SocketWatcherFactory is thread safe. All socket watchers created by | |
| 36 // SocketWatcherFactory call |updated_rtt_observation_callback| every time a new | |
| 37 // RTT observation is available. | |
| 38 class SocketWatcherFactory : public SocketPerformanceWatcherFactory { | |
| 39 public: | |
| 40 SocketWatcherFactory( | |
|
bengr
2016/06/01 17:41:04
Please add a comment that describes the parameters
tbansal1
2016/06/01 18:24:36
Done.
| |
| 41 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | |
| 42 OnUpdatedRTTAvailableCallback updated_rtt_observation_callback); | |
| 43 | |
| 44 ~SocketWatcherFactory() override; | |
| 45 | |
| 46 // SocketPerformanceWatcherFactory implementation: | |
| 47 std::unique_ptr<SocketPerformanceWatcher> CreateSocketPerformanceWatcher( | |
| 48 const Protocol protocol) override; | |
| 49 | |
| 50 private: | |
| 51 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | |
| 52 | |
| 53 // Called every time a new RTT observation is available. | |
| 54 OnUpdatedRTTAvailableCallback updated_rtt_observation_callback_; | |
| 55 | |
| 56 DISALLOW_COPY_AND_ASSIGN(SocketWatcherFactory); | |
| 57 }; | |
| 58 | |
| 59 } // namespace internal | |
| 60 | |
| 61 } // namespace nqe | |
| 62 | |
| 63 } // namespace net | |
| 64 | |
| 65 #endif // NET_NQE_SOCKET_WATCHER_FACTORY_H_ | |
| OLD | NEW |