| 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 #include "content/browser/appcache/appcache_database.h" | 5 #include "content/browser/appcache/appcache_database.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 last_deletable_response_rowid); | 271 last_deletable_response_rowid); |
| 272 | 272 |
| 273 *last_group_id = 0; | 273 *last_group_id = 0; |
| 274 *last_cache_id = 0; | 274 *last_cache_id = 0; |
| 275 *last_response_id = 0; | 275 *last_response_id = 0; |
| 276 *last_deletable_response_rowid = 0; | 276 *last_deletable_response_rowid = 0; |
| 277 | 277 |
| 278 if (!LazyOpen(kDontCreate)) | 278 if (!LazyOpen(kDontCreate)) |
| 279 return false; | 279 return false; |
| 280 | 280 |
| 281 const char* kMaxGroupIdSql = "SELECT MAX(group_id) FROM Groups"; | 281 const char kMaxGroupIdSql[] = "SELECT MAX(group_id) FROM Groups"; |
| 282 const char* kMaxCacheIdSql = "SELECT MAX(cache_id) FROM Caches"; | 282 const char kMaxCacheIdSql[] = "SELECT MAX(cache_id) FROM Caches"; |
| 283 const char* kMaxResponseIdFromEntriesSql = | 283 const char kMaxResponseIdFromEntriesSql[] = |
| 284 "SELECT MAX(response_id) FROM Entries"; | 284 "SELECT MAX(response_id) FROM Entries"; |
| 285 const char* kMaxResponseIdFromDeletablesSql = | 285 const char kMaxResponseIdFromDeletablesSql[] = |
| 286 "SELECT MAX(response_id) FROM DeletableResponseIds"; | 286 "SELECT MAX(response_id) FROM DeletableResponseIds"; |
| 287 const char* kMaxDeletableResponseRowIdSql = | 287 const char kMaxDeletableResponseRowIdSql[] = |
| 288 "SELECT MAX(rowid) FROM DeletableResponseIds"; | 288 "SELECT MAX(rowid) FROM DeletableResponseIds"; |
| 289 int64_t max_group_id; | 289 int64_t max_group_id; |
| 290 int64_t max_cache_id; | 290 int64_t max_cache_id; |
| 291 int64_t max_response_id_from_entries; | 291 int64_t max_response_id_from_entries; |
| 292 int64_t max_response_id_from_deletables; | 292 int64_t max_response_id_from_deletables; |
| 293 int64_t max_deletable_response_rowid; | 293 int64_t max_deletable_response_rowid; |
| 294 if (!RunUniqueStatementWithInt64Result(kMaxGroupIdSql, &max_group_id) || | 294 if (!RunUniqueStatementWithInt64Result(kMaxGroupIdSql, &max_group_id) || |
| 295 !RunUniqueStatementWithInt64Result(kMaxCacheIdSql, &max_cache_id) || | 295 !RunUniqueStatementWithInt64Result(kMaxCacheIdSql, &max_cache_id) || |
| 296 !RunUniqueStatementWithInt64Result(kMaxResponseIdFromEntriesSql, | 296 !RunUniqueStatementWithInt64Result(kMaxResponseIdFromEntriesSql, |
| 297 &max_response_id_from_entries) || | 297 &max_response_id_from_entries) || |
| (...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1320 } | 1320 } |
| 1321 | 1321 |
| 1322 void AppCacheDatabase::OnDatabaseError(int err, sql::Statement* stmt) { | 1322 void AppCacheDatabase::OnDatabaseError(int err, sql::Statement* stmt) { |
| 1323 was_corruption_detected_ |= sql::IsErrorCatastrophic(err); | 1323 was_corruption_detected_ |= sql::IsErrorCatastrophic(err); |
| 1324 if (!db_->ShouldIgnoreSqliteError(err)) | 1324 if (!db_->ShouldIgnoreSqliteError(err)) |
| 1325 DLOG(ERROR) << db_->GetErrorMessage(); | 1325 DLOG(ERROR) << db_->GetErrorMessage(); |
| 1326 // TODO: Maybe use non-catostrophic errors to trigger a full integrity check? | 1326 // TODO: Maybe use non-catostrophic errors to trigger a full integrity check? |
| 1327 } | 1327 } |
| 1328 | 1328 |
| 1329 } // namespace content | 1329 } // namespace content |
| OLD | NEW |