Speculative fix for the white/stale tab issue on Windows.
[chromium-blink-merge.git] / sql / diagnostic_error_delegate.h
blob78b3d9d8155217adbec54abb9e135d080c95d684
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
3 // found in the LICENSE file.
5 #ifndef SQL_DIAGNOSTIC_ERROR_DELEGATE_H_
6 #define SQL_DIAGNOSTIC_ERROR_DELEGATE_H_
8 #include "base/logging.h"
9 #include "sql/connection.h"
10 #include "sql/error_delegate_util.h"
11 #include "sql/sql_export.h"
13 namespace sql {
15 // This class handles the exceptional sqlite errors that we might encounter
16 // if for example the db is corrupted. Right now we just generate a UMA
17 // histogram for release and an assert for debug builds.
18 // See error_delegate_util.h for an explanation as to why this class is a
19 // template.
20 template <class UniqueT>
21 class DiagnosticErrorDelegate : public ErrorDelegate {
22 public:
23 DiagnosticErrorDelegate() {}
24 virtual ~DiagnosticErrorDelegate() {}
26 virtual int OnError(int error, Connection* connection,
27 Statement* stmt) {
28 LogAndRecordErrorInHistogram<UniqueT>(error, connection);
29 return error;
32 private:
33 DISALLOW_COPY_AND_ASSIGN(DiagnosticErrorDelegate);
36 } // namespace sql
38 #endif // SQL_DIAGNOSTIC_ERROR_DELEGATE_H_