Index: net/quic/quic_connection.cc |
diff --git a/net/quic/quic_connection.cc b/net/quic/quic_connection.cc |
index 454a15b59b5780745b593b603b0c4c06aa0d8bf2..be82bff04eb1d1a116fc1142f9d4dee580287a47 100644 |
--- a/net/quic/quic_connection.cc |
+++ b/net/quic/quic_connection.cc |
@@ -1403,7 +1403,8 @@ bool QuicConnection::WritePacketInner(QueuedPacket* packet) { |
return true; |
} |
// Connection close packets are encrypted and saved, so don't exit early. |
- if (writer_->IsWriteBlocked() && !IsConnectionClose(*packet)) { |
+ const bool is_connection_close = IsConnectionClose(*packet); |
+ if (writer_->IsWriteBlocked() && !is_connection_close) { |
return false; |
} |
@@ -1427,7 +1428,7 @@ bool QuicConnection::WritePacketInner(QueuedPacket* packet) { |
// Connection close packets are eventually owned by TimeWaitListManager. |
// Others are deleted at the end of this call. |
scoped_ptr<QuicEncryptedPacket> encrypted_deleter; |
- if (IsConnectionClose(*packet)) { |
+ if (is_connection_close) { |
DCHECK(connection_close_packet_.get() == nullptr); |
connection_close_packet_.reset(encrypted); |
// This assures we won't try to write *forced* packets when blocked. |
@@ -2104,15 +2105,14 @@ HasRetransmittableData QuicConnection::IsRetransmittable( |
} |
} |
-bool QuicConnection::IsConnectionClose( |
- QueuedPacket packet) { |
- RetransmittableFrames* retransmittable_frames = |
+bool QuicConnection::IsConnectionClose(const QueuedPacket& packet) { |
+ const RetransmittableFrames* retransmittable_frames = |
packet.serialized_packet.retransmittable_frames; |
- if (!retransmittable_frames) { |
+ if (retransmittable_frames == nullptr) { |
return false; |
} |
- for (size_t i = 0; i < retransmittable_frames->frames().size(); ++i) { |
- if (retransmittable_frames->frames()[i].type == CONNECTION_CLOSE_FRAME) { |
+ for (const QuicFrame& frame : retransmittable_frames->frames()) { |
+ if (frame.type == CONNECTION_CLOSE_FRAME) { |
return true; |
} |
} |