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

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

Issue 1376473003: Notify NQE of TCP RTT values (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed rsleevi comments Created 4 years, 9 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/compiler_specific.h"
8 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/time/time.h"
9 #include "net/base/net_export.h" 11 #include "net/base/net_export.h"
10 #include "net/base/socket_performance_watcher_factory.h" 12 #include "net/base/socket_performance_watcher_factory.h"
11 13
12 namespace base { 14 namespace base {
13 class TimeDelta; 15 class TimeDelta;
14 } // namespace base 16 } // namespace base
15 17
16 namespace net { 18 namespace net {
17 19
18 // SocketPerformanceWatcher is the base class for recording and aggregating 20 // SocketPerformanceWatcher is the base class for recording and aggregating
19 // socket statistics. 21 // socket statistics.
20 class NET_EXPORT_PRIVATE SocketPerformanceWatcher { 22 class NET_EXPORT_PRIVATE SocketPerformanceWatcher {
21 public: 23 public:
22 // |socket_performance_watcher_factory| is the factory that constructed 24 // |socket_performance_watcher_factory| is the factory that constructed
23 // |this| watcher. 25 // |this| watcher.
24 SocketPerformanceWatcher( 26 SocketPerformanceWatcher(
25 const SocketPerformanceWatcherFactory::Protocol protocol, 27 const SocketPerformanceWatcherFactory::Protocol protocol,
26 SocketPerformanceWatcherFactory* socket_performance_watcher_factory); 28 SocketPerformanceWatcherFactory* socket_performance_watcher_factory);
27 29
28 virtual ~SocketPerformanceWatcher(); 30 virtual ~SocketPerformanceWatcher();
29 31
30 // Called when updated transport layer RTT information is available. This 32 // Called when updated transport layer RTT information is available. This
31 // must be the transport layer RTT from this device to the remote transport 33 // must be the transport layer RTT from this device to the remote transport
32 // layer endpoint. This method is called immediately after the observation is 34 // layer endpoint. This method is called immediately after the observation is
33 // made, hence no timestamp. 35 // made, hence no timestamp.
34 void OnUpdatedRTTAvailable(const base::TimeDelta& rtt) const; 36 void OnUpdatedRTTAvailable(const base::TimeDelta& rtt);
37
38 // Returns true if |this| should be notified of the updated RTT value.
39 bool ShouldNotifyUpdatedRTT() const WARN_UNUSED_RESULT;
Ryan Sleevi 2016/03/04 01:38:38 I still don't know how to make sense of this - or
tbansal1 2016/03/04 02:37:53 Yes, that's what I meant.
40
41 // Resets the internal state of this SocketPerformanceWatcher in preparation
42 // for observing a new socket.
43 // Note: The new socket must share the same protocol as the previously
44 // observed socket.
45 void Reset();
35 46
36 private: 47 private:
37 // Transport layer protocol used by the socket that |this| is watching. 48 // Transport layer protocol used by the socket that |this| is watching.
38 const SocketPerformanceWatcherFactory::Protocol protocol_; 49 const SocketPerformanceWatcherFactory::Protocol protocol_;
39 50
51 // Time when the last RTT notification was received.
52 base::TimeTicks last_rtt_notification_;
53
54 // Minimum time interval between two successive OnUpdatedRTTAvailable
55 // notifications to |this|.
56 const base::TimeDelta rtt_notification_interval_;
57
40 // |socket_performance_watcher_factory_| is the factory that created 58 // |socket_performance_watcher_factory_| is the factory that created
41 // |this| watcher. 59 // |this| watcher.
42 SocketPerformanceWatcherFactory* socket_performance_watcher_factory_; 60 SocketPerformanceWatcherFactory* socket_performance_watcher_factory_;
43 61
44 DISALLOW_COPY_AND_ASSIGN(SocketPerformanceWatcher); 62 DISALLOW_COPY_AND_ASSIGN(SocketPerformanceWatcher);
45 }; 63 };
46 64
47 } // namespace net 65 } // namespace net
48 66
49 #endif // NET_BASE_SOCKET_PERFORMANCE_WATCHER_H_ 67 #endif // NET_BASE_SOCKET_PERFORMANCE_WATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698