Add parameter to OnCanCreateNewStream indicating directionality

Added a parameter to OnCanCreateNewStream to indicate whether the
available streams are unidirectional or not.

gfe-relnote: N/A is for IETF QUIC (v99 flag protected) only.
PiperOrigin-RevId: 258824808
Change-Id: Ib5f36b81afa35f26fd0ce77e499b51b4a12627b5
diff --git a/quic/core/quic_session.cc b/quic/core/quic_session.cc
index 7fa925d..e5650a9 100644
--- a/quic/core/quic_session.cc
+++ b/quic/core/quic_session.cc
@@ -870,7 +870,9 @@
       !VersionHasIetfQuicFrames(connection_->transport_version())) {
     // Streams that first became draining already called OnCanCreate...
     // This covers the case where the stream went directly to being closed.
-    OnCanCreateNewOutgoingStream();
+    // called with unidirectional false because this is for Google QUIC, which
+    // supports only bidirectional streams.
+    OnCanCreateNewOutgoingStream(false);
   }
 }
 
@@ -926,7 +928,7 @@
       v99_streamid_manager_.OnStreamClosed(stream_id);
     }
   } else if (!VersionHasIetfQuicFrames(connection_->transport_version())) {
-    OnCanCreateNewOutgoingStream();
+    OnCanCreateNewOutgoingStream(false);
   }
 }
 
@@ -1271,7 +1273,16 @@
   }
   if (!IsIncomingStream(stream_id)) {
     // Inform application that a stream is available.
-    OnCanCreateNewOutgoingStream();
+    if (VersionHasIetfQuicFrames(connection_->transport_version())) {
+      if (QuicUtils::IsBidirectionalStreamId(stream_id)) {
+        OnCanCreateNewOutgoingStream(false);
+      } else {
+        OnCanCreateNewOutgoingStream(true);
+      }
+    } else {
+      // Google QUIC has only bidirectional streams.
+      OnCanCreateNewOutgoingStream(false);
+    }
   }
 }
 
@@ -1856,7 +1867,7 @@
   control_frame_manager_.WriteOrBufferStopSending(code, stream_id);
 }
 
-void QuicSession::OnCanCreateNewOutgoingStream() {}
+void QuicSession::OnCanCreateNewOutgoingStream(bool /*unidirectional*/) {}
 
 QuicStreamId QuicSession::next_outgoing_bidirectional_stream_id() const {
   if (VersionHasIetfQuicFrames(connection_->transport_version())) {