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

Side by Side Diff: components/webdata/common/web_database_backend.cc

Issue 2225333003: Recreate the WebData database on a catastrophic SQL error (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: shess@' comments Created 4 years, 4 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
« no previous file with comments | « no previous file | components/webdata/common/web_database_service.h » ('j') | sql/connection.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/webdata/common/web_database_backend.h" 5 #include "components/webdata/common/web_database_backend.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 WebDatabaseBackend::~WebDatabaseBackend() { 117 WebDatabaseBackend::~WebDatabaseBackend() {
118 ShutdownDatabase(); 118 ShutdownDatabase();
119 } 119 }
120 120
121 void WebDatabaseBackend::DatabaseErrorCallback(int error, 121 void WebDatabaseBackend::DatabaseErrorCallback(int error,
122 sql::Statement* statement) { 122 sql::Statement* statement) {
123 // We ignore any further error callbacks after the first catastrophic error. 123 // We ignore any further error callbacks after the first catastrophic error.
124 if (!catastrophic_error_occurred_ && sql::IsErrorCatastrophic(error)) { 124 if (!catastrophic_error_occurred_ && sql::IsErrorCatastrophic(error)) {
125 catastrophic_error_occurred_ = true; 125 catastrophic_error_occurred_ = true;
126 diagnostics_ = db_->GetDiagnosticInfo(error, statement); 126 diagnostics_ = db_->GetDiagnosticInfo(error, statement);
127
128 db_->GetSQLConnection()->RazeAndClose();
127 } 129 }
128 } 130 }
129 131
130 void WebDatabaseBackend::Commit() { 132 void WebDatabaseBackend::Commit() {
131 DCHECK(db_); 133 DCHECK(db_);
132 DCHECK_EQ(sql::INIT_OK, init_status_); 134 DCHECK_EQ(sql::INIT_OK, init_status_);
133 db_->CommitTransaction(); 135 db_->CommitTransaction();
134 db_->BeginTransaction(); 136 db_->BeginTransaction();
135 } 137 }
OLDNEW
« no previous file with comments | « no previous file | components/webdata/common/web_database_service.h » ('j') | sql/connection.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698