Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(295)

Side by Side Diff: webkit/fileapi/file_system_context.h

Issue 11090019: Add LocalFileSyncContext class which wires up profile-owned service and FileSystemContext(s) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/platform_file.h" 14 #include "base/platform_file.h"
15 #include "base/sequenced_task_runner_helpers.h" 15 #include "base/sequenced_task_runner_helpers.h"
16 #include "webkit/fileapi/file_system_types.h" 16 #include "webkit/fileapi/file_system_types.h"
17 #include "webkit/fileapi/fileapi_export.h" 17 #include "webkit/fileapi/fileapi_export.h"
18 #include "webkit/fileapi/task_runner_bound_observer_list.h" 18 #include "webkit/fileapi/task_runner_bound_observer_list.h"
19 #include "webkit/fileapi/syncable/syncable_context.h"
19 #include "webkit/quota/special_storage_policy.h" 20 #include "webkit/quota/special_storage_policy.h"
20 21
21 class FilePath; 22 class FilePath;
22 23
23 namespace quota { 24 namespace quota {
24 class QuotaManagerProxy; 25 class QuotaManagerProxy;
25 } 26 }
26 27
27 namespace webkit_blob { 28 namespace webkit_blob {
28 class FileStreamReader; 29 class FileStreamReader;
29 } 30 }
30 31
31 namespace fileapi { 32 namespace fileapi {
32 33
33 class ExternalFileSystemMountPointProvider; 34 class ExternalFileSystemMountPointProvider;
34 class FileSystemFileUtil; 35 class FileSystemFileUtil;
35 class FileSystemMountPointProvider; 36 class FileSystemMountPointProvider;
36 class FileSystemOperation; 37 class FileSystemOperation;
37 class FileSystemOptions; 38 class FileSystemOptions;
38 class FileSystemQuotaUtil; 39 class FileSystemQuotaUtil;
39 class FileSystemTaskRunners; 40 class FileSystemTaskRunners;
40 class FileSystemURL; 41 class FileSystemURL;
41 class IsolatedMountPointProvider; 42 class IsolatedMountPointProvider;
42 class LocalFileChangeTracker; 43 class LocalFileChangeTracker;
43 class SandboxMountPointProvider; 44 class SandboxMountPointProvider;
45 class SyncableContext;
tzik 2012/10/11 09:42:53 looks not needed.
kinuko 2012/10/11 10:13:02 Removed the include on line 19
44 46
45 struct DefaultContextDeleter; 47 struct DefaultContextDeleter;
46 48
47 // This class keeps and provides a file system context for FileSystem API. 49 // This class keeps and provides a file system context for FileSystem API.
48 // An instance of this class is created and owned by profile. 50 // An instance of this class is created and owned by profile.
49 class FILEAPI_EXPORT FileSystemContext 51 class FILEAPI_EXPORT FileSystemContext
50 : public base::RefCountedThreadSafe<FileSystemContext, 52 : public base::RefCountedThreadSafe<FileSystemContext,
51 DefaultContextDeleter> { 53 DefaultContextDeleter> {
52 public: 54 public:
53 // task_runners->file_task_runner() is used as default TaskRunner. 55 // task_runners->file_task_runner() is used as default TaskRunner.
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 // Register a filesystem provider. The ownership of |provider| is 160 // Register a filesystem provider. The ownership of |provider| is
159 // transferred to this instance. 161 // transferred to this instance.
160 void RegisterMountPointProvider(FileSystemType type, 162 void RegisterMountPointProvider(FileSystemType type,
161 FileSystemMountPointProvider* provider); 163 FileSystemMountPointProvider* provider);
162 164
163 FileSystemTaskRunners* task_runners() { return task_runners_.get(); } 165 FileSystemTaskRunners* task_runners() { return task_runners_.get(); }
164 166
165 LocalFileChangeTracker* change_tracker() { return change_tracker_.get(); } 167 LocalFileChangeTracker* change_tracker() { return change_tracker_.get(); }
166 void SetLocalFileChangeTracker(scoped_ptr<LocalFileChangeTracker> tracker); 168 void SetLocalFileChangeTracker(scoped_ptr<LocalFileChangeTracker> tracker);
167 169
170 SyncableContext* syncable_context() { return syncable_context_.get(); }
171 void set_syncable_context(SyncableContext* syncable_context) {
172 syncable_context_ = syncable_context;
173 }
174
168 const FilePath& partition_path() const { return partition_path_; } 175 const FilePath& partition_path() const { return partition_path_; }
169 176
170 private: 177 private:
171 friend struct DefaultContextDeleter; 178 friend struct DefaultContextDeleter;
172 friend class base::DeleteHelper<FileSystemContext>; 179 friend class base::DeleteHelper<FileSystemContext>;
173 friend class base::RefCountedThreadSafe<FileSystemContext, 180 friend class base::RefCountedThreadSafe<FileSystemContext,
174 DefaultContextDeleter>; 181 DefaultContextDeleter>;
175 ~FileSystemContext(); 182 ~FileSystemContext();
176 183
177 void DeleteOnCorrectThread() const; 184 void DeleteOnCorrectThread() const;
178 185
179 scoped_ptr<FileSystemTaskRunners> task_runners_; 186 scoped_ptr<FileSystemTaskRunners> task_runners_;
180 187
181 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; 188 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_;
182 189
183 // Regular mount point providers. 190 // Regular mount point providers.
184 scoped_ptr<SandboxMountPointProvider> sandbox_provider_; 191 scoped_ptr<SandboxMountPointProvider> sandbox_provider_;
185 scoped_ptr<IsolatedMountPointProvider> isolated_provider_; 192 scoped_ptr<IsolatedMountPointProvider> isolated_provider_;
186 scoped_ptr<ExternalFileSystemMountPointProvider> external_provider_; 193 scoped_ptr<ExternalFileSystemMountPointProvider> external_provider_;
187 194
188 // Registered mount point providers. 195 // Registered mount point providers.
189 std::map<FileSystemType, FileSystemMountPointProvider*> provider_map_; 196 std::map<FileSystemType, FileSystemMountPointProvider*> provider_map_;
190 197
191 // The base path of the storage partition for this context. 198 // The base path of the storage partition for this context.
192 const FilePath& partition_path_; 199 const FilePath& partition_path_;
193 200
194 // For syncable file systems. 201 // For syncable file systems.
195 scoped_ptr<LocalFileChangeTracker> change_tracker_; 202 scoped_ptr<LocalFileChangeTracker> change_tracker_;
203 scoped_refptr<SyncableContext> syncable_context_;
196 204
197 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemContext); 205 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemContext);
198 }; 206 };
199 207
200 struct DefaultContextDeleter { 208 struct DefaultContextDeleter {
201 static void Destruct(const FileSystemContext* context) { 209 static void Destruct(const FileSystemContext* context) {
202 context->DeleteOnCorrectThread(); 210 context->DeleteOnCorrectThread();
203 } 211 }
204 }; 212 };
205 213
206 } // namespace fileapi 214 } // namespace fileapi
207 215
208 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ 216 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698