summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chrome_elf_init_win.cc
diff options
context:
space:
mode:
authornoamsml@google.com <noamsml@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-10 00:07:02 +0000
committernoamsml@google.com <noamsml@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-10 00:07:02 +0000
commit86ba1fe0d2582adf113f68a32532277017c4449f (patch)
tree32b52af42748b2a397620a1347f27ac1754d63d7 /chrome/browser/chrome_elf_init_win.cc
parent8261d96a668f541bfe152c172f670697681e3bcc (diff)
downloadchromium_src-86ba1fe0d2582adf113f68a32532277017c4449f.zip
chromium_src-86ba1fe0d2582adf113f68a32532277017c4449f.tar.gz
chromium_src-86ba1fe0d2582adf113f68a32532277017c4449f.tar.bz2
Revert 243967 "Use a Finch Experiment to control the Browser Bla..."
> Use a Finch Experiment to control the Browser Blacklist > > Also increase the states stored in the register to prevent > the setup code from running multiple times per version if > it fails to start one time. > > BUG=329023 > > Review URL: https://codereview.chromium.org/120963002 TBR=csharp@chromium.org Review URL: https://codereview.chromium.org/132043005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244026 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chrome_elf_init_win.cc')
-rw-r--r--chrome/browser/chrome_elf_init_win.cc103
1 files changed, 0 insertions, 103 deletions
diff --git a/chrome/browser/chrome_elf_init_win.cc b/chrome/browser/chrome_elf_init_win.cc
deleted file mode 100644
index 672b0a3..0000000
--- a/chrome/browser/chrome_elf_init_win.cc
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/metrics/field_trial.h"
-#include "base/metrics/histogram.h"
-#include "base/strings/utf_string_conversions.h"
-#include "base/win/registry.h"
-#include "chrome/browser/chrome_elf_init_win.h"
-#include "chrome_elf/blacklist/blacklist.h"
-#include "version.h" // NOLINT
-
-namespace {
-
-const char kBrowserBlacklistTrialName[] = "BrowserBlacklist";
-const char kBrowserBlacklistTrialEnabledGroupName[] = "Enabled";
-
-// This enum is used to define the buckets for an enumerated UMA histogram.
-// Hence,
-// (a) existing enumerated constants should never be deleted or reordered, and
-// (b) new constants should only be appended in front of
-// BLACKLIST_SETUP_EVENT_MAX.
-enum BlacklistSetupEventType {
- // The blacklist beacon has placed to enable the browser blacklisting.
- BLACKLIST_SETUP_ENABLED = 0,
-
- // The blacklist was successfully enabled.
- BLACKLIST_SETUP_RAN_SUCCESSFULLY,
-
- // The blacklist setup code failed to execute.
- BLACKLIST_SETUP_FAILED,
-
- // Always keep this at the end.
- BLACKLIST_SETUP_EVENT_MAX,
-};
-
-void RecordBlacklistSetupEvent(BlacklistSetupEventType blacklist_setup_event) {
- UMA_HISTOGRAM_ENUMERATION("Blacklist.Setup",
- blacklist_setup_event,
- BLACKLIST_SETUP_EVENT_MAX);
-}
-
-} // namespace
-
-void InitializeChromeElf() {
- if (base::FieldTrialList::FindFullName(kBrowserBlacklistTrialName) ==
- kBrowserBlacklistTrialEnabledGroupName) {
- BrowserBlacklistBeaconSetup();
- } else {
- // Disable the blacklist for all future runs by removing the beacon.
- base::win::RegKey blacklist_registry_key(HKEY_CURRENT_USER);
- blacklist_registry_key.DeleteKey(blacklist::kRegistryBeaconPath);
- }
-}
-
-void BrowserBlacklistBeaconSetup() {
- base::win::RegKey blacklist_registry_key(HKEY_CURRENT_USER,
- blacklist::kRegistryBeaconPath,
- KEY_QUERY_VALUE | KEY_SET_VALUE);
-
- // Find the last recorded blacklist version.
- base::string16 blacklist_version;
- blacklist_registry_key.ReadValue(blacklist::kBeaconVersion,
- &blacklist_version);
-
- if (blacklist_version != TEXT(CHROME_VERSION_STRING)) {
- // The blacklist hasn't run for this version yet, so enable it.
- LONG set_version = blacklist_registry_key.WriteValue(
- blacklist::kBeaconVersion,
- TEXT(CHROME_VERSION_STRING));
-
- LONG set_state = blacklist_registry_key.WriteValue(
- blacklist::kBeaconState,
- blacklist::BLACKLIST_ENABLED);
-
- // 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)
- RecordBlacklistSetupEvent(BLACKLIST_SETUP_ENABLED);
-
- // Don't try to record if the blacklist setup succeeded or failed in the
- // run since it could have been from either this version or the previous
- // version (since crashes occur before we set the version in the registry).
- } else {
- // The blacklist version didn't change, so record the results of the
- // latest setup.
- DWORD blacklist_state = blacklist::BLACKLIST_STATE_MAX;
- blacklist_registry_key.ReadValueDW(blacklist::kBeaconState,
- &blacklist_state);
-
- // Record the results of the latest blacklist setup.
- if (blacklist_state == blacklist::BLACKLIST_ENABLED) {
- RecordBlacklistSetupEvent(BLACKLIST_SETUP_RAN_SUCCESSFULLY);
- } else if (blacklist_state == blacklist::BLACKLIST_SETUP_RUNNING) {
- RecordBlacklistSetupEvent(BLACKLIST_SETUP_FAILED);
-
- // Since the setup failed, mark the blacklist as disabled so we don't
- // try it again for this version.
- blacklist_registry_key.WriteValue(blacklist::kBeaconState,
- blacklist::BLACKLIST_DISABLED);
- }
- }
-}