| 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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 } | 391 } |
| 392 GetUsageAndQuotaThenRunTask( | 392 GetUsageAndQuotaThenRunTask( |
| 393 src_path_.origin(), src_path_.type(), | 393 src_path_.origin(), src_path_.type(), |
| 394 base::Bind(&FileSystemOperation::DoOpenFile, | 394 base::Bind(&FileSystemOperation::DoOpenFile, |
| 395 base::Unretained(deleter.release()), callback, file_flags), | 395 base::Unretained(deleter.release()), callback, file_flags), |
| 396 base::Bind(callback, base::PLATFORM_FILE_ERROR_FAILED, | 396 base::Bind(callback, base::PLATFORM_FILE_ERROR_FAILED, |
| 397 base::kInvalidPlatformFileValue, | 397 base::kInvalidPlatformFileValue, |
| 398 base::kNullProcessHandle)); | 398 base::kNullProcessHandle)); |
| 399 } | 399 } |
| 400 | 400 |
| 401 void FileSystemOperation::NotifyCloseFile(const GURL& path, |
| 402 const StatusCallback& callback) { |
| 403 // No particular task to do. Just returning. |
| 404 callback.Run(base::PLATFORM_FILE_OK); |
| 405 } |
| 406 |
| 401 // We can only get here on a write or truncate that's not yet completed. | 407 // We can only get here on a write or truncate that's not yet completed. |
| 402 // We don't support cancelling any other operation at this time. | 408 // We don't support cancelling any other operation at this time. |
| 403 void FileSystemOperation::Cancel(const StatusCallback& cancel_callback) { | 409 void FileSystemOperation::Cancel(const StatusCallback& cancel_callback) { |
| 404 if (file_writer_delegate_.get()) { | 410 if (file_writer_delegate_.get()) { |
| 405 DCHECK_EQ(kOperationWrite, pending_operation_); | 411 DCHECK_EQ(kOperationWrite, pending_operation_); |
| 406 | 412 |
| 407 // Writes are done without proxying through FileUtilProxy after the initial | 413 // Writes are done without proxying through FileUtilProxy after the initial |
| 408 // opening of the PlatformFile. All state changes are done on this thread, | 414 // opening of the PlatformFile. All state changes are done on this thread, |
| 409 // so we're guaranteed to be able to shut down atomically. | 415 // so we're guaranteed to be able to shut down atomically. |
| 410 const bool delete_now = file_writer_delegate_->Cancel(); | 416 const bool delete_now = file_writer_delegate_->Cancel(); |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 } | 733 } |
| 728 | 734 |
| 729 bool FileSystemOperation::SetPendingOperationType(OperationType type) { | 735 bool FileSystemOperation::SetPendingOperationType(OperationType type) { |
| 730 if (pending_operation_ != kOperationNone) | 736 if (pending_operation_ != kOperationNone) |
| 731 return false; | 737 return false; |
| 732 pending_operation_ = type; | 738 pending_operation_ = type; |
| 733 return true; | 739 return true; |
| 734 } | 740 } |
| 735 | 741 |
| 736 } // namespace fileapi | 742 } // namespace fileapi |
| OLD | NEW |