Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(448)

Side by Side Diff: components/history/core/browser/history_backend.cc

Issue 2107493002: Offer user to send feedback from profile error dialog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unused variable Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
650 650
651 // Unretained to avoid a ref loop with db_. 651 // Unretained to avoid a ref loop with db_.
652 db_->set_error_callback(base::Bind(&HistoryBackend::DatabaseErrorCallback, 652 db_->set_error_callback(base::Bind(&HistoryBackend::DatabaseErrorCallback,
653 base::Unretained(this))); 653 base::Unretained(this)));
654 654
655 sql::InitStatus status = db_->Init(history_name); 655 sql::InitStatus status = db_->Init(history_name);
656 switch (status) { 656 switch (status) {
657 case sql::INIT_OK: 657 case sql::INIT_OK:
658 break; 658 break;
659 case sql::INIT_TOO_NEW: 659 case sql::INIT_TOO_NEW:
660 delegate_->NotifyProfileError(status); 660 delegate_->NotifyProfileError(history_name, status);
661 db_.reset(); 661 db_.reset();
662 return; 662 return;
663 case sql::INIT_FAILURE: { 663 case sql::INIT_FAILURE: {
664 // A null db_ will cause all calls on this object to notice this error 664 // A null db_ will cause all calls on this object to notice this error
665 // and to not continue. If the error callback scheduled killing the 665 // and to not continue. If the error callback scheduled killing the
666 // database, the task it posted has not executed yet. Try killing the 666 // database, the task it posted has not executed yet. Try killing the
667 // database now before we close it. 667 // database now before we close it.
668 bool kill_db = scheduled_kill_db_; 668 bool kill_db = scheduled_kill_db_;
669 if (kill_db) 669 if (kill_db)
670 KillHistoryDatabase(); 670 KillHistoryDatabase();
671 UMA_HISTOGRAM_BOOLEAN("History.AttemptedToFixProfileError", kill_db); 671 UMA_HISTOGRAM_BOOLEAN("History.AttemptedToFixProfileError", kill_db);
672 delegate_->NotifyProfileError(status); 672 delegate_->NotifyProfileError(history_name, status);
Scott Hess - ex-Googler 2016/06/29 05:13:48 Note that if the db is open, it may hold locks whi
afakhry 2016/06/29 18:57:18 So do you suggest moving these calls elsewhere? Pe
Scott Hess - ex-Googler 2016/06/29 19:17:27 Depends on what you're going to do. If NotifyProf
673 db_.reset(); 673 db_.reset();
674 return; 674 return;
675 } 675 }
676 default: 676 default:
677 NOTREACHED(); 677 NOTREACHED();
678 } 678 }
679 679
680 // Fill the in-memory database and send it back to the history service on the 680 // Fill the in-memory database and send it back to the history service on the
681 // main thread. 681 // main thread.
682 { 682 {
(...skipping 1940 matching lines...) Expand 10 before | Expand all | Expand 10 after
2623 // transaction is currently open. 2623 // transaction is currently open.
2624 db_->CommitTransaction(); 2624 db_->CommitTransaction();
2625 db_->Vacuum(); 2625 db_->Vacuum();
2626 db_->BeginTransaction(); 2626 db_->BeginTransaction();
2627 db_->GetStartDate(&first_recorded_time_); 2627 db_->GetStartDate(&first_recorded_time_);
2628 2628
2629 return true; 2629 return true;
2630 } 2630 }
2631 2631
2632 } // namespace history 2632 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698