| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/core/quic_packet_generator.h" | 5 #include "net/quic/core/quic_packet_generator.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "net/quic/core/quic_bug_tracker.h" | 8 #include "net/quic/core/quic_bug_tracker.h" |
| 9 #include "net/quic/core/quic_flags.h" | 9 #include "net/quic/core/quic_flags.h" |
| 10 #include "net/quic/core/quic_utils.h" | 10 #include "net/quic/core/quic_utils.h" |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 const QuicIOVector& iov, | 130 const QuicIOVector& iov, |
| 131 QuicStreamOffset offset, | 131 QuicStreamOffset offset, |
| 132 bool fin, | 132 bool fin, |
| 133 QuicAckListenerInterface* listener) { | 133 QuicAckListenerInterface* listener) { |
| 134 DCHECK_NE(id, kCryptoStreamId); | 134 DCHECK_NE(id, kCryptoStreamId); |
| 135 size_t total_bytes_consumed = 0; | 135 size_t total_bytes_consumed = 0; |
| 136 while (total_bytes_consumed < iov.total_length && | 136 while (total_bytes_consumed < iov.total_length && |
| 137 delegate_->ShouldGeneratePacket(HAS_RETRANSMITTABLE_DATA, | 137 delegate_->ShouldGeneratePacket(HAS_RETRANSMITTABLE_DATA, |
| 138 NOT_HANDSHAKE)) { | 138 NOT_HANDSHAKE)) { |
| 139 // Serialize and encrypt the packet. | 139 // Serialize and encrypt the packet. |
| 140 ALIGNAS(64) char encrypted_buffer[kMaxPacketSize]; | |
| 141 size_t bytes_consumed = 0; | 140 size_t bytes_consumed = 0; |
| 142 packet_creator_.CreateAndSerializeStreamFrame( | 141 packet_creator_.CreateAndSerializeStreamFrame( |
| 143 id, iov, total_bytes_consumed, offset + total_bytes_consumed, fin, | 142 id, iov, total_bytes_consumed, offset + total_bytes_consumed, fin, |
| 144 listener, encrypted_buffer, kMaxPacketSize, &bytes_consumed); | 143 listener, &bytes_consumed); |
| 145 total_bytes_consumed += bytes_consumed; | 144 total_bytes_consumed += bytes_consumed; |
| 146 } | 145 } |
| 147 | 146 |
| 148 return QuicConsumedData(total_bytes_consumed, | 147 return QuicConsumedData(total_bytes_consumed, |
| 149 fin && (total_bytes_consumed == iov.total_length)); | 148 fin && (total_bytes_consumed == iov.total_length)); |
| 150 } | 149 } |
| 151 | 150 |
| 152 void QuicPacketGenerator::GenerateMtuDiscoveryPacket( | 151 void QuicPacketGenerator::GenerateMtuDiscoveryPacket( |
| 153 QuicByteCount target_mtu, | 152 QuicByteCount target_mtu, |
| 154 QuicAckListenerInterface* listener) { | 153 QuicAckListenerInterface* listener) { |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 | 319 |
| 321 void QuicPacketGenerator::SetCurrentPath( | 320 void QuicPacketGenerator::SetCurrentPath( |
| 322 QuicPathId path_id, | 321 QuicPathId path_id, |
| 323 QuicPacketNumber least_packet_awaited_by_peer, | 322 QuicPacketNumber least_packet_awaited_by_peer, |
| 324 QuicPacketCount max_packets_in_flight) { | 323 QuicPacketCount max_packets_in_flight) { |
| 325 packet_creator_.SetCurrentPath(path_id, least_packet_awaited_by_peer, | 324 packet_creator_.SetCurrentPath(path_id, least_packet_awaited_by_peer, |
| 326 max_packets_in_flight); | 325 max_packets_in_flight); |
| 327 } | 326 } |
| 328 | 327 |
| 329 } // namespace net | 328 } // namespace net |
| OLD | NEW |