| Index: chrome/browser/sync_file_system/local/syncable_file_system_operation.cc
|
| diff --git a/chrome/browser/sync_file_system/local/syncable_file_system_operation.cc b/chrome/browser/sync_file_system/local/syncable_file_system_operation.cc
|
| index d078c10279c77439681208b7fefebb53af782b38..09e84bc452a1f686fab09f5bf2e843f97fcdc105 100644
|
| --- a/chrome/browser/sync_file_system/local/syncable_file_system_operation.cc
|
| +++ b/chrome/browser/sync_file_system/local/syncable_file_system_operation.cc
|
| @@ -12,6 +12,7 @@
|
| #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h"
|
| #include "chrome/browser/sync_file_system/local/syncable_file_operation_runner.h"
|
| #include "chrome/browser/sync_file_system/syncable_file_system_util.h"
|
| +#include "content/public/browser/browser_thread.h"
|
| #include "net/url_request/url_request.h"
|
| #include "storage/browser/blob/shareable_file_reference.h"
|
| #include "storage/browser/fileapi/file_system_context.h"
|
| @@ -68,7 +69,7 @@ class SyncableFileSystemOperation::QueueableTask
|
| private:
|
| base::WeakPtr<SyncableFileSystemOperation> operation_;
|
| base::Closure task_;
|
| - std::vector<FileSystemURL> target_paths_;
|
| + const std::vector<FileSystemURL> target_paths_;
|
| DISALLOW_COPY_AND_ASSIGN(QueueableTask);
|
| };
|
|
|
| @@ -78,7 +79,7 @@ void SyncableFileSystemOperation::CreateFile(
|
| const FileSystemURL& url,
|
| bool exclusive,
|
| const StatusCallback& callback) {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
| if (!operation_runner_.get()) {
|
| callback.Run(base::File::FILE_ERROR_NOT_FOUND);
|
| return;
|
| @@ -99,7 +100,7 @@ void SyncableFileSystemOperation::CreateDirectory(
|
| bool exclusive,
|
| bool recursive,
|
| const StatusCallback& callback) {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
| if (!operation_runner_.get()) {
|
| callback.Run(base::File::FILE_ERROR_NOT_FOUND);
|
| return;
|
| @@ -122,7 +123,7 @@ void SyncableFileSystemOperation::Copy(
|
| ErrorBehavior error_behavior,
|
| const CopyProgressCallback& progress_callback,
|
| const StatusCallback& callback) {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
| if (!operation_runner_.get()) {
|
| callback.Run(base::File::FILE_ERROR_NOT_FOUND);
|
| return;
|
| @@ -143,7 +144,7 @@ void SyncableFileSystemOperation::Move(
|
| const FileSystemURL& dest_url,
|
| CopyOrMoveOption option,
|
| const StatusCallback& callback) {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
| if (!operation_runner_.get()) {
|
| callback.Run(base::File::FILE_ERROR_NOT_FOUND);
|
| return;
|
| @@ -163,14 +164,14 @@ void SyncableFileSystemOperation::Move(
|
| void SyncableFileSystemOperation::DirectoryExists(
|
| const FileSystemURL& url,
|
| const StatusCallback& callback) {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
| impl_->DirectoryExists(url, callback);
|
| }
|
|
|
| void SyncableFileSystemOperation::FileExists(
|
| const FileSystemURL& url,
|
| const StatusCallback& callback) {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
| impl_->FileExists(url, callback);
|
| }
|
|
|
| @@ -178,14 +179,14 @@ void SyncableFileSystemOperation::GetMetadata(
|
| const FileSystemURL& url,
|
| int fields,
|
| const GetMetadataCallback& callback) {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
| impl_->GetMetadata(url, fields, callback);
|
| }
|
|
|
| void SyncableFileSystemOperation::ReadDirectory(
|
| const FileSystemURL& url,
|
| const ReadDirectoryCallback& callback) {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
| // This is a read operation and there'd be no hard to let it go even if
|
| // directory operation is disabled. (And we should allow this if it's made
|
| // on the root directory)
|
| @@ -195,7 +196,7 @@ void SyncableFileSystemOperation::ReadDirectory(
|
| void SyncableFileSystemOperation::Remove(
|
| const FileSystemURL& url, bool recursive,
|
| const StatusCallback& callback) {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
| if (!operation_runner_.get()) {
|
| callback.Run(base::File::FILE_ERROR_NOT_FOUND);
|
| return;
|
| @@ -216,7 +217,7 @@ void SyncableFileSystemOperation::Write(
|
| std::unique_ptr<storage::FileWriterDelegate> writer_delegate,
|
| std::unique_ptr<net::URLRequest> blob_request,
|
| const WriteCallback& callback) {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
| if (!operation_runner_.get()) {
|
| callback.Run(base::File::FILE_ERROR_NOT_FOUND, 0, true);
|
| return;
|
| @@ -236,7 +237,7 @@ void SyncableFileSystemOperation::Write(
|
| void SyncableFileSystemOperation::Truncate(const FileSystemURL& url,
|
| int64_t length,
|
| const StatusCallback& callback) {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
| if (!operation_runner_.get()) {
|
| callback.Run(base::File::FILE_ERROR_NOT_FOUND);
|
| return;
|
| @@ -257,7 +258,7 @@ void SyncableFileSystemOperation::TouchFile(
|
| const base::Time& last_access_time,
|
| const base::Time& last_modified_time,
|
| const StatusCallback& callback) {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
| impl_->TouchFile(url, last_access_time, last_modified_time, callback);
|
| }
|
|
|
| @@ -270,14 +271,14 @@ void SyncableFileSystemOperation::OpenFile(
|
|
|
| void SyncableFileSystemOperation::Cancel(
|
| const StatusCallback& cancel_callback) {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
| impl_->Cancel(cancel_callback);
|
| }
|
|
|
| void SyncableFileSystemOperation::CreateSnapshotFile(
|
| const FileSystemURL& path,
|
| const SnapshotFileCallback& callback) {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
| impl_->CreateSnapshotFile(path, callback);
|
| }
|
|
|
| @@ -285,7 +286,7 @@ void SyncableFileSystemOperation::CopyInForeignFile(
|
| const base::FilePath& src_local_disk_path,
|
| const FileSystemURL& dest_url,
|
| const StatusCallback& callback) {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
| if (!operation_runner_.get()) {
|
| callback.Run(base::File::FILE_ERROR_NOT_FOUND);
|
| return;
|
| @@ -304,14 +305,14 @@ void SyncableFileSystemOperation::CopyInForeignFile(
|
| void SyncableFileSystemOperation::RemoveFile(
|
| const FileSystemURL& url,
|
| const StatusCallback& callback) {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
| impl_->RemoveFile(url, callback);
|
| }
|
|
|
| void SyncableFileSystemOperation::RemoveDirectory(
|
| const FileSystemURL& url,
|
| const StatusCallback& callback) {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
| impl_->RemoveDirectory(url, callback);
|
| }
|
|
|
| @@ -321,7 +322,7 @@ void SyncableFileSystemOperation::CopyFileLocal(
|
| CopyOrMoveOption option,
|
| const CopyFileProgressCallback& progress_callback,
|
| const StatusCallback& callback) {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
| impl_->CopyFileLocal(src_url, dest_url, option, progress_callback, callback);
|
| }
|
|
|
| @@ -330,7 +331,7 @@ void SyncableFileSystemOperation::MoveFileLocal(
|
| const FileSystemURL& dest_url,
|
| CopyOrMoveOption option,
|
| const StatusCallback& callback) {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
| impl_->MoveFileLocal(src_url, dest_url, option, callback);
|
| }
|
|
|
| @@ -361,7 +362,7 @@ SyncableFileSystemOperation::SyncableFileSystemOperation(
|
| }
|
|
|
| void SyncableFileSystemOperation::DidFinish(base::File::Error status) {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
| DCHECK(!completion_callback_.is_null());
|
| if (operation_runner_.get())
|
| operation_runner_->OnOperationCompleted(target_paths_);
|
| @@ -372,7 +373,7 @@ void SyncableFileSystemOperation::DidWrite(const WriteCallback& callback,
|
| base::File::Error result,
|
| int64_t bytes,
|
| bool complete) {
|
| - DCHECK(CalledOnValidThread());
|
| + DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
|
| if (!complete) {
|
| callback.Run(result, bytes, complete);
|
| return;
|
|
|