OLD | NEW |
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" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 typedef FileSystemOperation::StatusCallback StatusCallback; | 42 typedef FileSystemOperation::StatusCallback StatusCallback; |
43 typedef FileSystemOperation::WriteCallback WriteCallback; | 43 typedef FileSystemOperation::WriteCallback WriteCallback; |
44 typedef FileSystemOperation::OpenFileCallback OpenFileCallback; | 44 typedef FileSystemOperation::OpenFileCallback OpenFileCallback; |
45 | 45 |
46 typedef int OperationID; | 46 typedef int OperationID; |
47 | 47 |
48 static const OperationID kErrorOperationID; | 48 static const OperationID kErrorOperationID; |
49 | 49 |
50 virtual ~FileSystemOperationRunner(); | 50 virtual ~FileSystemOperationRunner(); |
51 | 51 |
| 52 // Cancels all inflight operations. |
| 53 void Shutdown(); |
| 54 |
52 // Creates a file at |url|. If |exclusive| is true, an error is raised | 55 // Creates a file at |url|. If |exclusive| is true, an error is raised |
53 // in case a file is already present at the URL. | 56 // in case a file is already present at the URL. |
54 OperationID CreateFile(const FileSystemURL& url, | 57 OperationID CreateFile(const FileSystemURL& url, |
55 bool exclusive, | 58 bool exclusive, |
56 const StatusCallback& callback); | 59 const StatusCallback& callback); |
57 | 60 |
58 OperationID CreateDirectory(const FileSystemURL& url, | 61 OperationID CreateDirectory(const FileSystemURL& url, |
59 bool exclusive, | 62 bool exclusive, |
60 bool recursive, | 63 bool recursive, |
61 const StatusCallback& callback); | 64 const StatusCallback& callback); |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 void PrepareForWrite(OperationID id, const FileSystemURL& url); | 272 void PrepareForWrite(OperationID id, const FileSystemURL& url); |
270 void PrepareForRead(OperationID id, const FileSystemURL& url); | 273 void PrepareForRead(OperationID id, const FileSystemURL& url); |
271 | 274 |
272 // This must be called at the end of any async operations. | 275 // This must be called at the end of any async operations. |
273 void FinishOperation(OperationID id); | 276 void FinishOperation(OperationID id); |
274 | 277 |
275 // Not owned; file_system_context owns this. | 278 // Not owned; file_system_context owns this. |
276 FileSystemContext* file_system_context_; | 279 FileSystemContext* file_system_context_; |
277 | 280 |
278 // IDMap<FileSystemOperation, IDMapOwnPointer> operations_; | 281 // IDMap<FileSystemOperation, IDMapOwnPointer> operations_; |
279 IDMap<FileSystemOperation> operations_; | 282 IDMap<FileSystemOperation, IDMapOwnPointer> operations_; |
280 | 283 |
281 // We keep track of the file to be modified by each operation so that | 284 // We keep track of the file to be modified by each operation so that |
282 // we can notify observers when we're done. | 285 // we can notify observers when we're done. |
283 typedef std::map<OperationID, FileSystemURLSet> OperationToURLSet; | 286 typedef std::map<OperationID, FileSystemURLSet> OperationToURLSet; |
284 OperationToURLSet write_target_urls_; | 287 OperationToURLSet write_target_urls_; |
285 | 288 |
286 DISALLOW_COPY_AND_ASSIGN(FileSystemOperationRunner); | 289 DISALLOW_COPY_AND_ASSIGN(FileSystemOperationRunner); |
287 }; | 290 }; |
288 | 291 |
289 } // namespace fileapi | 292 } // namespace fileapi |
290 | 293 |
291 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_ | 294 #endif // WEBKIT_BROWSER_FILEAPI_FILE_SYSTEM_OPERATION_RUNNER_H_ |
OLD | NEW |