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

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

Issue 145693005: [FileAPI] Replace default leveldb::Env with leveldb::MemEnv in tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 10 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_OBFUSCATED_FILE_UTIL_H_ 5 #ifndef WEBKIT_BROWSER_FILEAPI_OBFUSCATED_FILE_UTIL_H_
6 #define WEBKIT_BROWSER_FILEAPI_OBFUSCATED_FILE_UTIL_H_ 6 #define WEBKIT_BROWSER_FILEAPI_OBFUSCATED_FILE_UTIL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 // |known_type_strings| are known type string names that this file system 97 // |known_type_strings| are known type string names that this file system
98 // should care about. 98 // should care about.
99 // This info is used to determine whether we could delete the entire 99 // This info is used to determine whether we could delete the entire
100 // origin directory or not in DeleteDirectoryForOriginAndType. If no directory 100 // origin directory or not in DeleteDirectoryForOriginAndType. If no directory
101 // for any known type exists the origin directory may get deleted when 101 // for any known type exists the origin directory may get deleted when
102 // one origin/type pair is deleted. 102 // one origin/type pair is deleted.
103 // 103 //
104 ObfuscatedFileUtil( 104 ObfuscatedFileUtil(
105 quota::SpecialStoragePolicy* special_storage_policy, 105 quota::SpecialStoragePolicy* special_storage_policy,
106 const base::FilePath& file_system_directory, 106 const base::FilePath& file_system_directory,
107 leveldb::Env* env_override,
107 base::SequencedTaskRunner* file_task_runner, 108 base::SequencedTaskRunner* file_task_runner,
108 const GetTypeStringForURLCallback& get_type_string_for_url, 109 const GetTypeStringForURLCallback& get_type_string_for_url,
109 const std::set<std::string>& known_type_strings, 110 const std::set<std::string>& known_type_strings,
110 SandboxFileSystemBackendDelegate* sandbox_delegate); 111 SandboxFileSystemBackendDelegate* sandbox_delegate);
111 virtual ~ObfuscatedFileUtil(); 112 virtual ~ObfuscatedFileUtil();
112 113
113 // FileSystemFileUtil overrides. 114 // FileSystemFileUtil overrides.
114 virtual base::File::Error CreateOrOpen( 115 virtual base::File::Error CreateOrOpen(
115 FileSystemOperationContext* context, 116 FileSystemOperationContext* context,
116 const FileSystemURL& url, 117 const FileSystemURL& url,
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 friend class ObfuscatedFileEnumerator; 237 friend class ObfuscatedFileEnumerator;
237 friend class QuotaBackendImplTest; 238 friend class QuotaBackendImplTest;
238 friend class content::ObfuscatedFileUtilTest; 239 friend class content::ObfuscatedFileUtilTest;
239 240
240 // Helper method to create an obfuscated file util for regular 241 // Helper method to create an obfuscated file util for regular
241 // (temporary, persistent) file systems. Used only for testing. 242 // (temporary, persistent) file systems. Used only for testing.
242 // Note: this is implemented in sandbox_file_system_backend_delegate.cc. 243 // Note: this is implemented in sandbox_file_system_backend_delegate.cc.
243 static ObfuscatedFileUtil* CreateForTesting( 244 static ObfuscatedFileUtil* CreateForTesting(
244 quota::SpecialStoragePolicy* special_storage_policy, 245 quota::SpecialStoragePolicy* special_storage_policy,
245 const base::FilePath& file_system_directory, 246 const base::FilePath& file_system_directory,
247 leveldb::Env* env_override,
246 base::SequencedTaskRunner* file_task_runner); 248 base::SequencedTaskRunner* file_task_runner);
247 249
248 base::FilePath GetDirectoryForURL( 250 base::FilePath GetDirectoryForURL(
249 const FileSystemURL& url, 251 const FileSystemURL& url,
250 bool create, 252 bool create,
251 base::File::Error* error_code); 253 base::File::Error* error_code);
252 254
253 // This just calls get_type_string_for_url_ callback that is given in ctor. 255 // This just calls get_type_string_for_url_ callback that is given in ctor.
254 std::string CallGetTypeStringForURL(const FileSystemURL& url); 256 std::string CallGetTypeStringForURL(const FileSystemURL& url);
255 257
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 base::PlatformFile* file_handle, 329 base::PlatformFile* file_handle,
328 bool* created); 330 bool* created);
329 331
330 bool HasIsolatedStorage(const GURL& origin); 332 bool HasIsolatedStorage(const GURL& origin);
331 333
332 typedef std::map<std::string, SandboxDirectoryDatabase*> DirectoryMap; 334 typedef std::map<std::string, SandboxDirectoryDatabase*> DirectoryMap;
333 DirectoryMap directories_; 335 DirectoryMap directories_;
334 scoped_ptr<SandboxOriginDatabaseInterface> origin_database_; 336 scoped_ptr<SandboxOriginDatabaseInterface> origin_database_;
335 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; 337 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_;
336 base::FilePath file_system_directory_; 338 base::FilePath file_system_directory_;
339 leveldb::Env* env_override_;
337 340
338 // Used to delete database after a certain period of inactivity. 341 // Used to delete database after a certain period of inactivity.
339 int64 db_flush_delay_seconds_; 342 int64 db_flush_delay_seconds_;
340 343
341 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; 344 scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
342 scoped_ptr<TimedTaskHelper> timer_; 345 scoped_ptr<TimedTaskHelper> timer_;
343 346
344 GetTypeStringForURLCallback get_type_string_for_url_; 347 GetTypeStringForURLCallback get_type_string_for_url_;
345 std::set<std::string> known_type_strings_; 348 std::set<std::string> known_type_strings_;
346 349
347 // Not owned. 350 // Not owned.
348 SandboxFileSystemBackendDelegate* sandbox_delegate_; 351 SandboxFileSystemBackendDelegate* sandbox_delegate_;
349 352
350 DISALLOW_COPY_AND_ASSIGN(ObfuscatedFileUtil); 353 DISALLOW_COPY_AND_ASSIGN(ObfuscatedFileUtil);
351 }; 354 };
352 355
353 } // namespace fileapi 356 } // namespace fileapi
354 357
355 #endif // WEBKIT_BROWSER_FILEAPI_OBFUSCATED_FILE_UTIL_H_ 358 #endif // WEBKIT_BROWSER_FILEAPI_OBFUSCATED_FILE_UTIL_H_
OLDNEW
« no previous file with comments | « webkit/browser/fileapi/file_system_options.cc ('k') | webkit/browser/fileapi/obfuscated_file_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698