| Index: net/quic/core/quic_session.cc
|
| diff --git a/net/quic/core/quic_session.cc b/net/quic/core/quic_session.cc
|
| index 5aa0de73926ee469875b9f38b90b8e1edabe67ec..aaae09067bcf75ec8622691475747f7bcc182769 100644
|
| --- a/net/quic/core/quic_session.cc
|
| +++ b/net/quic/core/quic_session.cc
|
| @@ -47,13 +47,18 @@ QuicSession::QuicSession(QuicConnection* connection,
|
| currently_writing_stream_id_(0),
|
| respect_goaway_(true),
|
| use_stream_notifier_(
|
| - FLAGS_quic_reloadable_flag_quic_use_stream_notifier2) {}
|
| + FLAGS_quic_reloadable_flag_quic_use_stream_notifier2),
|
| + streams_own_data_(use_stream_notifier_ &&
|
| + FLAGS_quic_reloadable_flag_quic_stream_owns_data) {}
|
|
|
| void QuicSession::Initialize() {
|
| connection_->set_visitor(this);
|
| if (use_stream_notifier_) {
|
| connection_->SetStreamNotifier(this);
|
| }
|
| + if (streams_own_data_) {
|
| + connection_->SetDelegateSavesData(true);
|
| + }
|
| connection_->SetFromConfig(config_);
|
|
|
| DCHECK_EQ(kCryptoStreamId, GetMutableCryptoStream()->id());
|
| @@ -1022,4 +1027,34 @@ void QuicSession::OnStreamFrameDiscarded(const QuicStreamFrame& frame) {
|
| stream->OnStreamFrameDiscarded(frame);
|
| }
|
|
|
| +void QuicSession::SaveStreamData(QuicStreamId id,
|
| + QuicIOVector iov,
|
| + size_t iov_offset,
|
| + QuicStreamOffset offset,
|
| + QuicByteCount data_length) {
|
| + QuicStream* stream = GetStream(id);
|
| + if (stream == nullptr) {
|
| + QUIC_BUG << "Stream " << id << " does not exist when trying to save data.";
|
| + connection()->CloseConnection(
|
| + QUIC_INTERNAL_ERROR, "Attempt to save data of a closed stream",
|
| + ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
|
| + return;
|
| + }
|
| + stream->SaveStreamData(iov, iov_offset, offset, data_length);
|
| +}
|
| +
|
| +bool QuicSession::WriteStreamData(QuicStreamId id,
|
| + QuicStreamOffset offset,
|
| + QuicByteCount data_length,
|
| + QuicDataWriter* writer) {
|
| + QuicStream* stream = GetStream(id);
|
| + if (stream == nullptr) {
|
| + // This causes the connection to be closed because of failed to serialize
|
| + // packet.
|
| + QUIC_BUG << "Stream " << id << " does not exist when trying to write data.";
|
| + return false;
|
| + }
|
| + return stream->WriteStreamData(offset, data_length, writer);
|
| +}
|
| +
|
| } // namespace net
|
|
|