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

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

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_framer.cc ('k') | net/quic/quic_protocol.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 #ifndef NET_QUIC_QUIC_PROTOCOL_H_ 5 #ifndef NET_QUIC_QUIC_PROTOCOL_H_
6 #define NET_QUIC_QUIC_PROTOCOL_H_ 6 #define NET_QUIC_QUIC_PROTOCOL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 876 matching lines...) Expand 10 before | Expand all | Expand 10 after
887 QuicPacketEntropyHash entropy_hash; 887 QuicPacketEntropyHash entropy_hash;
888 // The lowest packet we've sent which is unacked, and we expect an ack for. 888 // The lowest packet we've sent which is unacked, and we expect an ack for.
889 QuicPacketNumber least_unacked; 889 QuicPacketNumber least_unacked;
890 }; 890 };
891 891
892 // A sequence of packet numbers where each number is unique. Intended to be used 892 // A sequence of packet numbers where each number is unique. Intended to be used
893 // in a sliding window fashion, where smaller old packet numbers are removed and 893 // in a sliding window fashion, where smaller old packet numbers are removed and
894 // larger new packet numbers are added, with the occasional random access. 894 // larger new packet numbers are added, with the occasional random access.
895 class NET_EXPORT_PRIVATE PacketNumberQueue { 895 class NET_EXPORT_PRIVATE PacketNumberQueue {
896 public: 896 public:
897 using const_interval_iterator = IntervalSet<QuicPacketNumber>::const_iterator;
898 using const_reverse_interval_iterator =
899 IntervalSet<QuicPacketNumber>::const_reverse_iterator;
897 // TODO(jdorfman): remove const_iterator and change the callers to iterate 900 // TODO(jdorfman): remove const_iterator and change the callers to iterate
898 // over the intervals. 901 // over the intervals.
899 class NET_EXPORT_PRIVATE const_iterator 902 class NET_EXPORT_PRIVATE const_iterator
900 : public std::iterator<std::input_iterator_tag, 903 : public std::iterator<std::input_iterator_tag,
901 QuicPacketNumber, 904 QuicPacketNumber,
902 std::ptrdiff_t, 905 std::ptrdiff_t,
903 const QuicPacketNumber*, 906 const QuicPacketNumber*,
904 const QuicPacketNumber&> { 907 const QuicPacketNumber&> {
905 public: 908 public:
906 const_iterator( 909 const_iterator(
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 989
987 // Returns iterators over the individual packet numbers. 990 // Returns iterators over the individual packet numbers.
988 const_iterator begin() const; 991 const_iterator begin() const;
989 const_iterator end() const; 992 const_iterator end() const;
990 const_iterator lower_bound(QuicPacketNumber packet_number) const; 993 const_iterator lower_bound(QuicPacketNumber packet_number) const;
991 994
992 NET_EXPORT_PRIVATE friend std::ostream& operator<<( 995 NET_EXPORT_PRIVATE friend std::ostream& operator<<(
993 std::ostream& os, 996 std::ostream& os,
994 const PacketNumberQueue& q); 997 const PacketNumberQueue& q);
995 998
999 // Returns iterators over the packet number intervals.
1000 const_interval_iterator begin_intervals() const;
1001 const_interval_iterator end_intervals() const;
1002 const_reverse_interval_iterator rbegin_intervals() const;
1003 const_reverse_interval_iterator rend_intervals() const;
1004
996 private: 1005 private:
997 IntervalSet<QuicPacketNumber> packet_number_intervals_; 1006 IntervalSet<QuicPacketNumber> packet_number_intervals_;
998 }; 1007 };
999 1008
1000 struct NET_EXPORT_PRIVATE QuicAckFrame { 1009 struct NET_EXPORT_PRIVATE QuicAckFrame {
1001 QuicAckFrame(); 1010 QuicAckFrame();
1002 QuicAckFrame(const QuicAckFrame& other); 1011 QuicAckFrame(const QuicAckFrame& other);
1003 ~QuicAckFrame(); 1012 ~QuicAckFrame();
1004 1013
1005 NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os, 1014 NET_EXPORT_PRIVATE friend std::ostream& operator<<(std::ostream& os,
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
1497 : iov(iov), iov_count(iov_count), total_length(total_length) {} 1506 : iov(iov), iov_count(iov_count), total_length(total_length) {}
1498 1507
1499 const struct iovec* iov; 1508 const struct iovec* iov;
1500 const int iov_count; 1509 const int iov_count;
1501 const size_t total_length; 1510 const size_t total_length;
1502 }; 1511 };
1503 1512
1504 } // namespace net 1513 } // namespace net
1505 1514
1506 #endif // NET_QUIC_QUIC_PROTOCOL_H_ 1515 #endif // NET_QUIC_QUIC_PROTOCOL_H_
OLDNEW
« no previous file with comments | « net/quic/quic_framer.cc ('k') | net/quic/quic_protocol.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698