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

Side by Side Diff: webkit/fileapi/file_system_origin_database.h

Issue 12163003: Add FilePath to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/fileapi/file_system_operation.h ('k') | webkit/fileapi/file_system_origin_database.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_ORIGIN_DATABASE_H_ 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_ORIGIN_DATABASE_H_
6 #define WEBKIT_FILEAPI_FILE_SYSTEM_ORIGIN_DATABASE_H_ 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_ORIGIN_DATABASE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 13 matching lines...) Expand all
24 } 24 }
25 25
26 namespace fileapi { 26 namespace fileapi {
27 27
28 // All methods of this class other than the constructor may be used only from 28 // All methods of this class other than the constructor may be used only from
29 // the browser's FILE thread. The constructor may be used on any thread. 29 // the browser's FILE thread. The constructor may be used on any thread.
30 class WEBKIT_STORAGE_EXPORT_PRIVATE FileSystemOriginDatabase { 30 class WEBKIT_STORAGE_EXPORT_PRIVATE FileSystemOriginDatabase {
31 public: 31 public:
32 struct WEBKIT_STORAGE_EXPORT_PRIVATE OriginRecord { 32 struct WEBKIT_STORAGE_EXPORT_PRIVATE OriginRecord {
33 std::string origin; 33 std::string origin;
34 FilePath path; 34 base::FilePath path;
35 35
36 OriginRecord(); 36 OriginRecord();
37 OriginRecord(const std::string& origin, const FilePath& path); 37 OriginRecord(const std::string& origin, const base::FilePath& path);
38 ~OriginRecord(); 38 ~OriginRecord();
39 }; 39 };
40 40
41 // Only one instance of FileSystemOriginDatabase should exist for a given path 41 // Only one instance of FileSystemOriginDatabase should exist for a given path
42 // at a given time. 42 // at a given time.
43 explicit FileSystemOriginDatabase(const FilePath& file_system_directory); 43 explicit FileSystemOriginDatabase(const base::FilePath& file_system_directory) ;
44 ~FileSystemOriginDatabase(); 44 ~FileSystemOriginDatabase();
45 45
46 bool HasOriginPath(const std::string& origin); 46 bool HasOriginPath(const std::string& origin);
47 47
48 // This will produce a unique path and add it to its database, if it's not 48 // This will produce a unique path and add it to its database, if it's not
49 // already present. 49 // already present.
50 bool GetPathForOrigin(const std::string& origin, FilePath* directory); 50 bool GetPathForOrigin(const std::string& origin, base::FilePath* directory);
51 51
52 // Also returns success if the origin is not found. 52 // Also returns success if the origin is not found.
53 bool RemovePathForOrigin(const std::string& origin); 53 bool RemovePathForOrigin(const std::string& origin);
54 54
55 bool ListAllOrigins(std::vector<OriginRecord>* origins); 55 bool ListAllOrigins(std::vector<OriginRecord>* origins);
56 56
57 // This will release all database resources in use; call it to save memory. 57 // This will release all database resources in use; call it to save memory.
58 void DropDatabase(); 58 void DropDatabase();
59 59
60 private: 60 private:
61 enum RecoveryOption { 61 enum RecoveryOption {
62 REPAIR_ON_CORRUPTION, 62 REPAIR_ON_CORRUPTION,
63 DELETE_ON_CORRUPTION, 63 DELETE_ON_CORRUPTION,
64 FAIL_ON_CORRUPTION, 64 FAIL_ON_CORRUPTION,
65 }; 65 };
66 66
67 bool Init(RecoveryOption recovery_option); 67 bool Init(RecoveryOption recovery_option);
68 bool RepairDatabase(const std::string& db_path); 68 bool RepairDatabase(const std::string& db_path);
69 void HandleError(const tracked_objects::Location& from_here, 69 void HandleError(const tracked_objects::Location& from_here,
70 const leveldb::Status& status); 70 const leveldb::Status& status);
71 void ReportInitStatus(const leveldb::Status& status); 71 void ReportInitStatus(const leveldb::Status& status);
72 bool GetLastPathNumber(int* number); 72 bool GetLastPathNumber(int* number);
73 73
74 FilePath file_system_directory_; 74 base::FilePath file_system_directory_;
75 scoped_ptr<leveldb::DB> db_; 75 scoped_ptr<leveldb::DB> db_;
76 base::Time last_reported_time_; 76 base::Time last_reported_time_;
77 DISALLOW_COPY_AND_ASSIGN(FileSystemOriginDatabase); 77 DISALLOW_COPY_AND_ASSIGN(FileSystemOriginDatabase);
78 }; 78 };
79 79
80 } // namespace fileapi 80 } // namespace fileapi
81 81
82 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_ORIGIN_DATABASE_H_ 82 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_ORIGIN_DATABASE_H_
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_operation.h ('k') | webkit/fileapi/file_system_origin_database.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698