| 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 |
| 11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/time.h" | 13 #include "base/time.h" |
| 14 #include "third_party/leveldb/include/leveldb/db.h" | 14 #include "third_party/leveldb/include/leveldb/db.h" |
| 15 | 15 |
| 16 namespace leveldb { | 16 namespace leveldb { |
| 17 class WriteBatch; | 17 class WriteBatch; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace fileapi { | 20 namespace fileapi { |
| 21 | 21 |
| 22 // This class WILL NOT protect you against producing directory loops, giving an | 22 // This class WILL NOT protect you against producing directory loops, giving an |
| (...skipping 21 matching lines...) Expand all Loading... |
| 44 | 44 |
| 45 FileId parent_id; | 45 FileId parent_id; |
| 46 FilePath data_path; | 46 FilePath data_path; |
| 47 FilePath::StringType name; | 47 FilePath::StringType name; |
| 48 // This modification time is valid only for directories, not files, as | 48 // This modification time is valid only for directories, not files, as |
| 49 // FileWriter will get the files out of sync. | 49 // FileWriter will get the files out of sync. |
| 50 // For files, look at the modification time of the underlying data_path. | 50 // For files, look at the modification time of the underlying data_path. |
| 51 base::Time modification_time; | 51 base::Time modification_time; |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 FileSystemDirectoryDatabase(const FilePath& path); | 54 explicit FileSystemDirectoryDatabase(const FilePath& path); |
| 55 ~FileSystemDirectoryDatabase(); | 55 ~FileSystemDirectoryDatabase(); |
| 56 | 56 |
| 57 bool GetChildWithName( | 57 bool GetChildWithName( |
| 58 FileId parent_id, const FilePath::StringType& name, FileId* child_id); | 58 FileId parent_id, const FilePath::StringType& name, FileId* child_id); |
| 59 bool GetFileWithPath(const FilePath& path, FileId* file_id); | 59 bool GetFileWithPath(const FilePath& path, FileId* file_id); |
| 60 // ListChildren will succeed, returning 0 children, if parent_id doesn't | 60 // ListChildren will succeed, returning 0 children, if parent_id doesn't |
| 61 // exist. | 61 // exist. |
| 62 bool ListChildren(FileId parent_id, std::vector<FileId>* children); | 62 bool ListChildren(FileId parent_id, std::vector<FileId>* children); |
| 63 bool GetFileInfo(FileId file_id, FileInfo* info); | 63 bool GetFileInfo(FileId file_id, FileInfo* info); |
| 64 bool AddFileInfo(const FileInfo& info, FileId* file_id); | 64 bool AddFileInfo(const FileInfo& info, FileId* file_id); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 91 const FileInfo& info, FileId file_id, leveldb::WriteBatch* batch); | 91 const FileInfo& info, FileId file_id, leveldb::WriteBatch* batch); |
| 92 bool RemoveFileInfoHelper(FileId file_id, leveldb::WriteBatch* batch); | 92 bool RemoveFileInfoHelper(FileId file_id, leveldb::WriteBatch* batch); |
| 93 void HandleError(leveldb::Status status); | 93 void HandleError(leveldb::Status status); |
| 94 | 94 |
| 95 std::string path_; | 95 std::string path_; |
| 96 scoped_ptr<leveldb::DB> db_; | 96 scoped_ptr<leveldb::DB> db_; |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 } // namespace fileapi | 99 } // namespace fileapi |
| 100 | 100 |
| 101 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_DIRECTORY_DATABASE_H | 101 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_DIRECTORY_DATABASE_H_ |
| OLD | NEW |