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

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

Issue 2024813003: Split SocketWatcher and SocketWatcherFactory out of NQE (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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_H_
6 #define NET_NQE_SOCKET_WATCHER_H_
7
8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/weak_ptr.h"
11 #include "base/threading/thread_checker.h"
12 #include "net/socket/socket_performance_watcher.h"
13 #include "net/socket/socket_performance_watcher_factory.h"
14
15 namespace base {
16 class SingleThreadTaskRunner;
17 class TimeDelta;
18 } // namespace base
19
20 namespace net {
21
22 namespace {
23 typedef base::Callback<void(SocketPerformanceWatcherFactory::Protocol protocol,
24 const base::TimeDelta& rtt)>
25 OnUpdatedRTTAvailableCallback;
26 }
27
28 namespace nqe {
29
30 namespace internal {
31
32 // SocketWatcher implements SocketPerformanceWatcher, and calls
33 // |updated_rtt_observation_callback| every time a new RTT observation is
34 // available. SocketWatcher is not thread-safe.
35 class SocketWatcher : public SocketPerformanceWatcher {
36 public:
37 SocketWatcher(SocketPerformanceWatcherFactory::Protocol protocol,
bengr 2016/06/01 17:41:04 Please add a comment that describes the parameters
tbansal1 2016/06/01 18:24:36 Done.
38 scoped_refptr<base::SingleThreadTaskRunner> task_runner,
39 OnUpdatedRTTAvailableCallback updated_rtt_observation_callback);
40
41 ~SocketWatcher() override;
42
43 // SocketPerformanceWatcher implementation:
44 bool ShouldNotifyUpdatedRTT() const override;
45 void OnUpdatedRTTAvailable(const base::TimeDelta& rtt) override;
46 void OnConnectionChanged() override;
47
48 private:
49 // Transport layer protocol used by the socket that |this| is watching.
50 const SocketPerformanceWatcherFactory::Protocol protocol_;
51
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 base::ThreadChecker thread_checker_;
58
59 DISALLOW_COPY_AND_ASSIGN(SocketWatcher);
60 };
61
62 } // namespace internal
63
64 } // namespace nqe
65
66 } // namespace net
67
68 #endif // NET_NQE_SOCKET_WATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698