Move methods related to stream priority change to StreamDelegateInterface.
gfe-relnote: no behavior change. not protected.
PiperOrigin-RevId: 296006373
Change-Id: I68eda3a4373ecc1095eb484640bd17de174af434
diff --git a/quic/core/quic_session.h b/quic/core/quic_session.h
index 1d6534f..baf3a14 100644
--- a/quic/core/quic_session.h
+++ b/quic/core/quic_session.h
@@ -251,6 +251,17 @@
// Implement StreamDelegateInterface.
void OnStreamError(QuicErrorCode error_code,
std::string error_details) override;
+ // Sets priority in the write blocked list.
+ void RegisterStreamPriority(
+ QuicStreamId id,
+ bool is_static,
+ const spdy::SpdyStreamPrecedence& precedence) override;
+ // Clears priority from the write blocked list.
+ void UnregisterStreamPriority(QuicStreamId id, bool is_static) override;
+ // Updates priority on the write blocked list.
+ void UpdateStreamPriority(
+ QuicStreamId id,
+ const spdy::SpdyStreamPrecedence& new_precedence) override;
// Called by streams when they want to write data to the peer.
// Returns a pair with the number of bytes consumed from data, and a boolean
@@ -271,20 +282,6 @@
virtual void OnCryptoHandshakeMessageReceived(
const CryptoHandshakeMessage& message);
- // Called by the stream on creation to set priority in the write blocked list.
- virtual void RegisterStreamPriority(
- QuicStreamId id,
- bool is_static,
- const spdy::SpdyStreamPrecedence& precedence);
- // Called by the stream on deletion to clear priority from the write blocked
- // list.
- virtual void UnregisterStreamPriority(QuicStreamId id, bool is_static);
- // Called by the stream on SetPriority to update priority on the write blocked
- // list.
- virtual void UpdateStreamPriority(
- QuicStreamId id,
- const spdy::SpdyStreamPrecedence& new_precedence);
-
// Returns mutable config for this session. Returned config is owned
// by QuicSession.
QuicConfig* config();
diff --git a/quic/core/quic_stream.cc b/quic/core/quic_stream.cc
index 6dcbd36..ffbc7aa 100644
--- a/quic/core/quic_stream.cc
+++ b/quic/core/quic_stream.cc
@@ -366,7 +366,7 @@
CloseWriteSide();
}
if (type_ != CRYPTO) {
- session_->RegisterStreamPriority(id, is_static_, precedence_);
+ stream_delegate_->RegisterStreamPriority(id, is_static_, precedence_);
}
}
@@ -378,8 +378,8 @@
<< send_buffer_.stream_bytes_outstanding()
<< ", fin_outstanding: " << fin_outstanding_;
}
- if (session_ != nullptr && type_ != CRYPTO) {
- session_->UnregisterStreamPriority(id(), is_static_);
+ if (stream_delegate_ != nullptr && type_ != CRYPTO) {
+ stream_delegate_->UnregisterStreamPriority(id(), is_static_);
}
}
@@ -551,7 +551,7 @@
MaybeSendPriorityUpdateFrame();
- session_->UpdateStreamPriority(id(), precedence);
+ stream_delegate_->UpdateStreamPriority(id(), precedence);
}
void QuicStream::WriteOrBufferData(
diff --git a/quic/core/stream_delegate_interface.h b/quic/core/stream_delegate_interface.h
index 2616f13..81ec92c 100644
--- a/quic/core/stream_delegate_interface.h
+++ b/quic/core/stream_delegate_interface.h
@@ -7,6 +7,7 @@
#include <cstddef>
#include "net/third_party/quiche/src/quic/core/quic_types.h"
+#include "net/third_party/quiche/src/spdy/core/spdy_protocol.h"
namespace quic {
@@ -19,13 +20,23 @@
// Called when the stream has encountered errors that it can't handle.
virtual void OnStreamError(QuicErrorCode error_code,
std::string error_details) = 0;
-
// Called when the stream needs to write data.
virtual QuicConsumedData WritevData(QuicStream* stream,
QuicStreamId id,
size_t write_length,
QuicStreamOffset offset,
StreamSendingState state) = 0;
+ // Called on stream creation.
+ virtual void RegisterStreamPriority(
+ QuicStreamId id,
+ bool is_static,
+ const spdy::SpdyStreamPrecedence& precedence) = 0;
+ // Called on stream destruction to clear priority.
+ virtual void UnregisterStreamPriority(QuicStreamId id, bool is_static) = 0;
+ // Called by the stream on SetPriority to update priority.
+ virtual void UpdateStreamPriority(
+ QuicStreamId id,
+ const spdy::SpdyStreamPrecedence& new_precedence) = 0;
};
} // namespace quic