| Index: chrome/browser/chrome_elf_init_win.cc
|
| diff --git a/chrome/browser/chrome_elf_init_win.cc b/chrome/browser/chrome_elf_init_win.cc
|
| index 042f3d1a4063383134df0cf06f5f238598af6837..71d54d41f33db4a18d8ed61a9325fe2b768f3333 100644
|
| --- a/chrome/browser/chrome_elf_init_win.cc
|
| +++ b/chrome/browser/chrome_elf_init_win.cc
|
| @@ -18,6 +18,8 @@
|
| const char kBrowserBlacklistTrialName[] = "BrowserBlacklist";
|
| const char kBrowserBlacklistTrialDisabledGroupName[] = "NoBlacklist";
|
|
|
| +const DWORD kBeaconAttempts = 2;
|
| +
|
| namespace {
|
|
|
| // How long to wait, in seconds, before reporting for the second (and last
|
| @@ -103,6 +105,17 @@ void InitializeChromeElf() {
|
| base::TimeDelta::FromSeconds(kBlacklistReportingDelaySec));
|
| }
|
|
|
| +void GetBlacklistFailedCount(DWORD* failed_count) {
|
| + base::win::RegKey key(HKEY_CURRENT_USER,
|
| + blacklist::kRegistryBeaconPath,
|
| + KEY_QUERY_VALUE | KEY_SET_VALUE);
|
| + bool count_exists = key.HasValue(blacklist::kBeaconFailedCount);
|
| + if (!count_exists)
|
| + key.WriteValue(blacklist::kBeaconFailedCount, static_cast<DWORD>(0));
|
| +
|
| + key.ReadValueDW(blacklist::kBeaconFailedCount, failed_count);
|
| +}
|
| +
|
| void BrowserBlacklistBeaconSetup() {
|
| base::win::RegKey blacklist_registry_key(HKEY_CURRENT_USER,
|
| blacklist::kRegistryBeaconPath,
|
| @@ -118,6 +131,16 @@ void BrowserBlacklistBeaconSetup() {
|
|
|
| if (blacklist_state == blacklist::BLACKLIST_ENABLED) {
|
| RecordBlacklistSetupEvent(BLACKLIST_SETUP_RAN_SUCCESSFULLY);
|
| +
|
| + // The blacklist was enabled successfully so we record the event (along with
|
| + // the number of failed previous attempts) and reset the failure count.
|
| + DWORD failed_attempt_count = 0;
|
| + GetBlacklistFailedCount(&failed_attempt_count);
|
| + UMA_HISTOGRAM_COUNTS("Blacklist.RetryWorked", failed_attempt_count);
|
| +
|
| + blacklist_registry_key.WriteValue(blacklist::kBeaconFailedCount,
|
| + static_cast<DWORD>(0));
|
| +
|
| } else {
|
| switch (blacklist_state) {
|
| case blacklist::BLACKLIST_SETUP_RUNNING:
|
| @@ -131,11 +154,24 @@ void BrowserBlacklistBeaconSetup() {
|
| break;
|
| }
|
|
|
| - // Since some part of the blacklist failed, mark it as disabled
|
| - // for this version.
|
| + // Some part of the blacklist failed. If this has occured some minimum
|
| + // number of times in a row we give up, disable it, and record the
|
| + // disabling event with UMA.
|
| if (blacklist_state != blacklist::BLACKLIST_DISABLED) {
|
| - blacklist_registry_key.WriteValue(blacklist::kBeaconState,
|
| - blacklist::BLACKLIST_DISABLED);
|
| + DWORD failed_attempt_count = 0;
|
| + GetBlacklistFailedCount(&failed_attempt_count);
|
| + failed_attempt_count = failed_attempt_count + 1;
|
| +
|
| + if (failed_attempt_count >= kBeaconAttempts) {
|
| + blacklist_registry_key.WriteValue(blacklist::kBeaconState,
|
| + blacklist::BLACKLIST_DISABLED);
|
| + UMA_HISTOGRAM_COUNTS("Blacklist.Disabled", true);
|
| + } else {
|
| + blacklist_registry_key.WriteValue(blacklist::kBeaconFailedCount,
|
| + failed_attempt_count);
|
| + blacklist_registry_key.WriteValue(blacklist::kBeaconState,
|
| + blacklist::BLACKLIST_ENABLED);
|
| + }
|
| }
|
| }
|
|
|
| @@ -145,7 +181,8 @@ void BrowserBlacklistBeaconSetup() {
|
| &blacklist_version);
|
|
|
| if (blacklist_version != TEXT(CHROME_VERSION_STRING)) {
|
| - // The blacklist hasn't been enabled for this version yet, so enable it.
|
| + // The blacklist hasn't been enabled for this version yet, so enable it
|
| + // and reset the failure count to zero.
|
| LONG set_version = blacklist_registry_key.WriteValue(
|
| blacklist::kBeaconVersion,
|
| TEXT(CHROME_VERSION_STRING));
|
| @@ -154,6 +191,9 @@ void BrowserBlacklistBeaconSetup() {
|
| blacklist::kBeaconState,
|
| blacklist::BLACKLIST_ENABLED);
|
|
|
| + blacklist_registry_key.WriteValue(blacklist::kBeaconFailedCount,
|
| + static_cast<DWORD>(0));
|
| +
|
| // Only report the blacklist as getting setup when both registry writes
|
| // succeed, since otherwise the blacklist wasn't properly setup.
|
| if (set_version == ERROR_SUCCESS && set_state == ERROR_SUCCESS)
|
|
|