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

Unified Diff: webkit/fileapi/remove_operation_delegate.h

Issue 12051055: 2nd try: FileAPI: Split recursive remove into multiple tasks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 7 years, 11 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
« no previous file with comments | « webkit/fileapi/obfuscated_file_util.cc ('k') | webkit/fileapi/remove_operation_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/fileapi/remove_operation_delegate.h
diff --git a/webkit/fileapi/remove_operation_delegate.h b/webkit/fileapi/remove_operation_delegate.h
new file mode 100644
index 0000000000000000000000000000000000000000..43ea9d2059619ca0ca772499ea0d88cd3270c9e8
--- /dev/null
+++ b/webkit/fileapi/remove_operation_delegate.h
@@ -0,0 +1,64 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WEBKIT_FILEAPI_REMOVE_OPERATION_DELEGATE_H_
+#define WEBKIT_FILEAPI_REMOVE_OPERATION_DELEGATE_H_
+
+#include <queue>
+#include <stack>
+
+#include "base/basictypes.h"
+#include "base/callback.h"
+#include "base/memory/weak_ptr.h"
+#include "webkit/fileapi/file_system_operation.h"
+#include "webkit/fileapi/file_system_url.h"
+
+namespace fileapi {
+
+class FileSystemURL;
+class LocalFileSystemOperation;
+
+class RemoveOperationDelegate
+ : public base::SupportsWeakPtr<RemoveOperationDelegate> {
+ public:
+ typedef FileSystemOperation::StatusCallback StatusCallback;
+ typedef FileSystemOperation::FileEntryList FileEntryList;
+
+ RemoveOperationDelegate(LocalFileSystemOperation* original_operation,
+ const StatusCallback& callback);
+ virtual ~RemoveOperationDelegate();
+
+ void Run(const FileSystemURL& url);
+ void RunRecursively(const FileSystemURL& url);
+
+ private:
+ void ProcessNextDirectory(base::PlatformFileError error);
+ void DidTryRemoveFile(
+ const FileSystemURL& url,
+ base::PlatformFileError error);
+ void DidReadDirectory(
+ const FileSystemURL& parent,
+ base::PlatformFileError error,
+ const FileEntryList& entries,
+ bool has_more);
+ void RemoveFile(const FileSystemURL& url);
+ void DidRemoveFile(base::PlatformFileError error);
+ void RemoveNextDirectory(base::PlatformFileError error);
+
+ LocalFileSystemOperation* NewOperation(const FileSystemURL& url);
+
+ LocalFileSystemOperation* original_operation_;
+ StatusCallback callback_;
+
+ std::queue<FileSystemURL> pending_directories_;
+ std::stack<FileSystemURL> to_remove_directories_;
+
+ int inflight_operations_;
+
+ DISALLOW_COPY_AND_ASSIGN(RemoveOperationDelegate);
+};
+
+} // namespace fileapi
+
+#endif // WEBKIT_FILEAPI_REMOVE_OPERATION_DELEGATE_H_
« no previous file with comments | « webkit/fileapi/obfuscated_file_util.cc ('k') | webkit/fileapi/remove_operation_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698