OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 5 #ifndef STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
6 #define STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 6 #define STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 // The return value must be bitwise-or'd of FilePermissionPolicy. | 87 // The return value must be bitwise-or'd of FilePermissionPolicy. |
88 // | 88 // |
89 // Note: if a part of a filesystem is returned via 'Isolated' mount point, | 89 // Note: if a part of a filesystem is returned via 'Isolated' mount point, |
90 // its per-filesystem permission overrides the underlying filesystem's | 90 // its per-filesystem permission overrides the underlying filesystem's |
91 // permission policy. | 91 // permission policy. |
92 static int GetPermissionPolicy(FileSystemType type); | 92 static int GetPermissionPolicy(FileSystemType type); |
93 | 93 |
94 // file_task_runner is used as default TaskRunner. | 94 // file_task_runner is used as default TaskRunner. |
95 // Unless a FileSystemBackend is overridden in CreateFileSystemOperation, | 95 // Unless a FileSystemBackend is overridden in CreateFileSystemOperation, |
96 // it is used for all file operations and file related meta operations. | 96 // it is used for all file operations and file related meta operations. |
97 // The code assumes that file_task_runner->RunsTasksOnCurrentThread() | 97 // The code assumes that file_task_runner->RunsTasksInCurrentSequence() |
98 // returns false if the current task is not running on the thread that allows | 98 // returns false if the current task is not running on the sequence that allow
s |
99 // blocking file operations (like SequencedWorkerPool implementation does). | 99 // blocking file operations (like SequencedWorkerPool implementation does). |
100 // | 100 // |
101 // |external_mount_points| contains non-system external mount points available | 101 // |external_mount_points| contains non-system external mount points available |
102 // in the context. If not NULL, it will be used during URL cracking. | 102 // in the context. If not NULL, it will be used during URL cracking. |
103 // |external_mount_points| may be NULL only on platforms different from | 103 // |external_mount_points| may be NULL only on platforms different from |
104 // ChromeOS (i.e. platforms that don't use external_mount_point_provider). | 104 // ChromeOS (i.e. platforms that don't use external_mount_point_provider). |
105 // | 105 // |
106 // |additional_backends| are added to the internal backend map | 106 // |additional_backends| are added to the internal backend map |
107 // to serve filesystem requests for non-regular types. | 107 // to serve filesystem requests for non-regular types. |
108 // If none is given, this context only handles HTML5 Sandbox FileSystem | 108 // If none is given, this context only handles HTML5 Sandbox FileSystem |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 // For plugin_private_backend(). | 314 // For plugin_private_backend(). |
315 friend class content::PluginPrivateFileSystemBackendTest; | 315 friend class content::PluginPrivateFileSystemBackendTest; |
316 | 316 |
317 // Deleters. | 317 // Deleters. |
318 friend struct DefaultContextDeleter; | 318 friend struct DefaultContextDeleter; |
319 friend class base::DeleteHelper<FileSystemContext>; | 319 friend class base::DeleteHelper<FileSystemContext>; |
320 friend class base::RefCountedThreadSafe<FileSystemContext, | 320 friend class base::RefCountedThreadSafe<FileSystemContext, |
321 DefaultContextDeleter>; | 321 DefaultContextDeleter>; |
322 ~FileSystemContext(); | 322 ~FileSystemContext(); |
323 | 323 |
324 void DeleteOnCorrectThread() const; | 324 void DeleteOnCorrectSequence() const; |
325 | 325 |
326 // Creates a new FileSystemOperation instance by getting an appropriate | 326 // Creates a new FileSystemOperation instance by getting an appropriate |
327 // FileSystemBackend for |url| and calling the backend's corresponding | 327 // FileSystemBackend for |url| and calling the backend's corresponding |
328 // CreateFileSystemOperation method. | 328 // CreateFileSystemOperation method. |
329 // The resolved FileSystemBackend could perform further specialization | 329 // The resolved FileSystemBackend could perform further specialization |
330 // depending on the filesystem type pointed by the |url|. | 330 // depending on the filesystem type pointed by the |url|. |
331 // | 331 // |
332 // Called by FileSystemOperationRunner. | 332 // Called by FileSystemOperationRunner. |
333 FileSystemOperation* CreateFileSystemOperation( | 333 FileSystemOperation* CreateFileSystemOperation( |
334 const FileSystemURL& url, | 334 const FileSystemURL& url, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 | 402 |
403 bool is_incognito_; | 403 bool is_incognito_; |
404 | 404 |
405 std::unique_ptr<FileSystemOperationRunner> operation_runner_; | 405 std::unique_ptr<FileSystemOperationRunner> operation_runner_; |
406 | 406 |
407 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemContext); | 407 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemContext); |
408 }; | 408 }; |
409 | 409 |
410 struct DefaultContextDeleter { | 410 struct DefaultContextDeleter { |
411 static void Destruct(const FileSystemContext* context) { | 411 static void Destruct(const FileSystemContext* context) { |
412 context->DeleteOnCorrectThread(); | 412 context->DeleteOnCorrectSequence(); |
413 } | 413 } |
414 }; | 414 }; |
415 | 415 |
416 } // namespace storage | 416 } // namespace storage |
417 | 417 |
418 #endif // STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 418 #endif // STORAGE_BROWSER_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
OLD | NEW |