| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_ack_notifier_manager.h" | 5 #include "net/quic/quic_ack_notifier_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 74 |
| 75 void AckNotifierManager::OnSerializedPacket( | 75 void AckNotifierManager::OnSerializedPacket( |
| 76 const SerializedPacket& serialized_packet) { | 76 const SerializedPacket& serialized_packet) { |
| 77 if (FLAGS_quic_attach_ack_notifiers_to_packets) { | 77 if (FLAGS_quic_attach_ack_notifiers_to_packets) { |
| 78 // Inform each attached AckNotifier of the packet's sequence number. | 78 // Inform each attached AckNotifier of the packet's sequence number. |
| 79 for (QuicAckNotifier* notifier : serialized_packet.notifiers) { | 79 for (QuicAckNotifier* notifier : serialized_packet.notifiers) { |
| 80 if (notifier == nullptr) { | 80 if (notifier == nullptr) { |
| 81 LOG(DFATAL) << "AckNotifier should not be nullptr."; | 81 LOG(DFATAL) << "AckNotifier should not be nullptr."; |
| 82 continue; | 82 continue; |
| 83 } | 83 } |
| 84 notifier->AddSequenceNumber(serialized_packet.sequence_number, | 84 notifier->OnSerializedPacket(); |
| 85 serialized_packet.packet->length()); | |
| 86 | 85 |
| 87 // Update the mapping in the other direction, from sequence number to | 86 // Update the mapping in the other direction, from sequence number to |
| 88 // AckNotifier. | 87 // AckNotifier. |
| 89 ack_notifier_map_[serialized_packet.sequence_number].push_back(notifier); | 88 ack_notifier_map_[serialized_packet.sequence_number].push_back(notifier); |
| 90 | 89 |
| 91 // Take ownership of the AckNotifier. | 90 // Take ownership of the AckNotifier. |
| 92 ack_notifiers_.insert(notifier); | 91 ack_notifiers_.insert(notifier); |
| 93 } | 92 } |
| 94 } else { | 93 } else { |
| 95 // AckNotifiers can only be attached to retransmittable frames. | 94 // AckNotifiers can only be attached to retransmittable frames. |
| 96 RetransmittableFrames* frames = serialized_packet.retransmittable_frames; | 95 RetransmittableFrames* frames = serialized_packet.retransmittable_frames; |
| 97 if (frames == nullptr) { | 96 if (frames == nullptr) { |
| 98 return; | 97 return; |
| 99 } | 98 } |
| 100 | 99 |
| 101 // For each frame in |serialized_packet|, inform any attached AckNotifiers | 100 // For each frame in |serialized_packet|, inform any attached AckNotifiers |
| 102 // of the packet's sequence number. | 101 // of the packet's sequence number. |
| 103 for (const QuicFrame& quic_frame : frames->frames()) { | 102 for (const QuicFrame& quic_frame : frames->frames()) { |
| 104 if (quic_frame.type != STREAM_FRAME || | 103 if (quic_frame.type != STREAM_FRAME || |
| 105 quic_frame.stream_frame->notifier == nullptr) { | 104 quic_frame.stream_frame->notifier == nullptr) { |
| 106 continue; | 105 continue; |
| 107 } | 106 } |
| 108 | 107 |
| 109 QuicAckNotifier* notifier = quic_frame.stream_frame->notifier; | 108 QuicAckNotifier* notifier = quic_frame.stream_frame->notifier; |
| 110 notifier->AddSequenceNumber(serialized_packet.sequence_number, | 109 notifier->OnSerializedPacket(); |
| 111 serialized_packet.packet->length()); | |
| 112 | 110 |
| 113 // Update the mapping in the other direction, from sequence number to | 111 // Update the mapping in the other direction, from sequence number to |
| 114 // AckNotifier. | 112 // AckNotifier. |
| 115 ack_notifier_map_[serialized_packet.sequence_number].push_back(notifier); | 113 ack_notifier_map_[serialized_packet.sequence_number].push_back(notifier); |
| 116 | 114 |
| 117 // Take ownership of the AckNotifier. | 115 // Take ownership of the AckNotifier. |
| 118 ack_notifiers_.insert(notifier); | 116 ack_notifiers_.insert(notifier); |
| 119 } | 117 } |
| 120 } | 118 } |
| 121 } | 119 } |
| 122 | 120 |
| 123 } // namespace net | 121 } // namespace net |
| OLD | NEW |