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

Unified Diff: storage/browser/fileapi/recursive_operation_delegate.h

Issue 1184343002: Recursive operation delegate continues operations with ignoring errors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: storage/browser/fileapi/recursive_operation_delegate.h
diff --git a/storage/browser/fileapi/recursive_operation_delegate.h b/storage/browser/fileapi/recursive_operation_delegate.h
index f7f07c2549c9163eabd7c971c49afe9e2f9e6929..d120c3366d4113f50d7b4c2cf0645a6878429640 100644
--- a/storage/browser/fileapi/recursive_operation_delegate.h
+++ b/storage/browser/fileapi/recursive_operation_delegate.h
@@ -28,6 +28,7 @@ class STORAGE_EXPORT RecursiveOperationDelegate
: public base::SupportsWeakPtr<RecursiveOperationDelegate> {
public:
typedef FileSystemOperation::StatusCallback StatusCallback;
+ typedef FileSystemOperation::ErrorCallback ErrorCallback;
typedef FileSystemOperation::FileEntryList FileEntryList;
virtual ~RecursiveOperationDelegate();
@@ -108,6 +109,20 @@ class STORAGE_EXPORT RecursiveOperationDelegate
void StartRecursiveOperation(const FileSystemURL& root,
const StatusCallback& callback);
+ // Starts to process files/directories recursively from the given |root|.
+ // Compared with StartRecursiveOperation, this continues operation with
+ // ignoring erros of ProcessFile.
+ //
+ // |error_callback| is fired when a ProcessFile has failed in the middle of
+ // operations. If some errors had happened, |status_callback| is fired with
+ // base::File::FILE_ERROR_FAILED at the end.
+ //
+ // TODO(yawano): Handle errors of ProcessDirectory as well.
+ void StartRecursiveOperationWithIgnoringError(
+ const FileSystemURL& root,
+ const ErrorCallback& error_callback,
+ const StatusCallback& status_callback);
+
FileSystemContext* file_system_context() { return file_system_context_; }
const FileSystemContext* file_system_context() const {
return file_system_context_;
@@ -120,6 +135,7 @@ class STORAGE_EXPORT RecursiveOperationDelegate
virtual void OnCancel();
private:
+ void TryProcessFile(const FileSystemURL& root);
void DidTryProcessFile(const FileSystemURL& root,
base::File::Error error);
void ProcessNextDirectory();
@@ -129,7 +145,7 @@ class STORAGE_EXPORT RecursiveOperationDelegate
const FileEntryList& entries,
bool has_more);
void ProcessPendingFiles();
- void DidProcessFile(base::File::Error error);
+ void DidProcessFile(const FileSystemURL& url, base::File::Error error);
void ProcessSubDirectory();
void DidPostProcessDirectory(base::File::Error error);
@@ -138,11 +154,14 @@ class STORAGE_EXPORT RecursiveOperationDelegate
FileSystemContext* file_system_context_;
StatusCallback callback_;
+ ErrorCallback error_callback_;
std::stack<FileSystemURL> pending_directories_;
std::stack<std::queue<FileSystemURL> > pending_directory_stack_;
std::queue<FileSystemURL> pending_files_;
int inflight_operations_;
bool canceled_;
+ bool ignore_error_;
+ bool failed_some_operations_;
DISALLOW_COPY_AND_ASSIGN(RecursiveOperationDelegate);
};
« no previous file with comments | « storage/browser/fileapi/file_system_operation.h ('k') | storage/browser/fileapi/recursive_operation_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698