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

Unified Diff: webkit/dom_storage/dom_storage_database.cc

Issue 15104003: Remove last client of sql::DiagnosticErrorDelegate. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Convert to error callback. Created 7 years, 7 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 | « sql/sql.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/dom_storage/dom_storage_database.cc
diff --git a/webkit/dom_storage/dom_storage_database.cc b/webkit/dom_storage/dom_storage_database.cc
index 85f421838681e14904939201e9d75d59ec952408..4994d872ae0cce6f06499d67d4d16ff238ba8642 100644
--- a/webkit/dom_storage/dom_storage_database.cc
+++ b/webkit/dom_storage/dom_storage_database.cc
@@ -4,9 +4,9 @@
#include "webkit/dom_storage/dom_storage_database.h"
+#include "base/bind.h"
#include "base/file_util.h"
#include "base/logging.h"
-#include "sql/diagnostic_error_delegate.h"
#include "sql/statement.h"
#include "sql/transaction.h"
#include "third_party/sqlite/sqlite3.h"
@@ -15,13 +15,16 @@ namespace {
const base::FilePath::CharType kJournal[] = FILE_PATH_LITERAL("-journal");
-class HistogramUniquifier {
- public:
- static const char* name() { return "Sqlite.DomStorageDatabase.Error"; }
-};
-
-sql::ErrorDelegate* GetErrorHandlerForDomStorageDatabase() {
- return new sql::DiagnosticErrorDelegate<HistogramUniquifier>();
+void DatabaseErrorCallback(int error, sql::Statement* stmt) {
+ // Without a callback to ignore errors,
+ // DomStorageDatabaseTest.TestCanOpenFileThatIsNotADatabase fails with:
+ // ERROR:connection.cc(735)] sqlite error 522, errno 0: disk I/O error
+ // FATAL:connection.cc(750)] disk I/O error
+ // <backtrace>
+ // <crash>
+ //
+ // TODO(shess): If/when infrastructure lands which can allow tests
+ // to handle SQLite errors appropriately, remove this.
}
} // anon namespace
@@ -159,7 +162,8 @@ bool DomStorageDatabase::LazyOpen(bool create_if_needed) {
}
db_.reset(new sql::Connection());
- db_->set_error_delegate(GetErrorHandlerForDomStorageDatabase());
+ db_->set_histogram_tag("DomStorageDatabase");
marja 2013/05/23 05:32:29 Will we get the same error histogram information v
Scott Hess - ex-Googler 2013/05/23 05:45:37 Old School: Complicated function template calling
+ db_->set_error_callback(base::Bind(&DatabaseErrorCallback));
if (file_path_.empty()) {
// This code path should only be triggered by unit tests.
« no previous file with comments | « sql/sql.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698