| 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 // Responsible for generating packets on behalf of a QuicConnection. | 5 // Responsible for generating packets on behalf of a QuicConnection. |
| 6 // Packets are serialized just-in-time. Control frames are queued. | 6 // Packets are serialized just-in-time. Control frames are queued. |
| 7 // Ack and Feedback frames will be requested from the Connection | 7 // Ack and Feedback frames will be requested from the Connection |
| 8 // just-in-time. When a packet needs to be sent, the Generator | 8 // just-in-time. When a packet needs to be sent, the Generator |
| 9 // will serialize a packet and pass it to QuicConnection::SendOrQueuePacket() | 9 // will serialize a packet and pass it to QuicConnection::SendOrQueuePacket() |
| 10 // | 10 // |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 #include "net/quic/quic_types.h" | 58 #include "net/quic/quic_types.h" |
| 59 | 59 |
| 60 namespace net { | 60 namespace net { |
| 61 | 61 |
| 62 namespace test { | 62 namespace test { |
| 63 class QuicPacketGeneratorPeer; | 63 class QuicPacketGeneratorPeer; |
| 64 } // namespace test | 64 } // namespace test |
| 65 | 65 |
| 66 class QuicAckNotifier; | 66 class QuicAckNotifier; |
| 67 | 67 |
| 68 class NET_EXPORT_PRIVATE QuicPacketGenerator | 68 class NET_EXPORT_PRIVATE QuicPacketGenerator { |
| 69 : public QuicSentPacketManager::NetworkChangeVisitor { | |
| 70 public: | 69 public: |
| 71 class NET_EXPORT_PRIVATE DelegateInterface { | 70 class NET_EXPORT_PRIVATE DelegateInterface { |
| 72 public: | 71 public: |
| 73 virtual ~DelegateInterface() {} | 72 virtual ~DelegateInterface() {} |
| 74 virtual bool ShouldGeneratePacket(TransmissionType transmission_type, | 73 virtual bool ShouldGeneratePacket(TransmissionType transmission_type, |
| 75 HasRetransmittableData retransmittable, | 74 HasRetransmittableData retransmittable, |
| 76 IsHandshake handshake) = 0; | 75 IsHandshake handshake) = 0; |
| 77 virtual QuicAckFrame* CreateAckFrame() = 0; | 76 virtual QuicAckFrame* CreateAckFrame() = 0; |
| 78 virtual QuicCongestionFeedbackFrame* CreateFeedbackFrame() = 0; | 77 virtual QuicCongestionFeedbackFrame* CreateFeedbackFrame() = 0; |
| 79 virtual QuicStopWaitingFrame* CreateStopWaitingFrame() = 0; | 78 virtual QuicStopWaitingFrame* CreateStopWaitingFrame() = 0; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 93 virtual void OnFrameAddedToPacket(const QuicFrame& frame) {} | 92 virtual void OnFrameAddedToPacket(const QuicFrame& frame) {} |
| 94 }; | 93 }; |
| 95 | 94 |
| 96 QuicPacketGenerator(QuicConnectionId connection_id, | 95 QuicPacketGenerator(QuicConnectionId connection_id, |
| 97 QuicFramer* framer, | 96 QuicFramer* framer, |
| 98 QuicRandom* random_generator, | 97 QuicRandom* random_generator, |
| 99 DelegateInterface* delegate); | 98 DelegateInterface* delegate); |
| 100 | 99 |
| 101 virtual ~QuicPacketGenerator(); | 100 virtual ~QuicPacketGenerator(); |
| 102 | 101 |
| 103 // QuicSentPacketManager::NetworkChangeVisitor methods. | 102 // Called by the connection in the event of the congestion window changing. |
| 104 virtual void OnCongestionWindowChange(QuicByteCount congestion_window) | 103 void OnCongestionWindowChange(QuicByteCount congestion_window); |
| 105 OVERRIDE; | |
| 106 | 104 |
| 107 // Indicates that an ACK frame should be sent. If |also_send_feedback| is | 105 // Indicates that an ACK frame should be sent. If |also_send_feedback| is |
| 108 // true, then it also indicates a CONGESTION_FEEDBACK frame should be sent. | 106 // true, then it also indicates a CONGESTION_FEEDBACK frame should be sent. |
| 109 // If |also_send_stop_waiting| is true, then it also indicates that a | 107 // If |also_send_stop_waiting| is true, then it also indicates that a |
| 110 // STOP_WAITING frame should be sent as well. | 108 // STOP_WAITING frame should be sent as well. |
| 111 // The contents of the frame(s) will be generated via a call to the delegates | 109 // The contents of the frame(s) will be generated via a call to the delegates |
| 112 // CreateAckFrame() and CreateFeedbackFrame() when the packet is serialized. | 110 // CreateAckFrame() and CreateFeedbackFrame() when the packet is serialized. |
| 113 void SetShouldSendAck(bool also_send_feedback, | 111 void SetShouldSendAck(bool also_send_feedback, |
| 114 bool also_send_stop_waiting); | 112 bool also_send_stop_waiting); |
| 115 | 113 |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 scoped_ptr<QuicAckFrame> pending_ack_frame_; | 238 scoped_ptr<QuicAckFrame> pending_ack_frame_; |
| 241 scoped_ptr<QuicCongestionFeedbackFrame> pending_feedback_frame_; | 239 scoped_ptr<QuicCongestionFeedbackFrame> pending_feedback_frame_; |
| 242 scoped_ptr<QuicStopWaitingFrame> pending_stop_waiting_frame_; | 240 scoped_ptr<QuicStopWaitingFrame> pending_stop_waiting_frame_; |
| 243 | 241 |
| 244 DISALLOW_COPY_AND_ASSIGN(QuicPacketGenerator); | 242 DISALLOW_COPY_AND_ASSIGN(QuicPacketGenerator); |
| 245 }; | 243 }; |
| 246 | 244 |
| 247 } // namespace net | 245 } // namespace net |
| 248 | 246 |
| 249 #endif // NET_QUIC_QUIC_PACKET_GENERATOR_H_ | 247 #endif // NET_QUIC_QUIC_PACKET_GENERATOR_H_ |
| OLD | NEW |