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

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

Issue 2298823002: Resetting the HttpRequestInfo pointers in HttpNetworkTransaction and streams (Closed)
Patch Set: Initial patch Created 4 years, 4 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 df0a0d6834c977c500694a517df81d2dd15d6a66..998d5a9ba0af9f4937566018a64716d3f8ddbe17 100644
--- a/net/quic/chromium/quic_http_stream.cc
+++ b/net/quic/chromium/quic_http_stream.cc
@@ -310,6 +310,9 @@ int QuicHttpStream::SendRequest(const HttpRequestHeaders& request_headers,
}
UploadProgress QuicHttpStream::GetUploadProgress() const {
+ if (!request_info_)
+ return upload_progress_;
+
if (!request_body_stream_)
return UploadProgress();
@@ -342,6 +345,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 HttpCache::Transactions which might require this
+ // stream to outlive the request_info_'s owner URLRequestHttpJob.
+ if (request_info_)
+ ResetRequestInfo();
if (!stream_) {
// If the stream is already closed, there is no body to read.
return response_status_;
@@ -837,4 +845,16 @@ 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(next_state_ == STATE_OPEN);
mmenke 2016/08/31 21:57:59 DCHECK_EQ provides more useful output on failure.
shivanisha 2016/09/08 20:43:54 done.
+
+ // Save upload progress, if any.
+ upload_progress_ = GetUploadProgress();
+ request_body_stream_ = nullptr;
+
+ request_info_ = nullptr;
+}
} // namespace net
mmenke 2016/08/31 21:57:59 Add blank line before end of namespace.
shivanisha 2016/09/08 20:43:54 done.

Powered by Google App Engine
This is Rietveld 408576698