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

Side by Side Diff: webkit/browser/fileapi/file_system_operation_runner.h

Issue 23477026: Make OperationID usable for error handling. (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | webkit/browser/fileapi/file_system_operation_runner.cc » ('j') | 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 #ifndef WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_ 5 #ifndef WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_
6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_ 6 #define WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/id_map.h" 11 #include "base/id_map.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "webkit/browser/fileapi/file_system_operation.h" 14 #include "webkit/browser/fileapi/file_system_operation.h"
15 #include "webkit/browser/fileapi/file_system_url.h" 15 #include "webkit/browser/fileapi/file_system_url.h"
16 #include "webkit/browser/webkit_storage_browser_export.h" 16 #include "webkit/browser/webkit_storage_browser_export.h"
17 17
18 namespace net { 18 namespace net {
19 class URLRequestContext; 19 class URLRequestContext;
20 } 20 }
21 21
22 namespace fileapi { 22 namespace fileapi {
23 23
24 class FileSystemURL; 24 class FileSystemURL;
25 class FileSystemContext; 25 class FileSystemContext;
26 26
27 // A central interface for running FileSystem API operations. 27 // A central interface for running FileSystem API operations.
28 // All operation methods take callback and returns OperationID, which is 28 // All operation methods take callback and returns OperationID, which is
29 // an integer value which can be used for cancelling an operation. 29 // an integer value which can be used for cancelling an operation.
30 // All operation methods return kErrorOperationID if running (posting) an 30 // All operation methods return valid OperationID even if running (posting) an
31 // operation fails, in addition to dispatching the callback with an error 31 // operation fails, in addition to dispatching the callback with an error
32 // code (therefore in most cases the caller does not need to check the 32 // code (therefore in most cases the caller does not need to check the
33 // returned operation ID). 33 // returned operation ID).
34 class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemOperationRunner 34 class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemOperationRunner
35 : public base::SupportsWeakPtr<FileSystemOperationRunner> { 35 : public base::SupportsWeakPtr<FileSystemOperationRunner> {
36 public: 36 public:
37 typedef FileSystemOperation::GetMetadataCallback GetMetadataCallback; 37 typedef FileSystemOperation::GetMetadataCallback GetMetadataCallback;
38 typedef FileSystemOperation::ReadDirectoryCallback ReadDirectoryCallback; 38 typedef FileSystemOperation::ReadDirectoryCallback ReadDirectoryCallback;
39 typedef FileSystemOperation::SnapshotFileCallback SnapshotFileCallback; 39 typedef FileSystemOperation::SnapshotFileCallback SnapshotFileCallback;
40 typedef FileSystemOperation::StatusCallback StatusCallback; 40 typedef FileSystemOperation::StatusCallback StatusCallback;
41 typedef FileSystemOperation::WriteCallback WriteCallback; 41 typedef FileSystemOperation::WriteCallback WriteCallback;
42 typedef FileSystemOperation::OpenFileCallback OpenFileCallback; 42 typedef FileSystemOperation::OpenFileCallback OpenFileCallback;
43 43
44 typedef int OperationID; 44 typedef int OperationID;
45 45
46 static const OperationID kErrorOperationID;
47
48 virtual ~FileSystemOperationRunner(); 46 virtual ~FileSystemOperationRunner();
49 47
50 // Cancels all inflight operations. 48 // Cancels all inflight operations.
51 void Shutdown(); 49 void Shutdown();
52 50
53 // Creates a file at |url|. If |exclusive| is true, an error is raised 51 // Creates a file at |url|. If |exclusive| is true, an error is raised
54 // in case a file is already present at the URL. 52 // in case a file is already present at the URL.
55 OperationID CreateFile(const FileSystemURL& url, 53 OperationID CreateFile(const FileSystemURL& url,
56 bool exclusive, 54 bool exclusive,
57 const StatusCallback& callback); 55 const StatusCallback& callback);
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 // we can notify observers when we're done. 271 // we can notify observers when we're done.
274 typedef std::map<OperationID, FileSystemURLSet> OperationToURLSet; 272 typedef std::map<OperationID, FileSystemURLSet> OperationToURLSet;
275 OperationToURLSet write_target_urls_; 273 OperationToURLSet write_target_urls_;
276 274
277 DISALLOW_COPY_AND_ASSIGN(FileSystemOperationRunner); 275 DISALLOW_COPY_AND_ASSIGN(FileSystemOperationRunner);
278 }; 276 };
279 277
280 } // namespace fileapi 278 } // namespace fileapi
281 279
282 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_ 280 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_
OLDNEW
« 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