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

Side by Side Diff: net/nqe/socket_watcher_factory.h

Issue 2024813003: Split SocketWatcher and SocketWatcherFactory out of NQE (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 6 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
« no previous file with comments | « net/nqe/socket_watcher.cc ('k') | net/nqe/socket_watcher_factory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #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.
36 class SocketWatcherFactory : public SocketPerformanceWatcherFactory {
37 public:
38 // Creates a SocketWatcherFactory. All socket watchers created by
39 // SocketWatcherFactory call |updated_rtt_observation_callback| on
40 // |task_runner| every time a new RTT observation is available.
41 SocketWatcherFactory(
42 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
43 OnUpdatedRTTAvailableCallback updated_rtt_observation_callback);
44
45 ~SocketWatcherFactory() override;
46
47 // SocketPerformanceWatcherFactory implementation:
48 std::unique_ptr<SocketPerformanceWatcher> CreateSocketPerformanceWatcher(
49 const Protocol protocol) override;
50
51 private:
52 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
53
54 // Called every time a new RTT observation is available.
55 OnUpdatedRTTAvailableCallback updated_rtt_observation_callback_;
56
57 DISALLOW_COPY_AND_ASSIGN(SocketWatcherFactory);
58 };
59
60 } // namespace internal
61
62 } // namespace nqe
63
64 } // namespace net
65
66 #endif // NET_NQE_SOCKET_WATCHER_FACTORY_H_
OLDNEW
« no previous file with comments | « net/nqe/socket_watcher.cc ('k') | net/nqe/socket_watcher_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698