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

Side by Side Diff: webkit/browser/fileapi/sandbox_mount_point_provider.h

Issue 18668003: SyncFS: Introduce SyncFileSystemBackend (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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_BROWSER_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ 5 #ifndef WEBKIT_BROWSER_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_
6 #define WEBKIT_BROWSER_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ 6 #define WEBKIT_BROWSER_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 13 matching lines...) Expand all
24 24
25 namespace base { 25 namespace base {
26 class SequencedTaskRunner; 26 class SequencedTaskRunner;
27 } 27 }
28 28
29 namespace quota { 29 namespace quota {
30 class QuotaManagerProxy; 30 class QuotaManagerProxy;
31 class SpecialStoragePolicy; 31 class SpecialStoragePolicy;
32 } 32 }
33 33
34 namespace sync_file_system {
35 class CannedSyncableFileSystem;
36 class SyncableFileSystemOperation;
37 }
38
39 namespace fileapi { 34 namespace fileapi {
40 35
41 class AsyncFileUtilAdapter; 36 class AsyncFileUtilAdapter;
42 class FileSystemUsageCache; 37 class FileSystemUsageCache;
43 class LocalFileSystemOperation; 38 class LocalFileSystemOperation;
44 class ObfuscatedFileUtil; 39 class ObfuscatedFileUtil;
45 class SandboxQuotaObserver; 40 class SandboxQuotaObserver;
46 41
47 // An interface to construct or crack sandboxed filesystem paths for 42 // An interface to construct or crack sandboxed filesystem paths for
48 // TEMPORARY or PERSISTENT filesystems, which are placed under the user's 43 // TEMPORARY or PERSISTENT filesystems, which are placed under the user's
(...skipping 25 matching lines...) Expand all
74 SandboxMountPointProvider( 69 SandboxMountPointProvider(
75 quota::QuotaManagerProxy* quota_manager_proxy, 70 quota::QuotaManagerProxy* quota_manager_proxy,
76 base::SequencedTaskRunner* file_task_runner, 71 base::SequencedTaskRunner* file_task_runner,
77 const base::FilePath& profile_path, 72 const base::FilePath& profile_path,
78 const FileSystemOptions& file_system_options, 73 const FileSystemOptions& file_system_options,
79 quota::SpecialStoragePolicy* special_storage_policy); 74 quota::SpecialStoragePolicy* special_storage_policy);
80 virtual ~SandboxMountPointProvider(); 75 virtual ~SandboxMountPointProvider();
81 76
82 // FileSystemMountPointProvider overrides. 77 // FileSystemMountPointProvider overrides.
83 virtual bool CanHandleType(FileSystemType type) const OVERRIDE; 78 virtual bool CanHandleType(FileSystemType type) const OVERRIDE;
79 virtual GURL GetRootURI(const GURL& origin_url,
80 FileSystemType type) const OVERRIDE;
84 virtual void OpenFileSystem( 81 virtual void OpenFileSystem(
85 const GURL& origin_url, 82 const GURL& origin_url,
86 FileSystemType type, 83 FileSystemType type,
87 OpenFileSystemMode mode, 84 OpenFileSystemMode mode,
88 const OpenFileSystemCallback& callback) OVERRIDE; 85 const OpenFileSystemCallback& callback) OVERRIDE;
89 virtual FileSystemFileUtil* GetFileUtil(FileSystemType type) OVERRIDE; 86 virtual FileSystemFileUtil* GetFileUtil(FileSystemType type) OVERRIDE;
90 virtual AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) OVERRIDE; 87 virtual AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) OVERRIDE;
91 virtual CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory( 88 virtual CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory(
92 FileSystemType type, 89 FileSystemType type,
93 base::PlatformFileError* error_code) OVERRIDE; 90 base::PlatformFileError* error_code) OVERRIDE;
94 virtual FileSystemOperation* CreateFileSystemOperation( 91 virtual FileSystemOperation* CreateFileSystemOperation(
95 const FileSystemURL& url, 92 const FileSystemURL& url,
96 FileSystemContext* context, 93 FileSystemContext* context,
97 base::PlatformFileError* error_code) const OVERRIDE; 94 base::PlatformFileError* error_code) const OVERRIDE;
98 virtual scoped_ptr<webkit_blob::FileStreamReader> CreateFileStreamReader( 95 virtual scoped_ptr<webkit_blob::FileStreamReader> CreateFileStreamReader(
99 const FileSystemURL& url, 96 const FileSystemURL& url,
100 int64 offset, 97 int64 offset,
101 const base::Time& expected_modification_time, 98 const base::Time& expected_modification_time,
102 FileSystemContext* context) const OVERRIDE; 99 FileSystemContext* context) const OVERRIDE;
103 virtual scoped_ptr<FileStreamWriter> CreateFileStreamWriter( 100 virtual scoped_ptr<FileStreamWriter> CreateFileStreamWriter(
104 const FileSystemURL& url, 101 const FileSystemURL& url,
105 int64 offset, 102 int64 offset,
106 FileSystemContext* context) const OVERRIDE; 103 FileSystemContext* context) const OVERRIDE;
107 virtual FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE; 104 virtual FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE;
105 virtual const UpdateObserverList* GetUpdateObservers(
106 FileSystemType type) const OVERRIDE;
108 107
109 // Returns an origin enumerator of this provider. 108 // Returns an origin enumerator of this provider.
110 // This method can only be called on the file thread. 109 // This method can only be called on the file thread.
111 OriginEnumerator* CreateOriginEnumerator(); 110 OriginEnumerator* CreateOriginEnumerator();
112 111
113 // Gets a base directory path of the sandboxed filesystem that is 112 // Gets a base directory path of the sandboxed filesystem that is
114 // specified by |origin_url| and |type|. 113 // specified by |origin_url| and |type|.
115 // (The path is similar to the origin's root path but doesn't contain 114 // (The path is similar to the origin's root path but doesn't contain
116 // the 'unique' part.) 115 // the 'unique' part.)
117 // Returns an empty path if the given type is invalid. 116 // Returns an empty path if the given type is invalid.
(...skipping 21 matching lines...) Expand all
139 const GURL& origin_url, 138 const GURL& origin_url,
140 FileSystemType type) OVERRIDE; 139 FileSystemType type) OVERRIDE;
141 140
142 virtual void InvalidateUsageCache(const GURL& origin_url, 141 virtual void InvalidateUsageCache(const GURL& origin_url,
143 FileSystemType type) OVERRIDE; 142 FileSystemType type) OVERRIDE;
144 virtual void StickyInvalidateUsageCache(const GURL& origin_url, 143 virtual void StickyInvalidateUsageCache(const GURL& origin_url,
145 FileSystemType type) OVERRIDE; 144 FileSystemType type) OVERRIDE;
146 145
147 void CollectOpenFileSystemMetrics(base::PlatformFileError error_code); 146 void CollectOpenFileSystemMetrics(base::PlatformFileError error_code);
148 147
149 // Returns observers for the given type. 148 // Returns access observers for the given type.
150 const UpdateObserverList* GetUpdateObservers(FileSystemType type) const;
151 const AccessObserverList* GetAccessObservers(FileSystemType type) const; 149 const AccessObserverList* GetAccessObservers(FileSystemType type) const;
152 150
153 void AddFileUpdateObserver(FileSystemType type, 151 virtual void AddFileUpdateObserver(FileSystemType type,
154 FileUpdateObserver* observer, 152 FileUpdateObserver* observer,
155 base::SequencedTaskRunner* task_runner); 153 base::SequencedTaskRunner* task_runner);
156 void AddFileChangeObserver(FileSystemType type, 154 virtual void AddFileChangeObserver(FileSystemType type,
157 FileChangeObserver* observer, 155 FileChangeObserver* observer,
158 base::SequencedTaskRunner* task_runner); 156 base::SequencedTaskRunner* task_runner);
159 157
160 // Performs API-specific validity checks on the given path |url|. 158 // Performs API-specific validity checks on the given path |url|.
161 // Returns true if access to |url| is valid in this filesystem. 159 // Returns true if access to |url| is valid in this filesystem.
162 bool IsAccessValid(const FileSystemURL& url) const; 160 bool IsAccessValid(const FileSystemURL& url) const;
163 161
164 void set_enable_temporary_file_system_in_incognito(bool enable) { 162 void set_enable_temporary_file_system_in_incognito(bool enable) {
165 enable_temporary_file_system_in_incognito_ = enable; 163 enable_temporary_file_system_in_incognito_ = enable;
166 } 164 }
167 165
166 protected:
167 scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
168
169 // Observers.
170 UpdateObserverList update_observers_;
171 ChangeObserverList change_observers_;
172 AccessObserverList access_observers_;
173
174 scoped_ptr<AsyncFileUtilAdapter> sandbox_file_util_;
175 scoped_ptr<SandboxQuotaObserver> quota_observer_;
176
177 // Indicates if the usage tracking for FileSystem is enabled or not.
178 // The usage tracking is enabled by default and can be disabled by
179 // a command-line switch (--disable-file-system-usage-tracking).
180 bool enable_usage_tracking_;
181
168 private: 182 private:
169 friend class SandboxQuotaObserver; 183 friend class SandboxQuotaObserver;
170 friend class SandboxFileSystemTestHelper; 184 friend class SandboxFileSystemTestHelper;
171 friend class SandboxMountPointProviderMigrationTest; 185 friend class SandboxMountPointProviderMigrationTest;
172 friend class SandboxMountPointProviderOriginEnumeratorTest; 186 friend class SandboxMountPointProviderOriginEnumeratorTest;
173 187
174 // Returns a path to the usage cache file. 188 // Returns a path to the usage cache file.
175 base::FilePath GetUsageCachePathForOriginAndType( 189 base::FilePath GetUsageCachePathForOriginAndType(
176 const GURL& origin_url, 190 const GURL& origin_url,
177 FileSystemType type); 191 FileSystemType type);
(...skipping 18 matching lines...) Expand all
196 static void InvalidateUsageCacheOnFileThread( 210 static void InvalidateUsageCacheOnFileThread(
197 ObfuscatedFileUtil* file_util, 211 ObfuscatedFileUtil* file_util,
198 const GURL& origin, 212 const GURL& origin,
199 FileSystemType type, 213 FileSystemType type,
200 FileSystemUsageCache* usage_cache); 214 FileSystemUsageCache* usage_cache);
201 215
202 int64 RecalculateUsage(FileSystemContext* context, 216 int64 RecalculateUsage(FileSystemContext* context,
203 const GURL& origin, 217 const GURL& origin,
204 FileSystemType type); 218 FileSystemType type);
205 219
206 scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
207
208 const base::FilePath profile_path_; 220 const base::FilePath profile_path_;
209 221
210 FileSystemOptions file_system_options_; 222 FileSystemOptions file_system_options_;
211 bool enable_temporary_file_system_in_incognito_; 223 bool enable_temporary_file_system_in_incognito_;
212 224
213 scoped_ptr<AsyncFileUtilAdapter> sandbox_file_util_;
214
215 scoped_ptr<FileSystemUsageCache> file_system_usage_cache_; 225 scoped_ptr<FileSystemUsageCache> file_system_usage_cache_;
216 226
217 scoped_ptr<SandboxQuotaObserver> quota_observer_;
218
219 // Acccessed only on the file thread. 227 // Acccessed only on the file thread.
220 std::set<GURL> visited_origins_; 228 std::set<GURL> visited_origins_;
221 229
222 // Observers.
223 UpdateObserverList update_observers_;
224 ChangeObserverList change_observers_;
225 AccessObserverList access_observers_;
226
227 // Observers for syncable file systems.
228 UpdateObserverList syncable_update_observers_;
229 ChangeObserverList syncable_change_observers_;
230
231 base::Time next_release_time_for_open_filesystem_stat_; 230 base::Time next_release_time_for_open_filesystem_stat_;
232 231
233 std::set<std::pair<GURL, FileSystemType> > sticky_dirty_origins_; 232 std::set<std::pair<GURL, FileSystemType> > sticky_dirty_origins_;
234 233
235 // Indicates if the usage tracking for FileSystem is enabled or not.
236 // The usage tracking is enabled by default and can be disabled by
237 // a command-line switch (--disable-file-system-usage-tracking).
238 bool enable_usage_tracking_;
239
240 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; 234 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_;
241 235
242 base::WeakPtrFactory<SandboxMountPointProvider> weak_factory_; 236 base::WeakPtrFactory<SandboxMountPointProvider> weak_factory_;
243 237
244 DISALLOW_COPY_AND_ASSIGN(SandboxMountPointProvider); 238 DISALLOW_COPY_AND_ASSIGN(SandboxMountPointProvider);
245 }; 239 };
246 240
247 } // namespace fileapi 241 } // namespace fileapi
248 242
249 #endif // WEBKIT_BROWSER_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_ 243 #endif // WEBKIT_BROWSER_FILEAPI_SANDBOX_MOUNT_POINT_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698