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 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 } | 260 } |
261 | 261 |
262 void FileSystemURLRequestJob::DidOpen(base::PlatformFileError error_code, | 262 void FileSystemURLRequestJob::DidOpen(base::PlatformFileError error_code, |
263 base::PassPlatformFile file, | 263 base::PassPlatformFile file, |
264 bool created) { | 264 bool created) { |
265 if (error_code != base::PLATFORM_FILE_OK) { | 265 if (error_code != base::PLATFORM_FILE_OK) { |
266 NotifyFailed(error_code); | 266 NotifyFailed(error_code); |
267 return; | 267 return; |
268 } | 268 } |
269 | 269 |
270 stream_.reset(new net::FileStream(file.ReleaseValue(), kFileFlags)); | 270 stream_.reset(new net::FileStream(file.ReleaseValue(), kFileFlags, NULL)); |
271 | 271 |
272 remaining_bytes_ = byte_range_.last_byte_position() - | 272 remaining_bytes_ = byte_range_.last_byte_position() - |
273 byte_range_.first_byte_position() + 1; | 273 byte_range_.first_byte_position() + 1; |
274 DCHECK_GE(remaining_bytes_, 0); | 274 DCHECK_GE(remaining_bytes_, 0); |
275 | 275 |
276 // TODO(adamk): Please remove this ScopedAllowIO once we support async seek on | 276 // TODO(adamk): Please remove this ScopedAllowIO once we support async seek on |
277 // FileStream. | 277 // FileStream. |
278 base::ThreadRestrictions::ScopedAllowIO allow_io; | 278 base::ThreadRestrictions::ScopedAllowIO allow_io; |
279 // Do the seek at the beginning of the request. | 279 // Do the seek at the beginning of the request. |
280 if (remaining_bytes_ > 0 && | 280 if (remaining_bytes_ > 0 && |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 } | 321 } |
322 | 322 |
323 return false; | 323 return false; |
324 } | 324 } |
325 | 325 |
326 void FileSystemURLRequestJob::NotifyFailed(int rv) { | 326 void FileSystemURLRequestJob::NotifyFailed(int rv) { |
327 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); | 327 NotifyDone(URLRequestStatus(URLRequestStatus::FAILED, rv)); |
328 } | 328 } |
329 | 329 |
330 } // namespace fileapi | 330 } // namespace fileapi |
OLD | NEW |