summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-11 02:39:22 +0000
committerrkc@chromium.org <rkc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-11 02:39:22 +0000
commitf1b2fa14cc17e587c4d3d5de827262386906cfe4 (patch)
treec77494964fdadc345432fa05447157af33fd8b93
parente2e124eda54b2c29ef1f6b025ab143c80ae4c84e (diff)
downloadchromium_src-f1b2fa14cc17e587c4d3d5de827262386906cfe4.zip
chromium_src-f1b2fa14cc17e587c4d3d5de827262386906cfe4.tar.gz
chromium_src-f1b2fa14cc17e587c4d3d5de827262386906cfe4.tar.bz2
Add UMA stats for when we show the profile corruption dialog.
Currently the profile corruption dialog is shown from 5 different places, with no way for us to know what the reason for showing it was. This CL adds a enum that identifies each of the calling locations and adds an UMA stat which records the value of this enum. This should help us narrow down on the various profile corruption dialogs that we're seeing randomly on ChromeOS (and possibly on other platforms). Owners reviews requested, c/b/prefs - mnissler@ c/b/history - sky@ c/b/ui - pkasting@ c/b/webdata - pkasting@ t/m/histograms - isherman@ R=isherman@chromium.org, mnissler@chromium.org, pkasting@chromium.org, sky@chromium.org BUG=318471 Review URL: https://codereview.chromium.org/110763002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239974 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/history/history_service.cc1
-rw-r--r--chrome/browser/prefs/chrome_pref_service_factory.cc4
-rw-r--r--chrome/browser/ui/profile_error_dialog.cc4
-rw-r--r--chrome/browser/ui/profile_error_dialog.h22
-rw-r--r--chrome/browser/webdata/web_data_service_factory.cc12
-rw-r--r--tools/metrics/histograms/histograms.xml16
6 files changed, 51 insertions, 8 deletions
diff --git a/chrome/browser/history/history_service.cc b/chrome/browser/history/history_service.cc
index c615675..ea3de09 100644
--- a/chrome/browser/history/history_service.cc
+++ b/chrome/browser/history/history_service.cc
@@ -1103,6 +1103,7 @@ void HistoryService::NotifyProfileError(int backend_id,
return;
}
ShowProfileErrorDialog(
+ PROFILE_ERROR_HISTORY,
(init_status == sql::INIT_FAILURE) ?
IDS_COULDNT_OPEN_PROFILE_ERROR : IDS_PROFILE_TOO_NEW_ERROR);
}
diff --git a/chrome/browser/prefs/chrome_pref_service_factory.cc b/chrome/browser/prefs/chrome_pref_service_factory.cc
index 4976cc6..7fe3d3c 100644
--- a/chrome/browser/prefs/chrome_pref_service_factory.cc
+++ b/chrome/browser/prefs/chrome_pref_service_factory.cc
@@ -63,7 +63,9 @@ void HandleReadError(PersistentPrefStore::PrefReadError error) {
if (message_id) {
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
- base::Bind(&ShowProfileErrorDialog, message_id));
+ base::Bind(&ShowProfileErrorDialog,
+ PROFILE_ERROR_PREFERENCES,
+ message_id));
}
#else
// On ChromeOS error screen with message about broken local state
diff --git a/chrome/browser/ui/profile_error_dialog.cc b/chrome/browser/ui/profile_error_dialog.cc
index e99e3ff..9e3138e 100644
--- a/chrome/browser/ui/profile_error_dialog.cc
+++ b/chrome/browser/ui/profile_error_dialog.cc
@@ -4,15 +4,17 @@
#include "chrome/browser/ui/profile_error_dialog.h"
+#include "base/metrics/histogram.h"
#include "chrome/browser/ui/simple_message_box.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
-void ShowProfileErrorDialog(int message_id) {
+void ShowProfileErrorDialog(ProfileErrorType type, int message_id) {
#if defined(OS_ANDROID) || defined(OS_IOS)
NOTIMPLEMENTED();
#else
+ UMA_HISTOGRAM_ENUMERATION("Profile.ProfileError", type, PROFILE_ERROR_END);
chrome::ShowMessageBox(NULL,
l10n_util::GetStringUTF16(IDS_PRODUCT_NAME),
l10n_util::GetStringUTF16(message_id),
diff --git a/chrome/browser/ui/profile_error_dialog.h b/chrome/browser/ui/profile_error_dialog.h
index 81455bd..bb483af 100644
--- a/chrome/browser/ui/profile_error_dialog.h
+++ b/chrome/browser/ui/profile_error_dialog.h
@@ -5,9 +5,27 @@
#ifndef CHROME_BROWSER_UI_PROFILE_ERROR_DIALOG_H_
#define CHROME_BROWSER_UI_PROFILE_ERROR_DIALOG_H_
+// Be very careful while modifying this enum. Do NOT remove any elements from
+// this enum. If you need to add one, add them to the end, right before
+// PROFILE_ERROR_END. PROFILE_ERROR_END should ALWAYS be the last element in
+// this enum. This is important because this enum is used to back a histogram,
+// and these are implicit assumptions made in terms of how enumerated
+// histograms are defined.
+enum ProfileErrorType {
+ PROFILE_ERROR_HISTORY,
+ PROFILE_ERROR_PREFERENCES,
+ PROFILE_ERROR_DB_AUTOFILL_WEB_DATA,
+ PROFILE_ERROR_DB_TOKEN_WEB_DATA,
+ PROFILE_ERROR_DB_WEB_DATA,
+ PROFILE_ERROR_END
+};
+
// Shows an error dialog corresponding to the inability to open some portion of
// the profile. |message_id| is a string id corresponding to the message to
-// show.
-void ShowProfileErrorDialog(int message_id);
+// show. The ProfileErrorType needs to correspond to one of the profile error
+// types in the enum above. If your use case doesn't fit any of the ones listed
+// above, please add your type to the enum and modify the enum
+// definition in tools/metrics/histograms/histograms.xml accordingly.
+void ShowProfileErrorDialog(ProfileErrorType type, int message_id);
#endif // CHROME_BROWSER_UI_PROFILE_ERROR_DIALOG_H_
diff --git a/chrome/browser/webdata/web_data_service_factory.cc b/chrome/browser/webdata/web_data_service_factory.cc
index 85a2feb..bb97ac3 100644
--- a/chrome/browser/webdata/web_data_service_factory.cc
+++ b/chrome/browser/webdata/web_data_service_factory.cc
@@ -34,8 +34,9 @@ using content::BrowserThread;
namespace {
// Callback to show error dialog on profile load error.
-void ProfileErrorCallback(sql::InitStatus status) {
+void ProfileErrorCallback(ProfileErrorType type, sql::InitStatus status) {
ShowProfileErrorDialog(
+ type,
(status == sql::INIT_FAILURE) ?
IDS_COULDNT_OPEN_PROFILE_ERROR : IDS_PROFILE_TOO_NEW_ERROR);
}
@@ -99,15 +100,18 @@ WebDataServiceWrapper::WebDataServiceWrapper(Profile* profile) {
web_database_->LoadDatabase();
autofill_web_data_ = new AutofillWebDataService(
- web_database_, ui_thread, db_thread, base::Bind(&ProfileErrorCallback));
+ web_database_, ui_thread, db_thread, base::Bind(
+ &ProfileErrorCallback, PROFILE_ERROR_DB_AUTOFILL_WEB_DATA));
autofill_web_data_->Init();
token_web_data_ = new TokenWebData(
- web_database_, base::Bind(&ProfileErrorCallback));
+ web_database_, base::Bind(&ProfileErrorCallback,
+ PROFILE_ERROR_DB_TOKEN_WEB_DATA));
token_web_data_->Init();
web_data_ = new WebDataService(
- web_database_, base::Bind(&ProfileErrorCallback));
+ web_database_, base::Bind(&ProfileErrorCallback,
+ PROFILE_ERROR_DB_WEB_DATA));
web_data_->Init();
autofill_web_data_->GetAutofillBackend(
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index 8a23b401..03e1a70 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -14771,6 +14771,14 @@ other types of suffix sets.
</summary>
</histogram>
+<histogram name="Profile.ProfileError" enum="ProfileErrorType">
+ <summary>
+ The error with the current user profile that caused an error dialog to be
+ shown. This dialog is shown usually when there is some sort of corruption in
+ the user's profile data.
+ </summary>
+</histogram>
+
<histogram name="Profile.SupervisedProfileCreateError"
enum="GoogleServiceAuthError">
<summary>
@@ -28320,6 +28328,14 @@ other types of suffix sets.
<int value="4" label="Canceled"/>
</enum>
+<enum name="ProfileErrorType" type="int">
+ <int value="0" label="History error"/>
+ <int value="1" label="Preferences error"/>
+ <int value="2" label="Webdata autofill DB error"/>
+ <int value="3" label="Webdata token DB error"/>
+ <int value="4" label="Webdata DB error"/>
+</enum>
+
<enum name="ProfileImageDownloadResult" type="int">
<int value="0" label="DownloadSuccessChanged">
<summary>