OLD | NEW |
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; |
(...skipping 30 matching lines...) Expand all Loading... |
41 } | 41 } |
42 } | 42 } |
43 | 43 |
44 void QuicSentEntropyManager::RecordPacketEntropyHash( | 44 void QuicSentEntropyManager::RecordPacketEntropyHash( |
45 QuicPacketSequenceNumber sequence_number, | 45 QuicPacketSequenceNumber sequence_number, |
46 QuicPacketEntropyHash entropy_hash) { | 46 QuicPacketEntropyHash entropy_hash) { |
47 if (!packets_entropy_.empty()) { | 47 if (!packets_entropy_.empty()) { |
48 // Ensure packets always are recorded in order. | 48 // Ensure packets always are recorded in order. |
49 // Every packet's entropy is recorded, even if it's not sent, so there | 49 // Every packet's entropy is recorded, even if it's not sent, so there |
50 // are not sequence number gaps. | 50 // are not sequence number gaps. |
51 DCHECK_EQ(GetLargestPacketWithEntropy() + 1, sequence_number); | 51 DCHECK_LT(GetLargestPacketWithEntropy(), sequence_number); |
52 } | 52 } |
53 packets_entropy_.push_back(entropy_hash); | 53 packets_entropy_.push_back(entropy_hash); |
54 DVLOG(2) << "Recorded sequence number " << sequence_number | 54 DVLOG(2) << "Recorded sequence number " << sequence_number |
55 << " with entropy hash: " << static_cast<int>(entropy_hash); | 55 << " with entropy hash: " << static_cast<int>(entropy_hash); |
56 } | 56 } |
57 | 57 |
58 QuicPacketEntropyHash QuicSentEntropyManager::GetCumulativeEntropy( | 58 QuicPacketEntropyHash QuicSentEntropyManager::GetCumulativeEntropy( |
59 QuicPacketSequenceNumber sequence_number) { | 59 QuicPacketSequenceNumber sequence_number) { |
60 DCHECK_LE(last_cumulative_entropy_.sequence_number, sequence_number); | 60 DCHECK_LE(last_cumulative_entropy_.sequence_number, sequence_number); |
61 DCHECK_GE(GetLargestPacketWithEntropy(), sequence_number); | 61 DCHECK_GE(GetLargestPacketWithEntropy(), sequence_number); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 UpdateCumulativeEntropy(sequence_number, &last_valid_entropy_); | 103 UpdateCumulativeEntropy(sequence_number, &last_valid_entropy_); |
104 } | 104 } |
105 while (map_offset_ < sequence_number) { | 105 while (map_offset_ < sequence_number) { |
106 packets_entropy_.pop_front(); | 106 packets_entropy_.pop_front(); |
107 ++map_offset_; | 107 ++map_offset_; |
108 } | 108 } |
109 DVLOG(2) << "Cleared entropy before: " << sequence_number; | 109 DVLOG(2) << "Cleared entropy before: " << sequence_number; |
110 } | 110 } |
111 | 111 |
112 } // namespace net | 112 } // namespace net |
OLD | NEW |