Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Side by Side Diff: net/quic/congestion_control/send_algorithm_simulator.h

Issue 968233004: Land Recent QUIC Changes until 03/02/2015. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cleanup
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 bool lost; 115 bool lost;
116 Transfer* transfer; 116 Transfer* transfer;
117 }; 117 };
118 118
119 // |rtt_stats| should be the same RttStats used by the |send_algorithm|. 119 // |rtt_stats| should be the same RttStats used by the |send_algorithm|.
120 SendAlgorithmSimulator(MockClock* clock_, 120 SendAlgorithmSimulator(MockClock* clock_,
121 QuicBandwidth bandwidth, 121 QuicBandwidth bandwidth,
122 QuicTime::Delta rtt); 122 QuicTime::Delta rtt);
123 ~SendAlgorithmSimulator(); 123 ~SendAlgorithmSimulator();
124 124
125 // For local ad-hoc testing.
125 void set_bandwidth(QuicBandwidth bandwidth) { 126 void set_bandwidth(QuicBandwidth bandwidth) {
126 bandwidth_ = bandwidth; 127 bandwidth_ = bandwidth;
127 } 128 }
128 129
129 void set_forward_loss_rate(float loss_rate) { 130 void set_forward_loss_rate(float loss_rate) {
130 DCHECK_LT(loss_rate, 1.0f); 131 DCHECK_LT(loss_rate, 1.0f);
131 forward_loss_rate_ = loss_rate; 132 forward_loss_rate_ = loss_rate;
132 } 133 }
133 134
135 // For local ad-hoc testing.
134 void set_reverse_loss_rate(float loss_rate) { 136 void set_reverse_loss_rate(float loss_rate) {
135 DCHECK_LT(loss_rate, 1.0f); 137 DCHECK_LT(loss_rate, 1.0f);
136 reverse_loss_rate_ = loss_rate; 138 reverse_loss_rate_ = loss_rate;
137 } 139 }
138 140
141 // For local ad-hoc testing.
139 void set_loss_correlation(float loss_correlation) { 142 void set_loss_correlation(float loss_correlation) {
140 DCHECK_LT(loss_correlation, 1.0f); 143 DCHECK_LT(loss_correlation, 1.0f);
141 loss_correlation_ = loss_correlation; 144 loss_correlation_ = loss_correlation;
142 } 145 }
143 146
144 void set_buffer_size(size_t buffer_size_bytes) { 147 void set_buffer_size(size_t buffer_size_bytes) {
145 buffer_size_ = buffer_size_bytes; 148 buffer_size_ = buffer_size_bytes;
146 } 149 }
147 150
148 void set_delayed_ack_timer(QuicTime::Delta delayed_ack_timer) { 151 void set_delayed_ack_timer(QuicTime::Delta delayed_ack_timer) {
149 delayed_ack_timer_ = delayed_ack_timer; 152 delayed_ack_timer_ = delayed_ack_timer;
150 } 153 }
151 154
152 // Advance the time by |delta| without sending anything. 155 // Advance the time by |delta| without sending anything.
156 // For local ad-hoc testing.
153 void AdvanceTime(QuicTime::Delta delta); 157 void AdvanceTime(QuicTime::Delta delta);
154 158
155 // Adds a pending sender. The send will run when TransferBytes is called. 159 // Adds a pending sender. The send will run when TransferBytes is called.
156 // Adding two transfers with the same sender is unsupported. 160 // Adding two transfers with the same sender is unsupported.
157 void AddTransfer(Sender* sender, size_t num_bytes); 161 void AddTransfer(Sender* sender, size_t num_bytes);
158 162
159 // Adds a pending sending to start at the specified time. 163 // Adds a pending sending to start at the specified time.
160 void AddTransfer(Sender* sender, 164 void AddTransfer(Sender* sender,
161 size_t num_bytes, 165 size_t num_bytes,
162 QuicTime start_time, 166 QuicTime start_time,
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 QuicTime::Delta rtt_; 232 QuicTime::Delta rtt_;
229 size_t buffer_size_; // In bytes. 233 size_t buffer_size_; // In bytes.
230 QuicTime::Delta delayed_ack_timer_; 234 QuicTime::Delta delayed_ack_timer_;
231 235
232 DISALLOW_COPY_AND_ASSIGN(SendAlgorithmSimulator); 236 DISALLOW_COPY_AND_ASSIGN(SendAlgorithmSimulator);
233 }; 237 };
234 238
235 } // namespace net 239 } // namespace net
236 240
237 #endif // NET_QUIC_CONGESTION_CONTROL_SEND_ALGORITHM_SIMULATOR_H_ 241 #endif // NET_QUIC_CONGESTION_CONTROL_SEND_ALGORITHM_SIMULATOR_H_
OLDNEW
« no previous file with comments | « net/quic/congestion_control/send_algorithm_interface.cc ('k') | net/quic/congestion_control/send_algorithm_simulator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698