diff options
author | shess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-03 23:59:14 +0000 |
---|---|---|
committer | shess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-03 23:59:14 +0000 |
commit | c088e3a35dcb52d62255f97307960b8ad3aaffa7 (patch) | |
tree | 4b8638a366467cbaa4915575ed47fd72b5d8a2a6 /chrome/browser/history | |
parent | 8d469a234bbc0e1b59fb4d5315be697069f780c1 (diff) | |
download | chromium_src-c088e3a35dcb52d62255f97307960b8ad3aaffa7.zip chromium_src-c088e3a35dcb52d62255f97307960b8ad3aaffa7.tar.gz chromium_src-c088e3a35dcb52d62255f97307960b8ad3aaffa7.tar.bz2 |
Bake targeted error histogram support directly into sql::Connection.
Previously there was a convoluted template system to unique histogram names for purposes of tracking database errors separately. This was needed due to the static cache used by the histogram macros. Instead, just log the histogram manually without using a static cache.
Additionally, pull the histogram functionality right up into the connection, rather than requiring formalized delegation to get it.
BUG=none
Review URL: https://chromiumcodereview.appspot.com/11474030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175055 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/history')
-rw-r--r-- | chrome/browser/history/history_backend.cc | 7 | ||||
-rw-r--r-- | chrome/browser/history/history_database.cc | 2 | ||||
-rw-r--r-- | chrome/browser/history/text_database.cc | 3 | ||||
-rw-r--r-- | chrome/browser/history/thumbnail_database.cc | 3 | ||||
-rw-r--r-- | chrome/browser/history/top_sites_database.cc | 2 |
5 files changed, 5 insertions, 12 deletions
diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc index 779e67e..d53f672 100644 --- a/chrome/browser/history/history_backend.cc +++ b/chrome/browser/history/history_backend.cc @@ -219,8 +219,6 @@ class KillHistoryDatabaseErrorDelegate : public sql::ErrorDelegate { virtual int OnError(int error, sql::Connection* connection, sql::Statement* stmt) OVERRIDE { - sql::LogAndRecordErrorInHistogram<HistogramUniquifier>(error, connection); - // Do not schedule killing database more than once. If the first time // failed, it is unlikely that a second time will be successful. if (!scheduled_killing_database_ && sql::IsErrorCatastrophic(error)) { @@ -242,11 +240,6 @@ class KillHistoryDatabaseErrorDelegate : public sql::ErrorDelegate { } private: - class HistogramUniquifier { - public: - static const char* name() { return "Sqlite.History.Error"; } - }; - // Do not increment the count on |HistoryBackend| as that would create a // circular reference (HistoryBackend -> HistoryDatabase -> Connection -> // ErrorDelegate -> HistoryBackend). diff --git a/chrome/browser/history/history_database.cc b/chrome/browser/history/history_database.cc index 348683a..e4a5920 100644 --- a/chrome/browser/history/history_database.cc +++ b/chrome/browser/history/history_database.cc @@ -68,6 +68,8 @@ HistoryDatabase::~HistoryDatabase() { sql::InitStatus HistoryDatabase::Init(const FilePath& history_name, sql::ErrorDelegate* error_delegate) { + db_.set_error_histogram_name("Sqlite.History.Error"); + // Set the exceptional sqlite error handler. db_.set_error_delegate(error_delegate); diff --git a/chrome/browser/history/text_database.cc b/chrome/browser/history/text_database.cc index e9bb3c7..9d179be 100644 --- a/chrome/browser/history/text_database.cc +++ b/chrome/browser/history/text_database.cc @@ -130,8 +130,7 @@ bool TextDatabase::Init() { return false; } - // Set the exceptional sqlite error handler. - db_.set_error_delegate(GetErrorHandlerForTextDb()); + db_.set_error_histogram_name("Sqlite.Text.Error"); // Set the database page size to something a little larger to give us // better performance (we're typically seek rather than bandwidth limited). diff --git a/chrome/browser/history/thumbnail_database.cc b/chrome/browser/history/thumbnail_database.cc index af07679..ae7c82e 100644 --- a/chrome/browser/history/thumbnail_database.cc +++ b/chrome/browser/history/thumbnail_database.cc @@ -219,8 +219,7 @@ sql::InitStatus ThumbnailDatabase::Init( sql::InitStatus ThumbnailDatabase::OpenDatabase(sql::Connection* db, const FilePath& db_name) { - // Set the exceptional sqlite error handler. - db->set_error_delegate(GetErrorHandlerForThumbnailDb()); + db->set_error_histogram_name("Sqlite.Thumbnail.Error"); // Thumbnails db now only stores favicons, so we don't need that big a page // size or cache. diff --git a/chrome/browser/history/top_sites_database.cc b/chrome/browser/history/top_sites_database.cc index dce0ce4..17afb1e 100644 --- a/chrome/browser/history/top_sites_database.cc +++ b/chrome/browser/history/top_sites_database.cc @@ -374,7 +374,7 @@ bool TopSitesDatabase::RemoveURL(const MostVisitedURL& url) { sql::Connection* TopSitesDatabase::CreateDB(const FilePath& db_name) { scoped_ptr<sql::Connection> db(new sql::Connection()); // Settings copied from ThumbnailDatabase. - db->set_error_delegate(GetErrorHandlerForThumbnailDb()); + db->set_error_histogram_name("Sqlite.Thumbnail.Error"); db->set_page_size(4096); db->set_cache_size(32); |