| 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 "webkit/fileapi/file_system_url_request_job.h" | 5 #include "webkit/fileapi/file_system_url_request_job.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/file_util_proxy.h" | 10 #include "base/file_util_proxy.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 return false; | 102 return false; |
| 103 | 103 |
| 104 if (remaining_bytes_ < dest_size) | 104 if (remaining_bytes_ < dest_size) |
| 105 dest_size = static_cast<int>(remaining_bytes_); | 105 dest_size = static_cast<int>(remaining_bytes_); |
| 106 | 106 |
| 107 if (!dest_size) { | 107 if (!dest_size) { |
| 108 *bytes_read = 0; | 108 *bytes_read = 0; |
| 109 return true; | 109 return true; |
| 110 } | 110 } |
| 111 | 111 |
| 112 int rv = stream_->Read(dest->data(), dest_size, | 112 int rv = stream_->Read(dest, dest_size, |
| 113 base::Bind(&FileSystemURLRequestJob::DidRead, | 113 base::Bind(&FileSystemURLRequestJob::DidRead, |
| 114 base::Unretained(this))); | 114 base::Unretained(this))); |
| 115 if (rv >= 0) { | 115 if (rv >= 0) { |
| 116 // Data is immediately available. | 116 // Data is immediately available. |
| 117 *bytes_read = rv; | 117 *bytes_read = rv; |
| 118 remaining_bytes_ -= rv; | 118 remaining_bytes_ -= rv; |
| 119 DCHECK_GE(remaining_bytes_, 0); | 119 DCHECK_GE(remaining_bytes_, 0); |
| 120 return true; | 120 return true; |
| 121 } | 121 } |
| 122 | 122 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 } | 279 } |
| 280 | 280 |
| 281 return false; | 281 return false; |
| 282 } | 282 } |
| 283 | 283 |
| 284 void FileSystemURLRequestJob::NotifyFailed(int rv) { | 284 void FileSystemURLRequestJob::NotifyFailed(int rv) { |
| 285 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); | 285 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); |
| 286 } | 286 } |
| 287 | 287 |
| 288 } // namespace fileapi | 288 } // namespace fileapi |
| OLD | NEW |