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

Unified Diff: net/quic/chromium/quic_http_stream.cc

Issue 2298823002: Resetting the HttpRequestInfo pointers in HttpNetworkTransaction and streams (Closed)
Patch Set: Rebased, removed upload progress plumbing, feedback. (Rebased till refs/heads/master@{#417381}) Created 4 years, 3 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
Index: net/quic/chromium/quic_http_stream.cc
diff --git a/net/quic/chromium/quic_http_stream.cc b/net/quic/chromium/quic_http_stream.cc
index 9ec364ce0833da527ac00ce86cea55bbf0ba219a..388bce47efb27026ec4f9ed3fadd9c3b433d12ef 100644
--- a/net/quic/chromium/quic_http_stream.cc
+++ b/net/quic/chromium/quic_http_stream.cc
@@ -310,14 +310,6 @@ int QuicHttpStream::SendRequest(const HttpRequestHeaders& request_headers,
return rv > 0 ? OK : rv;
}
-UploadProgress QuicHttpStream::GetUploadProgress() const {
- if (!request_body_stream_)
- return UploadProgress();
-
- return UploadProgress(request_body_stream_->position(),
- request_body_stream_->size());
-}
-
int QuicHttpStream::ReadResponseHeaders(const CompletionCallback& callback) {
CHECK(callback_.is_null());
CHECK(!callback.is_null());
@@ -343,6 +335,11 @@ int QuicHttpStream::ReadResponseBody(IOBuffer* buf,
CHECK(!user_buffer_.get());
CHECK_EQ(0, user_buffer_len_);
+ // Invalidate HttpRequestInfo pointer. This is to allow the stream to be
+ // shared across multiple transactions which might require this
+ // stream to outlive the request_info_'s owner.
+ if (request_info_)
+ ResetRequestInfo();
if (!stream_) {
// If the stream is already closed, there is no body to read.
return response_status_;
@@ -709,7 +706,7 @@ int QuicHttpStream::DoSendHeadersComplete(int rv) {
if (rv < 0)
return rv;
- // If the stream is already closed, don't read the request the body.
+ // If the stream is already closed, don't read the request body.
if (!stream_)
return response_status_;
@@ -842,4 +839,13 @@ void QuicHttpStream::ResetStream() {
request_body_stream_->Reset();
}
+void QuicHttpStream::ResetRequestInfo() {
+ // Only allowed when Read state machine starts. It is safe to reset it at
+ // this point since request_info_->upload_data_stream is also not needed
+ // anymore.
+ DCHECK_EQ(STATE_OPEN, next_state_);
Randy Smith (Not in Mondays) 2016/09/09 17:28:24 nit, suggestion: Separate routine needed? (Applie
shivanisha 2016/09/13 19:58:34 done.
+
+ request_info_ = nullptr;
+}
+
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698