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