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

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

Issue 23464033: Land Recent QUIC changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix valgrind error Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_ack_notifier.h ('k') | net/quic/quic_ack_notifier_test.cc » ('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 (c) 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 namespace net {
8
9 QuicAckNotifier::DelegateInterface::DelegateInterface() {}
10
11 QuicAckNotifier::DelegateInterface::~DelegateInterface() {}
12
13 QuicAckNotifier::QuicAckNotifier(DelegateInterface* delegate)
14 : delegate_(delegate) {
15 DCHECK(delegate_);
16 }
17
18 QuicAckNotifier::~QuicAckNotifier() {}
19
20 void QuicAckNotifier::AddSequenceNumber(
21 const QuicPacketSequenceNumber& sequence_number) {
22 sequence_numbers_.insert(sequence_number);
23 }
24
25 void QuicAckNotifier::AddSequenceNumbers(
26 const SequenceNumberSet& sequence_numbers) {
27 for (SequenceNumberSet::const_iterator it = sequence_numbers.begin();
28 it != sequence_numbers.end(); ++it) {
29 AddSequenceNumber(*it);
30 }
31 }
32
33 bool QuicAckNotifier::OnAck(SequenceNumberSet sequence_numbers) {
34 // If the set of sequence numbers we are tracking is empty then this
35 // QuicAckNotifier should have already been deleted.
36 DCHECK(!sequence_numbers_.empty());
37
38 for (SequenceNumberSet::iterator it = sequence_numbers.begin();
39 it != sequence_numbers.end(); ++it) {
40 sequence_numbers_.erase(*it);
41 if (sequence_numbers_.empty()) {
42 delegate_->OnAckNotification();
43 return true;
44 }
45 }
46 return false;
47 }
48
49 void QuicAckNotifier::UpdateSequenceNumber(
50 QuicPacketSequenceNumber old_sequence_number,
51 QuicPacketSequenceNumber new_sequence_number) {
52 sequence_numbers_.erase(old_sequence_number);
53 sequence_numbers_.insert(new_sequence_number);
54 }
55
56 }; // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_ack_notifier.h ('k') | net/quic/quic_ack_notifier_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698