Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(368)

Unified Diff: net/quic/core/quic_session.cc

Issue 2963763003: In QUIC, send data is copied to streams rather than frames. Protected by FLAGS_quic_reloadable_flag… (Closed)
Patch Set: Rebase Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/core/quic_session.h ('k') | net/quic/core/quic_spdy_stream_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « net/quic/core/quic_session.h ('k') | net/quic/core/quic_spdy_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698