Chromium Code Reviews| 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_APPCACHE_APPCACHE_DATABASE_H_ | 5 #ifndef WEBKIT_BROWSER_APPCACHE_APPCACHE_DATABASE_H_ |
| 6 #define WEBKIT_BROWSER_APPCACHE_APPCACHE_DATABASE_H_ | 6 #define WEBKIT_BROWSER_APPCACHE_APPCACHE_DATABASE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 GURL namespace_url; | 79 GURL namespace_url; |
| 80 bool is_pattern; | 80 bool is_pattern; |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 explicit AppCacheDatabase(const base::FilePath& path); | 83 explicit AppCacheDatabase(const base::FilePath& path); |
| 84 ~AppCacheDatabase(); | 84 ~AppCacheDatabase(); |
| 85 | 85 |
| 86 void CloseConnection(); | 86 void CloseConnection(); |
| 87 void Disable(); | 87 void Disable(); |
| 88 bool is_disabled() const { return is_disabled_; } | 88 bool is_disabled() const { return is_disabled_; } |
| 89 bool was_corruption_dectected(); | |
|
jsbell
2014/01/22 00:37:19
typo: "dectected"
| |
| 90 // const; { return was_corruption_detected_; } | |
| 89 | 91 |
| 90 int64 GetOriginUsage(const GURL& origin); | 92 int64 GetOriginUsage(const GURL& origin); |
| 91 bool GetAllOriginUsage(std::map<GURL, int64>* usage_map); | 93 bool GetAllOriginUsage(std::map<GURL, int64>* usage_map); |
| 92 | 94 |
| 93 bool FindOriginsWithGroups(std::set<GURL>* origins); | 95 bool FindOriginsWithGroups(std::set<GURL>* origins); |
| 94 bool FindLastStorageIds( | 96 bool FindLastStorageIds( |
| 95 int64* last_group_id, int64* last_cache_id, int64* last_response_id, | 97 int64* last_group_id, int64* last_cache_id, int64* last_response_id, |
| 96 int64* last_deletable_response_rowid); | 98 int64* last_deletable_response_rowid); |
| 97 | 99 |
| 98 bool FindGroup(int64 group_id, GroupRecord* record); | 100 bool FindGroup(int64 group_id, GroupRecord* record); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 192 bool CreateSchema(); | 194 bool CreateSchema(); |
| 193 bool UpgradeSchema(); | 195 bool UpgradeSchema(); |
| 194 | 196 |
| 195 void ResetConnectionAndTables(); | 197 void ResetConnectionAndTables(); |
| 196 | 198 |
| 197 // Deletes the existing database file and the entire directory containing | 199 // Deletes the existing database file and the entire directory containing |
| 198 // the database file including the disk cache in which response headers | 200 // the database file including the disk cache in which response headers |
| 199 // and bodies are stored, and then creates a new database file. | 201 // and bodies are stored, and then creates a new database file. |
| 200 bool DeleteExistingAndCreateNewDatabase(); | 202 bool DeleteExistingAndCreateNewDatabase(); |
| 201 | 203 |
| 204 void OnDatabaseError(int err, sql::Statement* stmt); | |
| 205 | |
| 202 base::FilePath db_file_path_; | 206 base::FilePath db_file_path_; |
| 203 scoped_ptr<sql::Connection> db_; | 207 scoped_ptr<sql::Connection> db_; |
| 204 scoped_ptr<sql::MetaTable> meta_table_; | 208 scoped_ptr<sql::MetaTable> meta_table_; |
| 205 bool is_disabled_; | 209 bool is_disabled_; |
| 206 bool is_recreating_; | 210 bool is_recreating_; |
| 211 bool was_corruption_detected_; | |
| 207 | 212 |
| 213 friend class AppCacheStorageImplTest; | |
| 208 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, CacheRecords); | 214 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, CacheRecords); |
| 209 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, EntryRecords); | 215 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, EntryRecords); |
| 210 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, QuickIntegrityCheck); | 216 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, QuickIntegrityCheck); |
| 211 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, NamespaceRecords); | 217 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, NamespaceRecords); |
| 212 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, GroupRecords); | 218 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, GroupRecords); |
| 213 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, LazyOpen); | 219 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, LazyOpen); |
| 214 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, ExperimentalFlags); | 220 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, ExperimentalFlags); |
| 215 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, OnlineWhiteListRecords); | 221 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, OnlineWhiteListRecords); |
| 216 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, ReCreate); | 222 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, ReCreate); |
| 217 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, DeletableResponseIds); | 223 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, DeletableResponseIds); |
| 218 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, OriginUsage); | 224 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, OriginUsage); |
| 219 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, UpgradeSchema3to5); | 225 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, UpgradeSchema3to5); |
| 220 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, UpgradeSchema4to5); | 226 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, UpgradeSchema4to5); |
| 227 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, WasCorrutionDetected); | |
| 221 | 228 |
| 222 DISALLOW_COPY_AND_ASSIGN(AppCacheDatabase); | 229 DISALLOW_COPY_AND_ASSIGN(AppCacheDatabase); |
| 223 }; | 230 }; |
| 224 | 231 |
| 225 } // namespace appcache | 232 } // namespace appcache |
| 226 | 233 |
| 227 #endif // WEBKIT_BROWSER_APPCACHE_APPCACHE_DATABASE_H_ | 234 #endif // WEBKIT_BROWSER_APPCACHE_APPCACHE_DATABASE_H_ |
| OLD | NEW |