OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_ack_notifier.h" | 5 #include "net/quic/quic_ack_notifier.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 DCHECK(delegate); | 26 DCHECK(delegate); |
27 } | 27 } |
28 | 28 |
29 QuicAckNotifier::~QuicAckNotifier() { | 29 QuicAckNotifier::~QuicAckNotifier() { |
30 } | 30 } |
31 | 31 |
32 void QuicAckNotifier::OnSerializedPacket() { | 32 void QuicAckNotifier::OnSerializedPacket() { |
33 ++unacked_packets_; | 33 ++unacked_packets_; |
34 } | 34 } |
35 | 35 |
36 bool QuicAckNotifier::OnAck(QuicPacketSequenceNumber sequence_number, | 36 bool QuicAckNotifier::OnAck(QuicTime::Delta delta_largest_observed) { |
37 QuicTime::Delta delta_largest_observed) { | |
38 if (unacked_packets_ <= 0) { | 37 if (unacked_packets_ <= 0) { |
39 LOG(DFATAL) << "Acked more packets than were tracked." | 38 LOG(DFATAL) << "Acked more packets than were tracked." |
40 << " unacked_packets:" << unacked_packets_; | 39 << " unacked_packets:" << unacked_packets_; |
41 return true; | 40 return true; |
42 } | 41 } |
43 --unacked_packets_; | 42 --unacked_packets_; |
44 if (!HasUnackedPackets()) { | 43 if (!HasUnackedPackets()) { |
45 // We have seen all the sequence numbers we were waiting for, trigger | 44 // We have seen all the sequence numbers we were waiting for, trigger |
46 // callback notification. | 45 // callback notification. |
47 delegate_->OnAckNotification(retransmitted_packet_count_, | 46 delegate_->OnAckNotification(retransmitted_packet_count_, |
(...skipping 13 matching lines...) Expand all Loading... |
61 --unacked_packets_; | 60 --unacked_packets_; |
62 return unacked_packets_ == 0; | 61 return unacked_packets_ == 0; |
63 } | 62 } |
64 | 63 |
65 void QuicAckNotifier::OnPacketRetransmitted(int packet_payload_size) { | 64 void QuicAckNotifier::OnPacketRetransmitted(int packet_payload_size) { |
66 ++retransmitted_packet_count_; | 65 ++retransmitted_packet_count_; |
67 retransmitted_byte_count_ += packet_payload_size; | 66 retransmitted_byte_count_ += packet_payload_size; |
68 } | 67 } |
69 | 68 |
70 }; // namespace net | 69 }; // namespace net |
OLD | NEW |