| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/chromeos/drive/fileapi/async_file_util.h" | 5 #include "chrome/browser/chromeos/drive/fileapi/async_file_util.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
| 13 #include "base/task_scheduler/post_task.h" |
| 13 #include "base/threading/sequenced_worker_pool.h" | 14 #include "base/threading/sequenced_worker_pool.h" |
| 14 #include "base/threading/thread_task_runner_handle.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
| 15 #include "chrome/browser/chromeos/drive/drive_integration_service.h" | 16 #include "chrome/browser/chromeos/drive/drive_integration_service.h" |
| 16 #include "chrome/browser/chromeos/drive/file_system_util.h" | 17 #include "chrome/browser/chromeos/drive/file_system_util.h" |
| 17 #include "chrome/browser/chromeos/drive/fileapi/fileapi_worker.h" | 18 #include "chrome/browser/chromeos/drive/fileapi/fileapi_worker.h" |
| 18 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
| 19 #include "google_apis/drive/task_util.h" | 20 #include "google_apis/drive/task_util.h" |
| 20 #include "storage/browser/blob/shareable_file_reference.h" | 21 #include "storage/browser/blob/shareable_file_reference.h" |
| 21 #include "storage/browser/fileapi/file_system_operation_context.h" | 22 #include "storage/browser/fileapi/file_system_operation_context.h" |
| 22 #include "storage/browser/fileapi/file_system_url.h" | 23 #include "storage/browser/fileapi/file_system_url.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 const base::File::Info& file_info, | 113 const base::File::Info& file_info, |
| 113 const base::FilePath& local_path, | 114 const base::FilePath& local_path, |
| 114 storage::ScopedFile::ScopeOutPolicy scope_out_policy) { | 115 storage::ScopedFile::ScopeOutPolicy scope_out_policy) { |
| 115 // ShareableFileReference is thread *unsafe* class. So it is necessary to | 116 // ShareableFileReference is thread *unsafe* class. So it is necessary to |
| 116 // create the instance (by invoking GetOrCreate) on IO thread, though | 117 // create the instance (by invoking GetOrCreate) on IO thread, though |
| 117 // most drive file system related operations run on UI thread. | 118 // most drive file system related operations run on UI thread. |
| 118 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 119 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 119 | 120 |
| 120 scoped_refptr<storage::ShareableFileReference> file_reference = | 121 scoped_refptr<storage::ShareableFileReference> file_reference = |
| 121 storage::ShareableFileReference::GetOrCreate(storage::ScopedFile( | 122 storage::ShareableFileReference::GetOrCreate(storage::ScopedFile( |
| 122 local_path, scope_out_policy, BrowserThread::GetBlockingPool())); | 123 local_path, scope_out_policy, |
| 124 base::CreateSequencedTaskRunnerWithTraits( |
| 125 {base::MayBlock(), base::TaskPriority::USER_BLOCKING}))); |
| 123 callback.Run(error, file_info, local_path, file_reference); | 126 callback.Run(error, file_info, local_path, file_reference); |
| 124 } | 127 } |
| 125 | 128 |
| 126 } // namespace | 129 } // namespace |
| 127 | 130 |
| 128 AsyncFileUtil::AsyncFileUtil() { | 131 AsyncFileUtil::AsyncFileUtil() { |
| 129 } | 132 } |
| 130 | 133 |
| 131 AsyncFileUtil::~AsyncFileUtil() { | 134 AsyncFileUtil::~AsyncFileUtil() { |
| 132 } | 135 } |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 base::Bind(&RunCreateSnapshotFileCallback, callback))), | 448 base::Bind(&RunCreateSnapshotFileCallback, callback))), |
| 446 base::Bind(callback, | 449 base::Bind(callback, |
| 447 base::File::FILE_ERROR_FAILED, | 450 base::File::FILE_ERROR_FAILED, |
| 448 base::File::Info(), | 451 base::File::Info(), |
| 449 base::FilePath(), | 452 base::FilePath(), |
| 450 scoped_refptr<storage::ShareableFileReference>())); | 453 scoped_refptr<storage::ShareableFileReference>())); |
| 451 } | 454 } |
| 452 | 455 |
| 453 } // namespace internal | 456 } // namespace internal |
| 454 } // namespace drive | 457 } // namespace drive |
| OLD | NEW |