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

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

Issue 7307013: Do not create a new directory database for read operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 9 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) 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 explicit ObfuscatedFileSystemFileUtil(const FilePath& file_system_directory);
52 virtual ~ObfuscatedFileSystemFileUtil(); 52 virtual ~ObfuscatedFileSystemFileUtil();
53 53
54 virtual base::PlatformFileError CreateOrOpen( 54 virtual base::PlatformFileError CreateOrOpen(
55 FileSystemOperationContext* context, 55 FileSystemOperationContext* context,
56 const FilePath& file_path, 56 const FilePath& file_path,
57 int file_flags, 57 int file_flags,
58 base::PlatformFile* file_handle, 58 base::PlatformFile* file_handle,
59 bool* created) OVERRIDE; 59 bool* created) OVERRIDE;
60 60
61 virtual base::PlatformFileError EnsureFileExists( 61 virtual base::PlatformFileError EnsureFileExists(
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 const FilePath& virtual_path); 205 const FilePath& virtual_path);
206 // This converts from a relative path [as is stored in the FileInfo.data_path 206 // This converts from a relative path [as is stored in the FileInfo.data_path
207 // field] to an absolute local path that can be given to the operating system. 207 // field] to an absolute local path that can be given to the operating system.
208 // It does no checks as to whether the file actually exists; it's pure path 208 // It does no checks as to whether the file actually exists; it's pure path
209 // manipulation. 209 // manipulation.
210 FilePath DataPathToLocalPath( 210 FilePath DataPathToLocalPath(
211 const GURL& origin, FileSystemType type, const FilePath& data_path); 211 const GURL& origin, FileSystemType type, const FilePath& data_path);
212 // This does the reverse of DataPathToLocalPath. 212 // This does the reverse of DataPathToLocalPath.
213 FilePath LocalPathToDataPath( 213 FilePath LocalPathToDataPath(
214 const GURL& origin, FileSystemType type, const FilePath& local_path); 214 const GURL& origin, FileSystemType type, const FilePath& local_path);
215 // This returns NULL if |create| flag is false and a filesystem does not
216 // exist for the given |origin_url| and |type|.
217 // For read operations |create| should be false.
215 FileSystemDirectoryDatabase* GetDirectoryDatabase( 218 FileSystemDirectoryDatabase* GetDirectoryDatabase(
216 const GURL& origin_url, FileSystemType type); 219 const GURL& origin_url, FileSystemType type, bool create);
217 void MarkUsed(); 220 void MarkUsed();
218 void DropDatabases(); 221 void DropDatabases();
219 bool DestroyDirectoryDatabase(const GURL& origin, FileSystemType type); 222 bool DestroyDirectoryDatabase(const GURL& origin, FileSystemType type);
220 bool InitOriginDatabase(bool create); 223 bool InitOriginDatabase(bool create);
221 224
222 typedef std::map<std::string, FileSystemDirectoryDatabase*> DirectoryMap; 225 typedef std::map<std::string, FileSystemDirectoryDatabase*> DirectoryMap;
223 DirectoryMap directories_; 226 DirectoryMap directories_;
224 scoped_ptr<FileSystemOriginDatabase> origin_database_; 227 scoped_ptr<FileSystemOriginDatabase> origin_database_;
225 FilePath file_system_directory_; 228 FilePath file_system_directory_;
226 base::OneShotTimer<ObfuscatedFileSystemFileUtil> timer_; 229 base::OneShotTimer<ObfuscatedFileSystemFileUtil> timer_;
227 230
228 DISALLOW_COPY_AND_ASSIGN(ObfuscatedFileSystemFileUtil); 231 DISALLOW_COPY_AND_ASSIGN(ObfuscatedFileSystemFileUtil);
229 }; 232 };
230 233
231 } // namespace fileapi 234 } // namespace fileapi
232 235
233 #endif // WEBKIT_FILEAPI_OBFUSCATED_FILE_SYSTEM_FILE_UTIL_H_ 236 #endif // WEBKIT_FILEAPI_OBFUSCATED_FILE_SYSTEM_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | webkit/fileapi/obfuscated_file_system_file_util.cc » ('j') | webkit/fileapi/obfuscated_file_system_file_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698