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

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

Issue 7174002: Change {Obfuscated|Local}FileSystemFileUtil non-Singleton to take an underlying *FileUtil. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fixed memery leak at LocalFSFUTest, and rebased. Created 9 years, 6 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_OBFUSCATED_FILE_SYSTEM_FILE_UTIL_H_ 5 #ifndef WEBKIT_FILEAPI_OBFUSCATED_FILE_SYSTEM_FILE_UTIL_H_
6 #define WEBKIT_FILEAPI_OBFUSCATED_FILE_SYSTEM_FILE_UTIL_H_ 6 #define WEBKIT_FILEAPI_OBFUSCATED_FILE_SYSTEM_FILE_UTIL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 30 matching lines...) Expand all
41 // SandboxMountPointProvider [and the task it uses to drop the reference] and 41 // SandboxMountPointProvider [and the task it uses to drop the reference] and
42 // SandboxMountPointProvider::GetFileSystemRootPathTask. Without that last one, 42 // SandboxMountPointProvider::GetFileSystemRootPathTask. Without that last one,
43 // we wouldn't need ref counting. 43 // we wouldn't need ref counting.
44 // 44 //
45 // TODO(ericu): We don't ever update directory mtimes; which operations should 45 // TODO(ericu): We don't ever update directory mtimes; which operations should
46 // do that? 46 // do that?
47 class ObfuscatedFileSystemFileUtil : public FileSystemFileUtil, 47 class ObfuscatedFileSystemFileUtil : public FileSystemFileUtil,
48 public base::RefCountedThreadSafe<ObfuscatedFileSystemFileUtil> { 48 public base::RefCountedThreadSafe<ObfuscatedFileSystemFileUtil> {
49 public: 49 public:
50 50
51 ObfuscatedFileSystemFileUtil(const FilePath& file_system_directory); 51 ObfuscatedFileSystemFileUtil(
52 const FilePath& file_system_directory,
53 FileSystemFileUtil* underlying_file_util);
52 virtual ~ObfuscatedFileSystemFileUtil(); 54 virtual ~ObfuscatedFileSystemFileUtil();
53 55
54 virtual base::PlatformFileError CreateOrOpen( 56 virtual base::PlatformFileError CreateOrOpen(
55 FileSystemOperationContext* context, 57 FileSystemOperationContext* context,
56 const FilePath& file_path, 58 const FilePath& file_path,
57 int file_flags, 59 int file_flags,
58 base::PlatformFile* file_handle, 60 base::PlatformFile* file_handle,
59 bool* created) OVERRIDE; 61 bool* created) OVERRIDE;
60 62
61 virtual base::PlatformFileError EnsureFileExists( 63 virtual base::PlatformFileError EnsureFileExists(
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 AbstractOriginEnumerator* CreateOriginEnumerator(); 175 AbstractOriginEnumerator* CreateOriginEnumerator();
174 176
175 virtual AbstractFileEnumerator* CreateFileEnumerator( 177 virtual AbstractFileEnumerator* CreateFileEnumerator(
176 FileSystemOperationContext* context, 178 FileSystemOperationContext* context,
177 const FilePath& root_path) OVERRIDE; 179 const FilePath& root_path) OVERRIDE;
178 180
179 private: 181 private:
180 typedef FileSystemDirectoryDatabase::FileId FileId; 182 typedef FileSystemDirectoryDatabase::FileId FileId;
181 typedef FileSystemDirectoryDatabase::FileInfo FileInfo; 183 typedef FileSystemDirectoryDatabase::FileInfo FileInfo;
182 184
185 static ObfuscatedFileSystemFileUtil* GetInstance();
ericu 2011/06/17 20:32:07 I think this got in here by accident.
Dai Mikurube (NOT FULLTIME) 2011/06/23 08:13:32 Oh, it's not required now. Removed. This declara
186
183 // Creates a new file, both the underlying backing file and the entry in the 187 // Creates a new file, both the underlying backing file and the entry in the
184 // database. file_info is an in-out parameter. Supply the name and 188 // database. file_info is an in-out parameter. Supply the name and
185 // parent_id; data_path is ignored. On success, data_path will 189 // parent_id; data_path is ignored. On success, data_path will
186 // always be set to the relative path [from the root of the type-specific 190 // always be set to the relative path [from the root of the type-specific
187 // filesystem directory] of a NEW backing file, and handle, if supplied, will 191 // filesystem directory] of a NEW backing file, and handle, if supplied, will
188 // hold open PlatformFile for the backing file, which the caller is 192 // hold open PlatformFile for the backing file, which the caller is
189 // responsible for closing. If you supply a path in source_path, it will be 193 // responsible for closing. If you supply a path in source_path, it will be
190 // used as a source from which to COPY data. 194 // used as a source from which to COPY data.
191 // Caveat: do not supply handle if you're also supplying a data path. It was 195 // Caveat: do not supply handle if you're also supplying a data path. It was
192 // easier not to support this, and no code has needed it so far, so it will 196 // easier not to support this, and no code has needed it so far, so it will
(...skipping 24 matching lines...) Expand all
217 void MarkUsed(); 221 void MarkUsed();
218 void DropDatabases(); 222 void DropDatabases();
219 bool DestroyDirectoryDatabase(const GURL& origin, FileSystemType type); 223 bool DestroyDirectoryDatabase(const GURL& origin, FileSystemType type);
220 bool InitOriginDatabase(bool create); 224 bool InitOriginDatabase(bool create);
221 225
222 typedef std::map<std::string, FileSystemDirectoryDatabase*> DirectoryMap; 226 typedef std::map<std::string, FileSystemDirectoryDatabase*> DirectoryMap;
223 DirectoryMap directories_; 227 DirectoryMap directories_;
224 scoped_ptr<FileSystemOriginDatabase> origin_database_; 228 scoped_ptr<FileSystemOriginDatabase> origin_database_;
225 FilePath file_system_directory_; 229 FilePath file_system_directory_;
226 base::OneShotTimer<ObfuscatedFileSystemFileUtil> timer_; 230 base::OneShotTimer<ObfuscatedFileSystemFileUtil> timer_;
231 FileSystemFileUtil* underlying_file_util_;
227 232
228 DISALLOW_COPY_AND_ASSIGN(ObfuscatedFileSystemFileUtil); 233 DISALLOW_COPY_AND_ASSIGN(ObfuscatedFileSystemFileUtil);
229 }; 234 };
230 235
231 } // namespace fileapi 236 } // namespace fileapi
232 237
233 #endif // WEBKIT_FILEAPI_OBFUSCATED_FILE_SYSTEM_FILE_UTIL_H_ 238 #endif // WEBKIT_FILEAPI_OBFUSCATED_FILE_SYSTEM_FILE_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698