Add perspective_ member for QuicStream.

This change is in favor of removing session access from stream.

gfe-relnote: no behavior change. Not protected.
PiperOrigin-RevId: 295011376
Change-Id: Ie6a9f899a52bbc1c7ae4eda149259bbc40dba95d
diff --git a/quic/core/quic_stream.cc b/quic/core/quic_stream.cc
index 5331c37..34a9464 100644
--- a/quic/core/quic_stream.cc
+++ b/quic/core/quic_stream.cc
@@ -23,7 +23,7 @@
 namespace quic {
 
 #define ENDPOINT \
-  (session_->perspective() == Perspective::IS_SERVER ? "Server: " : "Client: ")
+  (perspective_ == Perspective::IS_SERVER ? "Server: " : "Client: ")
 
 namespace {
 
@@ -144,9 +144,6 @@
 void PendingStream::Reset(QuicRstStreamErrorCode /*error*/) {
   // Currently PendingStream is only read-unidirectional. It shouldn't send
   // Reset.
-  DCHECK_EQ(READ_UNIDIRECTIONAL,
-            QuicUtils::GetStreamType(id_, session_->perspective(),
-                                     /*peer_initiated = */ true));
   QUIC_NOTREACHED();
 }
 
@@ -363,7 +360,8 @@
                 ? QuicUtils::GetStreamType(id_,
                                            session->perspective(),
                                            session->IsIncomingStream(id_))
-                : type) {
+                : type),
+      perspective_(session->perspective()) {
   if (type_ == WRITE_UNIDIRECTIONAL) {
     set_fin_received(true);
     CloseReadSide();
diff --git a/quic/core/quic_stream.h b/quic/core/quic_stream.h
index c182031..933c77a 100644
--- a/quic/core/quic_stream.h
+++ b/quic/core/quic_stream.h
@@ -535,6 +535,8 @@
   // Indicates whether this stream is bidirectional, read unidirectional or
   // write unidirectional.
   const StreamType type_;
+
+  Perspective perspective_;
 };
 
 }  // namespace quic