summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-13 08:18:59 +0000
committerpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-13 08:18:59 +0000
commit58782b2f8efb02065f7eb8149becd156b677042d (patch)
treed72fe1a8fdf9a8c3da17be083a32bf52dbdd3831
parent64853b1bdaf54456b93379c38b3324b85402fc84 (diff)
downloadchromium_src-58782b2f8efb02065f7eb8149becd156b677042d.zip
chromium_src-58782b2f8efb02065f7eb8149becd156b677042d.tar.gz
chromium_src-58782b2f8efb02065f7eb8149becd156b677042d.tar.bz2
Add UMA histogram to see how widespread it is for users to have a favicons database with a missing column.
Bug=151841, 160360 Test=histogram for ThumbnailDatabase.InvalidFaviconsDBStructure shows up on histograms dashboard Review URL: https://chromiumcodereview.appspot.com/11362191 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167327 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/history/thumbnail_database.cc10
-rw-r--r--chrome/browser/history/thumbnail_database.h8
2 files changed, 18 insertions, 0 deletions
diff --git a/chrome/browser/history/thumbnail_database.cc b/chrome/browser/history/thumbnail_database.cc
index f0e45f9..d4d1b5a 100644
--- a/chrome/browser/history/thumbnail_database.cc
+++ b/chrome/browser/history/thumbnail_database.cc
@@ -10,6 +10,7 @@
#include "base/command_line.h"
#include "base/file_util.h"
#include "base/memory/ref_counted_memory.h"
+#include "base/metrics/histogram.h"
#include "base/string_number_conversions.h"
#include "base/string_tokenizer.h"
#include "base/string_util.h"
@@ -197,6 +198,10 @@ sql::InitStatus ThumbnailDatabase::Init(
return sql::INIT_FAILURE;
}
+ // Log in a UMA histogram if the structure of the favicons database is not
+ // what it should be.
+ LogIfFaviconDBStructureIncorrect();
+
return sql::INIT_OK;
}
@@ -321,6 +326,11 @@ bool ThumbnailDatabase::InitFaviconBitmapsIndex() {
"favicon_bitmaps(icon_id)");
}
+void ThumbnailDatabase::LogIfFaviconDBStructureIncorrect() {
+ if (!db_.IsSQLValid("SELECT id, url, icon_type, sizes FROM favicons"))
+ UMA_HISTOGRAM_BOOLEAN("ThumbnailDatabase.InvalidFaviconsDBStructure", true);
+}
+
void ThumbnailDatabase::BeginTransaction() {
db_.BeginTransaction();
}
diff --git a/chrome/browser/history/thumbnail_database.h b/chrome/browser/history/thumbnail_database.h
index c9f4dc8..c6f2208 100644
--- a/chrome/browser/history/thumbnail_database.h
+++ b/chrome/browser/history/thumbnail_database.h
@@ -376,6 +376,14 @@ class ThumbnailDatabase {
// with no index).
bool InitIconMappingIndex();
+ // For the purpose of determining how widespread www.crbug.com/151841 is, log
+ // in a UMA histogram if the |favicons| database is missing a column. This is
+ // important because the SQLite error code from running SQL statements against
+ // a database with missing columns is SQLITE_ERROR which is not unique enough
+ // to act upon.
+ // TODO(pkotwicz): remove this function once www.crbug.com/151841 is resolved.
+ void LogIfFaviconDBStructureIncorrect();
+
// Adds a mapping between the given page_url and icon_id; The mapping will be
// added to temp_icon_mapping table if is_temporary is true.
// Returns the new mapping id if the adding succeeds, otherwise 0 is returned.