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/base/upload_data_stream.h" | 5 #include "net/base/upload_data_stream.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "net/base/io_buffer.h" | 8 #include "net/base/io_buffer.h" |
9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
10 #include "net/base/upload_bytes_element_reader.h" | 10 #include "net/base/upload_bytes_element_reader.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 182 |
183 if (reader->BytesRemaining() == 0) { | 183 if (reader->BytesRemaining() == 0) { |
184 ++element_index_; | 184 ++element_index_; |
185 continue; | 185 continue; |
186 } | 186 } |
187 | 187 |
188 if (buf->BytesRemaining() == 0) | 188 if (buf->BytesRemaining() == 0) |
189 break; | 189 break; |
190 | 190 |
191 int result = reader->Read( | 191 int result = reader->Read( |
192 buf, | 192 buf.get(), |
193 buf->BytesRemaining(), | 193 buf->BytesRemaining(), |
194 base::Bind(base::IgnoreResult(&UploadDataStream::ResumePendingRead), | 194 base::Bind(base::IgnoreResult(&UploadDataStream::ResumePendingRead), |
195 weak_ptr_factory_.GetWeakPtr(), | 195 weak_ptr_factory_.GetWeakPtr(), |
196 buf, | 196 buf, |
197 callback)); | 197 callback)); |
198 if (result == ERR_IO_PENDING) { | 198 if (result == ERR_IO_PENDING) { |
199 DCHECK(!callback.is_null()); | 199 DCHECK(!callback.is_null()); |
200 return ERR_IO_PENDING; | 200 return ERR_IO_PENDING; |
201 } | 201 } |
202 ProcessReadResult(buf, result); | 202 ProcessReadResult(buf, result); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 DCHECK_NE(ERR_IO_PENDING, result); | 255 DCHECK_NE(ERR_IO_PENDING, result); |
256 DCHECK(!read_failed_); | 256 DCHECK(!read_failed_); |
257 | 257 |
258 if (result >= 0) | 258 if (result >= 0) |
259 buf->DidConsume(result); | 259 buf->DidConsume(result); |
260 else | 260 else |
261 read_failed_ = true; | 261 read_failed_ = true; |
262 } | 262 } |
263 | 263 |
264 } // namespace net | 264 } // namespace net |
OLD | NEW |