| 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 WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
| 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 struct DefaultContextDeleter; | 44 struct DefaultContextDeleter; |
| 45 | 45 |
| 46 // This class keeps and provides a file system context for FileSystem API. | 46 // This class keeps and provides a file system context for FileSystem API. |
| 47 // An instance of this class is created and owned by profile. | 47 // An instance of this class is created and owned by profile. |
| 48 class FILEAPI_EXPORT FileSystemContext | 48 class FILEAPI_EXPORT FileSystemContext |
| 49 : public base::RefCountedThreadSafe<FileSystemContext, | 49 : public base::RefCountedThreadSafe<FileSystemContext, |
| 50 DefaultContextDeleter> { | 50 DefaultContextDeleter> { |
| 51 public: | 51 public: |
| 52 // task_runners->file_task_runner() is used as default TaskRunner. | 52 // task_runners->file_task_runner() is used as default TaskRunner. |
| 53 // Unless a MountPointProvired is override in CreateFileSystemOperation, | 53 // Unless a MountPointProvider is overridden in CreateFileSystemOperation, |
| 54 // it is used for all file operations and file related meta operations. | 54 // it is used for all file operations and file related meta operations. |
| 55 // The code assumes that | 55 // The code assumes that |
| 56 // task_runners->file_task_runner()->RunsTasksOnCurrentThread() | 56 // task_runners->file_task_runner()->RunsTasksOnCurrentThread() |
| 57 // returns false if the current task is not running on the thread that allows | 57 // returns false if the current task is not running on the thread that allows |
| 58 // blocking file operations (like SequencedWorkerPool implementation does). | 58 // blocking file operations (like SequencedWorkerPool implementation does). |
| 59 FileSystemContext( | 59 FileSystemContext( |
| 60 scoped_ptr<FileSystemTaskRunners> task_runners, | 60 scoped_ptr<FileSystemTaskRunners> task_runners, |
| 61 quota::SpecialStoragePolicy* special_storage_policy, | 61 quota::SpecialStoragePolicy* special_storage_policy, |
| 62 quota::QuotaManagerProxy* quota_manager_proxy, | 62 quota::QuotaManagerProxy* quota_manager_proxy, |
| 63 const FilePath& profile_path, | 63 const FilePath& profile_path, |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 void DeleteFileSystem( | 122 void DeleteFileSystem( |
| 123 const GURL& origin_url, | 123 const GURL& origin_url, |
| 124 FileSystemType type, | 124 FileSystemType type, |
| 125 const DeleteFileSystemCallback& callback); | 125 const DeleteFileSystemCallback& callback); |
| 126 | 126 |
| 127 // Creates a new FileSystemOperation instance by cracking | 127 // Creates a new FileSystemOperation instance by cracking |
| 128 // the given filesystem URL |url| to get an appropriate MountPointProvider | 128 // the given filesystem URL |url| to get an appropriate MountPointProvider |
| 129 // and calling the provider's corresponding CreateFileSystemOperation method. | 129 // and calling the provider's corresponding CreateFileSystemOperation method. |
| 130 // The resolved MountPointProvider could perform further specialization | 130 // The resolved MountPointProvider could perform further specialization |
| 131 // depending on the filesystem type pointed by the |url|. | 131 // depending on the filesystem type pointed by the |url|. |
| 132 FileSystemOperation* CreateFileSystemOperation(const FileSystemURL& url); | 132 FileSystemOperation* CreateFileSystemOperation( |
| 133 const FileSystemURL& url, |
| 134 base::PlatformFileError* error_code); |
| 133 | 135 |
| 134 // Creates new FileStreamReader instance to read a file pointed by the given | 136 // Creates new FileStreamReader instance to read a file pointed by the given |
| 135 // filesystem URL |url| starting from |offset|. | 137 // filesystem URL |url| starting from |offset|. |
| 136 // This method internally cracks the |url|, get an appropriate | 138 // This method internally cracks the |url|, get an appropriate |
| 137 // MountPointProvider for the URL and call the provider's CreateFileReader. | 139 // MountPointProvider for the URL and call the provider's CreateFileReader. |
| 138 // The resolved MountPointProvider could perform further specialization | 140 // The resolved MountPointProvider could perform further specialization |
| 139 // depending on the filesystem type pointed by the |url|. | 141 // depending on the filesystem type pointed by the |url|. |
| 140 webkit_blob::FileStreamReader* CreateFileStreamReader( | 142 webkit_blob::FileStreamReader* CreateFileStreamReader( |
| 141 const FileSystemURL& url, | 143 const FileSystemURL& url, |
| 142 int64 offset); | 144 int64 offset); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 | 176 |
| 175 struct DefaultContextDeleter { | 177 struct DefaultContextDeleter { |
| 176 static void Destruct(const FileSystemContext* context) { | 178 static void Destruct(const FileSystemContext* context) { |
| 177 context->DeleteOnCorrectThread(); | 179 context->DeleteOnCorrectThread(); |
| 178 } | 180 } |
| 179 }; | 181 }; |
| 180 | 182 |
| 181 } // namespace fileapi | 183 } // namespace fileapi |
| 182 | 184 |
| 183 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 185 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
| OLD | NEW |