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

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

Issue 287443003: Remove unnecessary methods from QuicUnackedPacketMap and a minor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_unacked_packet_map.h ('k') | net/quic/test_tools/quic_sent_packet_manager_peer.h » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_unacked_packet_map.h" 5 #include "net/quic/quic_unacked_packet_map.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "net/quic/quic_connection_stats.h" 9 #include "net/quic/quic_connection_stats.h"
10 #include "net/quic/quic_utils_chromium.h" 10 #include "net/quic/quic_utils_chromium.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 return !transmission_info.pending && 158 return !transmission_info.pending &&
159 transmission_info.sent_time != QuicTime::Zero() && 159 transmission_info.sent_time != QuicTime::Zero() &&
160 transmission_info.bytes_sent == 0; 160 transmission_info.bytes_sent == 0;
161 } 161 }
162 162
163 bool QuicUnackedPacketMap::IsUnacked( 163 bool QuicUnackedPacketMap::IsUnacked(
164 QuicPacketSequenceNumber sequence_number) const { 164 QuicPacketSequenceNumber sequence_number) const {
165 return ContainsKey(unacked_packets_, sequence_number); 165 return ContainsKey(unacked_packets_, sequence_number);
166 } 166 }
167 167
168 bool QuicUnackedPacketMap::IsPending(
169 QuicPacketSequenceNumber sequence_number) const {
170 const TransmissionInfo* transmission_info =
171 FindOrNull(unacked_packets_, sequence_number);
172 return transmission_info != NULL && transmission_info->pending;
173 }
174
175 void QuicUnackedPacketMap::SetNotPending( 168 void QuicUnackedPacketMap::SetNotPending(
176 QuicPacketSequenceNumber sequence_number) { 169 QuicPacketSequenceNumber sequence_number) {
177 UnackedPacketMap::iterator it = unacked_packets_.find(sequence_number); 170 UnackedPacketMap::iterator it = unacked_packets_.find(sequence_number);
178 if (it == unacked_packets_.end()) { 171 if (it == unacked_packets_.end()) {
179 LOG(DFATAL) << "SetNotPending called for packet that is not unacked: " 172 LOG(DFATAL) << "SetNotPending called for packet that is not unacked: "
180 << sequence_number; 173 << sequence_number;
181 return; 174 return;
182 } 175 }
183 if (it->second.pending) { 176 if (it->second.pending) {
184 LOG_IF(DFATAL, bytes_in_flight_ < it->second.bytes_sent); 177 LOG_IF(DFATAL, bytes_in_flight_ < it->second.bytes_sent);
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 QuicPacketSequenceNumber 272 QuicPacketSequenceNumber
280 QuicUnackedPacketMap::GetLeastUnackedSentPacket() const { 273 QuicUnackedPacketMap::GetLeastUnackedSentPacket() const {
281 if (unacked_packets_.empty()) { 274 if (unacked_packets_.empty()) {
282 // If there are no unacked packets, return 0. 275 // If there are no unacked packets, return 0.
283 return 0; 276 return 0;
284 } 277 }
285 278
286 return unacked_packets_.begin()->first; 279 return unacked_packets_.begin()->first;
287 } 280 }
288 281
289 SequenceNumberSet QuicUnackedPacketMap::GetUnackedPackets() const {
290 SequenceNumberSet unacked_packets;
291 for (UnackedPacketMap::const_iterator it = unacked_packets_.begin();
292 it != unacked_packets_.end(); ++it) {
293 unacked_packets.insert(it->first);
294 }
295 return unacked_packets;
296 }
297
298 void QuicUnackedPacketMap::SetSent(QuicPacketSequenceNumber sequence_number, 282 void QuicUnackedPacketMap::SetSent(QuicPacketSequenceNumber sequence_number,
299 QuicTime sent_time, 283 QuicTime sent_time,
300 QuicByteCount bytes_sent, 284 QuicByteCount bytes_sent,
301 bool set_pending) { 285 bool set_pending) {
302 DCHECK_LT(0u, sequence_number); 286 DCHECK_LT(0u, sequence_number);
303 UnackedPacketMap::iterator it = unacked_packets_.find(sequence_number); 287 UnackedPacketMap::iterator it = unacked_packets_.find(sequence_number);
304 if (it == unacked_packets_.end()) { 288 if (it == unacked_packets_.end()) {
305 LOG(DFATAL) << "OnPacketSent called for packet that is not unacked: " 289 LOG(DFATAL) << "OnPacketSent called for packet that is not unacked: "
306 << sequence_number; 290 << sequence_number;
307 return; 291 return;
308 } 292 }
309 DCHECK(!it->second.pending); 293 DCHECK(!it->second.pending);
310 294
311 largest_sent_packet_ = max(sequence_number, largest_sent_packet_); 295 largest_sent_packet_ = max(sequence_number, largest_sent_packet_);
312 it->second.sent_time = sent_time; 296 it->second.sent_time = sent_time;
313 if (set_pending) { 297 if (set_pending) {
314 bytes_in_flight_ += bytes_sent; 298 bytes_in_flight_ += bytes_sent;
315 it->second.bytes_sent = bytes_sent; 299 it->second.bytes_sent = bytes_sent;
316 it->second.pending = true; 300 it->second.pending = true;
317 } 301 }
318 } 302 }
319 303
320 } // namespace net 304 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_unacked_packet_map.h ('k') | net/quic/test_tools/quic_sent_packet_manager_peer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698