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

Side by Side Diff: net/base/socket_performance_watcher.h

Issue 1831383002: Add SocketWatcherFactory as a helper class to NQE (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed rsleevi comments Created 4 years, 8 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef NET_BASE_SOCKET_PERFORMANCE_WATCHER_H_ 5 #ifndef NET_BASE_SOCKET_PERFORMANCE_WATCHER_H_
6 #define NET_BASE_SOCKET_PERFORMANCE_WATCHER_H_ 6 #define NET_BASE_SOCKET_PERFORMANCE_WATCHER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "net/base/net_export.h" 9 #include "net/base/net_export.h"
10 #include "net/base/socket_performance_watcher_factory.h"
11 10
12 namespace base { 11 namespace base {
13 class TimeDelta; 12 class TimeDelta;
14 } // namespace base 13 } // namespace base
15 14
16 namespace net { 15 namespace net {
17 16
18 // SocketPerformanceWatcher is the base class for recording and aggregating 17 // SocketPerformanceWatcher is the base class for recording and aggregating
19 // socket statistics. 18 // per-socket statistics. SocketPerformanceWatcher is not thread safe.
Ryan Sleevi 2016/04/02 00:48:20 In a pure interface, you can't make this claim (th
tbansal1 2016/04/04 16:55:44 I thought it would be useful for the interface to
Ryan Sleevi 2016/04/04 17:30:09 If you're expressing requirements, then express th
tbansal1 2016/04/04 18:35:46 Done. The requirement comes from SocketWatcher not
Ryan Sleevi 2016/04/04 18:53:36 I'm not sure I follow this logic. If this is the c
tbansal1 2016/04/04 22:07:02 TCPSocket is a reasonable place for now. I can mov
Ryan Sleevi 2016/04/04 22:34:04 SG
20 class NET_EXPORT_PRIVATE SocketPerformanceWatcher { 19 class NET_EXPORT_PRIVATE SocketPerformanceWatcher {
21 public: 20 public:
22 // |socket_performance_watcher_factory| is the factory that constructed 21 ~SocketPerformanceWatcher() {}
23 // |this| watcher.
24 SocketPerformanceWatcher(
25 const SocketPerformanceWatcherFactory::Protocol protocol,
26 SocketPerformanceWatcherFactory* socket_performance_watcher_factory);
27 22
28 virtual ~SocketPerformanceWatcher(); 23 // Notifies |this| SocketPerformanceWatcher of updated transport layer RTT
24 // from this device to the remote transport layer endpoint. This method is
25 // called immediately after the observation is made, hence no timestamp.
26 // There is no guarantee that OnUpdatedRTTAvailable will be called every time
27 // an updated RTT is available as the socket may throttle
28 // OnUpdatedRTTAvailable call for various reasons (including performance).
29 virtual void OnUpdatedRTTAvailable(const base::TimeDelta& rtt) = 0;
29 30
30 // Called when updated transport layer RTT information is available. This 31 // Returns true if |this| SocketPerformanceWatcher is interested in receiving
31 // must be the transport layer RTT from this device to the remote transport 32 // an updated RTT estimate (via OnUpdatedRTTAvailable).
32 // layer endpoint. This method is called immediately after the observation is 33 virtual bool ShouldNotifyUpdatedRTT() const = 0;
33 // made, hence no timestamp. 34
34 void OnUpdatedRTTAvailable(const base::TimeDelta& rtt) const; 35 // Notifies that |this| watcher will be reused to watch a different socket.
36 // Note: The new socket shares the same protocol as the previously watched
37 // socket.
38 virtual void Reset() = 0;
39
40 protected:
41 SocketPerformanceWatcher() {}
Ryan Sleevi 2016/04/02 00:48:20 There's no need for this. It's a pure interface -
tbansal1 2016/04/04 16:55:44 Done.
35 42
36 private: 43 private:
37 // Transport layer protocol used by the socket that |this| is watching.
38 const SocketPerformanceWatcherFactory::Protocol protocol_;
39
40 // |socket_performance_watcher_factory_| is the factory that created
41 // |this| watcher.
42 SocketPerformanceWatcherFactory* socket_performance_watcher_factory_;
43
44 DISALLOW_COPY_AND_ASSIGN(SocketPerformanceWatcher); 44 DISALLOW_COPY_AND_ASSIGN(SocketPerformanceWatcher);
45 }; 45 };
46 46
47 } // namespace net 47 } // namespace net
48 48
49 #endif // NET_BASE_SOCKET_PERFORMANCE_WATCHER_H_ 49 #endif // NET_BASE_SOCKET_PERFORMANCE_WATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698