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

Unified Diff: webkit/browser/fileapi/file_system_operation_runner.h

Issue 23898002: Dispatch FileSystemOperationRunner callbacks always synchronously (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webkit/browser/fileapi/file_system_operation_runner.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/browser/fileapi/file_system_operation_runner.h
diff --git a/webkit/browser/fileapi/file_system_operation_runner.h b/webkit/browser/fileapi/file_system_operation_runner.h
index 3b36c4333f74f4b8dc525a7e997bfe4a6f71b180..4a499a8e24adf967f17605b2aab9743887e7f3d0 100644
--- a/webkit/browser/fileapi/file_system_operation_runner.h
+++ b/webkit/browser/fileapi/file_system_operation_runner.h
@@ -43,8 +43,6 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemOperationRunner
typedef int OperationID;
- static const OperationID kErrorOperationID;
-
virtual ~FileSystemOperationRunner();
// Cancels all inflight operations.
@@ -222,35 +220,45 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemOperationRunner
base::FilePath* platform_path);
private:
+ class BeginOperationScoper;
+
+ struct OperationHandle {
+ OperationID id;
+ base::WeakPtr<BeginOperationScoper> scope;
+
+ OperationHandle();
+ ~OperationHandle();
+ };
+
friend class FileSystemContext;
explicit FileSystemOperationRunner(FileSystemContext* file_system_context);
- void DidFinish(OperationID id,
+ void DidFinish(OperationHandle handle,
tzik 2013/09/05 03:35:20 Can we replace these OperationHandle with const re
kinuko 2013/09/05 05:51:02 Done.
const StatusCallback& callback,
base::PlatformFileError rv);
- void DidGetMetadata(OperationID id,
+ void DidGetMetadata(OperationHandle handle,
const GetMetadataCallback& callback,
base::PlatformFileError rv,
const base::PlatformFileInfo& file_info);
- void DidReadDirectory(OperationID id,
+ void DidReadDirectory(OperationHandle handle,
const ReadDirectoryCallback& callback,
base::PlatformFileError rv,
const std::vector<DirectoryEntry>& entries,
bool has_more);
- void DidWrite(OperationID id,
+ void DidWrite(OperationHandle handle,
const WriteCallback& callback,
base::PlatformFileError rv,
int64 bytes,
bool complete);
void DidOpenFile(
- OperationID id,
+ OperationHandle handle,
const OpenFileCallback& callback,
base::PlatformFileError rv,
base::PlatformFile file,
const base::Closure& on_close_callback,
base::ProcessHandle peer_handle);
void DidCreateSnapshot(
- OperationID id,
+ OperationHandle handle,
const SnapshotFileCallback& callback,
base::PlatformFileError rv,
const base::PlatformFileInfo& file_info,
@@ -260,7 +268,9 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemOperationRunner
void PrepareForWrite(OperationID id, const FileSystemURL& url);
void PrepareForRead(OperationID id, const FileSystemURL& url);
- // This must be called at the end of any async operations.
+ // These must be called at the beginning and end of any async operations.
+ OperationHandle BeginOperation(FileSystemOperation* operation,
+ base::WeakPtr<BeginOperationScoper> scope);
void FinishOperation(OperationID id);
// Not owned; file_system_context owns this.
@@ -274,6 +284,12 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemOperationRunner
typedef std::map<OperationID, FileSystemURLSet> OperationToURLSet;
OperationToURLSet write_target_urls_;
+ // Operations that are finished but not yet fire their callbacks.
+ std::set<OperationID> finished_operations_;
+
+ // Callbacks for stray cancels whose target operation is already finished.
+ std::map<OperationID, StatusCallback> stray_cancel_callbacks_;
+
DISALLOW_COPY_AND_ASSIGN(FileSystemOperationRunner);
};
« no previous file with comments | « no previous file | webkit/browser/fileapi/file_system_operation_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698