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

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

Issue 992733002: Remove //net (except for Android test stuff) and sdch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "net/quic/quic_ack_notifier.h"
6
7 #include <set>
8
9 #include "base/logging.h"
10 #include "base/stl_util.h"
11
12 using base::hash_map;
13 using std::make_pair;
14
15 namespace net {
16
17 QuicAckNotifier::DelegateInterface::DelegateInterface() {}
18
19 QuicAckNotifier::DelegateInterface::~DelegateInterface() {}
20
21 QuicAckNotifier::QuicAckNotifier(DelegateInterface* delegate)
22 : delegate_(delegate),
23 unacked_packets_(0),
24 retransmitted_packet_count_(0),
25 retransmitted_byte_count_(0) {
26 DCHECK(delegate);
27 }
28
29 QuicAckNotifier::~QuicAckNotifier() {
30 }
31
32 void QuicAckNotifier::OnSerializedPacket() {
33 ++unacked_packets_;
34 }
35
36 bool QuicAckNotifier::OnAck(QuicTime::Delta delta_largest_observed) {
37 if (unacked_packets_ <= 0) {
38 LOG(DFATAL) << "Acked more packets than were tracked."
39 << " unacked_packets:" << unacked_packets_;
40 return true;
41 }
42 --unacked_packets_;
43 if (!HasUnackedPackets()) {
44 // We have seen all the sequence numbers we were waiting for, trigger
45 // callback notification.
46 delegate_->OnAckNotification(retransmitted_packet_count_,
47 retransmitted_byte_count_,
48 delta_largest_observed);
49 return true;
50 }
51 return false;
52 }
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
64 void QuicAckNotifier::OnPacketRetransmitted(int packet_payload_size) {
65 ++retransmitted_packet_count_;
66 retransmitted_byte_count_ += packet_payload_size;
67 }
68
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