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_connection_stats.h" | 9 #include "net/quic/quic_connection_stats.h" |
10 #include "net/quic/quic_utils_chromium.h" | 10 #include "net/quic/quic_utils_chromium.h" |
11 | 11 |
12 using std::max; | 12 using std::max; |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 | 15 |
16 #define ENDPOINT (is_server_ ? "Server: " : " Client: ") | |
17 | |
18 QuicUnackedPacketMap::TransmissionInfo::TransmissionInfo() | 16 QuicUnackedPacketMap::TransmissionInfo::TransmissionInfo() |
19 : retransmittable_frames(NULL), | 17 : retransmittable_frames(NULL), |
20 sequence_number_length(PACKET_1BYTE_SEQUENCE_NUMBER), | 18 sequence_number_length(PACKET_1BYTE_SEQUENCE_NUMBER), |
21 sent_time(QuicTime::Zero()), | 19 sent_time(QuicTime::Zero()), |
22 bytes_sent(0), | 20 bytes_sent(0), |
23 nack_count(0), | 21 nack_count(0), |
24 all_transmissions(NULL), | 22 all_transmissions(NULL), |
25 pending(false) { } | 23 pending(false) { } |
26 | 24 |
27 QuicUnackedPacketMap::TransmissionInfo::TransmissionInfo( | 25 QuicUnackedPacketMap::TransmissionInfo::TransmissionInfo( |
(...skipping 18 matching lines...) Expand all Loading... |
46 : retransmittable_frames(retransmittable_frames), | 44 : retransmittable_frames(retransmittable_frames), |
47 sequence_number_length(sequence_number_length), | 45 sequence_number_length(sequence_number_length), |
48 sent_time(QuicTime::Zero()), | 46 sent_time(QuicTime::Zero()), |
49 bytes_sent(0), | 47 bytes_sent(0), |
50 nack_count(0), | 48 nack_count(0), |
51 all_transmissions(all_transmissions), | 49 all_transmissions(all_transmissions), |
52 pending(false) { | 50 pending(false) { |
53 all_transmissions->insert(sequence_number); | 51 all_transmissions->insert(sequence_number); |
54 } | 52 } |
55 | 53 |
56 QuicUnackedPacketMap::QuicUnackedPacketMap(bool is_server) | 54 QuicUnackedPacketMap::QuicUnackedPacketMap() |
57 : largest_sent_packet_(0), | 55 : largest_sent_packet_(0), |
58 bytes_in_flight_(0), | 56 bytes_in_flight_(0) { |
59 is_server_(is_server) { | |
60 } | 57 } |
61 | 58 |
62 QuicUnackedPacketMap::~QuicUnackedPacketMap() { | 59 QuicUnackedPacketMap::~QuicUnackedPacketMap() { |
63 for (UnackedPacketMap::iterator it = unacked_packets_.begin(); | 60 for (UnackedPacketMap::iterator it = unacked_packets_.begin(); |
64 it != unacked_packets_.end(); ++it) { | 61 it != unacked_packets_.end(); ++it) { |
65 delete it->second.retransmittable_frames; | 62 delete it->second.retransmittable_frames; |
66 // Only delete all_transmissions once, for the newest packet. | 63 // Only delete all_transmissions once, for the newest packet. |
67 if (it->first == *it->second.all_transmissions->rbegin()) { | 64 if (it->first == *it->second.all_transmissions->rbegin()) { |
68 delete it->second.all_transmissions; | 65 delete it->second.all_transmissions; |
69 } | 66 } |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 DCHECK(!it->second.pending); | 332 DCHECK(!it->second.pending); |
336 | 333 |
337 largest_sent_packet_ = max(sequence_number, largest_sent_packet_); | 334 largest_sent_packet_ = max(sequence_number, largest_sent_packet_); |
338 bytes_in_flight_ += bytes_sent; | 335 bytes_in_flight_ += bytes_sent; |
339 it->second.sent_time = sent_time; | 336 it->second.sent_time = sent_time; |
340 it->second.bytes_sent = bytes_sent; | 337 it->second.bytes_sent = bytes_sent; |
341 it->second.pending = true; | 338 it->second.pending = true; |
342 } | 339 } |
343 | 340 |
344 } // namespace net | 341 } // namespace net |
OLD | NEW |