| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/async_file_util_adapter.h" | 5 #include "storage/browser/fileapi/async_file_util_adapter.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/sequenced_task_runner.h" | 14 #include "base/sequenced_task_runner.h" |
| 15 #include "base/task_runner_util.h" | 15 #include "base/task_runner_util.h" |
| 16 #include "base/thread_task_runner_handle.h" | 16 #include "base/thread_task_runner_handle.h" |
| 17 #include "storage/browser/blob/shareable_file_reference.h" | 17 #include "storage/browser/blob/shareable_file_reference.h" |
| 18 #include "storage/browser/fileapi/file_system_context.h" | 18 #include "storage/browser/fileapi/file_system_context.h" |
| 19 #include "storage/browser/fileapi/file_system_file_util.h" | 19 #include "storage/browser/fileapi/file_system_file_util.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 context, url, &error_, &file_info_, &platform_path_); | 69 context, url, &error_, &file_info_, &platform_path_); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void ReplyFileInfo(const AsyncFileUtil::GetFileInfoCallback& callback) { | 72 void ReplyFileInfo(const AsyncFileUtil::GetFileInfoCallback& callback) { |
| 73 callback.Run(error_, file_info_); | 73 callback.Run(error_, file_info_); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void ReplySnapshotFile( | 76 void ReplySnapshotFile( |
| 77 const AsyncFileUtil::CreateSnapshotFileCallback& callback) { | 77 const AsyncFileUtil::CreateSnapshotFileCallback& callback) { |
| 78 callback.Run(error_, file_info_, platform_path_, | 78 callback.Run(error_, file_info_, platform_path_, |
| 79 ShareableFileReference::GetOrCreate(scoped_file_.Pass())); | 79 ShareableFileReference::GetOrCreate(std::move(scoped_file_))); |
| 80 } | 80 } |
| 81 | 81 |
| 82 private: | 82 private: |
| 83 base::File::Error error_; | 83 base::File::Error error_; |
| 84 base::File::Info file_info_; | 84 base::File::Info file_info_; |
| 85 base::FilePath platform_path_; | 85 base::FilePath platform_path_; |
| 86 storage::ScopedFile scoped_file_; | 86 storage::ScopedFile scoped_file_; |
| 87 DISALLOW_COPY_AND_ASSIGN(GetFileInfoHelper); | 87 DISALLOW_COPY_AND_ASSIGN(GetFileInfoHelper); |
| 88 }; | 88 }; |
| 89 | 89 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 } | 131 } |
| 132 origin_runner->PostTask( | 132 origin_runner->PostTask( |
| 133 FROM_HERE, base::Bind(callback, base::File::FILE_OK, entries, | 133 FROM_HERE, base::Bind(callback, base::File::FILE_OK, entries, |
| 134 false /* has_more */)); | 134 false /* has_more */)); |
| 135 } | 135 } |
| 136 | 136 |
| 137 void RunCreateOrOpenCallback( | 137 void RunCreateOrOpenCallback( |
| 138 FileSystemOperationContext* context, | 138 FileSystemOperationContext* context, |
| 139 const AsyncFileUtil::CreateOrOpenCallback& callback, | 139 const AsyncFileUtil::CreateOrOpenCallback& callback, |
| 140 base::File file) { | 140 base::File file) { |
| 141 callback.Run(file.Pass(), base::Closure()); | 141 callback.Run(std::move(file), base::Closure()); |
| 142 } | 142 } |
| 143 | 143 |
| 144 } // namespace | 144 } // namespace |
| 145 | 145 |
| 146 AsyncFileUtilAdapter::AsyncFileUtilAdapter( | 146 AsyncFileUtilAdapter::AsyncFileUtilAdapter( |
| 147 FileSystemFileUtil* sync_file_util) | 147 FileSystemFileUtil* sync_file_util) |
| 148 : sync_file_util_(sync_file_util) { | 148 : sync_file_util_(sync_file_util) { |
| 149 DCHECK(sync_file_util_.get()); | 149 DCHECK(sync_file_util_.get()); |
| 150 } | 150 } |
| 151 | 151 |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 GetFileInfoHelper* helper = new GetFileInfoHelper; | 346 GetFileInfoHelper* helper = new GetFileInfoHelper; |
| 347 const bool success = context_ptr->task_runner()->PostTaskAndReply( | 347 const bool success = context_ptr->task_runner()->PostTaskAndReply( |
| 348 FROM_HERE, | 348 FROM_HERE, |
| 349 Bind(&GetFileInfoHelper::CreateSnapshotFile, Unretained(helper), | 349 Bind(&GetFileInfoHelper::CreateSnapshotFile, Unretained(helper), |
| 350 sync_file_util_.get(), base::Owned(context_ptr), url), | 350 sync_file_util_.get(), base::Owned(context_ptr), url), |
| 351 Bind(&GetFileInfoHelper::ReplySnapshotFile, Owned(helper), callback)); | 351 Bind(&GetFileInfoHelper::ReplySnapshotFile, Owned(helper), callback)); |
| 352 DCHECK(success); | 352 DCHECK(success); |
| 353 } | 353 } |
| 354 | 354 |
| 355 } // namespace storage | 355 } // namespace storage |
| OLD | NEW |