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

Unified Diff: net/http/http_response_body_drainer.cc

Issue 8591037: Implement Drain() on HttpPipelinedStream. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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
« net/http/http_pipelined_stream.cc ('K') | « net/http/http_response_body_drainer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_response_body_drainer.cc
diff --git a/net/http/http_response_body_drainer.cc b/net/http/http_response_body_drainer.cc
index aefb18026528f2b90307349fc153e15cbdd7d3c6..718b5ae7ac38eead6c4bf8091cc0b25602c0d9cb 100644
--- a/net/http/http_response_body_drainer.cc
+++ b/net/http/http_response_body_drainer.cc
@@ -25,7 +25,14 @@ HttpResponseBodyDrainer::HttpResponseBodyDrainer(HttpStream* stream)
HttpResponseBodyDrainer::~HttpResponseBodyDrainer() {}
void HttpResponseBodyDrainer::Start(HttpNetworkSession* session) {
- read_buf_ = new IOBuffer(kDrainBodyBufferSize);
+ StartWithSize(session, kDrainBodyBufferSize);
+}
+
+void HttpResponseBodyDrainer::StartWithSize(HttpNetworkSession* session,
+ int num_bytes_to_drain) {
+ DCHECK_LT(0, num_bytes_to_drain);
+ read_size_ = num_bytes_to_drain;
+ read_buf_ = new IOBuffer(read_size_);
mmenke 2011/11/18 15:45:38 This could be a very large amount of memory, for,
James Simonsen 2011/11/22 01:24:20 Done.
next_state_ = STATE_DRAIN_RESPONSE_BODY;
int rv = DoLoop(OK);
@@ -71,7 +78,7 @@ int HttpResponseBodyDrainer::DoDrainResponseBody() {
next_state_ = STATE_DRAIN_RESPONSE_BODY_COMPLETE;
return stream_->ReadResponseBody(
- read_buf_, kDrainBodyBufferSize - total_read_,
+ read_buf_, read_size_ - total_read_,
&io_callback_);
}
« net/http/http_pipelined_stream.cc ('K') | « net/http/http_response_body_drainer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698