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_operation.h" | 5 #include "webkit/fileapi/file_system_operation.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/sequenced_task_runner.h" | 8 #include "base/sequenced_task_runner.h" |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 return; | 301 return; |
302 } | 302 } |
303 | 303 |
304 DCHECK(blob_url.is_valid()); | 304 DCHECK(blob_url.is_valid()); |
305 file_writer_delegate_.reset(new FileWriterDelegate( | 305 file_writer_delegate_.reset(new FileWriterDelegate( |
306 base::Bind(&FileSystemOperation::DidWrite, weak_factory_.GetWeakPtr()), | 306 base::Bind(&FileSystemOperation::DidWrite, weak_factory_.GetWeakPtr()), |
307 writer.Pass())); | 307 writer.Pass())); |
308 | 308 |
309 set_write_callback(callback); | 309 set_write_callback(callback); |
310 scoped_ptr<net::URLRequest> blob_request( | 310 scoped_ptr<net::URLRequest> blob_request( |
311 new net::URLRequest(blob_url, file_writer_delegate_.get())); | 311 new net::URLRequest(blob_url, |
312 blob_request->set_context(url_request_context); | 312 file_writer_delegate_.get(), |
| 313 url_request_context)); |
313 | 314 |
314 file_writer_delegate_->Start(blob_request.Pass()); | 315 file_writer_delegate_->Start(blob_request.Pass()); |
315 } | 316 } |
316 | 317 |
317 void FileSystemOperation::Truncate(const GURL& path_url, int64 length, | 318 void FileSystemOperation::Truncate(const GURL& path_url, int64 length, |
318 const StatusCallback& callback) { | 319 const StatusCallback& callback) { |
319 DCHECK(SetPendingOperationType(kOperationTruncate)); | 320 DCHECK(SetPendingOperationType(kOperationTruncate)); |
320 | 321 |
321 base::PlatformFileError result = SetUpFileSystemPath( | 322 base::PlatformFileError result = SetUpFileSystemPath( |
322 path_url, &src_path_, &src_util_, PATH_FOR_WRITE); | 323 path_url, &src_path_, &src_util_, PATH_FOR_WRITE); |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
727 } | 728 } |
728 | 729 |
729 bool FileSystemOperation::SetPendingOperationType(OperationType type) { | 730 bool FileSystemOperation::SetPendingOperationType(OperationType type) { |
730 if (pending_operation_ != kOperationNone) | 731 if (pending_operation_ != kOperationNone) |
731 return false; | 732 return false; |
732 pending_operation_ = type; | 733 pending_operation_ = type; |
733 return true; | 734 return true; |
734 } | 735 } |
735 | 736 |
736 } // namespace fileapi | 737 } // namespace fileapi |
OLD | NEW |