| 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/syncable/syncable_file_system_operation.h" | 5 #include "webkit/fileapi/syncable/syncable_file_system_operation.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "webkit/blob/shareable_file_reference.h" | 8 #include "webkit/blob/blob_storage_context.h" |
| 9 #include "webkit/fileapi/file_system_context.h" | 9 #include "webkit/fileapi/file_system_context.h" |
| 10 #include "webkit/fileapi/file_system_url.h" | 10 #include "webkit/fileapi/file_system_url.h" |
| 11 #include "webkit/fileapi/local_file_system_operation.h" | 11 #include "webkit/fileapi/local_file_system_operation.h" |
| 12 #include "webkit/fileapi/sandbox_mount_point_provider.h" | 12 #include "webkit/fileapi/sandbox_mount_point_provider.h" |
| 13 #include "webkit/fileapi/syncable/local_file_sync_context.h" | 13 #include "webkit/fileapi/syncable/local_file_sync_context.h" |
| 14 #include "webkit/fileapi/syncable/syncable_file_operation_runner.h" | 14 #include "webkit/fileapi/syncable/syncable_file_operation_runner.h" |
| 15 | 15 |
| 16 namespace fileapi { | 16 namespace fileapi { |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 base::Bind(&FileSystemOperation::Remove, | 229 base::Bind(&FileSystemOperation::Remove, |
| 230 base::Unretained(file_system_operation_), | 230 base::Unretained(file_system_operation_), |
| 231 url, recursive, | 231 url, recursive, |
| 232 base::Bind(&self::DidFinish, base::Owned(this))))); | 232 base::Bind(&self::DidFinish, base::Owned(this))))); |
| 233 operation_runner_->PostOperationTask(task.Pass()); | 233 operation_runner_->PostOperationTask(task.Pass()); |
| 234 } | 234 } |
| 235 | 235 |
| 236 void SyncableFileSystemOperation::Write( | 236 void SyncableFileSystemOperation::Write( |
| 237 const net::URLRequestContext* url_request_context, | 237 const net::URLRequestContext* url_request_context, |
| 238 const FileSystemURL& url, | 238 const FileSystemURL& url, |
| 239 const GURL& blob_url, | 239 scoped_ptr<webkit_blob::BlobDataHandle> blob_handle, |
| 240 int64 offset, | 240 int64 offset, |
| 241 const WriteCallback& callback) { | 241 const WriteCallback& callback) { |
| 242 DCHECK(CalledOnValidThread()); | 242 DCHECK(CalledOnValidThread()); |
| 243 if (!operation_runner_) { | 243 if (!operation_runner_) { |
| 244 callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND, 0, true); | 244 callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND, 0, true); |
| 245 delete file_system_operation_; | 245 delete file_system_operation_; |
| 246 delete this; | 246 delete this; |
| 247 return; | 247 return; |
| 248 } | 248 } |
| 249 DCHECK(operation_runner_.get()); | 249 DCHECK(operation_runner_.get()); |
| 250 target_paths_.push_back(url); | 250 target_paths_.push_back(url); |
| 251 completion_callback_ = base::Bind(&WriteCallbackAdapter, callback); | 251 completion_callback_ = base::Bind(&WriteCallbackAdapter, callback); |
| 252 scoped_ptr<SyncableFileOperationRunner::Task> task(new QueueableTask( | 252 scoped_ptr<SyncableFileOperationRunner::Task> task(new QueueableTask( |
| 253 this, | 253 this, |
| 254 file_system_operation_->GetWriteClosure( | 254 file_system_operation_->GetWriteClosure( |
| 255 url_request_context, url, blob_url, offset, | 255 url_request_context, url, blob_handle.Pass(), offset, |
| 256 base::Bind(&self::DidWrite, base::Owned(this), callback)))); | 256 base::Bind(&self::DidWrite, base::Owned(this), callback)))); |
| 257 operation_runner_->PostOperationTask(task.Pass()); | 257 operation_runner_->PostOperationTask(task.Pass()); |
| 258 } | 258 } |
| 259 | 259 |
| 260 void SyncableFileSystemOperation::Truncate( | 260 void SyncableFileSystemOperation::Truncate( |
| 261 const FileSystemURL& url, int64 length, | 261 const FileSystemURL& url, int64 length, |
| 262 const StatusCallback& callback) { | 262 const StatusCallback& callback) { |
| 263 DCHECK(CalledOnValidThread()); | 263 DCHECK(CalledOnValidThread()); |
| 264 if (!operation_runner_) { | 264 if (!operation_runner_) { |
| 265 AbortOperation(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND); | 265 AbortOperation(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND); |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 | 386 |
| 387 void SyncableFileSystemOperation::AbortOperation( | 387 void SyncableFileSystemOperation::AbortOperation( |
| 388 const StatusCallback& callback, | 388 const StatusCallback& callback, |
| 389 base::PlatformFileError error) { | 389 base::PlatformFileError error) { |
| 390 callback.Run(error); | 390 callback.Run(error); |
| 391 delete file_system_operation_; | 391 delete file_system_operation_; |
| 392 delete this; | 392 delete this; |
| 393 } | 393 } |
| 394 | 394 |
| 395 } // namespace fileapi | 395 } // namespace fileapi |
| OLD | NEW |