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

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

Issue 1660593004: Landing Recent QUIC changes until 01/28/2016 18:41 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Final_0202
Patch Set: Created 4 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
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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 // A map manages packets which are transmitted across multiple paths. 5 // A map manages packets which are transmitted across multiple paths.
6 // For example, a packet is originally transmitted on path 1 with packet number 6 // For example, a packet is originally transmitted on path 1 with packet number
7 // 1. Then this packet is retransmitted on path 2 with packet number 1. (1, 1) 7 // 1. Then this packet is retransmitted on path 2 with packet number 1. (1, 1)
8 // and (2, 1) are inserted into this map. Suppose (2, 1) is detected lost and 8 // and (2, 1) are inserted into this map. Suppose (2, 1) is detected lost and
9 // gets retransmitted on path 2 with packet 2. (2, 2) will not be inserted 9 // gets retransmitted on path 2 with packet 2. (2, 2) will not be inserted
10 // because this transmission does not "across" path compared to (2, 1). 10 // because this transmission does not "across" path compared to (2, 1).
11 11
12 #ifndef NET_QUIC_QUIC_MULTIPATH_TRANSMISSIONS_MAP_H_ 12 #ifndef NET_QUIC_QUIC_MULTIPATH_TRANSMISSIONS_MAP_H_
13 #define NET_QUIC_QUIC_MULTIPATH_TRANSMISSIONS_MAP_H_ 13 #define NET_QUIC_QUIC_MULTIPATH_TRANSMISSIONS_MAP_H_
14 14
15 #include <deque> 15 #include <deque>
16 #include <unordered_map>
16 17
17 #include "base/containers/hash_tables.h" 18 #include "base/containers/hash_tables.h"
18 #include "base/macros.h" 19 #include "base/macros.h"
19 #include "net/quic/quic_protocol.h" 20 #include "net/quic/quic_protocol.h"
21 #include "net/quic/quic_utils.h"
20 22
21 namespace net_quic { 23 namespace net {
22 24
23 typedef std::pair<net::QuicPathId, net::QuicPacketNumber> 25 typedef std::pair<net::QuicPathId, net::QuicPacketNumber>
24 QuicPathIdPacketNumber; 26 QuicPathIdPacketNumber;
25 27
26 class NET_EXPORT_PRIVATE QuicMultipathTransmissionsMap { 28 class NET_EXPORT_PRIVATE QuicMultipathTransmissionsMap {
27 public: 29 public:
30 struct QuicPathIdPacketNumberHash {
31 size_t operator()(std::pair<QuicPathId, QuicPacketNumber> value) const {
32 return QuicUtils::PackPathIdAndPacketNumber(value.first, value.second);
33 }
34 };
35
28 typedef std::deque<QuicPathIdPacketNumber> MultipathTransmissionsList; 36 typedef std::deque<QuicPathIdPacketNumber> MultipathTransmissionsList;
29 typedef base::hash_map<QuicPathIdPacketNumber, MultipathTransmissionsList*> 37 typedef std::unordered_map<QuicPathIdPacketNumber,
38 MultipathTransmissionsList*,
39 QuicPathIdPacketNumberHash>
30 MultipathTransmissionsMap; 40 MultipathTransmissionsMap;
31 41
32 QuicMultipathTransmissionsMap(); 42 QuicMultipathTransmissionsMap();
33 ~QuicMultipathTransmissionsMap(); 43 ~QuicMultipathTransmissionsMap();
34 44
35 // Called when a packet is retransmitted on a different path. Adds both 45 // Called when a packet is retransmitted on a different path. Adds both
36 // |original_path_id_packet_number| (if not exists) and 46 // |original_path_id_packet_number| (if not exists) and
37 // |path_id_packet_number| to |transmission_map_|. 47 // |path_id_packet_number| to |transmission_map_|.
38 void OnPacketRetransmittedOnDifferentPath( 48 void OnPacketRetransmittedOnDifferentPath(
39 QuicPathIdPacketNumber original_path_id_packet_number, 49 QuicPathIdPacketNumber original_path_id_packet_number,
(...skipping 13 matching lines...) Expand all
53 private: 63 private:
54 // Keys of the map are QuicPathIdPacketNumber, and values are pointers to 64 // Keys of the map are QuicPathIdPacketNumber, and values are pointers to
55 // lists of multipath transmissions of the same packet. For example, if a 65 // lists of multipath transmissions of the same packet. For example, if a
56 // packet has been transmitted as (1, 1) and (2, 1), two entries are added 66 // packet has been transmitted as (1, 1) and (2, 1), two entries are added
57 // to this map and both values point to the same list: {(1, 1), (2, 1)}. 67 // to this map and both values point to the same list: {(1, 1), (2, 1)}.
58 // The MultipathTransmissionsList is owned by the transmission which is 68 // The MultipathTransmissionsList is owned by the transmission which is
59 // received first (on any path). 69 // received first (on any path).
60 MultipathTransmissionsMap transmission_map_; 70 MultipathTransmissionsMap transmission_map_;
61 }; 71 };
62 72
63 } // namespace net_quic 73 } // namespace net
64 74
65 #endif // NET_QUIC_QUIC_MULTIPATH_TRANSMISSIONS_MAP_H_ 75 #endif // NET_QUIC_QUIC_MULTIPATH_TRANSMISSIONS_MAP_H_
OLDNEW
« no previous file with comments | « net/quic/quic_multipath_received_packet_manager.h ('k') | net/quic/quic_multipath_transmissions_map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698