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

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

Issue 2192633002: Switch to PacketNumberQueue interval iteration and avoid allocations in new ACK frame generation. G… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@128431128
Patch Set: Rebase Created 4 years, 4 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_protocol.h ('k') | net/quic/quic_protocol_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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_protocol.h" 5 #include "net/quic/quic_protocol.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "net/quic/quic_flags.h" 9 #include "net/quic/quic_flags.h"
10 #include "net/quic/quic_utils.h" 10 #include "net/quic/quic_utils.h"
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 if (!packet_number_intervals_.Contains(packet_number)) { 557 if (!packet_number_intervals_.Contains(packet_number)) {
558 return end(); 558 return end();
559 } 559 }
560 IntervalSet<QuicPacketNumber>::const_iterator it = 560 IntervalSet<QuicPacketNumber>::const_iterator it =
561 packet_number_intervals_.Find(packet_number); 561 packet_number_intervals_.Find(packet_number);
562 first = packet_number; 562 first = packet_number;
563 last = packet_number_intervals_.rbegin()->max(); 563 last = packet_number_intervals_.rbegin()->max();
564 return const_iterator(it, first, last); 564 return const_iterator(it, first, last);
565 } 565 }
566 566
567 PacketNumberQueue::const_interval_iterator PacketNumberQueue::begin_intervals()
568 const {
569 return packet_number_intervals_.begin();
570 }
571
572 PacketNumberQueue::const_interval_iterator PacketNumberQueue::end_intervals()
573 const {
574 return packet_number_intervals_.end();
575 }
576
577 PacketNumberQueue::const_reverse_interval_iterator
578 PacketNumberQueue::rbegin_intervals() const {
579 return packet_number_intervals_.rbegin();
580 }
581
582 PacketNumberQueue::const_reverse_interval_iterator
583 PacketNumberQueue::rend_intervals() const {
584 return packet_number_intervals_.rend();
585 }
586
567 ostream& operator<<(ostream& os, const PacketNumberQueue& q) { 587 ostream& operator<<(ostream& os, const PacketNumberQueue& q) {
568 for (QuicPacketNumber packet_number : q) { 588 for (QuicPacketNumber packet_number : q) {
569 os << packet_number << " "; 589 os << packet_number << " ";
570 } 590 }
571 return os; 591 return os;
572 } 592 }
573 593
574 ostream& operator<<(ostream& os, const QuicAckFrame& ack_frame) { 594 ostream& operator<<(ostream& os, const QuicAckFrame& ack_frame) {
575 os << "{ entropy_hash: " << static_cast<int>(ack_frame.entropy_hash) 595 os << "{ entropy_hash: " << static_cast<int>(ack_frame.entropy_hash)
576 << ", largest_observed: " << ack_frame.largest_observed 596 << ", largest_observed: " << ack_frame.largest_observed
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
865 is_unackable(false), 885 is_unackable(false),
866 has_crypto_handshake(has_crypto_handshake), 886 has_crypto_handshake(has_crypto_handshake),
867 num_padding_bytes(num_padding_bytes), 887 num_padding_bytes(num_padding_bytes),
868 retransmission(0) {} 888 retransmission(0) {}
869 889
870 TransmissionInfo::TransmissionInfo(const TransmissionInfo& other) = default; 890 TransmissionInfo::TransmissionInfo(const TransmissionInfo& other) = default;
871 891
872 TransmissionInfo::~TransmissionInfo() {} 892 TransmissionInfo::~TransmissionInfo() {}
873 893
874 } // namespace net 894 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_protocol.h ('k') | net/quic/quic_protocol_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698