| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/http/http_response_body_drainer.h" | 5 #include "net/http/http_response_body_drainer.h" |
| 6 | 6 |
| 7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "net/base/io_buffer.h" | 9 #include "net/base/io_buffer.h" |
| 10 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 session_(NULL) {} | 23 session_(NULL) {} |
| 24 | 24 |
| 25 HttpResponseBodyDrainer::~HttpResponseBodyDrainer() {} | 25 HttpResponseBodyDrainer::~HttpResponseBodyDrainer() {} |
| 26 | 26 |
| 27 void HttpResponseBodyDrainer::Start(HttpNetworkSession* session) { | 27 void HttpResponseBodyDrainer::Start(HttpNetworkSession* session) { |
| 28 read_buf_ = new IOBuffer(kDrainBodyBufferSize); | 28 read_buf_ = new IOBuffer(kDrainBodyBufferSize); |
| 29 next_state_ = STATE_DRAIN_RESPONSE_BODY; | 29 next_state_ = STATE_DRAIN_RESPONSE_BODY; |
| 30 int rv = DoLoop(OK); | 30 int rv = DoLoop(OK); |
| 31 | 31 |
| 32 if (rv == ERR_IO_PENDING) { | 32 if (rv == ERR_IO_PENDING) { |
| 33 timer_.Start(FROM_HERE, | 33 timer_.Start(base::TimeDelta::FromSeconds(kTimeoutInSeconds), |
| 34 base::TimeDelta::FromSeconds(kTimeoutInSeconds), | |
| 35 this, | 34 this, |
| 36 &HttpResponseBodyDrainer::OnTimerFired); | 35 &HttpResponseBodyDrainer::OnTimerFired); |
| 37 session_ = session; | 36 session_ = session; |
| 38 session->AddResponseDrainer(this); | 37 session->AddResponseDrainer(this); |
| 39 return; | 38 return; |
| 40 } | 39 } |
| 41 | 40 |
| 42 Finish(rv); | 41 Finish(rv); |
| 43 } | 42 } |
| 44 | 43 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 stream_->Close(true /* no keep-alive */); | 117 stream_->Close(true /* no keep-alive */); |
| 119 } else { | 118 } else { |
| 120 DCHECK_EQ(OK, result); | 119 DCHECK_EQ(OK, result); |
| 121 stream_->Close(false /* keep-alive */); | 120 stream_->Close(false /* keep-alive */); |
| 122 } | 121 } |
| 123 | 122 |
| 124 delete this; | 123 delete this; |
| 125 } | 124 } |
| 126 | 125 |
| 127 } // namespace net | 126 } // namespace net |
| OLD | NEW |