OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 } | 80 } |
81 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE); | 81 } while (rv != ERR_IO_PENDING && next_state_ != STATE_NONE); |
82 | 82 |
83 return rv; | 83 return rv; |
84 } | 84 } |
85 | 85 |
86 int HttpResponseBodyDrainer::DoDrainResponseBody() { | 86 int HttpResponseBodyDrainer::DoDrainResponseBody() { |
87 next_state_ = STATE_DRAIN_RESPONSE_BODY_COMPLETE; | 87 next_state_ = STATE_DRAIN_RESPONSE_BODY_COMPLETE; |
88 | 88 |
89 return stream_->ReadResponseBody( | 89 return stream_->ReadResponseBody( |
90 read_buf_, read_size_ - total_read_, | 90 read_buf_.get(), |
| 91 read_size_ - total_read_, |
91 base::Bind(&HttpResponseBodyDrainer::OnIOComplete, | 92 base::Bind(&HttpResponseBodyDrainer::OnIOComplete, |
92 base::Unretained(this))); | 93 base::Unretained(this))); |
93 } | 94 } |
94 | 95 |
95 int HttpResponseBodyDrainer::DoDrainResponseBodyComplete(int result) { | 96 int HttpResponseBodyDrainer::DoDrainResponseBodyComplete(int result) { |
96 DCHECK_NE(ERR_IO_PENDING, result); | 97 DCHECK_NE(ERR_IO_PENDING, result); |
97 | 98 |
98 if (result < 0) | 99 if (result < 0) |
99 return result; | 100 return result; |
100 | 101 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 stream_->Close(true /* no keep-alive */); | 136 stream_->Close(true /* no keep-alive */); |
136 } else { | 137 } else { |
137 DCHECK_EQ(OK, result); | 138 DCHECK_EQ(OK, result); |
138 stream_->Close(false /* keep-alive */); | 139 stream_->Close(false /* keep-alive */); |
139 } | 140 } |
140 | 141 |
141 delete this; | 142 delete this; |
142 } | 143 } |
143 | 144 |
144 } // namespace net | 145 } // namespace net |
OLD | NEW |