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 <stddef.h> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.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) const; |
35 | 37 |
| 38 // Called when the incremental packet counts at the transport layer are |
| 39 // available. All the counts are since the last call to the |
| 40 // OnIncrementalPacketCountAvailable. This method is called immediately after |
| 41 // the observation is made, hence no timestamp. |
| 42 |
| 43 // An example: |
| 44 // Last observation after packet #1. Packets #5 and #6 are received: |
| 45 // missing = 3, in_order = 2, out_of_order = 0. |
| 46 |
| 47 // Last observation after packet #6. Packet #3 received: |
| 48 // missing = 0, in_order = 0, out_of_order = 1. |
| 49 void OnIncrementalPacketCountAvailable( |
| 50 size_t packets_missing, |
| 51 size_t packets_received_in_order, |
| 52 size_t packets_received_out_of_order) const; |
| 53 |
36 private: | 54 private: |
37 // Transport layer protocol used by the socket that |this| is watching. | 55 // Transport layer protocol used by the socket that |this| is watching. |
38 const SocketPerformanceWatcherFactory::Protocol protocol_; | 56 const SocketPerformanceWatcherFactory::Protocol protocol_; |
39 | 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_ |
OLD | NEW |