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

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

Issue 10066044: RefCounted types should not have public destructors, webkit/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Implementation ordering 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 | « webkit/fileapi/file_writer_delegate_unittest.cc ('k') | 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 : public FileSystemFileUtil, 46 class ObfuscatedFileUtil :
47 public FileSystemFileUtil,
47 public base::RefCountedThreadSafe<ObfuscatedFileUtil> { 48 public base::RefCountedThreadSafe<ObfuscatedFileUtil> {
48 public: 49 public:
49 // Origin enumerator interface. 50 // Origin enumerator interface.
50 // 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.
51 class AbstractOriginEnumerator { 52 class AbstractOriginEnumerator {
52 public: 53 public:
53 virtual ~AbstractOriginEnumerator() {} 54 virtual ~AbstractOriginEnumerator() {}
54 55
55 // 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.
56 virtual GURL Next() = 0; 57 virtual GURL Next() = 0;
57 58
58 // Returns the current origin's information. 59 // Returns the current origin's information.
59 virtual bool HasFileSystemType(FileSystemType type) const = 0; 60 virtual bool HasFileSystemType(FileSystemType type) const = 0;
60 }; 61 };
61 62
62 // |underlying_file_util| is owned by the instance. It will be deleted by 63 // |underlying_file_util| is owned by the instance. It will be deleted by
63 // the owner instance. For example, it can be instanciated as follows: 64 // the owner instance. For example, it can be instanciated as follows:
64 // FileSystemFileUtil* file_util = 65 // FileSystemFileUtil* file_util =
65 // new ObfuscatedFileUtil(new NativeFileUtil()); 66 // new ObfuscatedFileUtil(new NativeFileUtil());
66 ObfuscatedFileUtil(const FilePath& file_system_directory, 67 ObfuscatedFileUtil(const FilePath& file_system_directory,
67 FileSystemFileUtil* underlying_file_util); 68 FileSystemFileUtil* underlying_file_util);
68 virtual ~ObfuscatedFileUtil();
69 69
70 virtual base::PlatformFileError CreateOrOpen( 70 virtual base::PlatformFileError CreateOrOpen(
71 FileSystemOperationContext* context, 71 FileSystemOperationContext* context,
72 const FileSystemPath& path, 72 const FileSystemPath& path,
73 int file_flags, 73 int file_flags,
74 base::PlatformFile* file_handle, 74 base::PlatformFile* file_handle,
75 bool* created) OVERRIDE; 75 bool* created) OVERRIDE;
76 76
77 virtual base::PlatformFileError EnsureFileExists( 77 virtual base::PlatformFileError EnsureFileExists(
78 FileSystemOperationContext* context, 78 FileSystemOperationContext* context,
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 bool DestroyDirectoryDatabase(const GURL& origin, FileSystemType type); 180 bool DestroyDirectoryDatabase(const GURL& origin, FileSystemType type);
181 181
182 // Computes a cost for storing a given file in the obfuscated FSFU. 182 // Computes a cost for storing a given file in the obfuscated FSFU.
183 // As the cost of a file is independent of the cost of its parent directories, 183 // As the cost of a file is independent of the cost of its parent directories,
184 // this ignores all but the BaseName of the supplied path. In order to 184 // this ignores all but the BaseName of the supplied path. In order to
185 // compute the cost of adding a multi-segment directory recursively, call this 185 // compute the cost of adding a multi-segment directory recursively, call this
186 // on each path segment and add the results. 186 // on each path segment and add the results.
187 static int64 ComputeFilePathCost(const FilePath& path); 187 static int64 ComputeFilePathCost(const FilePath& path);
188 188
189 private: 189 private:
190 friend class base::RefCountedThreadSafe<ObfuscatedFileUtil>;
191
190 typedef FileSystemDirectoryDatabase::FileId FileId; 192 typedef FileSystemDirectoryDatabase::FileId FileId;
191 typedef FileSystemDirectoryDatabase::FileInfo FileInfo; 193 typedef FileSystemDirectoryDatabase::FileInfo FileInfo;
192 194
195 virtual ~ObfuscatedFileUtil();
196
193 base::PlatformFileError GetFileInfoInternal( 197 base::PlatformFileError GetFileInfoInternal(
194 FileSystemDirectoryDatabase* db, 198 FileSystemDirectoryDatabase* db,
195 FileSystemOperationContext* context, 199 FileSystemOperationContext* context,
196 const GURL& origin, 200 const GURL& origin,
197 FileSystemType type, 201 FileSystemType type,
198 FileId file_id, 202 FileId file_id,
199 FileInfo* local_info, 203 FileInfo* local_info,
200 base::PlatformFileInfo* file_info, 204 base::PlatformFileInfo* file_info,
201 FilePath* platform_file_path); 205 FilePath* platform_file_path);
202 206
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 scoped_ptr<FileSystemOriginDatabase> origin_database_; 259 scoped_ptr<FileSystemOriginDatabase> origin_database_;
256 FilePath file_system_directory_; 260 FilePath file_system_directory_;
257 base::OneShotTimer<ObfuscatedFileUtil> timer_; 261 base::OneShotTimer<ObfuscatedFileUtil> timer_;
258 262
259 DISALLOW_COPY_AND_ASSIGN(ObfuscatedFileUtil); 263 DISALLOW_COPY_AND_ASSIGN(ObfuscatedFileUtil);
260 }; 264 };
261 265
262 } // namespace fileapi 266 } // namespace fileapi
263 267
264 #endif // WEBKIT_FILEAPI_OBFUSCATED_FILE_UTIL_H_ 268 #endif // WEBKIT_FILEAPI_OBFUSCATED_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « webkit/fileapi/file_writer_delegate_unittest.cc ('k') | webkit/fileapi/obfuscated_file_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698