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

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

Issue 2916033003: Landing Recent QUIC changes until 03:18 AM, May 28, UTC (Closed)
Patch Set: A few more EXPORTs. Created 3 years, 6 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
« no previous file with comments | « net/quic/core/quic_unacked_packet_map.h ('k') | net/quic/core/stream_notifier_interface.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/core/quic_unacked_packet_map.h" 5 #include "net/quic/core/quic_unacked_packet_map.h"
6 6
7 #include "net/quic/core/quic_connection_stats.h" 7 #include "net/quic/core/quic_connection_stats.h"
8 #include "net/quic/core/quic_utils.h" 8 #include "net/quic/core/quic_utils.h"
9 #include "net/quic/platform/api/quic_bug_tracker.h" 9 #include "net/quic/platform/api/quic_bug_tracker.h"
10 10
11 namespace net { 11 namespace net {
12 12
13 QuicUnackedPacketMap::QuicUnackedPacketMap() 13 QuicUnackedPacketMap::QuicUnackedPacketMap()
14 : largest_sent_packet_(0), 14 : largest_sent_packet_(0),
15 largest_sent_retransmittable_packet_(0), 15 largest_sent_retransmittable_packet_(0),
16 largest_observed_(0), 16 largest_observed_(0),
17 least_unacked_(1), 17 least_unacked_(1),
18 bytes_in_flight_(0), 18 bytes_in_flight_(0),
19 pending_crypto_packet_count_(0) {} 19 pending_crypto_packet_count_(0),
20 stream_notifier_(nullptr) {}
20 21
21 QuicUnackedPacketMap::~QuicUnackedPacketMap() { 22 QuicUnackedPacketMap::~QuicUnackedPacketMap() {
22 for (QuicTransmissionInfo& transmission_info : unacked_packets_) { 23 for (QuicTransmissionInfo& transmission_info : unacked_packets_) {
23 DeleteFrames(&(transmission_info.retransmittable_frames)); 24 DeleteFrames(&(transmission_info.retransmittable_frames));
24 } 25 }
25 } 26 }
26 27
27 void QuicUnackedPacketMap::AddSentPacket(SerializedPacket* packet, 28 void QuicUnackedPacketMap::AddSentPacket(SerializedPacket* packet,
28 QuicPacketNumber old_packet_number, 29 QuicPacketNumber old_packet_number,
29 TransmissionType transmission_type, 30 TransmissionType transmission_type,
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 QUIC_BUG << "Old QuicTransmissionInfo never existed for :" 96 QUIC_BUG << "Old QuicTransmissionInfo never existed for :"
96 << old_packet_number << " largest_sent:" << largest_sent_packet_; 97 << old_packet_number << " largest_sent:" << largest_sent_packet_;
97 return; 98 return;
98 } 99 }
99 DCHECK_GE(new_packet_number, least_unacked_ + unacked_packets_.size()); 100 DCHECK_GE(new_packet_number, least_unacked_ + unacked_packets_.size());
100 DCHECK_NE(NOT_RETRANSMISSION, transmission_type); 101 DCHECK_NE(NOT_RETRANSMISSION, transmission_type);
101 102
102 QuicTransmissionInfo* transmission_info = 103 QuicTransmissionInfo* transmission_info =
103 &unacked_packets_.at(old_packet_number - least_unacked_); 104 &unacked_packets_.at(old_packet_number - least_unacked_);
104 QuicFrames* frames = &transmission_info->retransmittable_frames; 105 QuicFrames* frames = &transmission_info->retransmittable_frames;
106 if (stream_notifier_ != nullptr) {
107 for (const QuicFrame& frame : *frames) {
108 if (frame.type == STREAM_FRAME) {
109 stream_notifier_->OnStreamFrameRetransmitted(*frame.stream_frame);
110 }
111 }
112 }
105 for (AckListenerWrapper& wrapper : transmission_info->ack_listeners) { 113 for (AckListenerWrapper& wrapper : transmission_info->ack_listeners) {
106 wrapper.ack_listener->OnPacketRetransmitted(wrapper.length); 114 wrapper.ack_listener->OnPacketRetransmitted(wrapper.length);
107 } 115 }
108 116
109 // Swap the frames and preserve num_padding_bytes and has_crypto_handshake. 117 // Swap the frames and preserve num_padding_bytes and has_crypto_handshake.
110 frames->swap(info->retransmittable_frames); 118 frames->swap(info->retransmittable_frames);
111 info->has_crypto_handshake = transmission_info->has_crypto_handshake; 119 info->has_crypto_handshake = transmission_info->has_crypto_handshake;
112 transmission_info->has_crypto_handshake = false; 120 transmission_info->has_crypto_handshake = false;
113 info->num_padding_bytes = transmission_info->num_padding_bytes; 121 info->num_padding_bytes = transmission_info->num_padding_bytes;
114 122
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 return true; 351 return true;
344 } 352 }
345 } 353 }
346 return false; 354 return false;
347 } 355 }
348 356
349 QuicPacketNumber QuicUnackedPacketMap::GetLeastUnacked() const { 357 QuicPacketNumber QuicUnackedPacketMap::GetLeastUnacked() const {
350 return least_unacked_; 358 return least_unacked_;
351 } 359 }
352 360
361 void QuicUnackedPacketMap::SetStreamNotifier(
362 StreamNotifierInterface* stream_notifier) {
363 stream_notifier_ = stream_notifier;
364 }
365
366 void QuicUnackedPacketMap::NotifyStreamFramesAcked(
367 const QuicTransmissionInfo& info,
368 QuicTime::Delta ack_delay) {
369 if (stream_notifier_ == nullptr) {
370 return;
371 }
372
373 for (const QuicFrame& frame : info.retransmittable_frames) {
374 if (frame.type == STREAM_FRAME) {
375 stream_notifier_->OnStreamFrameAcked(*frame.stream_frame, ack_delay);
376 }
377 }
378 }
379
353 } // namespace net 380 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_unacked_packet_map.h ('k') | net/quic/core/stream_notifier_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698