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

Unified Diff: chrome/browser/net/sqlite_persistent_cookie_store.cc

Issue 270101: Move the sqlite error handler to a single location... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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
Index: chrome/browser/net/sqlite_persistent_cookie_store.cc
===================================================================
--- chrome/browser/net/sqlite_persistent_cookie_store.cc (revision 28907)
+++ chrome/browser/net/sqlite_persistent_cookie_store.cc (working copy)
@@ -14,6 +14,7 @@
#include "base/scoped_ptr.h"
#include "base/string_util.h"
#include "base/thread.h"
+#include "chrome/browser/diagnostics/sqlite_diagnostics.h"
using base::Time;
@@ -281,27 +282,6 @@
namespace {
-// 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.
-class CookieDbSqliteErrrorHandler : public sql::ErrorDelegate {
- public:
- virtual int OnError(int error, sql::Connection* connection,
- sql::Statement* stmt) {
- NOTREACHED() << "cookie db sqlite error " << error;
- RecordErrorInHistogram(error);
- return error;
- }
- private:
- static void RecordErrorInHistogram(int error) {
- // The histogram values from sqlite result codes go currently from 1 to
- // 26 currently but 50 gives them room to grow.
- static LinearHistogram histogram("Sqlite.Cookie.Error", 1, 50, 51);
- histogram.SetFlags(kUmaTargetedHistogramFlag);
- histogram.Add(error);
- }
-};
-
// Initializes the cookies table, returning true on success.
bool InitTable(sql::Connection* db) {
if (!db->DoesTableExist("cookies")) {
@@ -335,7 +315,7 @@
return false;
}
- db->set_error_delegate(new CookieDbSqliteErrrorHandler());
+ db->set_error_delegate(GetErrorHandlerForCookieDb());
if (!EnsureDatabaseVersion(db.get()) || !InitTable(db.get())) {
NOTREACHED() << "Unable to initialize cookie DB.";

Powered by Google App Engine
This is Rietveld 408576698