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

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

Issue 469383004: Re-add the QUIC DCHECK to ensure packets are always sent in the order of (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@optimize_HasCryptoHandshake_73125935
Patch Set: Created 6 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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_sent_entropy_manager.h" 5 #include "net/quic/quic_sent_entropy_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "net/base/linked_hash_map.h" 8 #include "net/base/linked_hash_map.h"
9 9
10 using std::make_pair; 10 using std::make_pair;
11 using std::max; 11 using std::max;
12 using std::min; 12 using std::min;
13 13
14 namespace net { 14 namespace net {
15 15
16 QuicSentEntropyManager::QuicSentEntropyManager() 16 QuicSentEntropyManager::QuicSentEntropyManager()
17 : packets_entropy_hash_(0) {} 17 : packets_entropy_hash_(0) {}
18 18
19 QuicSentEntropyManager::~QuicSentEntropyManager() {} 19 QuicSentEntropyManager::~QuicSentEntropyManager() {}
20 20
21 void QuicSentEntropyManager::RecordPacketEntropyHash( 21 void QuicSentEntropyManager::RecordPacketEntropyHash(
22 QuicPacketSequenceNumber sequence_number, 22 QuicPacketSequenceNumber sequence_number,
23 QuicPacketEntropyHash entropy_hash) { 23 QuicPacketEntropyHash entropy_hash) {
24 // TODO(satyamshekhar): Check this logic again when/if we enable packet 24 if (!packets_entropy_.empty()) {
25 // reordering. 25 // Ensure packets always are recorded in order.
26 // Every packet's entropy is recorded, even if it's not sent, so there
27 // are not sequence number gaps.
28 DCHECK_LT(packets_entropy_.back().first, sequence_number);
29 }
26 packets_entropy_hash_ ^= entropy_hash; 30 packets_entropy_hash_ ^= entropy_hash;
27 packets_entropy_.insert( 31 packets_entropy_.insert(
28 make_pair(sequence_number, 32 make_pair(sequence_number,
29 make_pair(entropy_hash, packets_entropy_hash_))); 33 make_pair(entropy_hash, packets_entropy_hash_)));
30 DVLOG(2) << "setting cumulative sent entropy hash to: " 34 DVLOG(2) << "setting cumulative sent entropy hash to: "
31 << static_cast<int>(packets_entropy_hash_) 35 << static_cast<int>(packets_entropy_hash_)
32 << " updated with sequence number " << sequence_number 36 << " updated with sequence number " << sequence_number
33 << " entropy hash: " << static_cast<int>(entropy_hash); 37 << " entropy hash: " << static_cast<int>(entropy_hash);
34 } 38 }
35 39
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 while (it->first < sequence_number) { 82 while (it->first < sequence_number) {
79 packets_entropy_.erase(it); 83 packets_entropy_.erase(it);
80 it = packets_entropy_.begin(); 84 it = packets_entropy_.begin();
81 DCHECK(it != packets_entropy_.end()); 85 DCHECK(it != packets_entropy_.end());
82 } 86 }
83 DVLOG(2) << "Cleared entropy before: " 87 DVLOG(2) << "Cleared entropy before: "
84 << packets_entropy_.begin()->first; 88 << packets_entropy_.begin()->first;
85 } 89 }
86 90
87 } // namespace net 91 } // namespace net
OLDNEW
« net/base/linked_hash_map.h ('K') | « net/quic/congestion_control/tcp_cubic_sender.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698