OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/time.h" | 13 #include "base/time.h" |
| 14 #include "webkit/fileapi/fileapi_export.h" |
14 | 15 |
15 namespace tracked_objects { | 16 namespace tracked_objects { |
16 class Location; | 17 class Location; |
17 } | 18 } |
18 | 19 |
19 namespace leveldb { | 20 namespace leveldb { |
20 class DB; | 21 class DB; |
21 class Status; | 22 class Status; |
22 class WriteBatch; | 23 class WriteBatch; |
23 } | 24 } |
24 | 25 |
25 namespace fileapi { | 26 namespace fileapi { |
26 | 27 |
27 // This class WILL NOT protect you against producing directory loops, giving an | 28 // This class WILL NOT protect you against producing directory loops, giving an |
28 // empty directory a backing data file, giving two files the same backing file, | 29 // empty directory a backing data file, giving two files the same backing file, |
29 // or pointing to a nonexistent backing file. It does no file IO other than | 30 // or pointing to a nonexistent backing file. It does no file IO other than |
30 // that involved with talking to its underlying database. It does not create or | 31 // that involved with talking to its underlying database. It does not create or |
31 // in any way touch real files; it only creates path entries in its database. | 32 // in any way touch real files; it only creates path entries in its database. |
32 | 33 |
33 // TODO(ericu): Safe mode, which does more checks such as the above on debug | 34 // TODO(ericu): Safe mode, which does more checks such as the above on debug |
34 // builds. | 35 // builds. |
35 // TODO(ericu): Add a method that will give a unique filename for a data file. | 36 // TODO(ericu): Add a method that will give a unique filename for a data file. |
36 class FileSystemDirectoryDatabase { | 37 class FILEAPI_EXPORT_PRIVATE FileSystemDirectoryDatabase { |
37 public: | 38 public: |
38 typedef int64 FileId; | 39 typedef int64 FileId; |
39 | 40 |
40 struct FileInfo { | 41 struct FILEAPI_EXPORT_PRIVATE FileInfo { |
41 FileInfo(); | 42 FileInfo(); |
42 ~FileInfo(); | 43 ~FileInfo(); |
43 | 44 |
44 bool is_directory() const { | 45 bool is_directory() const { |
45 return data_path.empty(); | 46 return data_path.empty(); |
46 } | 47 } |
47 | 48 |
48 FileId parent_id; | 49 FileId parent_id; |
49 FilePath data_path; | 50 FilePath data_path; |
50 FilePath::StringType name; | 51 FilePath::StringType name; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 113 |
113 FilePath filesystem_data_directory_; | 114 FilePath filesystem_data_directory_; |
114 scoped_ptr<leveldb::DB> db_; | 115 scoped_ptr<leveldb::DB> db_; |
115 base::Time last_reported_time_; | 116 base::Time last_reported_time_; |
116 DISALLOW_COPY_AND_ASSIGN(FileSystemDirectoryDatabase); | 117 DISALLOW_COPY_AND_ASSIGN(FileSystemDirectoryDatabase); |
117 }; | 118 }; |
118 | 119 |
119 } // namespace fileapi | 120 } // namespace fileapi |
120 | 121 |
121 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_DIRECTORY_DATABASE_H_ | 122 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_DIRECTORY_DATABASE_H_ |
OLD | NEW |