| 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_APPCACHE_APPCACHE_DATABASE_H_ | 5 #ifndef WEBKIT_APPCACHE_APPCACHE_DATABASE_H_ |
| 6 #define WEBKIT_APPCACHE_APPCACHE_DATABASE_H_ | 6 #define WEBKIT_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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 74 |
| 75 typedef std::vector<NamespaceRecord> NamespaceRecordVector; | 75 typedef std::vector<NamespaceRecord> NamespaceRecordVector; |
| 76 | 76 |
| 77 struct OnlineWhiteListRecord { | 77 struct OnlineWhiteListRecord { |
| 78 OnlineWhiteListRecord() : cache_id(0) {} | 78 OnlineWhiteListRecord() : cache_id(0) {} |
| 79 | 79 |
| 80 int64 cache_id; | 80 int64 cache_id; |
| 81 GURL namespace_url; | 81 GURL namespace_url; |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 explicit AppCacheDatabase(const FilePath& path); | 84 explicit AppCacheDatabase(const base::FilePath& path); |
| 85 ~AppCacheDatabase(); | 85 ~AppCacheDatabase(); |
| 86 | 86 |
| 87 void CloseConnection(); | 87 void CloseConnection(); |
| 88 void Disable(); | 88 void Disable(); |
| 89 bool is_disabled() const { return is_disabled_; } | 89 bool is_disabled() const { return is_disabled_; } |
| 90 | 90 |
| 91 int64 GetOriginUsage(const GURL& origin); | 91 int64 GetOriginUsage(const GURL& origin); |
| 92 bool GetAllOriginUsage(std::map<GURL, int64>* usage_map); | 92 bool GetAllOriginUsage(std::map<GURL, int64>* usage_map); |
| 93 | 93 |
| 94 bool FindOriginsWithGroups(std::set<GURL>* origins); | 94 bool FindOriginsWithGroups(std::set<GURL>* origins); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 bool CreateSchema(); | 193 bool CreateSchema(); |
| 194 bool UpgradeSchema(); | 194 bool UpgradeSchema(); |
| 195 | 195 |
| 196 void ResetConnectionAndTables(); | 196 void ResetConnectionAndTables(); |
| 197 | 197 |
| 198 // Deletes the existing database file and the entire directory containing | 198 // Deletes the existing database file and the entire directory containing |
| 199 // the database file including the disk cache in which response headers | 199 // the database file including the disk cache in which response headers |
| 200 // and bodies are stored, and then creates a new database file. | 200 // and bodies are stored, and then creates a new database file. |
| 201 bool DeleteExistingAndCreateNewDatabase(); | 201 bool DeleteExistingAndCreateNewDatabase(); |
| 202 | 202 |
| 203 FilePath db_file_path_; | 203 base::FilePath db_file_path_; |
| 204 scoped_ptr<sql::Connection> db_; | 204 scoped_ptr<sql::Connection> db_; |
| 205 scoped_ptr<sql::MetaTable> meta_table_; | 205 scoped_ptr<sql::MetaTable> meta_table_; |
| 206 bool is_disabled_; | 206 bool is_disabled_; |
| 207 bool is_recreating_; | 207 bool is_recreating_; |
| 208 | 208 |
| 209 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, CacheRecords); | 209 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, CacheRecords); |
| 210 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, EntryRecords); | 210 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, EntryRecords); |
| 211 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, NamespaceRecords); | 211 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, NamespaceRecords); |
| 212 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, GroupRecords); | 212 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, GroupRecords); |
| 213 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, LazyOpen); | 213 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, LazyOpen); |
| 214 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, OnlineWhiteListRecords); | 214 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, OnlineWhiteListRecords); |
| 215 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, ReCreate); | 215 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, ReCreate); |
| 216 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, DeletableResponseIds); | 216 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, DeletableResponseIds); |
| 217 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, OriginUsage); | 217 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, OriginUsage); |
| 218 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, UpgradeSchema3to4); | 218 FRIEND_TEST_ALL_PREFIXES(AppCacheDatabaseTest, UpgradeSchema3to4); |
| 219 | 219 |
| 220 DISALLOW_COPY_AND_ASSIGN(AppCacheDatabase); | 220 DISALLOW_COPY_AND_ASSIGN(AppCacheDatabase); |
| 221 }; | 221 }; |
| 222 | 222 |
| 223 } // namespace appcache | 223 } // namespace appcache |
| 224 | 224 |
| 225 #endif // WEBKIT_APPCACHE_APPCACHE_DATABASE_H_ | 225 #endif // WEBKIT_APPCACHE_APPCACHE_DATABASE_H_ |
| OLD | NEW |