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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 // another file [also not a directory]; we need to alter two files' info in a | 73 // another file [also not a directory]; we need to alter two files' info in a |
74 // single transaction to avoid weird backing file references in the event of a | 74 // single transaction to avoid weird backing file references in the event of a |
75 // partial failure. | 75 // partial failure. |
76 bool OverwritingMoveFile(FileId src_file_id, FileId dest_file_id); | 76 bool OverwritingMoveFile(FileId src_file_id, FileId dest_file_id); |
77 | 77 |
78 // This produces the series 0, 1, 2..., starting at 0 when the underlying | 78 // This produces the series 0, 1, 2..., starting at 0 when the underlying |
79 // filesystem is first created, and maintaining state across | 79 // filesystem is first created, and maintaining state across |
80 // creation/destruction of FileSystemDirectoryDatabase objects. | 80 // creation/destruction of FileSystemDirectoryDatabase objects. |
81 bool GetNextInteger(int64* next); | 81 bool GetNextInteger(int64* next); |
82 | 82 |
| 83 static bool DestroyDatabase(const FilePath& path); |
| 84 |
83 private: | 85 private: |
84 bool Init(); | 86 bool Init(); |
85 bool StoreDefaultValues(); | 87 bool StoreDefaultValues(); |
86 bool GetLastFileId(FileId* file_id); | 88 bool GetLastFileId(FileId* file_id); |
87 bool VerifyIsDirectory(FileId file_id); | 89 bool VerifyIsDirectory(FileId file_id); |
88 bool AddFileInfoHelper( | 90 bool AddFileInfoHelper( |
89 const FileInfo& info, FileId file_id, leveldb::WriteBatch* batch); | 91 const FileInfo& info, FileId file_id, leveldb::WriteBatch* batch); |
90 bool RemoveFileInfoHelper(FileId file_id, leveldb::WriteBatch* batch); | 92 bool RemoveFileInfoHelper(FileId file_id, leveldb::WriteBatch* batch); |
91 void HandleError(leveldb::Status status); | 93 void HandleError(leveldb::Status status); |
92 | 94 |
93 std::string path_; | 95 std::string path_; |
94 scoped_ptr<leveldb::DB> db_; | 96 scoped_ptr<leveldb::DB> db_; |
95 }; | 97 }; |
96 | 98 |
97 } // namespace fileapi | 99 } // namespace fileapi |
98 | 100 |
99 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_DIRECTORY_DATABASE_H | 101 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_DIRECTORY_DATABASE_H |
OLD | NEW |