A new user interface for you! Read more...

File quic.patch of Package chromium

description: fix gcc compile error with substreams_ initializer list
author: Michael Gilbert <mgilbert@debian.org>

--- a/net/third_party/quic/core/quic_crypto_stream.cc
+++ b/net/third_party/quic/core/quic_crypto_stream.cc
@@ -28,9 +28,9 @@ QuicCryptoStream::QuicCryptoStream(QuicS
                  session,
                  /*is_static=*/true,
                  BIDIRECTIONAL),
-      substreams_{{this, ENCRYPTION_NONE},
-                  {this, ENCRYPTION_ZERO_RTT},
-                  {this, ENCRYPTION_FORWARD_SECURE}} {
+     substreams_{std::make_unique<CryptoSubstream>(this, ENCRYPTION_NONE),
+                 std::make_unique<CryptoSubstream>(this, ENCRYPTION_ZERO_RTT),
+                 std::make_unique<CryptoSubstream>(this, ENCRYPTION_FORWARD_SECURE)} {
   // The crypto stream is exempt from connection level flow control.
   DisableConnectionFlowControlForThisStream();
 }
@@ -57,7 +57,7 @@ void QuicCryptoStream::OnCryptoFrame(con
   QUIC_BUG_IF(session()->connection()->transport_version() < QUIC_VERSION_47)
       << "Versions less than 47 shouldn't receive CRYPTO frames";
   EncryptionLevel level = session()->connection()->last_decrypted_level();
-  substreams_[level].sequencer.OnCryptoFrame(frame);
+  substreams_[level]->sequencer.OnCryptoFrame(frame);
 }
 
 void QuicCryptoStream::OnStreamFrame(const QuicStreamFrame& frame) {
@@ -79,7 +79,7 @@ void QuicCryptoStream::OnDataAvailable()
     OnDataAvailableInSequencer(sequencer(), level);
     return;
   }
-  OnDataAvailableInSequencer(&substreams_[level].sequencer, level);
+  OnDataAvailableInSequencer(&substreams_[level]->sequencer, level);
 }
 
 void QuicCryptoStream::OnDataAvailableInSequencer(
@@ -133,7 +133,7 @@ void QuicCryptoStream::WriteCryptoData(E
   }
   // Append |data| to the send buffer for this encryption level.
   struct iovec iov(QuicUtils::MakeIovec(data));
-  QuicStreamSendBuffer* send_buffer = &substreams_[level].send_buffer;
+  QuicStreamSendBuffer* send_buffer = &substreams_[level]->send_buffer;
   QuicStreamOffset offset = send_buffer->stream_offset();
   send_buffer->SaveStreamData(&iov, /*iov_count=*/1, /*iov_offset=*/0,
                               data.length());
@@ -160,7 +160,7 @@ void QuicCryptoStream::OnSuccessfulVersi
 bool QuicCryptoStream::OnCryptoFrameAcked(const QuicCryptoFrame& frame,
                                           QuicTime::Delta ack_delay_time) {
   QuicByteCount newly_acked_length = 0;
-  if (!substreams_[frame.level].send_buffer.OnStreamDataAcked(
+  if (!substreams_[frame.level]->send_buffer.OnStreamDataAcked(
           frame.offset, frame.data_length, &newly_acked_length)) {
     CloseConnectionWithDetails(QUIC_INTERNAL_ERROR,
                                "Trying to ack unsent crypto data.");
@@ -178,7 +178,7 @@ void QuicCryptoStream::NeuterUnencrypted
     }
     return;
   }
-  QuicStreamSendBuffer* send_buffer = &substreams_[ENCRYPTION_NONE].send_buffer;
+  QuicStreamSendBuffer* send_buffer = &substreams_[ENCRYPTION_NONE]->send_buffer;
   // TODO(nharper): Consider adding a Clear() method to QuicStreamSendBuffer to
   // replace the following code.
   QuicIntervalSet<QuicStreamOffset> to_ack = send_buffer->bytes_acked();
@@ -207,7 +207,7 @@ bool QuicCryptoStream::HasPendingCryptoR
   }
   for (EncryptionLevel level :
        {ENCRYPTION_NONE, ENCRYPTION_ZERO_RTT, ENCRYPTION_FORWARD_SECURE}) {
-    if (substreams_[level].send_buffer.HasPendingRetransmission()) {
+    if (substreams_[level]->send_buffer.HasPendingRetransmission()) {
       return true;
     }
   }
@@ -221,7 +221,7 @@ void QuicCryptoStream::WritePendingCrypt
       session()->connection()->encryption_level();
   for (EncryptionLevel level :
        {ENCRYPTION_NONE, ENCRYPTION_ZERO_RTT, ENCRYPTION_FORWARD_SECURE}) {
-    QuicStreamSendBuffer* send_buffer = &substreams_[level].send_buffer;
+    QuicStreamSendBuffer* send_buffer = &substreams_[level]->send_buffer;
     session()->connection()->SetDefaultEncryptionLevel(level);
     while (send_buffer->HasPendingRetransmission()) {
       auto pending = send_buffer->NextPendingRetransmission();
@@ -326,13 +326,13 @@ uint64_t QuicCryptoStream::crypto_bytes_
   if (session()->connection()->transport_version() < QUIC_VERSION_47) {
     return stream_bytes_read();
   }
-  return substreams_[ENCRYPTION_NONE].sequencer.NumBytesConsumed() +
-         substreams_[ENCRYPTION_ZERO_RTT].sequencer.NumBytesConsumed() +
-         substreams_[ENCRYPTION_FORWARD_SECURE].sequencer.NumBytesConsumed();
+  return substreams_[ENCRYPTION_NONE]->sequencer.NumBytesConsumed() +
+         substreams_[ENCRYPTION_ZERO_RTT]->sequencer.NumBytesConsumed() +
+         substreams_[ENCRYPTION_FORWARD_SECURE]->sequencer.NumBytesConsumed();
 }
 
 uint64_t QuicCryptoStream::BytesReadOnLevel(EncryptionLevel level) const {
-  return substreams_[level].sequencer.NumBytesConsumed();
+  return substreams_[level]->sequencer.NumBytesConsumed();
 }
 
 bool QuicCryptoStream::WriteCryptoFrame(EncryptionLevel level,
@@ -341,14 +341,14 @@ bool QuicCryptoStream::WriteCryptoFrame(
                                         QuicDataWriter* writer) {
   QUIC_BUG_IF(session()->connection()->transport_version() < QUIC_VERSION_47)
       << "Versions less than 47 don't write CRYPTO frames (2)";
-  return substreams_[level].send_buffer.WriteStreamData(offset, data_length,
+  return substreams_[level]->send_buffer.WriteStreamData(offset, data_length,
                                                         writer);
 }
 
 void QuicCryptoStream::OnCryptoFrameLost(QuicCryptoFrame* crypto_frame) {
   QUIC_BUG_IF(session()->connection()->transport_version() < QUIC_VERSION_47)
       << "Versions less than 47 don't lose CRYPTO frames";
-  substreams_[crypto_frame->level].send_buffer.OnStreamDataLost(
+  substreams_[crypto_frame->level]->send_buffer.OnStreamDataLost(
       crypto_frame->offset, crypto_frame->data_length);
 }
 
@@ -358,7 +358,7 @@ void QuicCryptoStream::RetransmitData(Qu
   QuicIntervalSet<QuicStreamOffset> retransmission(
       crypto_frame->offset, crypto_frame->offset + crypto_frame->data_length);
   QuicStreamSendBuffer* send_buffer =
-      &substreams_[crypto_frame->level].send_buffer;
+      &substreams_[crypto_frame->level]->send_buffer;
   retransmission.Difference(send_buffer->bytes_acked());
   if (retransmission.Empty()) {
     return;
@@ -389,7 +389,7 @@ bool QuicCryptoStream::IsFrameOutstandin
     // the wrong transport version.
     return false;
   }
-  return substreams_[level].send_buffer.IsStreamDataOutstanding(offset, length);
+  return substreams_[level]->send_buffer.IsStreamDataOutstanding(offset, length);
 }
 
 bool QuicCryptoStream::IsWaitingForAcks() const {
@@ -398,7 +398,7 @@ bool QuicCryptoStream::IsWaitingForAcks(
   }
   for (EncryptionLevel level :
        {ENCRYPTION_NONE, ENCRYPTION_ZERO_RTT, ENCRYPTION_FORWARD_SECURE}) {
-    if (substreams_[level].send_buffer.stream_bytes_outstanding()) {
+    if (substreams_[level]->send_buffer.stream_bytes_outstanding()) {
       return true;
     }
   }
--- a/net/third_party/quic/core/quic_crypto_stream.h
+++ b/net/third_party/quic/core/quic_crypto_stream.h
@@ -166,7 +166,7 @@ class QUIC_EXPORT_PRIVATE QuicCryptoStre
 
   // Keeps state for data sent/received in CRYPTO frames at each encryption
   // level.
-  CryptoSubstream substreams_[NUM_ENCRYPTION_LEVELS];
+  std::unique_ptr<CryptoSubstream> substreams_[NUM_ENCRYPTION_LEVELS];
 };
 
 }  // namespace quic