OLD | NEW |
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 STORAGE_BROWSER_FILEAPI_SANDBOX_DIRECTORY_DATABASE_H_ | 5 #ifndef STORAGE_BROWSER_FILEAPI_SANDBOX_DIRECTORY_DATABASE_H_ |
6 #define STORAGE_BROWSER_FILEAPI_SANDBOX_DIRECTORY_DATABASE_H_ | 6 #define STORAGE_BROWSER_FILEAPI_SANDBOX_DIRECTORY_DATABASE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // This produces the series 0, 1, 2..., starting at 0 when the underlying | 92 // This produces the series 0, 1, 2..., starting at 0 when the underlying |
93 // filesystem is first created, and maintaining state across | 93 // filesystem is first created, and maintaining state across |
94 // creation/destruction of SandboxDirectoryDatabase objects. | 94 // creation/destruction of SandboxDirectoryDatabase objects. |
95 bool GetNextInteger(int64* next); | 95 bool GetNextInteger(int64* next); |
96 | 96 |
97 bool IsDirectory(FileId file_id); | 97 bool IsDirectory(FileId file_id); |
98 | 98 |
99 // Returns true if the database looks consistent with local filesystem. | 99 // Returns true if the database looks consistent with local filesystem. |
100 bool IsFileSystemConsistent(); | 100 bool IsFileSystemConsistent(); |
101 | 101 |
102 static bool DestroyDatabase(const base::FilePath& path, | 102 // Completely deletes contents of the database. |
103 leveldb::Env* env_override); | 103 bool DestroyDatabase(); |
104 | 104 |
105 private: | 105 private: |
106 enum RecoveryOption { | 106 enum RecoveryOption { |
107 DELETE_ON_CORRUPTION, | 107 DELETE_ON_CORRUPTION, |
108 REPAIR_ON_CORRUPTION, | 108 REPAIR_ON_CORRUPTION, |
109 FAIL_ON_CORRUPTION, | 109 FAIL_ON_CORRUPTION, |
110 }; | 110 }; |
111 | 111 |
112 friend class content::SandboxDirectoryDatabaseTest; | 112 friend class content::SandboxDirectoryDatabaseTest; |
113 friend class ObfuscatedFileUtil; | 113 friend class ObfuscatedFileUtil; |
(...skipping 12 matching lines...) Expand all Loading... |
126 const base::FilePath filesystem_data_directory_; | 126 const base::FilePath filesystem_data_directory_; |
127 leveldb::Env* env_override_; | 127 leveldb::Env* env_override_; |
128 scoped_ptr<leveldb::DB> db_; | 128 scoped_ptr<leveldb::DB> db_; |
129 base::Time last_reported_time_; | 129 base::Time last_reported_time_; |
130 DISALLOW_COPY_AND_ASSIGN(SandboxDirectoryDatabase); | 130 DISALLOW_COPY_AND_ASSIGN(SandboxDirectoryDatabase); |
131 }; | 131 }; |
132 | 132 |
133 } // namespace storage | 133 } // namespace storage |
134 | 134 |
135 #endif // STORAGE_BROWSER_FILEAPI_SANDBOX_DIRECTORY_DATABASE_H_ | 135 #endif // STORAGE_BROWSER_FILEAPI_SANDBOX_DIRECTORY_DATABASE_H_ |
OLD | NEW |