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

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

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/BUILD.gn ('k') | components/metrics/clean_exit_beacon.cc » ('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 #ifndef COMPONENTS_METRICS_CLEAN_EXIT_BEACON_H_ 5 #ifndef COMPONENTS_METRICS_CLEAN_EXIT_BEACON_H_
6 #define COMPONENTS_METRICS_CLEAN_EXIT_BEACON_H_ 6 #define COMPONENTS_METRICS_CLEAN_EXIT_BEACON_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 10
11 class PrefRegistrySimple;
11 class PrefService; 12 class PrefService;
12 13
13 namespace metrics { 14 namespace metrics {
14 15
15 // Reads and updates a beacon used to detect whether the previous browser 16 // Reads and updates a beacon used to detect whether the previous browser
16 // process exited cleanly. 17 // process exited cleanly.
17 class CleanExitBeacon { 18 class CleanExitBeacon {
18 public: 19 public:
19 // Instantiates a CleanExitBeacon whose value is stored in |local_state|. 20 // Instantiates a CleanExitBeacon whose value is stored in |local_state|.
20 // |local_state| must be fully initialized. 21 // |local_state| must be fully initialized.
21 // On Windows, |backup_registry_key| is used to store a backup of the beacon. 22 // On Windows, |backup_registry_key| is used to store a backup of the beacon.
22 // It is ignored on other platforms. 23 // It is ignored on other platforms.
23 CleanExitBeacon( 24 CleanExitBeacon(
24 const base::string16& backup_registry_key, 25 const base::string16& backup_registry_key,
25 PrefService* local_state); 26 PrefService* local_state);
26 27
27 ~CleanExitBeacon(); 28 ~CleanExitBeacon();
28 29
29 // Returns the original value of the beacon. 30 // Returns the original value of the beacon.
30 bool exited_cleanly() const { return initial_value_; } 31 bool exited_cleanly() const { return initial_value_; }
31 32
32 // Writes the provided beacon value. 33 // Writes the provided beacon value.
33 void WriteBeaconValue(bool exited_cleanly); 34 void WriteBeaconValue(bool exited_cleanly);
34 35
36 // Registers local state prefs used by this class.
37 static void RegisterPrefs(PrefRegistrySimple* registry);
38
35 private: 39 private:
36 PrefService* const local_state_; 40 PrefService* const local_state_;
37 const bool initial_value_; 41 const bool initial_value_;
38 const base::string16 backup_registry_key_; 42 const base::string16 backup_registry_key_;
39 43
40 DISALLOW_COPY_AND_ASSIGN(CleanExitBeacon); 44 DISALLOW_COPY_AND_ASSIGN(CleanExitBeacon);
41 }; 45 };
42 46
43 } // namespace metrics 47 } // namespace metrics
44 48
45 #endif // COMPONENTS_METRICS_CLEAN_EXIT_BEACON_H_ 49 #endif // COMPONENTS_METRICS_CLEAN_EXIT_BEACON_H_
OLDNEW
« no previous file with comments | « components/metrics/BUILD.gn ('k') | components/metrics/clean_exit_beacon.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698