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 23 matching lines...) Expand all Loading... |
34 class FileSystemFileUtil; | 34 class FileSystemFileUtil; |
35 class FileSystemMountPointProvider; | 35 class FileSystemMountPointProvider; |
36 class FileSystemOperation; | 36 class FileSystemOperation; |
37 class FileSystemOptions; | 37 class FileSystemOptions; |
38 class FileSystemQuotaUtil; | 38 class FileSystemQuotaUtil; |
39 class FileSystemTaskRunners; | 39 class FileSystemTaskRunners; |
40 class FileSystemURL; | 40 class FileSystemURL; |
41 class IsolatedMountPointProvider; | 41 class IsolatedMountPointProvider; |
42 class LocalFileChangeTracker; | 42 class LocalFileChangeTracker; |
43 class SandboxMountPointProvider; | 43 class SandboxMountPointProvider; |
| 44 class LocalFileSyncContext; |
44 | 45 |
45 struct DefaultContextDeleter; | 46 struct DefaultContextDeleter; |
46 | 47 |
47 // This class keeps and provides a file system context for FileSystem API. | 48 // This class keeps and provides a file system context for FileSystem API. |
48 // An instance of this class is created and owned by profile. | 49 // An instance of this class is created and owned by profile. |
49 class FILEAPI_EXPORT FileSystemContext | 50 class FILEAPI_EXPORT FileSystemContext |
50 : public base::RefCountedThreadSafe<FileSystemContext, | 51 : public base::RefCountedThreadSafe<FileSystemContext, |
51 DefaultContextDeleter> { | 52 DefaultContextDeleter> { |
52 public: | 53 public: |
53 // task_runners->file_task_runner() is used as default TaskRunner. | 54 // task_runners->file_task_runner() is used as default TaskRunner. |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 // Register a filesystem provider. The ownership of |provider| is | 159 // Register a filesystem provider. The ownership of |provider| is |
159 // transferred to this instance. | 160 // transferred to this instance. |
160 void RegisterMountPointProvider(FileSystemType type, | 161 void RegisterMountPointProvider(FileSystemType type, |
161 FileSystemMountPointProvider* provider); | 162 FileSystemMountPointProvider* provider); |
162 | 163 |
163 FileSystemTaskRunners* task_runners() { return task_runners_.get(); } | 164 FileSystemTaskRunners* task_runners() { return task_runners_.get(); } |
164 | 165 |
165 LocalFileChangeTracker* change_tracker() { return change_tracker_.get(); } | 166 LocalFileChangeTracker* change_tracker() { return change_tracker_.get(); } |
166 void SetLocalFileChangeTracker(scoped_ptr<LocalFileChangeTracker> tracker); | 167 void SetLocalFileChangeTracker(scoped_ptr<LocalFileChangeTracker> tracker); |
167 | 168 |
| 169 LocalFileSyncContext* sync_context() { return sync_context_.get(); } |
| 170 void set_sync_context(LocalFileSyncContext* sync_context); |
| 171 |
168 const FilePath& partition_path() const { return partition_path_; } | 172 const FilePath& partition_path() const { return partition_path_; } |
169 | 173 |
170 private: | 174 private: |
171 friend struct DefaultContextDeleter; | 175 friend struct DefaultContextDeleter; |
172 friend class base::DeleteHelper<FileSystemContext>; | 176 friend class base::DeleteHelper<FileSystemContext>; |
173 friend class base::RefCountedThreadSafe<FileSystemContext, | 177 friend class base::RefCountedThreadSafe<FileSystemContext, |
174 DefaultContextDeleter>; | 178 DefaultContextDeleter>; |
175 ~FileSystemContext(); | 179 ~FileSystemContext(); |
176 | 180 |
177 void DeleteOnCorrectThread() const; | 181 void DeleteOnCorrectThread() const; |
178 | 182 |
179 scoped_ptr<FileSystemTaskRunners> task_runners_; | 183 scoped_ptr<FileSystemTaskRunners> task_runners_; |
180 | 184 |
181 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; | 185 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; |
182 | 186 |
183 // Regular mount point providers. | 187 // Regular mount point providers. |
184 scoped_ptr<SandboxMountPointProvider> sandbox_provider_; | 188 scoped_ptr<SandboxMountPointProvider> sandbox_provider_; |
185 scoped_ptr<IsolatedMountPointProvider> isolated_provider_; | 189 scoped_ptr<IsolatedMountPointProvider> isolated_provider_; |
186 scoped_ptr<ExternalFileSystemMountPointProvider> external_provider_; | 190 scoped_ptr<ExternalFileSystemMountPointProvider> external_provider_; |
187 | 191 |
188 // Registered mount point providers. | 192 // Registered mount point providers. |
189 std::map<FileSystemType, FileSystemMountPointProvider*> provider_map_; | 193 std::map<FileSystemType, FileSystemMountPointProvider*> provider_map_; |
190 | 194 |
191 // The base path of the storage partition for this context. | 195 // The base path of the storage partition for this context. |
192 const FilePath& partition_path_; | 196 const FilePath& partition_path_; |
193 | 197 |
194 // For syncable file systems. | 198 // For syncable file systems. |
195 scoped_ptr<LocalFileChangeTracker> change_tracker_; | 199 scoped_ptr<LocalFileChangeTracker> change_tracker_; |
| 200 scoped_refptr<LocalFileSyncContext> sync_context_; |
196 | 201 |
197 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemContext); | 202 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemContext); |
198 }; | 203 }; |
199 | 204 |
200 struct DefaultContextDeleter { | 205 struct DefaultContextDeleter { |
201 static void Destruct(const FileSystemContext* context) { | 206 static void Destruct(const FileSystemContext* context) { |
202 context->DeleteOnCorrectThread(); | 207 context->DeleteOnCorrectThread(); |
203 } | 208 } |
204 }; | 209 }; |
205 | 210 |
206 } // namespace fileapi | 211 } // namespace fileapi |
207 | 212 |
208 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 213 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
OLD | NEW |