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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 base::Bind(&FileSystemOperation::Remove, | 225 base::Bind(&FileSystemOperation::Remove, |
226 base::Unretained(file_system_operation_), | 226 base::Unretained(file_system_operation_), |
227 url, recursive, | 227 url, recursive, |
228 base::Bind(&self::DidFinish, base::Owned(this))))); | 228 base::Bind(&self::DidFinish, base::Owned(this))))); |
229 operation_runner_->PostOperationTask(task.Pass()); | 229 operation_runner_->PostOperationTask(task.Pass()); |
230 } | 230 } |
231 | 231 |
232 void SyncableFileSystemOperation::Write( | 232 void SyncableFileSystemOperation::Write( |
233 const net::URLRequestContext* url_request_context, | 233 const net::URLRequestContext* url_request_context, |
234 const FileSystemURL& url, | 234 const FileSystemURL& url, |
235 const GURL& blob_url, | 235 scoped_ptr<webkit_blob::BlobDataHandle> blob_handle, |
236 int64 offset, | 236 int64 offset, |
237 const WriteCallback& callback) { | 237 const WriteCallback& callback) { |
238 DCHECK(CalledOnValidThread()); | 238 DCHECK(CalledOnValidThread()); |
239 if (!operation_runner_) { | 239 if (!operation_runner_) { |
240 callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND, 0, true); | 240 callback.Run(base::PLATFORM_FILE_ERROR_NOT_FOUND, 0, true); |
241 delete file_system_operation_; | 241 delete file_system_operation_; |
242 delete this; | 242 delete this; |
243 return; | 243 return; |
244 } | 244 } |
245 DCHECK(operation_runner_.get()); | 245 DCHECK(operation_runner_.get()); |
246 target_paths_.push_back(url); | 246 target_paths_.push_back(url); |
247 completion_callback_ = base::Bind(&WriteCallbackAdapter, callback); | 247 completion_callback_ = base::Bind(&WriteCallbackAdapter, callback); |
248 scoped_ptr<SyncableFileOperationRunner::Task> task(new QueueableTask( | 248 scoped_ptr<SyncableFileOperationRunner::Task> task(new QueueableTask( |
249 this, | 249 this, |
250 file_system_operation_->GetWriteClosure( | 250 file_system_operation_->GetWriteClosure( |
251 url_request_context, url, blob_url, offset, | 251 url_request_context, url, blob_handle.Pass(), offset, |
252 base::Bind(&self::DidWrite, base::Owned(this), callback)))); | 252 base::Bind(&self::DidWrite, base::Owned(this), callback)))); |
253 operation_runner_->PostOperationTask(task.Pass()); | 253 operation_runner_->PostOperationTask(task.Pass()); |
254 } | 254 } |
255 | 255 |
256 void SyncableFileSystemOperation::Truncate( | 256 void SyncableFileSystemOperation::Truncate( |
257 const FileSystemURL& url, int64 length, | 257 const FileSystemURL& url, int64 length, |
258 const StatusCallback& callback) { | 258 const StatusCallback& callback) { |
259 DCHECK(CalledOnValidThread()); | 259 DCHECK(CalledOnValidThread()); |
260 if (!operation_runner_) { | 260 if (!operation_runner_) { |
261 AbortOperation(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND); | 261 AbortOperation(callback, base::PLATFORM_FILE_ERROR_NOT_FOUND); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 callback.Run(error); | 392 callback.Run(error); |
393 delete file_system_operation_; | 393 delete file_system_operation_; |
394 delete this; | 394 delete this; |
395 } | 395 } |
396 | 396 |
397 void SyncableFileSystemOperation::Destruct() { | 397 void SyncableFileSystemOperation::Destruct() { |
398 delete this; | 398 delete this; |
399 } | 399 } |
400 | 400 |
401 } // namespace fileapi | 401 } // namespace fileapi |
OLD | NEW |