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

Side by Side Diff: net/quic/quic_ack_notifier.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
« no previous file with comments | « net/quic/quic_ack_notifier.h ('k') | net/quic/quic_ack_notifier_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 11 matching lines...) Expand all
22 : delegate_(delegate), 22 : delegate_(delegate),
23 unacked_packets_(0), 23 unacked_packets_(0),
24 retransmitted_packet_count_(0), 24 retransmitted_packet_count_(0),
25 retransmitted_byte_count_(0) { 25 retransmitted_byte_count_(0) {
26 DCHECK(delegate); 26 DCHECK(delegate);
27 } 27 }
28 28
29 QuicAckNotifier::~QuicAckNotifier() { 29 QuicAckNotifier::~QuicAckNotifier() {
30 } 30 }
31 31
32 void QuicAckNotifier::AddSequenceNumber( 32 void QuicAckNotifier::OnSerializedPacket() {
33 const QuicPacketSequenceNumber& sequence_number,
34 int packet_payload_size) {
35 ++unacked_packets_; 33 ++unacked_packets_;
36 DVLOG(1) << "AckNotifier waiting for packet: " << sequence_number;
37 } 34 }
38 35
39 bool QuicAckNotifier::OnAck(QuicPacketSequenceNumber sequence_number, 36 bool QuicAckNotifier::OnAck(QuicTime::Delta delta_largest_observed) {
40 QuicTime::Delta delta_largest_observed) {
41 if (unacked_packets_ <= 0) { 37 if (unacked_packets_ <= 0) {
42 LOG(DFATAL) << "Acked more packets than were tracked."; 38 LOG(DFATAL) << "Acked more packets than were tracked."
39 << " unacked_packets:" << unacked_packets_;
43 return true; 40 return true;
44 } 41 }
45 --unacked_packets_; 42 --unacked_packets_;
46 if (IsEmpty()) { 43 if (!HasUnackedPackets()) {
47 // 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
48 // callback notification. 45 // callback notification.
49 delegate_->OnAckNotification(retransmitted_packet_count_, 46 delegate_->OnAckNotification(retransmitted_packet_count_,
50 retransmitted_byte_count_, 47 retransmitted_byte_count_,
51 delta_largest_observed); 48 delta_largest_observed);
52 return true; 49 return true;
53 } 50 }
54 return false; 51 return false;
55 } 52 }
56 53
54 bool QuicAckNotifier::OnPacketAbandoned() {
55 if (unacked_packets_ <= 0) {
56 LOG(DFATAL) << "Abandoned more packets than were tracked."
57 << " unacked_packets:" << unacked_packets_;
58 return true;
59 }
60 --unacked_packets_;
61 return unacked_packets_ == 0;
62 }
63
57 void QuicAckNotifier::OnPacketRetransmitted(int packet_payload_size) { 64 void QuicAckNotifier::OnPacketRetransmitted(int packet_payload_size) {
58 ++retransmitted_packet_count_; 65 ++retransmitted_packet_count_;
59 retransmitted_byte_count_ += packet_payload_size; 66 retransmitted_byte_count_ += packet_payload_size;
60 } 67 }
61 68
62 }; // namespace net 69 }; // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_ack_notifier.h ('k') | net/quic/quic_ack_notifier_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698