OLD | NEW |
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 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 LOG_IF(DFATAL, it->sent_time == QuicTime::Zero()) | 320 LOG_IF(DFATAL, it->sent_time == QuicTime::Zero()) |
321 << "Sent time can never be zero for a packet in flight."; | 321 << "Sent time can never be zero for a packet in flight."; |
322 return it->sent_time; | 322 return it->sent_time; |
323 } | 323 } |
324 ++it; | 324 ++it; |
325 } | 325 } |
326 LOG(DFATAL) << "GetLastPacketSentTime requires in flight packets."; | 326 LOG(DFATAL) << "GetLastPacketSentTime requires in flight packets."; |
327 return QuicTime::Zero(); | 327 return QuicTime::Zero(); |
328 } | 328 } |
329 | 329 |
330 QuicTime QuicUnackedPacketMap::GetFirstInFlightPacketSentTime() const { | |
331 UnackedPacketMap::const_iterator it = unacked_packets_.begin(); | |
332 while (it != unacked_packets_.end() && !it->in_flight) { | |
333 ++it; | |
334 } | |
335 if (it == unacked_packets_.end()) { | |
336 LOG(DFATAL) << "GetFirstInFlightPacketSentTime requires in flight packets."; | |
337 return QuicTime::Zero(); | |
338 } | |
339 return it->sent_time; | |
340 } | |
341 | |
342 size_t QuicUnackedPacketMap::GetNumUnackedPacketsDebugOnly() const { | 330 size_t QuicUnackedPacketMap::GetNumUnackedPacketsDebugOnly() const { |
343 size_t unacked_packet_count = 0; | 331 size_t unacked_packet_count = 0; |
344 QuicPacketSequenceNumber sequence_number = least_unacked_; | 332 QuicPacketSequenceNumber sequence_number = least_unacked_; |
345 for (UnackedPacketMap::const_iterator it = unacked_packets_.begin(); | 333 for (UnackedPacketMap::const_iterator it = unacked_packets_.begin(); |
346 it != unacked_packets_.end(); ++it, ++sequence_number) { | 334 it != unacked_packets_.end(); ++it, ++sequence_number) { |
347 if (!IsPacketUseless(sequence_number, *it)) { | 335 if (!IsPacketUseless(sequence_number, *it)) { |
348 ++unacked_packet_count; | 336 ++unacked_packet_count; |
349 } | 337 } |
350 } | 338 } |
351 return unacked_packet_count; | 339 return unacked_packet_count; |
(...skipping 25 matching lines...) Expand all Loading... |
377 } | 365 } |
378 } | 366 } |
379 return false; | 367 return false; |
380 } | 368 } |
381 | 369 |
382 QuicPacketSequenceNumber QuicUnackedPacketMap::GetLeastUnacked() const { | 370 QuicPacketSequenceNumber QuicUnackedPacketMap::GetLeastUnacked() const { |
383 return least_unacked_; | 371 return least_unacked_; |
384 } | 372 } |
385 | 373 |
386 } // namespace net | 374 } // namespace net |
OLD | NEW |