| 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 #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_bug_tracker.h" | 9 #include "net/quic/quic_bug_tracker.h" | 
| 10 #include "net/quic/quic_connection_stats.h" | 10 #include "net/quic/quic_connection_stats.h" | 
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 55     TransferRetransmissionInfo(old_packet_number, packet_number, | 55     TransferRetransmissionInfo(old_packet_number, packet_number, | 
| 56                                transmission_type, &info); | 56                                transmission_type, &info); | 
| 57   } | 57   } | 
| 58 | 58 | 
| 59   largest_sent_packet_ = packet_number; | 59   largest_sent_packet_ = packet_number; | 
| 60   if (set_in_flight) { | 60   if (set_in_flight) { | 
| 61     bytes_in_flight_ += bytes_sent; | 61     bytes_in_flight_ += bytes_sent; | 
| 62     info.in_flight = true; | 62     info.in_flight = true; | 
| 63   } | 63   } | 
| 64   unacked_packets_.push_back(info); | 64   unacked_packets_.push_back(info); | 
| 65   // Swap the ack listeners after to avoid an extra list allocation. | 65   // Swap the ack listeners and retransmittable frames to avoid allocations. | 
| 66   // TODO(ianswett): Could use emplace_back when Chromium can. | 66   // TODO(ianswett): Could use emplace_back when Chromium can. | 
| 67   if (old_packet_number == 0) { | 67   if (old_packet_number == 0) { | 
| 68     if (has_crypto_handshake) { | 68     if (has_crypto_handshake) { | 
| 69       ++pending_crypto_packet_count_; | 69       ++pending_crypto_packet_count_; | 
| 70     } | 70     } | 
| 71     if (packet->retransmittable_frames != nullptr) { | 71 | 
| 72       packet->retransmittable_frames->swap( | 72     packet->retransmittable_frames.swap( | 
| 73           unacked_packets_.back().retransmittable_frames); | 73         unacked_packets_.back().retransmittable_frames); | 
| 74       delete packet->retransmittable_frames; |  | 
| 75       packet->retransmittable_frames = nullptr; |  | 
| 76     } |  | 
| 77     unacked_packets_.back().ack_listeners.swap(packet->listeners); | 74     unacked_packets_.back().ack_listeners.swap(packet->listeners); | 
| 78   } | 75   } | 
| 79 } | 76 } | 
| 80 | 77 | 
| 81 void QuicUnackedPacketMap::RemoveObsoletePackets() { | 78 void QuicUnackedPacketMap::RemoveObsoletePackets() { | 
| 82   while (!unacked_packets_.empty()) { | 79   while (!unacked_packets_.empty()) { | 
| 83     if (!IsPacketUseless(least_unacked_, unacked_packets_.front())) { | 80     if (!IsPacketUseless(least_unacked_, unacked_packets_.front())) { | 
| 84       break; | 81       break; | 
| 85     } | 82     } | 
| 86 | 83 | 
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 352     } | 349     } | 
| 353   } | 350   } | 
| 354   return false; | 351   return false; | 
| 355 } | 352 } | 
| 356 | 353 | 
| 357 QuicPacketNumber QuicUnackedPacketMap::GetLeastUnacked() const { | 354 QuicPacketNumber QuicUnackedPacketMap::GetLeastUnacked() const { | 
| 358   return least_unacked_; | 355   return least_unacked_; | 
| 359 } | 356 } | 
| 360 | 357 | 
| 361 }  // namespace net | 358 }  // namespace net | 
| OLD | NEW | 
|---|