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/history_backend.h" | 5 #include "components/history/core/browser/history_backend.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include <list> | 9 #include <list> |
10 #include <map> | 10 #include <map> |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 case sql::INIT_OK: | 644 case sql::INIT_OK: |
645 break; | 645 break; |
646 case sql::INIT_FAILURE: { | 646 case sql::INIT_FAILURE: { |
647 // A null db_ will cause all calls on this object to notice this error | 647 // A null db_ will cause all calls on this object to notice this error |
648 // and to not continue. If the error callback scheduled killing the | 648 // and to not continue. If the error callback scheduled killing the |
649 // database, the task it posted has not executed yet. Try killing the | 649 // database, the task it posted has not executed yet. Try killing the |
650 // database now before we close it. | 650 // database now before we close it. |
651 bool kill_db = scheduled_kill_db_; | 651 bool kill_db = scheduled_kill_db_; |
652 if (kill_db) | 652 if (kill_db) |
653 KillHistoryDatabase(); | 653 KillHistoryDatabase(); |
| 654 |
| 655 // The frequency of this UMA will indicate how often history |
| 656 // initialization fails. |
654 UMA_HISTOGRAM_BOOLEAN("History.AttemptedToFixProfileError", kill_db); | 657 UMA_HISTOGRAM_BOOLEAN("History.AttemptedToFixProfileError", kill_db); |
655 } // Falls through. | 658 } // Falls through. |
656 case sql::INIT_TOO_NEW: { | 659 case sql::INIT_TOO_NEW: { |
657 db_diagnostics_ += sql::GetCorruptFileDiagnosticsInfo(history_name); | 660 db_diagnostics_ += sql::GetCorruptFileDiagnosticsInfo(history_name); |
658 delegate_->NotifyProfileError(status, db_diagnostics_); | 661 delegate_->NotifyProfileError(status, db_diagnostics_); |
659 db_.reset(); | 662 db_.reset(); |
660 return; | 663 return; |
661 } | 664 } |
662 default: | 665 default: |
663 NOTREACHED(); | 666 NOTREACHED(); |
(...skipping 1975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2639 // transaction is currently open. | 2642 // transaction is currently open. |
2640 db_->CommitTransaction(); | 2643 db_->CommitTransaction(); |
2641 db_->Vacuum(); | 2644 db_->Vacuum(); |
2642 db_->BeginTransaction(); | 2645 db_->BeginTransaction(); |
2643 db_->GetStartDate(&first_recorded_time_); | 2646 db_->GetStartDate(&first_recorded_time_); |
2644 | 2647 |
2645 return true; | 2648 return true; |
2646 } | 2649 } |
2647 | 2650 |
2648 } // namespace history | 2651 } // namespace history |
OLD | NEW |