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

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: More plumbing 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();
Wez 2016/03/04 18:50:26 Why is this dtor virtual? Nothing seems to inheri
tbansal1 2016/03/09 00:20:03 Done.
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 the current SocketPerformanceWatcher is interested
39 // in receiving a new RTT estimate (via OnUpdatedRTTAvailable).
40 // Callers may use this to avoid doing expensive work computing the
41 // RTT when the SocketPerformanceWatcher is not interested in such
42 // updates.
43 bool ShouldNotifyUpdatedRTT() const WARN_UNUSED_RESULT;
44
45 // Resets the internal state of this SocketPerformanceWatcher in preparation
46 // for observing a new socket.
47 // Note: The new socket must share the same protocol as the previously
48 // observed socket.
49 void Reset();
35 50
36 private: 51 private:
37 // Transport layer protocol used by the socket that |this| is watching. 52 // Transport layer protocol used by the socket that |this| is watching.
38 const SocketPerformanceWatcherFactory::Protocol protocol_; 53 const SocketPerformanceWatcherFactory::Protocol protocol_;
39 54
55 // Time when the last RTT notification was received.
56 base::TimeTicks last_rtt_notification_;
57
58 // Minimum time interval between two successive OnUpdatedRTTAvailable
59 // notifications to |this|.
60 const base::TimeDelta rtt_notification_interval_;
61
40 // |socket_performance_watcher_factory_| is the factory that created 62 // |socket_performance_watcher_factory_| is the factory that created
41 // |this| watcher. 63 // |this| watcher.
42 SocketPerformanceWatcherFactory* socket_performance_watcher_factory_; 64 SocketPerformanceWatcherFactory* socket_performance_watcher_factory_;
43 65
44 DISALLOW_COPY_AND_ASSIGN(SocketPerformanceWatcher); 66 DISALLOW_COPY_AND_ASSIGN(SocketPerformanceWatcher);
45 }; 67 };
46 68
47 } // namespace net 69 } // namespace net
48 70
49 #endif // NET_BASE_SOCKET_PERFORMANCE_WATCHER_H_ 71 #endif // NET_BASE_SOCKET_PERFORMANCE_WATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698