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 CONTENT_BROWSER_APPCACHE_APPCACHE_DATABASE_H_ | 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_DATABASE_H_ |
6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_DATABASE_H_ | 6 #define CONTENT_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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 bool FindOriginsWithGroups(std::set<GURL>* origins); | 109 bool FindOriginsWithGroups(std::set<GURL>* origins); |
110 bool FindLastStorageIds( | 110 bool FindLastStorageIds( |
111 int64* last_group_id, int64* last_cache_id, int64* last_response_id, | 111 int64* last_group_id, int64* last_cache_id, int64* last_response_id, |
112 int64* last_deletable_response_rowid); | 112 int64* last_deletable_response_rowid); |
113 | 113 |
114 bool FindGroup(int64 group_id, GroupRecord* record); | 114 bool FindGroup(int64 group_id, GroupRecord* record); |
115 bool FindGroupForManifestUrl(const GURL& manifest_url, GroupRecord* record); | 115 bool FindGroupForManifestUrl(const GURL& manifest_url, GroupRecord* record); |
116 bool FindGroupsForOrigin( | 116 bool FindGroupsForOrigin( |
117 const GURL& origin, std::vector<GroupRecord>* records); | 117 const GURL& origin, std::vector<GroupRecord>* records); |
118 bool FindGroupForCache(int64 cache_id, GroupRecord* record); | 118 bool FindGroupForCache(int64 cache_id, GroupRecord* record); |
119 bool UpdateGroupLastAccessTime( | 119 bool UpdateLastAccessTime( |
120 int64 group_id, base::Time last_access_time); | 120 int64 group_id, base::Time last_access_time); |
| 121 bool LazyUpdateLastAccessTime( |
| 122 int64 group_id, base::Time last_access_time); |
| 123 bool CommitLazyLastAccessTimes(); // The destructor calls this too. |
121 bool InsertGroup(const GroupRecord* record); | 124 bool InsertGroup(const GroupRecord* record); |
122 bool DeleteGroup(int64 group_id); | 125 bool DeleteGroup(int64 group_id); |
123 | 126 |
124 bool FindCache(int64 cache_id, CacheRecord* record); | 127 bool FindCache(int64 cache_id, CacheRecord* record); |
125 bool FindCacheForGroup(int64 group_id, CacheRecord* record); | 128 bool FindCacheForGroup(int64 group_id, CacheRecord* record); |
126 bool FindCachesForOrigin( | 129 bool FindCachesForOrigin( |
127 const GURL& origin, std::vector<CacheRecord>* records); | 130 const GURL& origin, std::vector<CacheRecord>* records); |
128 bool InsertCache(const CacheRecord* record); | 131 bool InsertCache(const CacheRecord* record); |
129 bool DeleteCache(int64 cache_id); | 132 bool DeleteCache(int64 cache_id); |
130 | 133 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 // Deletes the existing database file and the entire directory containing | 216 // Deletes the existing database file and the entire directory containing |
214 // the database file including the disk cache in which response headers | 217 // the database file including the disk cache in which response headers |
215 // and bodies are stored, and then creates a new database file. | 218 // and bodies are stored, and then creates a new database file. |
216 bool DeleteExistingAndCreateNewDatabase(); | 219 bool DeleteExistingAndCreateNewDatabase(); |
217 | 220 |
218 void OnDatabaseError(int err, sql::Statement* stmt); | 221 void OnDatabaseError(int err, sql::Statement* stmt); |
219 | 222 |
220 base::FilePath db_file_path_; | 223 base::FilePath db_file_path_; |
221 scoped_ptr<sql::Connection> db_; | 224 scoped_ptr<sql::Connection> db_; |
222 scoped_ptr<sql::MetaTable> meta_table_; | 225 scoped_ptr<sql::MetaTable> meta_table_; |
| 226 std::map<int64, base::Time> lazy_last_access_times_; |
223 bool is_disabled_; | 227 bool is_disabled_; |
224 bool is_recreating_; | 228 bool is_recreating_; |
225 bool was_corruption_detected_; | 229 bool was_corruption_detected_; |
226 | 230 |
227 friend class content::AppCacheDatabaseTest; | 231 friend class content::AppCacheDatabaseTest; |
228 friend class content::AppCacheStorageImplTest; | 232 friend class content::AppCacheStorageImplTest; |
229 | 233 |
230 FRIEND_TEST_ALL_PREFIXES(content::AppCacheDatabaseTest, CacheRecords); | 234 FRIEND_TEST_ALL_PREFIXES(content::AppCacheDatabaseTest, CacheRecords); |
231 FRIEND_TEST_ALL_PREFIXES(content::AppCacheDatabaseTest, EntryRecords); | 235 FRIEND_TEST_ALL_PREFIXES(content::AppCacheDatabaseTest, EntryRecords); |
232 FRIEND_TEST_ALL_PREFIXES(content::AppCacheDatabaseTest, QuickIntegrityCheck); | 236 FRIEND_TEST_ALL_PREFIXES(content::AppCacheDatabaseTest, QuickIntegrityCheck); |
233 FRIEND_TEST_ALL_PREFIXES(content::AppCacheDatabaseTest, NamespaceRecords); | 237 FRIEND_TEST_ALL_PREFIXES(content::AppCacheDatabaseTest, NamespaceRecords); |
234 FRIEND_TEST_ALL_PREFIXES(content::AppCacheDatabaseTest, GroupRecords); | 238 FRIEND_TEST_ALL_PREFIXES(content::AppCacheDatabaseTest, GroupRecords); |
235 FRIEND_TEST_ALL_PREFIXES(content::AppCacheDatabaseTest, LazyOpen); | 239 FRIEND_TEST_ALL_PREFIXES(content::AppCacheDatabaseTest, LazyOpen); |
236 FRIEND_TEST_ALL_PREFIXES(content::AppCacheDatabaseTest, ExperimentalFlags); | 240 FRIEND_TEST_ALL_PREFIXES(content::AppCacheDatabaseTest, ExperimentalFlags); |
237 FRIEND_TEST_ALL_PREFIXES(content::AppCacheDatabaseTest, | 241 FRIEND_TEST_ALL_PREFIXES(content::AppCacheDatabaseTest, |
238 OnlineWhiteListRecords); | 242 OnlineWhiteListRecords); |
239 FRIEND_TEST_ALL_PREFIXES(content::AppCacheDatabaseTest, ReCreate); | 243 FRIEND_TEST_ALL_PREFIXES(content::AppCacheDatabaseTest, ReCreate); |
240 FRIEND_TEST_ALL_PREFIXES(content::AppCacheDatabaseTest, DeletableResponseIds); | 244 FRIEND_TEST_ALL_PREFIXES(content::AppCacheDatabaseTest, DeletableResponseIds); |
241 FRIEND_TEST_ALL_PREFIXES(content::AppCacheDatabaseTest, OriginUsage); | 245 FRIEND_TEST_ALL_PREFIXES(content::AppCacheDatabaseTest, OriginUsage); |
242 FRIEND_TEST_ALL_PREFIXES(content::AppCacheDatabaseTest, UpgradeSchema3to5); | 246 FRIEND_TEST_ALL_PREFIXES(content::AppCacheDatabaseTest, UpgradeSchema3to5); |
243 FRIEND_TEST_ALL_PREFIXES(content::AppCacheDatabaseTest, UpgradeSchema4to5); | 247 FRIEND_TEST_ALL_PREFIXES(content::AppCacheDatabaseTest, UpgradeSchema4to5); |
244 FRIEND_TEST_ALL_PREFIXES(content::AppCacheDatabaseTest, WasCorrutionDetected); | 248 FRIEND_TEST_ALL_PREFIXES(content::AppCacheDatabaseTest, WasCorrutionDetected); |
245 | 249 |
246 DISALLOW_COPY_AND_ASSIGN(AppCacheDatabase); | 250 DISALLOW_COPY_AND_ASSIGN(AppCacheDatabase); |
247 }; | 251 }; |
248 | 252 |
249 } // namespace content | 253 } // namespace content |
250 | 254 |
251 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_DATABASE_H_ | 255 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_DATABASE_H_ |
OLD | NEW |