| 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/top_sites_database.h" | 5 #include "components/history/core/browser/top_sites_database.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 // | 270 // |
| 271 // What are the potential responses, even? The recovery database could be | 271 // What are the potential responses, even? The recovery database could be |
| 272 // opened as in-memory. If the temp database had a filesystem problem and | 272 // opened as in-memory. If the temp database had a filesystem problem and |
| 273 // the temp filesystem differs from the main database, then that could fix | 273 // the temp filesystem differs from the main database, then that could fix |
| 274 // it. | 274 // it. |
| 275 sql::Recovery::Rollback(std::move(recovery)); | 275 sql::Recovery::Rollback(std::move(recovery)); |
| 276 RecordRecoveryEvent(RECOVERY_EVENT_FAILED_SCHEMA_INIT); | 276 RecordRecoveryEvent(RECOVERY_EVENT_FAILED_SCHEMA_INIT); |
| 277 return; | 277 return; |
| 278 } | 278 } |
| 279 | 279 |
| 280 // The |1| is because v2 [thumbnails] has one less column than v3 did. In the | 280 // In the v2 case the missing column will get default values. |
| 281 // v2 case the column will get default values. | 281 if (!recovery->AutoRecoverTable("thumbnails", &thumbnails_recovered)) { |
| 282 if (!recovery->AutoRecoverTable("thumbnails", 1, &thumbnails_recovered)) { | |
| 283 sql::Recovery::Rollback(std::move(recovery)); | 282 sql::Recovery::Rollback(std::move(recovery)); |
| 284 RecordRecoveryEvent(RECOVERY_EVENT_FAILED_AUTORECOVER_THUMBNAILS); | 283 RecordRecoveryEvent(RECOVERY_EVENT_FAILED_AUTORECOVER_THUMBNAILS); |
| 285 return; | 284 return; |
| 286 } | 285 } |
| 287 | 286 |
| 288 // TODO(shess): Inline this? | 287 // TODO(shess): Inline this? |
| 289 FixThumbnailsTable(recovery->db()); | 288 FixThumbnailsTable(recovery->db()); |
| 290 | 289 |
| 291 if (!sql::Recovery::Recovered(std::move(recovery))) { | 290 if (!sql::Recovery::Recovered(std::move(recovery))) { |
| 292 // TODO(shess): Very unclear what this failure would actually mean, and what | 291 // TODO(shess): Very unclear what this failure would actually mean, and what |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 727 db->set_error_callback(base::Bind(&DatabaseErrorCallback, db.get(), db_name)); | 726 db->set_error_callback(base::Bind(&DatabaseErrorCallback, db.get(), db_name)); |
| 728 db->set_page_size(4096); | 727 db->set_page_size(4096); |
| 729 db->set_cache_size(32); | 728 db->set_cache_size(32); |
| 730 | 729 |
| 731 if (!db->Open(db_name)) | 730 if (!db->Open(db_name)) |
| 732 return NULL; | 731 return NULL; |
| 733 return db.release(); | 732 return db.release(); |
| 734 } | 733 } |
| 735 | 734 |
| 736 } // namespace history | 735 } // namespace history |
| OLD | NEW |