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

Unified Diff: webkit/fileapi/file_system_directory_database.h

Issue 9910005: Add database recovery for FileSystemDirectoryDatabase. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: webkit/fileapi/file_system_directory_database.h
diff --git a/webkit/fileapi/file_system_directory_database.h b/webkit/fileapi/file_system_directory_database.h
index 47ac60aa05d43a1672279393f06a1298aa9df180..fb51f0dc97290cebbb37569f62e74c65e03e340e 100644
--- a/webkit/fileapi/file_system_directory_database.h
+++ b/webkit/fileapi/file_system_directory_database.h
@@ -32,8 +32,6 @@ namespace fileapi {
// TODO(ericu): Safe mode, which does more checks such as the above on debug
// builds.
-// TODO(ericu): FSCK, for a full-database check [data file validation possibly
-// done elsewhere].
// TODO(ericu): Add a method that will give a unique filename for a data file.
class FileSystemDirectoryDatabase {
public:
@@ -86,15 +84,22 @@ class FileSystemDirectoryDatabase {
// creation/destruction of FileSystemDirectoryDatabase objects.
bool GetNextInteger(int64* next);
+ // Returns true if the database looks consistent with local filesystem.
+ bool IsFileSystemConsistent();
+
static bool DestroyDatabase(const FilePath& path);
private:
enum RecoveryOption {
DELETE_ON_CORRUPTION,
+ REPAIR_ON_CORRUPTION,
FAIL_ON_CORRUPTION,
};
+ friend class FileSystemDirectoryDatabaseTest;
+
bool Init(RecoveryOption recovery_option);
+ bool RepairDatabase(const std::string& db_path);
void ReportInitStatus(const leveldb::Status& status);
bool StoreDefaultValues();
bool GetLastFileId(FileId* file_id);
« no previous file with comments | « webkit/fileapi/file_system_database_test_helper.cc ('k') | webkit/fileapi/file_system_directory_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698