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

Unified Diff: app/sql/diagnostic_error_delegate.h

Issue 7353026: Move app/sql/* files to sql/ directory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « app/sql/connection_unittest.cc ('k') | app/sql/init_status.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: app/sql/diagnostic_error_delegate.h
diff --git a/app/sql/diagnostic_error_delegate.h b/app/sql/diagnostic_error_delegate.h
deleted file mode 100644
index 713c4aab88c47254f8e118741b8bdac07396c430..0000000000000000000000000000000000000000
--- a/app/sql/diagnostic_error_delegate.h
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef APP_SQL_DIAGNOSTIC_ERROR_DELEGATE_H_
-#define APP_SQL_DIAGNOSTIC_ERROR_DELEGATE_H_
-#pragma once
-
-#include "app/sql/connection.h"
-#include "base/logging.h"
-#include "base/metrics/histogram.h"
-
-namespace sql {
-
-// This class handles the exceptional sqlite errors that we might encounter
-// if for example the db is corrupted. Right now we just generate a UMA
-// histogram for release and an assert for debug builds.
-//
-// Why is it a template you ask? well, that is a funny story. The histograms
-// need to be singletons that is why they are always static at the function
-// scope, but we cannot use the Singleton class because they are not default
-// constructible. The template parameter makes the compiler to create unique
-// classes that don't share the same static variable.
-template <class UniqueT>
-class DiagnosticErrorDelegate : public ErrorDelegate {
- public:
-
- virtual int OnError(int error, Connection* connection,
- Statement* stmt) {
- NOTREACHED() << "sqlite error " << error
- << ", errno " << connection->GetLastErrno()
- << ": " << connection->GetErrorMessage();
- RecordErrorInHistogram(error);
- return error;
- }
-
- private:
- static void RecordErrorInHistogram(int error) {
- // Trim off the extended error codes.
- error &= 0xff;
-
- // The histogram values from sqlite result codes go currently from 1 to
- // 26 currently but 50 gives them room to grow.
- UMA_HISTOGRAM_ENUMERATION(UniqueT::name(), error, 50);
- }
-};
-
-} // namespace sql
-
-#endif // APP_SQL_DIAGNOSTIC_ERROR_DELEGATE_H_
« no previous file with comments | « app/sql/connection_unittest.cc ('k') | app/sql/init_status.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698