| Index: content/browser/renderer_host/redirect_to_file_resource_handler.cc
|
| diff --git a/content/browser/renderer_host/redirect_to_file_resource_handler.cc b/content/browser/renderer_host/redirect_to_file_resource_handler.cc
|
| index 8ebba69a259a904d9adbd1c44fc59e235b088735..c28c1bcc346d43da300976d249f0680c6083048d 100644
|
| --- a/content/browser/renderer_host/redirect_to_file_resource_handler.cc
|
| +++ b/content/browser/renderer_host/redirect_to_file_resource_handler.cc
|
| @@ -211,9 +211,20 @@ bool RedirectToFileResourceHandler::WriteMore() {
|
| if (write_callback_pending_)
|
| return true;
|
| DCHECK(write_cursor_ < buf_->offset());
|
| +
|
| + // Create a temporary drainable buffer that can be passed to
|
| + // Write(). Temporarily reset the buf_ offset to 0 so that the
|
| + // drainable buffer can point to the the beginning of the buf_.
|
| + int offset = buf_->offset();
|
| + buf_->set_offset(0);
|
| + scoped_refptr<net::DrainableIOBuffer>
|
| + drainable = new net::DrainableIOBuffer(buf_, offset);
|
| + drainable->DidConsume(write_cursor_);
|
| + buf_->set_offset(offset);
|
| +
|
| int rv = file_stream_->Write(
|
| - buf_->StartOfBuffer() + write_cursor_,
|
| - buf_->offset() - write_cursor_,
|
| + drainable,
|
| + drainable->BytesRemaining(),
|
| base::Bind(&RedirectToFileResourceHandler::DidWriteToFile,
|
| base::Unretained(this)));
|
| if (rv == net::ERR_IO_PENDING) {
|
|
|