Index: net/http/http_stream_parser.cc |
diff --git a/net/http/http_stream_parser.cc b/net/http/http_stream_parser.cc |
index 31681edb8200e547c7e07eab3c2ad372d8e91d9d..289b4040ee58d9e7586675ae001fa86a4d4b63a0 100644 |
--- a/net/http/http_stream_parser.cc |
+++ b/net/http/http_stream_parser.cc |
@@ -380,6 +380,12 @@ int HttpStreamParser::ReadResponseBody(IOBuffer* buf, int buf_len, |
user_read_buf_len_ = buf_len; |
io_state_ = STATE_READ_BODY; |
+ // Invalidate HttpRequestInfo pointer. This is to allow the stream to be |
+ // shared across multiple consumers which might require this |
+ // stream to outlive the consumer that initially created it. |
Randy Smith (Not in Mondays)
2016/09/09 17:28:24
nit, suggestion: Similarly to before, emphasize th
shivanisha
2016/09/13 19:58:34
done.
|
+ if (request_) |
+ ResetRequestInfo(); |
+ |
int result = DoLoop(OK); |
if (result == ERR_IO_PENDING) |
callback_ = callback; |
@@ -1101,14 +1107,6 @@ void HttpStreamParser::CalculateResponseBodySize() { |
} |
} |
-UploadProgress HttpStreamParser::GetUploadProgress() const { |
- if (!request_->upload_data_stream) |
- return UploadProgress(); |
- |
- return UploadProgress(request_->upload_data_stream->position(), |
- request_->upload_data_stream->size()); |
-} |
- |
bool HttpStreamParser::IsResponseBodyComplete() const { |
if (chunked_decoder_.get()) |
return chunked_decoder_->reached_eof(); |
@@ -1235,4 +1233,12 @@ bool HttpStreamParser::SendRequestBuffersEmpty() { |
request_body_send_buf_ == nullptr; |
} |
+void HttpStreamParser::ResetRequestInfo() { |
+ // Only allowed when Read state machine starts. It is safe to reset it at this |
+ // point since request_->upload_data_stream is also not needed anymore. |
+ DCHECK_EQ(STATE_READ_BODY, io_state_); |
Randy Smith (Not in Mondays)
2016/09/09 17:28:24
nit, suggestion: Same as before, I'm not sure if t
shivanisha
2016/09/13 19:58:34
done.
|
+ |
+ request_ = nullptr; |
+} |
+ |
} // namespace net |