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

Unified Diff: webkit/fileapi/file_system_origin_database.h

Issue 9663021: Add database recovery for FileSystemOriginDatabase (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 9 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_origin_database.h
diff --git a/webkit/fileapi/file_system_origin_database.h b/webkit/fileapi/file_system_origin_database.h
index 10247a7f534c9eb4f0aed421d7661fbd15f9b277..fddd3693a2e841d8633a92dbf2336efb2b012e1e 100644
--- a/webkit/fileapi/file_system_origin_database.h
+++ b/webkit/fileapi/file_system_origin_database.h
@@ -39,7 +39,7 @@ class FileSystemOriginDatabase {
// Only one instance of FileSystemOriginDatabase should exist for a given path
// at a given time.
- explicit FileSystemOriginDatabase(const FilePath& path);
+ explicit FileSystemOriginDatabase(const FilePath& file_system_directory);
~FileSystemOriginDatabase();
bool HasOriginPath(const std::string& origin);
@@ -57,13 +57,20 @@ class FileSystemOriginDatabase {
void DropDatabase();
private:
- bool Init();
+ enum RecoveryOption {
+ REPAIR_ON_CORRUPTION,
+ DELETE_ON_CORRUPTION,
+ FAIL_ON_CORRUPTION,
+ };
+
+ bool Init(RecoveryOption recovery_option);
+ bool RepairDatabase(const std::string& db_path);
void HandleError(const tracked_objects::Location& from_here,
const leveldb::Status& status);
void ReportInitStatus(const leveldb::Status& status);
bool GetLastPathNumber(int* number);
- std::string path_;
+ FilePath file_system_directory_;
scoped_ptr<leveldb::DB> db_;
base::Time last_reported_time_;
DISALLOW_COPY_AND_ASSIGN(FileSystemOriginDatabase);
« no previous file with comments | « webkit/fileapi/file_system_directory_database_unittest.cc ('k') | webkit/fileapi/file_system_origin_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698