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

Unified Diff: net/quic/quic_received_packet_manager.cc

Issue 565443002: remove lambda expression in quic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add missing const to keep the android toolchain happy Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_received_packet_manager.cc
diff --git a/net/quic/quic_received_packet_manager.cc b/net/quic/quic_received_packet_manager.cc
index 98136f8564f35a70333dbbb705292df9ad667848..255ce4dc10a7a4287ab497615d61471a4a74e29a 100644
--- a/net/quic/quic_received_packet_manager.cc
+++ b/net/quic/quic_received_packet_manager.cc
@@ -4,6 +4,9 @@
#include "net/quic/quic_received_packet_manager.h"
+#include <limits>
+#include <utility>
+
#include "base/logging.h"
#include "base/stl_util.h"
#include "net/base/linked_hash_map.h"
@@ -201,6 +204,20 @@ bool QuicReceivedPacketManager::IsAwaitingPacket(
return ::net::IsAwaitingPacket(ack_frame_, sequence_number);
}
+namespace {
+struct isTooLarge {
+ explicit isTooLarge(QuicPacketSequenceNumber n) : largest_observed_(n) {}
+ QuicPacketSequenceNumber largest_observed_;
+
+ // Return true if the packet in p is too different from largest_observed_
+ // to express.
+ bool operator() (
+ const std::pair<QuicPacketSequenceNumber, QuicTime>& p) const {
+ return largest_observed_ - p.first >= numeric_limits<uint8>::max();
+ }
+};
+} // namespace
+
void QuicReceivedPacketManager::UpdateReceivedPacketInfo(
QuicAckFrame* ack_frame, QuicTime approximate_now) {
*ack_frame = ack_frame_;
@@ -222,10 +239,7 @@ void QuicReceivedPacketManager::UpdateReceivedPacketInfo(
approximate_now.Subtract(time_largest_observed_);
// Remove all packets that are too far from largest_observed to express.
- received_packet_times_.remove_if(
- [this] (std::pair<QuicPacketSequenceNumber, QuicTime> p)
- { return ack_frame_.largest_observed - p.first >=
- numeric_limits<uint8>::max();});
+ received_packet_times_.remove_if(isTooLarge(ack_frame_.largest_observed));
ack_frame->received_packet_times = received_packet_times_;
received_packet_times_.clear();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698