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

Unified Diff: chrome/browser/history/archived_database.cc

Issue 10669033: Close ArchivedDatabase connection after transaction rollback. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: DoInitTransaction() -> InitTables. Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/history/archived_database.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/archived_database.cc
diff --git a/chrome/browser/history/archived_database.cc b/chrome/browser/history/archived_database.cc
index d932a57b0c26b8986952faaf298a855015e3b377..3eae2d6ae968f6a6949cfa31d5d4b054c14237ae 100644
--- a/chrome/browser/history/archived_database.cc
+++ b/chrome/browser/history/archived_database.cc
@@ -42,32 +42,34 @@ bool ArchivedDatabase::Init(const FilePath& file_name) {
if (!db_.Open(file_name))
return false;
- sql::Transaction transaction(&db_);
- if (!transaction.Begin()) {
+ if (!InitTables()) {
db_.Close();
return false;
}
+ return true;
+}
+
+bool ArchivedDatabase::InitTables() {
+ sql::Transaction transaction(&db_);
+ if (!transaction.Begin())
+ return false;
+
// Version check.
if (!meta_table_.Init(&db_, kCurrentVersionNumber,
- kCompatibleVersionNumber)) {
- db_.Close();
+ kCompatibleVersionNumber))
return false;
- }
// Create the tables.
if (!CreateURLTable(false) || !InitVisitTable() ||
- !InitKeywordSearchTermsTable()) {
- db_.Close();
+ !InitKeywordSearchTermsTable())
return false;
- }
+
CreateMainURLIndex();
CreateKeywordSearchTermsIndices();
- if (EnsureCurrentVersion() != sql::INIT_OK) {
- db_.Close();
+ if (EnsureCurrentVersion() != sql::INIT_OK)
return false;
- }
return transaction.Commit();
}
« no previous file with comments | « chrome/browser/history/archived_database.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698