OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/file_system_operation_runner.h" | 5 #include "storage/browser/fileapi/file_system_operation_runner.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop_proxy.h" | 8 #include "base/message_loop/message_loop_proxy.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "net/url_request/url_request_context.h" | 10 #include "net/url_request/url_request_context.h" |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 operation->Remove( | 231 operation->Remove( |
232 url, recursive, | 232 url, recursive, |
233 base::Bind(&FileSystemOperationRunner::DidFinish, AsWeakPtr(), | 233 base::Bind(&FileSystemOperationRunner::DidFinish, AsWeakPtr(), |
234 handle, callback)); | 234 handle, callback)); |
235 return handle.id; | 235 return handle.id; |
236 } | 236 } |
237 | 237 |
238 OperationID FileSystemOperationRunner::Write( | 238 OperationID FileSystemOperationRunner::Write( |
239 const net::URLRequestContext* url_request_context, | 239 const net::URLRequestContext* url_request_context, |
240 const FileSystemURL& url, | 240 const FileSystemURL& url, |
241 scoped_ptr<storage::BlobDataHandle> blob, | 241 scoped_ptr<storage::BlobDataSnapshotHandle> blob, |
242 int64 offset, | 242 int64 offset, |
243 const WriteCallback& callback) { | 243 const WriteCallback& callback) { |
244 base::File::Error error = base::File::FILE_OK; | 244 base::File::Error error = base::File::FILE_OK; |
245 FileSystemOperation* operation = | 245 FileSystemOperation* operation = |
246 file_system_context_->CreateFileSystemOperation(url, &error); | 246 file_system_context_->CreateFileSystemOperation(url, &error); |
247 | 247 |
248 BeginOperationScoper scope; | 248 BeginOperationScoper scope; |
249 OperationHandle handle = BeginOperation(operation, scope.AsWeakPtr()); | 249 OperationHandle handle = BeginOperation(operation, scope.AsWeakPtr()); |
250 if (!operation) { | 250 if (!operation) { |
251 DidWrite(handle, callback, error, 0, true); | 251 DidWrite(handle, callback, error, 0, true); |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 stray_cancel_callbacks_.find(id); | 681 stray_cancel_callbacks_.find(id); |
682 if (found_cancel != stray_cancel_callbacks_.end()) { | 682 if (found_cancel != stray_cancel_callbacks_.end()) { |
683 // This cancel has been requested after the operation has finished, | 683 // This cancel has been requested after the operation has finished, |
684 // so report that we failed to stop it. | 684 // so report that we failed to stop it. |
685 found_cancel->second.Run(base::File::FILE_ERROR_INVALID_OPERATION); | 685 found_cancel->second.Run(base::File::FILE_ERROR_INVALID_OPERATION); |
686 stray_cancel_callbacks_.erase(found_cancel); | 686 stray_cancel_callbacks_.erase(found_cancel); |
687 } | 687 } |
688 } | 688 } |
689 | 689 |
690 } // namespace storage | 690 } // namespace storage |
OLD | NEW |