Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / net / quic / quic_packet_generator.cc
index cd2013e..785c940 100644 (file)
@@ -61,6 +61,9 @@ QuicPacketGenerator::~QuicPacketGenerator() {
       case STOP_WAITING_FRAME:
         delete it->stop_waiting_frame;
         break;
+      case PING_FRAME:
+        delete it->ping_frame;
+        break;
       case NUM_FRAME_TYPES:
         DCHECK(false) << "Cannot delete type: " << it->type;
     }
@@ -91,9 +94,6 @@ QuicConsumedData QuicPacketGenerator::ConsumeData(QuicStreamId id,
                                                   bool fin,
                                                   QuicAckNotifier* notifier) {
   IsHandshake handshake = id == kCryptoStreamId ? IS_HANDSHAKE : NOT_HANDSHAKE;
-  // The caller should have flushed pending frames before sending handshake
-  // messages.
-  DCHECK(handshake == NOT_HANDSHAKE || !HasPendingFrames());
   SendQueuedFrames(false);
 
   size_t total_bytes_consumed = 0;
@@ -146,6 +146,8 @@ QuicConsumedData QuicPacketGenerator::ConsumeData(QuicStreamId id,
   // Ensure the FEC group is closed at the end of this method if not in batch
   // mode.
   if (!InBatchMode() && packet_creator_->ShouldSendFec(true)) {
+    // TODO(jri): SerializeFec can return a NULL packet, and this should
+    // cause an early return, with a call to delegate_->OnPacketGenerationError.
     SerializedPacket serialized_fec = packet_creator_->SerializeFec();
     DCHECK(serialized_fec.packet);
     delegate_->OnSerializedPacket(serialized_fec);
@@ -185,6 +187,9 @@ void QuicPacketGenerator::SendQueuedFrames(bool flush) {
     // Ensure the FEC group is closed at the end of this method unless other
     // writes are pending.
     if (packet_creator_->ShouldSendFec(true)) {
+      // TODO(jri): SerializeFec can return a NULL packet, and this should
+      // cause an early return, with a call to
+      // delegate_->OnPacketGenerationError.
       SerializedPacket serialized_fec = packet_creator_->SerializeFec();
       DCHECK(serialized_fec.packet);
       delegate_->OnSerializedPacket(serialized_fec);
@@ -271,6 +276,8 @@ void QuicPacketGenerator::SerializeAndSendPacket() {
   delegate_->OnSerializedPacket(serialized_packet);
 
   if (packet_creator_->ShouldSendFec(false)) {
+    // TODO(jri): SerializeFec can return a NULL packet, and this should
+    // cause an early return, with a call to delegate_->OnPacketGenerationError.
     SerializedPacket serialized_fec = packet_creator_->SerializeFec();
     DCHECK(serialized_fec.packet);
     delegate_->OnSerializedPacket(serialized_fec);