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_file_system_backend.h

Issue 18668003: SyncFS: Introduce SyncFileSystemBackend (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add Initialize() 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_FILE_SYSTEM_BACKEND_H_ 5 #ifndef WEBKIT_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_H_
6 #define WEBKIT_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_H_ 6 #define WEBKIT_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 virtual bool HasFileSystemType(FileSystemType type) const = 0; 66 virtual bool HasFileSystemType(FileSystemType type) const = 0;
67 }; 67 };
68 68
69 SandboxFileSystemBackend( 69 SandboxFileSystemBackend(
70 SandboxContext* sandbox_context, 70 SandboxContext* sandbox_context,
71 const FileSystemOptions& file_system_options); 71 const FileSystemOptions& file_system_options);
72 virtual ~SandboxFileSystemBackend(); 72 virtual ~SandboxFileSystemBackend();
73 73
74 // FileSystemBackend overrides. 74 // FileSystemBackend overrides.
75 virtual bool CanHandleType(FileSystemType type) const OVERRIDE; 75 virtual bool CanHandleType(FileSystemType type) const OVERRIDE;
76 virtual void Initialize(const fileapi::FileSystemContext* context) OVERRIDE;
76 virtual void InitializeFileSystem( 77 virtual void InitializeFileSystem(
77 const GURL& origin_url, 78 const GURL& origin_url,
78 FileSystemType type, 79 FileSystemType type,
79 OpenFileSystemMode mode, 80 OpenFileSystemMode mode,
80 FileSystemContext* context, 81 FileSystemContext* context,
81 const InitializeFileSystemCallback& callback) OVERRIDE; 82 const InitializeFileSystemCallback& callback) OVERRIDE;
82 virtual FileSystemFileUtil* GetFileUtil(FileSystemType type) OVERRIDE; 83 virtual FileSystemFileUtil* GetFileUtil(FileSystemType type) OVERRIDE;
83 virtual AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) OVERRIDE; 84 virtual AsyncFileUtil* GetAsyncFileUtil(FileSystemType type) OVERRIDE;
84 virtual CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory( 85 virtual CopyOrMoveFileValidatorFactory* GetCopyOrMoveFileValidatorFactory(
85 FileSystemType type, 86 FileSystemType type,
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 void CollectOpenFileSystemMetrics(base::PlatformFileError error_code); 160 void CollectOpenFileSystemMetrics(base::PlatformFileError error_code);
160 161
161 // Performs API-specific validity checks on the given path |url|. 162 // Performs API-specific validity checks on the given path |url|.
162 // Returns true if access to |url| is valid in this filesystem. 163 // Returns true if access to |url| is valid in this filesystem.
163 bool IsAccessValid(const FileSystemURL& url) const; 164 bool IsAccessValid(const FileSystemURL& url) const;
164 165
165 void set_enable_temporary_file_system_in_incognito(bool enable) { 166 void set_enable_temporary_file_system_in_incognito(bool enable) {
166 enable_temporary_file_system_in_incognito_ = enable; 167 enable_temporary_file_system_in_incognito_ = enable;
167 } 168 }
168 169
170 protected:
171 SandboxContext* sandbox_context_; // Not owned.
172
173 // Observers.
174 UpdateObserverList update_observers_;
175 ChangeObserverList change_observers_;
176 AccessObserverList access_observers_;
kinuko 2013/07/23 06:41:51 Can we keep them as private members but provide pr
nhiroki 2013/07/24 05:58:47 Done.
177
178 // Indicates if the usage tracking for FileSystem is enabled or not.
179 // The usage tracking is enabled by default and can be disabled by
180 // a command-line switch (--disable-file-system-usage-tracking).
181 bool enable_usage_tracking_;
kinuko 2013/07/23 06:41:51 I wonder if it's cleaner to move this into Sandbox
nhiroki 2013/07/24 05:58:47 Done in http://crrev.com/213070/
182
169 private: 183 private:
170 friend class SandboxQuotaObserver; 184 friend class SandboxQuotaObserver;
171 friend class SandboxFileSystemTestHelper; 185 friend class SandboxFileSystemTestHelper;
172 friend class SandboxFileSystemBackendMigrationTest; 186 friend class SandboxFileSystemBackendMigrationTest;
173 friend class SandboxFileSystemBackendOriginEnumeratorTest; 187 friend class SandboxFileSystemBackendOriginEnumeratorTest;
174 188
175 // Returns a path to the usage cache file. 189 // Returns a path to the usage cache file.
176 base::FilePath GetUsageCachePathForOriginAndType( 190 base::FilePath GetUsageCachePathForOriginAndType(
177 const GURL& origin_url, 191 const GURL& origin_url,
178 FileSystemType type); 192 FileSystemType type);
(...skipping 15 matching lines...) Expand all
194 static void InvalidateUsageCacheOnFileThread( 208 static void InvalidateUsageCacheOnFileThread(
195 ObfuscatedFileUtil* file_util, 209 ObfuscatedFileUtil* file_util,
196 const GURL& origin, 210 const GURL& origin,
197 FileSystemType type, 211 FileSystemType type,
198 FileSystemUsageCache* usage_cache); 212 FileSystemUsageCache* usage_cache);
199 213
200 int64 RecalculateUsage(FileSystemContext* context, 214 int64 RecalculateUsage(FileSystemContext* context,
201 const GURL& origin, 215 const GURL& origin,
202 FileSystemType type); 216 FileSystemType type);
203 217
204 SandboxContext* sandbox_context_; // Not owned.
205
206 FileSystemOptions file_system_options_; 218 FileSystemOptions file_system_options_;
207 bool enable_temporary_file_system_in_incognito_; 219 bool enable_temporary_file_system_in_incognito_;
208 220
209 // Acccessed only on the file thread. 221 // Acccessed only on the file thread.
210 std::set<GURL> visited_origins_; 222 std::set<GURL> visited_origins_;
211 223
212 // Observers.
213 UpdateObserverList update_observers_;
214 ChangeObserverList change_observers_;
215 AccessObserverList access_observers_;
216
217 // Observers for syncable file systems.
218 UpdateObserverList syncable_update_observers_;
219 ChangeObserverList syncable_change_observers_;
220
221 base::Time next_release_time_for_open_filesystem_stat_; 224 base::Time next_release_time_for_open_filesystem_stat_;
222 225
223 std::set<std::pair<GURL, FileSystemType> > sticky_dirty_origins_; 226 std::set<std::pair<GURL, FileSystemType> > sticky_dirty_origins_;
224 227
225 // Indicates if the usage tracking for FileSystem is enabled or not.
226 // The usage tracking is enabled by default and can be disabled by
227 // a command-line switch (--disable-file-system-usage-tracking).
228 bool enable_usage_tracking_;
229
230 base::WeakPtrFactory<SandboxFileSystemBackend> weak_factory_; 228 base::WeakPtrFactory<SandboxFileSystemBackend> weak_factory_;
231 229
232 DISALLOW_COPY_AND_ASSIGN(SandboxFileSystemBackend); 230 DISALLOW_COPY_AND_ASSIGN(SandboxFileSystemBackend);
233 }; 231 };
234 232
235 } // namespace fileapi 233 } // namespace fileapi
236 234
237 #endif // WEBKIT_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_H_ 235 #endif /// WEBKIT_BROWSER_FILEAPI_SANDBOX_FILE_SYSTEM_BACKEND_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698