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

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

Issue 10164025: Add UMA stats for ObfuscatedFileUtil::GetDirectoryForOriginAndTypes(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: label rename Created 8 years, 7 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
« no previous file with comments | « no previous file | webkit/fileapi/obfuscated_file_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_OBFUSCATED_FILE_UTIL_H_ 5 #ifndef WEBKIT_FILEAPI_OBFUSCATED_FILE_UTIL_H_
6 #define WEBKIT_FILEAPI_OBFUSCATED_FILE_UTIL_H_ 6 #define WEBKIT_FILEAPI_OBFUSCATED_FILE_UTIL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 25 matching lines...) Expand all
36 // backing file than have a database entry whose backing file is missing. When 36 // backing file than have a database entry whose backing file is missing. When
37 // doing FSCK operations, if you find a loose backing file with no reference, 37 // doing FSCK operations, if you find a loose backing file with no reference,
38 // you may safely delete it. 38 // you may safely delete it.
39 // 39 //
40 // This class is RefCountedThreadSafe because it may gain a reference on the IO 40 // This class is RefCountedThreadSafe because it may gain a reference on the IO
41 // thread, but must be deleted on the FILE thread because that's where 41 // thread, but must be deleted on the FILE thread because that's where
42 // DropDatabases needs to be called. References will be held by the 42 // DropDatabases needs to be called. References will be held by the
43 // SandboxMountPointProvider [and the task it uses to drop the reference] and 43 // SandboxMountPointProvider [and the task it uses to drop the reference] and
44 // SandboxMountPointProvider::GetFileSystemRootPathTask. Without that last one, 44 // SandboxMountPointProvider::GetFileSystemRootPathTask. Without that last one,
45 // we wouldn't need ref counting. 45 // we wouldn't need ref counting.
46 class ObfuscatedFileUtil : 46 class ObfuscatedFileUtil
47 public FileSystemFileUtil, 47 : public FileSystemFileUtil,
48 public base::RefCountedThreadSafe<ObfuscatedFileUtil> { 48 public base::RefCountedThreadSafe<ObfuscatedFileUtil> {
49 public: 49 public:
50 // Origin enumerator interface. 50 // Origin enumerator interface.
51 // An instance of this interface is assumed to be called on the file thread. 51 // An instance of this interface is assumed to be called on the file thread.
52 class AbstractOriginEnumerator { 52 class AbstractOriginEnumerator {
53 public: 53 public:
54 virtual ~AbstractOriginEnumerator() {} 54 virtual ~AbstractOriginEnumerator() {}
55 55
56 // Returns the next origin. Returns empty if there are no more origins. 56 // Returns the next origin. Returns empty if there are no more origins.
57 virtual GURL Next() = 0; 57 virtual GURL Next() = 0;
58 58
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 const FileSystemPath& path) OVERRIDE; 139 const FileSystemPath& path) OVERRIDE;
140 140
141 virtual base::PlatformFileError DeleteSingleDirectory( 141 virtual base::PlatformFileError DeleteSingleDirectory(
142 FileSystemOperationContext* context, 142 FileSystemOperationContext* context,
143 const FileSystemPath& path) OVERRIDE; 143 const FileSystemPath& path) OVERRIDE;
144 144
145 // Gets the topmost directory specific to this origin and type. This will 145 // Gets the topmost directory specific to this origin and type. This will
146 // contain both the directory database's files and all the backing file 146 // contain both the directory database's files and all the backing file
147 // subdirectories. 147 // subdirectories.
148 FilePath GetDirectoryForOriginAndType( 148 FilePath GetDirectoryForOriginAndType(
149 const GURL& origin, FileSystemType type, bool create); 149 const GURL& origin,
150 FileSystemType type,
151 bool create,
152 base::PlatformFileError* error_code);
153
154 FilePath GetDirectoryForOriginAndType(
155 const GURL& origin,
156 FileSystemType type,
157 bool create) {
158 return GetDirectoryForOriginAndType(origin, type, create, NULL);
159 }
150 160
151 // Deletes the topmost directory specific to this origin and type. This will 161 // Deletes the topmost directory specific to this origin and type. This will
152 // delete its directory database. 162 // delete its directory database.
153 bool DeleteDirectoryForOriginAndType(const GURL& origin, FileSystemType type); 163 bool DeleteDirectoryForOriginAndType(const GURL& origin, FileSystemType type);
154 164
155 // This will migrate a filesystem from the old passthrough sandbox into the 165 // This will migrate a filesystem from the old passthrough sandbox into the
156 // new obfuscated one. It won't obfuscate the old filenames [it will maintain 166 // new obfuscated one. It won't obfuscate the old filenames [it will maintain
157 // the old structure, but move it to a new root], but any new files created 167 // the old structure, but move it to a new root], but any new files created
158 // will go into the new standard locations. This will be completely 168 // will go into the new standard locations. This will be completely
159 // transparent to the user. This migration is atomic in that it won't alter 169 // transparent to the user. This migration is atomic in that it won't alter
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 FilePath LocalPathToDataPath(const FileSystemPath& local_path); 251 FilePath LocalPathToDataPath(const FileSystemPath& local_path);
242 252
243 // This returns NULL if |create| flag is false and a filesystem does not 253 // This returns NULL if |create| flag is false and a filesystem does not
244 // exist for the given |origin_url| and |type|. 254 // exist for the given |origin_url| and |type|.
245 // For read operations |create| should be false. 255 // For read operations |create| should be false.
246 FileSystemDirectoryDatabase* GetDirectoryDatabase( 256 FileSystemDirectoryDatabase* GetDirectoryDatabase(
247 const GURL& origin_url, FileSystemType type, bool create); 257 const GURL& origin_url, FileSystemType type, bool create);
248 258
249 // Gets the topmost directory specific to this origin. This will 259 // Gets the topmost directory specific to this origin. This will
250 // contain both the filesystem type subdirectories. 260 // contain both the filesystem type subdirectories.
251 FilePath GetDirectoryForOrigin(const GURL& origin, bool create); 261 FilePath GetDirectoryForOrigin(const GURL& origin,
262 bool create,
263 base::PlatformFileError* error_code);
252 264
253 void MarkUsed(); 265 void MarkUsed();
254 void DropDatabases(); 266 void DropDatabases();
255 bool InitOriginDatabase(bool create); 267 bool InitOriginDatabase(bool create);
256 268
257 typedef std::map<std::string, FileSystemDirectoryDatabase*> DirectoryMap; 269 typedef std::map<std::string, FileSystemDirectoryDatabase*> DirectoryMap;
258 DirectoryMap directories_; 270 DirectoryMap directories_;
259 scoped_ptr<FileSystemOriginDatabase> origin_database_; 271 scoped_ptr<FileSystemOriginDatabase> origin_database_;
260 FilePath file_system_directory_; 272 FilePath file_system_directory_;
261 base::OneShotTimer<ObfuscatedFileUtil> timer_; 273 base::OneShotTimer<ObfuscatedFileUtil> timer_;
262 274
263 DISALLOW_COPY_AND_ASSIGN(ObfuscatedFileUtil); 275 DISALLOW_COPY_AND_ASSIGN(ObfuscatedFileUtil);
264 }; 276 };
265 277
266 } // namespace fileapi 278 } // namespace fileapi
267 279
268 #endif // WEBKIT_FILEAPI_OBFUSCATED_FILE_UTIL_H_ 280 #endif // WEBKIT_FILEAPI_OBFUSCATED_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | webkit/fileapi/obfuscated_file_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698