Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_FILE_SYSTEM_DIRECTORY_DATABASE_H_ | 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_DIRECTORY_DATABASE_H_ |
| 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_DIRECTORY_DATABASE_H_ | 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_DIRECTORY_DATABASE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 80 bool OverwritingMoveFile(FileId src_file_id, FileId dest_file_id); | 80 bool OverwritingMoveFile(FileId src_file_id, FileId dest_file_id); |
| 81 | 81 |
| 82 // This produces the series 0, 1, 2..., starting at 0 when the underlying | 82 // This produces the series 0, 1, 2..., starting at 0 when the underlying |
| 83 // filesystem is first created, and maintaining state across | 83 // filesystem is first created, and maintaining state across |
| 84 // creation/destruction of FileSystemDirectoryDatabase objects. | 84 // creation/destruction of FileSystemDirectoryDatabase objects. |
| 85 bool GetNextInteger(int64* next); | 85 bool GetNextInteger(int64* next); |
| 86 | 86 |
| 87 static bool DestroyDatabase(const FilePath& path); | 87 static bool DestroyDatabase(const FilePath& path); |
| 88 | 88 |
| 89 private: | 89 private: |
| 90 bool Init(); | 90 enum RecoveryOption { |
| 91 DELETE_ON_CORRUPTION, | |
| 92 FAIL_ON_CORRUPTION, | |
|
ericu
2012/03/19 16:50:05
We should also attempt to repair here before delet
tzik
2012/03/21 08:59:21
To avoid web apps facing inconsistency, we can't s
ericu
2012/03/22 03:54:17
Sounds good.
| |
| 93 }; | |
| 94 | |
| 95 bool Init(RecoveryOption recovery_option); | |
| 91 bool StoreDefaultValues(); | 96 bool StoreDefaultValues(); |
| 92 bool GetLastFileId(FileId* file_id); | 97 bool GetLastFileId(FileId* file_id); |
| 93 bool VerifyIsDirectory(FileId file_id); | 98 bool VerifyIsDirectory(FileId file_id); |
| 94 bool AddFileInfoHelper( | 99 bool AddFileInfoHelper( |
| 95 const FileInfo& info, FileId file_id, leveldb::WriteBatch* batch); | 100 const FileInfo& info, FileId file_id, leveldb::WriteBatch* batch); |
| 96 bool RemoveFileInfoHelper(FileId file_id, leveldb::WriteBatch* batch); | 101 bool RemoveFileInfoHelper(FileId file_id, leveldb::WriteBatch* batch); |
| 97 void HandleError(const tracked_objects::Location& from_here, | 102 void HandleError(const tracked_objects::Location& from_here, |
| 98 leveldb::Status status); | 103 leveldb::Status status); |
| 99 | 104 |
| 100 std::string path_; | 105 FilePath sandbox_directory_; |
| 101 scoped_ptr<leveldb::DB> db_; | 106 scoped_ptr<leveldb::DB> db_; |
| 102 }; | 107 }; |
| 103 | 108 |
| 104 } // namespace fileapi | 109 } // namespace fileapi |
| 105 | 110 |
| 106 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_DIRECTORY_DATABASE_H_ | 111 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_DIRECTORY_DATABASE_H_ |
| OLD | NEW |