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

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

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 #include "net/quic/congestion_control/send_algorithm_simulator.h" 5 #include "net/quic/congestion_control/send_algorithm_simulator.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/rand_util.h" 10 #include "base/rand_util.h"
11 #include "net/quic/crypto/quic_random.h" 11 #include "net/quic/crypto/quic_random.h"
12 12
13 using std::list; 13 using std::list;
14 using std::make_pair;
15 using std::max; 14 using std::max;
16 using std::min; 15 using std::min;
17 using std::string; 16 using std::string;
18 using std::vector; 17 using std::vector;
19 18
20 namespace net { 19 namespace net {
21 20
22 namespace { 21 namespace {
23 22
24 const QuicByteCount kPacketSize = 1200; 23 const QuicByteCount kPacketSize = 1200;
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 info.in_flight = true; 282 info.in_flight = true;
284 // Find the next SentPacket for this transfer. 283 // Find the next SentPacket for this transfer.
285 while (it->transfer != transfer) { 284 while (it->transfer != transfer) {
286 DCHECK(it != sent_packets_.end()); 285 DCHECK(it != sent_packets_.end());
287 ++it; 286 ++it;
288 } 287 }
289 // If it's missing from the array, it's a loss. 288 // If it's missing from the array, it's a loss.
290 if (it->sequence_number > sender->last_acked) { 289 if (it->sequence_number > sender->last_acked) {
291 DVLOG(1) << "Lost packet:" << sender->last_acked 290 DVLOG(1) << "Lost packet:" << sender->last_acked
292 << " dropped by buffer overflow."; 291 << " dropped by buffer overflow.";
293 lost_packets.push_back(make_pair(sender->last_acked, info)); 292 lost_packets.push_back(std::make_pair(sender->last_acked, info));
294 continue; 293 continue;
295 } 294 }
296 if (it->lost) { 295 if (it->lost) {
297 lost_packets.push_back(make_pair(sender->last_acked, info)); 296 lost_packets.push_back(std::make_pair(sender->last_acked, info));
298 } else { 297 } else {
299 acked_packets.push_back(make_pair(sender->last_acked, info)); 298 acked_packets.push_back(std::make_pair(sender->last_acked, info));
300 } 299 }
301 // This packet has been acked or lost, remove it from sent_packets_. 300 // This packet has been acked or lost, remove it from sent_packets_.
302 largest_observed = *it; 301 largest_observed = *it;
303 sent_packets_.erase(it++); 302 sent_packets_.erase(it++);
304 } 303 }
305 304
306 DCHECK(!largest_observed.lost); 305 DCHECK(!largest_observed.lost);
307 DVLOG(1) << "Updating RTT from send_time:" 306 DVLOG(1) << "Updating RTT from send_time:"
308 << largest_observed.send_time.ToDebuggingValue() << " to ack_time:" 307 << largest_observed.send_time.ToDebuggingValue() << " to ack_time:"
309 << largest_observed.ack_time.ToDebuggingValue(); 308 << largest_observed.ack_time.ToDebuggingValue();
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 } 386 }
388 transfer->bytes_in_flight += kPacketSize; 387 transfer->bytes_in_flight += kPacketSize;
389 } 388 }
390 389
391 // Advance the time by |delta| without sending anything. 390 // Advance the time by |delta| without sending anything.
392 void SendAlgorithmSimulator::AdvanceTime(QuicTime::Delta delta) { 391 void SendAlgorithmSimulator::AdvanceTime(QuicTime::Delta delta) {
393 clock_->AdvanceTime(delta); 392 clock_->AdvanceTime(delta);
394 } 393 }
395 394
396 } // namespace net 395 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/congestion_control/receive_algorithm_interface.cc ('k') | net/quic/congestion_control/tcp_cubic_sender_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698