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

Side by Side Diff: net/quic/quic_unacked_packet_map.cc

Issue 1428303003: No functional change. Minor change to reorder when the list of QuicAckListeners is swapped into th… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/quic_unacked_packet_map.h" 5 #include "net/quic/quic_unacked_packet_map.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "net/quic/quic_connection_stats.h" 9 #include "net/quic/quic_connection_stats.h"
10 #include "net/quic/quic_flags.h" 10 #include "net/quic/quic_flags.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 LOG_IF(DFATAL, largest_sent_packet_ >= packet_number) << packet_number; 44 LOG_IF(DFATAL, largest_sent_packet_ >= packet_number) << packet_number;
45 DCHECK_GE(packet_number, least_unacked_ + unacked_packets_.size()); 45 DCHECK_GE(packet_number, least_unacked_ + unacked_packets_.size());
46 while (least_unacked_ + unacked_packets_.size() < packet_number) { 46 while (least_unacked_ + unacked_packets_.size() < packet_number) {
47 unacked_packets_.push_back(TransmissionInfo()); 47 unacked_packets_.push_back(TransmissionInfo());
48 unacked_packets_.back().is_unackable = true; 48 unacked_packets_.back().is_unackable = true;
49 } 49 }
50 50
51 TransmissionInfo info(packet->retransmittable_frames, 51 TransmissionInfo info(packet->retransmittable_frames,
52 packet->packet_number_length, transmission_type, 52 packet->packet_number_length, transmission_type,
53 sent_time, bytes_sent, packet->is_fec_packet); 53 sent_time, bytes_sent, packet->is_fec_packet);
54 if (old_packet_number == 0) { 54 if (old_packet_number > 0) {
55 if (packet->retransmittable_frames != nullptr &&
56 packet->retransmittable_frames->HasCryptoHandshake() == IS_HANDSHAKE) {
57 ++pending_crypto_packet_count_;
58 }
59 info.ack_listeners.swap(packet->listeners);
60 } else {
61 TransferRetransmissionInfo(old_packet_number, packet_number, 55 TransferRetransmissionInfo(old_packet_number, packet_number,
62 transmission_type, &info); 56 transmission_type, &info);
63 } 57 }
64 58
65 largest_sent_packet_ = packet_number; 59 largest_sent_packet_ = packet_number;
66 if (set_in_flight) { 60 if (set_in_flight) {
67 bytes_in_flight_ += bytes_sent; 61 bytes_in_flight_ += bytes_sent;
68 info.in_flight = true; 62 info.in_flight = true;
69 } 63 }
70 unacked_packets_.push_back(info); 64 unacked_packets_.push_back(info);
65 // Swap the ack listeners after to avoid an extra list allocation.
66 // TODO(ianswett): Could use emplace_back when Chromium can.
67 if (old_packet_number == 0) {
68 if (packet->retransmittable_frames != nullptr &&
69 packet->retransmittable_frames->HasCryptoHandshake() == IS_HANDSHAKE) {
70 ++pending_crypto_packet_count_;
71 }
72 unacked_packets_.back().ack_listeners.swap(packet->listeners);
73 }
71 } 74 }
72 75
73 void QuicUnackedPacketMap::RemoveObsoletePackets() { 76 void QuicUnackedPacketMap::RemoveObsoletePackets() {
74 while (!unacked_packets_.empty()) { 77 while (!unacked_packets_.empty()) {
75 if (!IsPacketUseless(least_unacked_, unacked_packets_.front())) { 78 if (!IsPacketUseless(least_unacked_, unacked_packets_.front())) {
76 break; 79 break;
77 } 80 }
78 81
79 unacked_packets_.pop_front(); 82 unacked_packets_.pop_front();
80 ++least_unacked_; 83 ++least_unacked_;
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 } 365 }
363 } 366 }
364 return false; 367 return false;
365 } 368 }
366 369
367 QuicPacketNumber QuicUnackedPacketMap::GetLeastUnacked() const { 370 QuicPacketNumber QuicUnackedPacketMap::GetLeastUnacked() const {
368 return least_unacked_; 371 return least_unacked_;
369 } 372 }
370 373
371 } // namespace net 374 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698