Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(405)

Side by Side Diff: storage/browser/fileapi/file_system_operation_runner.cc

Issue 579153002: Add update observer to file_system_operation_impl_unittest for (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/public/test/sandbox_file_system_test_helper.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 const StatusCallback& callback) { 415 const StatusCallback& callback) {
416 base::File::Error error = base::File::FILE_OK; 416 base::File::Error error = base::File::FILE_OK;
417 FileSystemOperation* operation = 417 FileSystemOperation* operation =
418 file_system_context_->CreateFileSystemOperation(url, &error); 418 file_system_context_->CreateFileSystemOperation(url, &error);
419 BeginOperationScoper scope; 419 BeginOperationScoper scope;
420 OperationHandle handle = BeginOperation(operation, scope.AsWeakPtr()); 420 OperationHandle handle = BeginOperation(operation, scope.AsWeakPtr());
421 if (!operation) { 421 if (!operation) {
422 DidFinish(handle, callback, error); 422 DidFinish(handle, callback, error);
423 return handle.id; 423 return handle.id;
424 } 424 }
425 PrepareForWrite(handle.id, url);
425 operation->RemoveFile( 426 operation->RemoveFile(
426 url, 427 url,
427 base::Bind(&FileSystemOperationRunner::DidFinish, AsWeakPtr(), 428 base::Bind(&FileSystemOperationRunner::DidFinish, AsWeakPtr(),
428 handle, callback)); 429 handle, callback));
429 return handle.id; 430 return handle.id;
430 } 431 }
431 432
432 OperationID FileSystemOperationRunner::RemoveDirectory( 433 OperationID FileSystemOperationRunner::RemoveDirectory(
433 const FileSystemURL& url, 434 const FileSystemURL& url,
434 const StatusCallback& callback) { 435 const StatusCallback& callback) {
435 base::File::Error error = base::File::FILE_OK; 436 base::File::Error error = base::File::FILE_OK;
436 FileSystemOperation* operation = 437 FileSystemOperation* operation =
437 file_system_context_->CreateFileSystemOperation(url, &error); 438 file_system_context_->CreateFileSystemOperation(url, &error);
438 BeginOperationScoper scope; 439 BeginOperationScoper scope;
439 OperationHandle handle = BeginOperation(operation, scope.AsWeakPtr()); 440 OperationHandle handle = BeginOperation(operation, scope.AsWeakPtr());
440 if (!operation) { 441 if (!operation) {
441 DidFinish(handle, callback, error); 442 DidFinish(handle, callback, error);
442 return handle.id; 443 return handle.id;
443 } 444 }
445 PrepareForWrite(handle.id, url);
444 operation->RemoveDirectory( 446 operation->RemoveDirectory(
445 url, 447 url,
446 base::Bind(&FileSystemOperationRunner::DidFinish, AsWeakPtr(), 448 base::Bind(&FileSystemOperationRunner::DidFinish, AsWeakPtr(),
447 handle, callback)); 449 handle, callback));
448 return handle.id; 450 return handle.id;
449 } 451 }
450 452
451 OperationID FileSystemOperationRunner::CopyFileLocal( 453 OperationID FileSystemOperationRunner::CopyFileLocal(
452 const FileSystemURL& src_url, 454 const FileSystemURL& src_url,
453 const FileSystemURL& dest_url, 455 const FileSystemURL& dest_url,
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 stray_cancel_callbacks_.find(id); 685 stray_cancel_callbacks_.find(id);
684 if (found_cancel != stray_cancel_callbacks_.end()) { 686 if (found_cancel != stray_cancel_callbacks_.end()) {
685 // This cancel has been requested after the operation has finished, 687 // This cancel has been requested after the operation has finished,
686 // so report that we failed to stop it. 688 // so report that we failed to stop it.
687 found_cancel->second.Run(base::File::FILE_ERROR_INVALID_OPERATION); 689 found_cancel->second.Run(base::File::FILE_ERROR_INVALID_OPERATION);
688 stray_cancel_callbacks_.erase(found_cancel); 690 stray_cancel_callbacks_.erase(found_cancel);
689 } 691 }
690 } 692 }
691 693
692 } // namespace storage 694 } // namespace storage
OLDNEW
« no previous file with comments | « content/public/test/sandbox_file_system_test_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698