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_FACTORY_H_ | 5 #ifndef NET_BASE_SOCKET_PERFORMANCE_WATCHER_FACTORY_H_ |
6 #define NET_BASE_SOCKET_PERFORMANCE_WATCHER_FACTORY_H_ | 6 #define NET_BASE_SOCKET_PERFORMANCE_WATCHER_FACTORY_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include "base/macros.h" | 10 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
10 #include "net/base/net_export.h" | 12 #include "net/base/net_export.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 |
(...skipping 17 matching lines...) Expand all Loading... |
35 const Protocol protocol) = 0; | 37 const Protocol protocol) = 0; |
36 | 38 |
37 // Called when updated transport layer RTT information is available from one | 39 // Called when updated transport layer RTT information is available from one |
38 // of the watchers created by |this|. |protocol| is the protocol that was used | 40 // of the watchers created by |this|. |protocol| is the protocol that was used |
39 // by the watcher. |rtt| must be the transport layer RTT from this device to | 41 // by the watcher. |rtt| must be the transport layer RTT from this device to |
40 // the remote transport layer endpoint. These methods are called immediately | 42 // the remote transport layer endpoint. These methods are called immediately |
41 // after the observation is made, hence no timestamp. | 43 // after the observation is made, hence no timestamp. |
42 virtual void OnUpdatedRTTAvailable(const Protocol protocol, | 44 virtual void OnUpdatedRTTAvailable(const Protocol protocol, |
43 const base::TimeDelta& rtt) = 0; | 45 const base::TimeDelta& rtt) = 0; |
44 | 46 |
| 47 // Called when an updated packet count at the transport layer is available. |
| 48 // |protocol| is the protocol that was used by the watcher. |
| 49 // |num_packets_lost| is the number of packets lost. |
| 50 // |num_packets_received_in_order| is the number of packets received in |
| 51 // order. |num_packets_received_not_in_order| is the number of packets |
| 52 // received out of order. All the counts are since the last call to the |
| 53 // OnUpdatedPacketCountAvailable. This method is called immediately after the |
| 54 // observation is made, hence no timestamp. |
| 55 // |
| 56 // As an example, assume that the packets with sequence number 1, 2 and 5 have |
| 57 // been received. Four cases are possible: (i) If next, a packet with sequence |
| 58 // number 6 is received, then this function should be called with |
| 59 // |num_packets_received_in_order| set to 1, and all other counts set to zero. |
| 60 // (ii) If packet with sequence number 3 is received, |
| 61 // |num_packets_received_not_in_order| should be set to 1, and all other |
| 62 // counts |
| 63 // should be zero. |
| 64 // (iii) If packet with sequence number 2 is received again, |
| 65 // |num_packets_received_not_in_order| should be set to 1, and all other |
| 66 // counts |
| 67 // should be zero. |
| 68 // (iv) If packet with sequence number 10 is received, |
| 69 // |num_packets_received_in_order| should be set to 1, |num_packets_lost| |
| 70 // should be set to 4, and |num_packets_received_not_in_order| should be set |
| 71 // to zero. |
| 72 virtual void OnUpdatedPacketCountAvailable( |
| 73 Protocol protocol, |
| 74 uint64_t num_packets_lost, |
| 75 uint64_t num_packets_received_in_order, |
| 76 uint64_t num_packets_received_not_in_order) = 0; |
| 77 |
45 protected: | 78 protected: |
46 SocketPerformanceWatcherFactory() {} | 79 SocketPerformanceWatcherFactory() {} |
47 | 80 |
48 private: | 81 private: |
49 DISALLOW_COPY_AND_ASSIGN(SocketPerformanceWatcherFactory); | 82 DISALLOW_COPY_AND_ASSIGN(SocketPerformanceWatcherFactory); |
50 }; | 83 }; |
51 | 84 |
52 } // namespace net | 85 } // namespace net |
53 | 86 |
54 #endif // NET_BASE_SOCKET_PERFORMANCE_WATCHER_FACTORY_H_ | 87 #endif // NET_BASE_SOCKET_PERFORMANCE_WATCHER_FACTORY_H_ |
OLD | NEW |