OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // A test only class to enable simulations of send algorithms. | 5 // A test only class to enable simulations of send algorithms. |
6 | 6 |
7 #ifndef NET_QUIC_CONGESTION_CONTROL_SEND_ALGORITHM_SIMULATOR_H_ | 7 #ifndef NET_QUIC_CONGESTION_CONTROL_SEND_ALGORITHM_SIMULATOR_H_ |
8 #define NET_QUIC_CONGESTION_CONTROL_SEND_ALGORITHM_SIMULATOR_H_ | 8 #define NET_QUIC_CONGESTION_CONTROL_SEND_ALGORITHM_SIMULATOR_H_ |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 Sender* sender; | 83 Sender* sender; |
84 QuicByteCount num_bytes; | 84 QuicByteCount num_bytes; |
85 QuicByteCount bytes_acked; | 85 QuicByteCount bytes_acked; |
86 QuicByteCount bytes_lost; | 86 QuicByteCount bytes_lost; |
87 QuicByteCount bytes_in_flight; | 87 QuicByteCount bytes_in_flight; |
88 QuicTime start_time; | 88 QuicTime start_time; |
89 }; | 89 }; |
90 | 90 |
91 struct SentPacket { | 91 struct SentPacket { |
| 92 SentPacket() |
| 93 : sequence_number(0), |
| 94 send_time(QuicTime::Zero()), |
| 95 ack_time(QuicTime::Zero()), |
| 96 lost(false), |
| 97 transfer(NULL) {} |
92 SentPacket(QuicPacketSequenceNumber sequence_number, | 98 SentPacket(QuicPacketSequenceNumber sequence_number, |
93 QuicTime send_time, | 99 QuicTime send_time, |
94 QuicTime ack_time, | 100 QuicTime ack_time, |
| 101 bool lost, |
95 Transfer* transfer) | 102 Transfer* transfer) |
96 : sequence_number(sequence_number), | 103 : sequence_number(sequence_number), |
97 send_time(send_time), | 104 send_time(send_time), |
98 ack_time(ack_time), | 105 ack_time(ack_time), |
| 106 lost(lost), |
99 transfer(transfer) {} | 107 transfer(transfer) {} |
100 | 108 |
101 QuicPacketSequenceNumber sequence_number; | 109 QuicPacketSequenceNumber sequence_number; |
102 QuicTime send_time; | 110 QuicTime send_time; |
103 QuicTime ack_time; | 111 QuicTime ack_time; |
| 112 bool lost; |
104 Transfer* transfer; | 113 Transfer* transfer; |
105 }; | 114 }; |
106 | 115 |
107 // |rtt_stats| should be the same RttStats used by the |send_algorithm|. | 116 // |rtt_stats| should be the same RttStats used by the |send_algorithm|. |
108 SendAlgorithmSimulator(MockClock* clock_, | 117 SendAlgorithmSimulator(MockClock* clock_, |
109 QuicBandwidth bandwidth, | 118 QuicBandwidth bandwidth, |
110 QuicTime::Delta rtt); | 119 QuicTime::Delta rtt); |
111 ~SendAlgorithmSimulator(); | 120 ~SendAlgorithmSimulator(); |
112 | 121 |
113 void set_bandwidth(QuicBandwidth bandwidth) { | 122 void set_bandwidth(QuicBandwidth bandwidth) { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 QuicTime::Delta rtt_; | 222 QuicTime::Delta rtt_; |
214 size_t buffer_size_; // In bytes. | 223 size_t buffer_size_; // In bytes. |
215 QuicTime::Delta delayed_ack_timer_; | 224 QuicTime::Delta delayed_ack_timer_; |
216 | 225 |
217 DISALLOW_COPY_AND_ASSIGN(SendAlgorithmSimulator); | 226 DISALLOW_COPY_AND_ASSIGN(SendAlgorithmSimulator); |
218 }; | 227 }; |
219 | 228 |
220 } // namespace net | 229 } // namespace net |
221 | 230 |
222 #endif // NET_QUIC_CONGESTION_CONTROL_SEND_ALGORITHM_SIMULATOR_H_ | 231 #endif // NET_QUIC_CONGESTION_CONTROL_SEND_ALGORITHM_SIMULATOR_H_ |
OLD | NEW |