Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Side by Side Diff: components/metrics/clean_exit_beacon.cc

Issue 2687393004: Gather stability prefs into managing objects. (Closed)
Patch Set: Incorporate Feedback Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/metrics/clean_exit_beacon.h ('k') | components/metrics/environment_recorder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/metrics/clean_exit_beacon.h" 5 #include "components/metrics/clean_exit_beacon.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "components/metrics/metrics_pref_names.h" 9 #include "components/metrics/metrics_pref_names.h"
10 #include "components/prefs/pref_registry_simple.h"
10 #include "components/prefs/pref_service.h" 11 #include "components/prefs/pref_service.h"
11 12
12 #if defined(OS_WIN) 13 #if defined(OS_WIN)
13 #include "base/metrics/histogram_macros.h" 14 #include "base/metrics/histogram_macros.h"
14 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
15 #include "base/win/registry.h" 16 #include "base/win/registry.h"
16 #endif 17 #endif
17 18
18 namespace metrics { 19 namespace metrics {
19 20
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 } 56 }
56 57
57 UMA_HISTOGRAM_ENUMERATION( 58 UMA_HISTOGRAM_ENUMERATION(
58 "UMA.CleanExitBeaconConsistency", consistency, NUM_CONSISTENCY_ENUMS); 59 "UMA.CleanExitBeaconConsistency", consistency, NUM_CONSISTENCY_ENUMS);
59 #endif 60 #endif
60 } 61 }
61 62
62 CleanExitBeacon::~CleanExitBeacon() { 63 CleanExitBeacon::~CleanExitBeacon() {
63 } 64 }
64 65
66 // static
67 void CleanExitBeacon::RegisterPrefs(PrefRegistrySimple* registry) {
68 registry->RegisterBooleanPref(prefs::kStabilityExitedCleanly, true);
69 }
70
65 void CleanExitBeacon::WriteBeaconValue(bool value) { 71 void CleanExitBeacon::WriteBeaconValue(bool value) {
66 local_state_->SetBoolean(prefs::kStabilityExitedCleanly, value); 72 local_state_->SetBoolean(prefs::kStabilityExitedCleanly, value);
67 73
68 #if defined(OS_WIN) 74 #if defined(OS_WIN)
69 base::win::RegKey regkey; 75 base::win::RegKey regkey;
70 if (regkey.Create(HKEY_CURRENT_USER, 76 if (regkey.Create(HKEY_CURRENT_USER,
71 backup_registry_key_.c_str(), 77 backup_registry_key_.c_str(),
72 KEY_ALL_ACCESS) == ERROR_SUCCESS) { 78 KEY_ALL_ACCESS) == ERROR_SUCCESS) {
73 regkey.WriteValue( 79 regkey.WriteValue(
74 base::ASCIIToUTF16(prefs::kStabilityExitedCleanly).c_str(), 80 base::ASCIIToUTF16(prefs::kStabilityExitedCleanly).c_str(),
75 value ? 1u : 0u); 81 value ? 1u : 0u);
76 } 82 }
77 #endif 83 #endif
78 } 84 }
79 85
80 } // namespace metrics 86 } // namespace metrics
OLDNEW
« no previous file with comments | « components/metrics/clean_exit_beacon.h ('k') | components/metrics/environment_recorder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698