| 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_BROWSER_FILEAPI_SANDBOX_DIRECTORY_DATABASE_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_SANDBOX_DIRECTORY_DATABASE_H_ |
| 6 #define WEBKIT_BROWSER_FILEAPI_SANDBOX_DIRECTORY_DATABASE_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_SANDBOX_DIRECTORY_DATABASE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/files/file.h" | 11 #include "base/files/file.h" |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
| 15 #include "webkit/browser/webkit_storage_browser_export.h" | 15 #include "webkit/browser/webkit_storage_browser_export.h" |
| 16 | 16 |
| 17 namespace content { |
| 18 class SandboxDirectoryDatabaseTest; |
| 19 } |
| 20 |
| 17 namespace tracked_objects { | 21 namespace tracked_objects { |
| 18 class Location; | 22 class Location; |
| 19 } | 23 } |
| 20 | 24 |
| 21 namespace leveldb { | 25 namespace leveldb { |
| 22 class DB; | 26 class DB; |
| 23 class Env; | 27 class Env; |
| 24 class Status; | 28 class Status; |
| 25 class WriteBatch; | 29 class WriteBatch; |
| 26 } | 30 } |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 static bool DestroyDatabase(const base::FilePath& path, | 102 static bool DestroyDatabase(const base::FilePath& path, |
| 99 leveldb::Env* env_override); | 103 leveldb::Env* env_override); |
| 100 | 104 |
| 101 private: | 105 private: |
| 102 enum RecoveryOption { | 106 enum RecoveryOption { |
| 103 DELETE_ON_CORRUPTION, | 107 DELETE_ON_CORRUPTION, |
| 104 REPAIR_ON_CORRUPTION, | 108 REPAIR_ON_CORRUPTION, |
| 105 FAIL_ON_CORRUPTION, | 109 FAIL_ON_CORRUPTION, |
| 106 }; | 110 }; |
| 107 | 111 |
| 112 friend class content::SandboxDirectoryDatabaseTest; |
| 108 friend class ObfuscatedFileUtil; | 113 friend class ObfuscatedFileUtil; |
| 109 friend class SandboxDirectoryDatabaseTest; | |
| 110 | 114 |
| 111 bool Init(RecoveryOption recovery_option); | 115 bool Init(RecoveryOption recovery_option); |
| 112 bool RepairDatabase(const std::string& db_path); | 116 bool RepairDatabase(const std::string& db_path); |
| 113 void ReportInitStatus(const leveldb::Status& status); | 117 void ReportInitStatus(const leveldb::Status& status); |
| 114 bool StoreDefaultValues(); | 118 bool StoreDefaultValues(); |
| 115 bool GetLastFileId(FileId* file_id); | 119 bool GetLastFileId(FileId* file_id); |
| 116 bool AddFileInfoHelper( | 120 bool AddFileInfoHelper( |
| 117 const FileInfo& info, FileId file_id, leveldb::WriteBatch* batch); | 121 const FileInfo& info, FileId file_id, leveldb::WriteBatch* batch); |
| 118 bool RemoveFileInfoHelper(FileId file_id, leveldb::WriteBatch* batch); | 122 bool RemoveFileInfoHelper(FileId file_id, leveldb::WriteBatch* batch); |
| 119 void HandleError(const tracked_objects::Location& from_here, | 123 void HandleError(const tracked_objects::Location& from_here, |
| 120 const leveldb::Status& status); | 124 const leveldb::Status& status); |
| 121 | 125 |
| 122 const base::FilePath filesystem_data_directory_; | 126 const base::FilePath filesystem_data_directory_; |
| 123 leveldb::Env* env_override_; | 127 leveldb::Env* env_override_; |
| 124 scoped_ptr<leveldb::DB> db_; | 128 scoped_ptr<leveldb::DB> db_; |
| 125 base::Time last_reported_time_; | 129 base::Time last_reported_time_; |
| 126 DISALLOW_COPY_AND_ASSIGN(SandboxDirectoryDatabase); | 130 DISALLOW_COPY_AND_ASSIGN(SandboxDirectoryDatabase); |
| 127 }; | 131 }; |
| 128 | 132 |
| 129 } // namespace fileapi | 133 } // namespace fileapi |
| 130 | 134 |
| 131 #endif // WEBKIT_BROWSER_FILEAPI_SANDBOX_DIRECTORY_DATABASE_H_ | 135 #endif // WEBKIT_BROWSER_FILEAPI_SANDBOX_DIRECTORY_DATABASE_H_ |
| OLD | NEW |