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 "components/history/core/browser/thumbnail_database.h" | 5 #include "components/history/core/browser/thumbnail_database.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
(...skipping 334 matching lines...) Loading... |
345 // | 345 // |
346 // What are the potential responses, even? The recovery database | 346 // What are the potential responses, even? The recovery database |
347 // could be opened as in-memory. If the temp database had a | 347 // could be opened as in-memory. If the temp database had a |
348 // filesystem problem and the temp filesystem differs from the | 348 // filesystem problem and the temp filesystem differs from the |
349 // main database, then that could fix it. | 349 // main database, then that could fix it. |
350 sql::Recovery::Rollback(std::move(recovery)); | 350 sql::Recovery::Rollback(std::move(recovery)); |
351 RecordRecoveryEvent(RECOVERY_EVENT_FAILED_INIT); | 351 RecordRecoveryEvent(RECOVERY_EVENT_FAILED_INIT); |
352 return; | 352 return; |
353 } | 353 } |
354 | 354 |
355 if (!recovery->AutoRecoverTable("favicons", 0, &favicons_rows_recovered)) { | 355 if (!recovery->AutoRecoverTable("favicons", &favicons_rows_recovered)) { |
356 sql::Recovery::Rollback(std::move(recovery)); | 356 sql::Recovery::Rollback(std::move(recovery)); |
357 RecordRecoveryEvent(RECOVERY_EVENT_FAILED_AUTORECOVER_FAVICONS); | 357 RecordRecoveryEvent(RECOVERY_EVENT_FAILED_AUTORECOVER_FAVICONS); |
358 return; | 358 return; |
359 } | 359 } |
360 if (!recovery->AutoRecoverTable("favicon_bitmaps", 0, | 360 if (!recovery->AutoRecoverTable("favicon_bitmaps", |
361 &favicon_bitmaps_rows_recovered)) { | 361 &favicon_bitmaps_rows_recovered)) { |
362 sql::Recovery::Rollback(std::move(recovery)); | 362 sql::Recovery::Rollback(std::move(recovery)); |
363 RecordRecoveryEvent(RECOVERY_EVENT_FAILED_AUTORECOVER_FAVICON_BITMAPS); | 363 RecordRecoveryEvent(RECOVERY_EVENT_FAILED_AUTORECOVER_FAVICON_BITMAPS); |
364 return; | 364 return; |
365 } | 365 } |
366 if (!recovery->AutoRecoverTable("icon_mapping", 0, | 366 if (!recovery->AutoRecoverTable("icon_mapping", |
367 &icon_mapping_rows_recovered)) { | 367 &icon_mapping_rows_recovered)) { |
368 sql::Recovery::Rollback(std::move(recovery)); | 368 sql::Recovery::Rollback(std::move(recovery)); |
369 RecordRecoveryEvent(RECOVERY_EVENT_FAILED_AUTORECOVER_ICON_MAPPING); | 369 RecordRecoveryEvent(RECOVERY_EVENT_FAILED_AUTORECOVER_ICON_MAPPING); |
370 return; | 370 return; |
371 } | 371 } |
372 | 372 |
373 // TODO(shess): Is it possible/likely to have broken foreign-key | 373 // TODO(shess): Is it possible/likely to have broken foreign-key |
374 // issues with the tables? | 374 // issues with the tables? |
375 // - icon_mapping.icon_id maps to no favicons.id | 375 // - icon_mapping.icon_id maps to no favicons.id |
376 // - favicon_bitmaps.icon_id maps to no favicons.id | 376 // - favicon_bitmaps.icon_id maps to no favicons.id |
(...skipping 860 matching lines...) Loading... |
1237 meta_table_.SetVersionNumber(8); | 1237 meta_table_.SetVersionNumber(8); |
1238 meta_table_.SetCompatibleVersionNumber(std::min(8, kCompatibleVersionNumber)); | 1238 meta_table_.SetCompatibleVersionNumber(std::min(8, kCompatibleVersionNumber)); |
1239 return true; | 1239 return true; |
1240 } | 1240 } |
1241 | 1241 |
1242 bool ThumbnailDatabase::IsFaviconDBStructureIncorrect() { | 1242 bool ThumbnailDatabase::IsFaviconDBStructureIncorrect() { |
1243 return !db_.IsSQLValid("SELECT id, url, icon_type FROM favicons"); | 1243 return !db_.IsSQLValid("SELECT id, url, icon_type FROM favicons"); |
1244 } | 1244 } |
1245 | 1245 |
1246 } // namespace history | 1246 } // namespace history |
OLD | NEW |