Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "storage/browser/fileapi/file_system_operation_runner.h" | 5 #include "storage/browser/fileapi/file_system_operation_runner.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <tuple> | 10 #include <tuple> |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 648 void FileSystemOperationRunner::PrepareForRead(OperationID id, | 648 void FileSystemOperationRunner::PrepareForRead(OperationID id, |
| 649 const FileSystemURL& url) { | 649 const FileSystemURL& url) { |
| 650 if (file_system_context_->GetAccessObservers(url.type())) { | 650 if (file_system_context_->GetAccessObservers(url.type())) { |
| 651 file_system_context_->GetAccessObservers(url.type())->Notify( | 651 file_system_context_->GetAccessObservers(url.type())->Notify( |
| 652 &FileAccessObserver::OnAccess, std::make_tuple(url)); | 652 &FileAccessObserver::OnAccess, std::make_tuple(url)); |
| 653 } | 653 } |
| 654 } | 654 } |
| 655 | 655 |
| 656 FileSystemOperationRunner::OperationHandle | 656 FileSystemOperationRunner::OperationHandle |
| 657 FileSystemOperationRunner::BeginOperation( | 657 FileSystemOperationRunner::BeginOperation( |
| 658 FileSystemOperation* operation, | 658 FileSystemOperation* operation, |
|
danakj
2016/11/18 00:15:34
can be unique_ptr?
| |
| 659 base::WeakPtr<BeginOperationScoper> scope) { | 659 base::WeakPtr<BeginOperationScoper> scope) { |
| 660 OperationHandle handle; | 660 OperationHandle handle; |
| 661 handle.id = operations_.Add(operation); | 661 handle.id = operations_.Add( |
| 662 std::unique_ptr<FileSystemOperation>(operation)); | |
| 662 handle.scope = scope; | 663 handle.scope = scope; |
| 663 return handle; | 664 return handle; |
| 664 } | 665 } |
| 665 | 666 |
| 666 void FileSystemOperationRunner::FinishOperation(OperationID id) { | 667 void FileSystemOperationRunner::FinishOperation(OperationID id) { |
| 667 OperationToURLSet::iterator found = write_target_urls_.find(id); | 668 OperationToURLSet::iterator found = write_target_urls_.find(id); |
| 668 if (found != write_target_urls_.end()) { | 669 if (found != write_target_urls_.end()) { |
| 669 const FileSystemURLSet& urls = found->second; | 670 const FileSystemURLSet& urls = found->second; |
| 670 for (FileSystemURLSet::const_iterator iter = urls.begin(); | 671 for (FileSystemURLSet::const_iterator iter = urls.begin(); |
| 671 iter != urls.end(); ++iter) { | 672 iter != urls.end(); ++iter) { |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 688 stray_cancel_callbacks_.find(id); | 689 stray_cancel_callbacks_.find(id); |
| 689 if (found_cancel != stray_cancel_callbacks_.end()) { | 690 if (found_cancel != stray_cancel_callbacks_.end()) { |
| 690 // This cancel has been requested after the operation has finished, | 691 // This cancel has been requested after the operation has finished, |
| 691 // so report that we failed to stop it. | 692 // so report that we failed to stop it. |
| 692 found_cancel->second.Run(base::File::FILE_ERROR_INVALID_OPERATION); | 693 found_cancel->second.Run(base::File::FILE_ERROR_INVALID_OPERATION); |
| 693 stray_cancel_callbacks_.erase(found_cancel); | 694 stray_cancel_callbacks_.erase(found_cancel); |
| 694 } | 695 } |
| 695 } | 696 } |
| 696 | 697 |
| 697 } // namespace storage | 698 } // namespace storage |
| OLD | NEW |