| Index: storage/browser/fileapi/recursive_operation_delegate.cc
|
| diff --git a/storage/browser/fileapi/recursive_operation_delegate.cc b/storage/browser/fileapi/recursive_operation_delegate.cc
|
| index a3cb1a8644913a753f77a456de03fee16efad2be..b74dc09d5cb73f4157fd88b9de8dbc0caaf61628 100644
|
| --- a/storage/browser/fileapi/recursive_operation_delegate.cc
|
| +++ b/storage/browser/fileapi/recursive_operation_delegate.cc
|
| @@ -22,7 +22,7 @@ RecursiveOperationDelegate::RecursiveOperationDelegate(
|
| : file_system_context_(file_system_context),
|
| inflight_operations_(0),
|
| canceled_(false),
|
| - ignore_error_(false),
|
| + error_behavior_(FileSystemOperation::ERROR_BEHAVIOR_TERMINATE),
|
| failed_some_operations_(false) {
|
| }
|
|
|
| @@ -36,31 +36,18 @@ void RecursiveOperationDelegate::Cancel() {
|
|
|
| void RecursiveOperationDelegate::StartRecursiveOperation(
|
| const FileSystemURL& root,
|
| + const ErrorBehavior error_behavior,
|
| const StatusCallback& callback) {
|
| DCHECK(pending_directory_stack_.empty());
|
| DCHECK(pending_files_.empty());
|
| DCHECK_EQ(0, inflight_operations_);
|
|
|
| + error_behavior_ = error_behavior;
|
| callback_ = callback;
|
|
|
| TryProcessFile(root);
|
| }
|
|
|
| -void RecursiveOperationDelegate::StartRecursiveOperationWithIgnoringError(
|
| - const FileSystemURL& root,
|
| - const ErrorCallback& error_callback,
|
| - const StatusCallback& status_callback) {
|
| - DCHECK(pending_directory_stack_.empty());
|
| - DCHECK(pending_files_.empty());
|
| - DCHECK_EQ(0, inflight_operations_);
|
| -
|
| - error_callback_ = error_callback;
|
| - callback_ = status_callback;
|
| - ignore_error_ = true;
|
| -
|
| - TryProcessFile(root);
|
| -}
|
| -
|
| void RecursiveOperationDelegate::TryProcessFile(const FileSystemURL& root) {
|
| ++inflight_operations_;
|
| ProcessFile(root, base::Bind(&RecursiveOperationDelegate::DidTryProcessFile,
|
| @@ -192,18 +179,15 @@ void RecursiveOperationDelegate::DidProcessFile(const FileSystemURL& url,
|
| --inflight_operations_;
|
|
|
| if (error != base::File::FILE_OK) {
|
| - if (!ignore_error_) {
|
| + if (error_behavior_ == FileSystemOperation::ERROR_BEHAVIOR_TERMINATE) {
|
| // If an error occurs, invoke Done immediately (even if there remain
|
| // running operations). It is because in the callback, this instance is
|
| // deleted.
|
| Done(error);
|
| return;
|
| - } else {
|
| - failed_some_operations_ = true;
|
| -
|
| - if (!error_callback_.is_null())
|
| - error_callback_.Run(url, error);
|
| }
|
| +
|
| + failed_some_operations_ = true;
|
| }
|
|
|
| ProcessPendingFiles();
|
| @@ -262,7 +246,8 @@ void RecursiveOperationDelegate::Done(base::File::Error error) {
|
| if (canceled_ && error == base::File::FILE_OK) {
|
| callback_.Run(base::File::FILE_ERROR_ABORT);
|
| } else {
|
| - if (ignore_error_ && failed_some_operations_)
|
| + if (error_behavior_ == FileSystemOperation::ERROR_BEHAVIOR_CONTINUE &&
|
| + failed_some_operations_)
|
| callback_.Run(base::File::FILE_ERROR_FAILED);
|
| else
|
| callback_.Run(error);
|
|
|