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 #include <stdint.h> |
| 10 |
8 #include "base/macros.h" | 11 #include "base/macros.h" |
9 #include "net/base/net_export.h" | 12 #include "net/base/net_export.h" |
10 #include "net/base/socket_performance_watcher_factory.h" | 13 #include "net/base/socket_performance_watcher_factory.h" |
11 | 14 |
12 namespace base { | 15 namespace base { |
13 class TimeDelta; | 16 class TimeDelta; |
14 } // namespace base | 17 } // namespace base |
15 | 18 |
16 namespace net { | 19 namespace net { |
17 | 20 |
18 // SocketPerformanceWatcher is the base class for recording and aggregating | 21 // SocketPerformanceWatcher is the base class for recording and aggregating |
19 // socket statistics. | 22 // socket statistics. |
20 class NET_EXPORT_PRIVATE SocketPerformanceWatcher { | 23 class NET_EXPORT_PRIVATE SocketPerformanceWatcher { |
21 public: | 24 public: |
22 // |socket_performance_watcher_factory| is the factory that constructed | 25 // |socket_performance_watcher_factory| is the factory that constructed |
23 // |this| watcher. | 26 // |this| watcher. |
24 SocketPerformanceWatcher( | 27 SocketPerformanceWatcher( |
25 const SocketPerformanceWatcherFactory::Protocol protocol, | 28 const SocketPerformanceWatcherFactory::Protocol protocol, |
26 SocketPerformanceWatcherFactory* socket_performance_watcher_factory); | 29 SocketPerformanceWatcherFactory* socket_performance_watcher_factory); |
27 | 30 |
28 virtual ~SocketPerformanceWatcher(); | 31 virtual ~SocketPerformanceWatcher(); |
29 | 32 |
30 // Called when updated transport layer RTT information is available. This | 33 // Called when updated transport layer RTT information is available. This |
31 // must be the transport layer RTT from this device to the remote transport | 34 // 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 | 35 // layer endpoint. This method is called immediately after the observation is |
33 // made, hence no timestamp. | 36 // made, hence no timestamp. |
34 void OnUpdatedRTTAvailable(const base::TimeDelta& rtt) const; | 37 void OnUpdatedRTTAvailable(const base::TimeDelta& rtt) const; |
35 | 38 |
| 39 // Called when an updated packet count at the transport layer is available. |
| 40 // All the counts are since the last call to the |
| 41 // OnUpdatedPacketCountAvailable. This method is called immediately after the |
| 42 // observation is made, hence no timestamp. |
| 43 |
| 44 // An example: |
| 45 // Last observation after packet #1. Packets #5 and #6 are received: |
| 46 // lost = 3, in_order = 2, out_of_order = 0. |
| 47 |
| 48 // Last observation after packet #6. Packet #3 received: |
| 49 // lost = 0, in_order = 0, out_of_order = 1. |
| 50 void OnUpdatedPacketCountAvailable( |
| 51 size_t packets_lost, |
| 52 size_t packets_received_in_order, |
| 53 size_t packets_received_out_of_order) const; |
| 54 |
36 private: | 55 private: |
37 // Transport layer protocol used by the socket that |this| is watching. | 56 // Transport layer protocol used by the socket that |this| is watching. |
38 const SocketPerformanceWatcherFactory::Protocol protocol_; | 57 const SocketPerformanceWatcherFactory::Protocol protocol_; |
39 | 58 |
40 // |socket_performance_watcher_factory_| is the factory that created | 59 // |socket_performance_watcher_factory_| is the factory that created |
41 // |this| watcher. | 60 // |this| watcher. |
42 SocketPerformanceWatcherFactory* socket_performance_watcher_factory_; | 61 SocketPerformanceWatcherFactory* socket_performance_watcher_factory_; |
43 | 62 |
44 DISALLOW_COPY_AND_ASSIGN(SocketPerformanceWatcher); | 63 DISALLOW_COPY_AND_ASSIGN(SocketPerformanceWatcher); |
45 }; | 64 }; |
46 | 65 |
47 } // namespace net | 66 } // namespace net |
48 | 67 |
49 #endif // NET_BASE_SOCKET_PERFORMANCE_WATCHER_H_ | 68 #endif // NET_BASE_SOCKET_PERFORMANCE_WATCHER_H_ |
OLD | NEW |