OLD | NEW |
---|---|
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| can be notified of a new RTT value. | |
Ryan Sleevi
2016/03/02 19:56:57
I'm not sure what this means?
tbansal1
2016/03/03 02:09:08
I renamed the function name, and edited the commen
| |
39 bool CanNotifyRTT() const WARN_UNUSED_RESULT; | |
40 | |
41 // Called when |this| socket performance watcher is reused for establishing a | |
42 // new transport layer connection. | |
Ryan Sleevi
2016/03/02 19:56:57
https://google.github.io/styleguide/cppguide.html#
tbansal1
2016/03/03 02:09:08
Done.
| |
43 void Reset() const; | |
35 | 44 |
36 private: | 45 private: |
37 // Transport layer protocol used by the socket that |this| is watching. | 46 // Transport layer protocol used by the socket that |this| is watching. |
38 const SocketPerformanceWatcherFactory::Protocol protocol_; | 47 const SocketPerformanceWatcherFactory::Protocol protocol_; |
39 | 48 |
49 // Time when the last RTT notification was received. | |
50 base::TimeTicks last_rtt_notification_; | |
51 | |
52 // Minimum time interval between two successive OnUpdatedRTTAvailable | |
53 // notifications to |this|. | |
54 const base::TimeDelta rtt_notification_interval_; | |
55 | |
40 // |socket_performance_watcher_factory_| is the factory that created | 56 // |socket_performance_watcher_factory_| is the factory that created |
41 // |this| watcher. | 57 // |this| watcher. |
42 SocketPerformanceWatcherFactory* socket_performance_watcher_factory_; | 58 SocketPerformanceWatcherFactory* socket_performance_watcher_factory_; |
43 | 59 |
44 DISALLOW_COPY_AND_ASSIGN(SocketPerformanceWatcher); | 60 DISALLOW_COPY_AND_ASSIGN(SocketPerformanceWatcher); |
45 }; | 61 }; |
46 | 62 |
47 } // namespace net | 63 } // namespace net |
48 | 64 |
49 #endif // NET_BASE_SOCKET_PERFORMANCE_WATCHER_H_ | 65 #endif // NET_BASE_SOCKET_PERFORMANCE_WATCHER_H_ |
OLD | NEW |