OLD | NEW |
| (Empty) |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_BROWSER_WATCHER_CRASH_REPORTING_METRICS_WIN_H_ | |
6 #define COMPONENTS_BROWSER_WATCHER_CRASH_REPORTING_METRICS_WIN_H_ | |
7 | |
8 #include "base/strings/string16.h" | |
9 | |
10 namespace browser_watcher { | |
11 | |
12 // Stores and retrieves metrics related to crash dump attempts. | |
13 class CrashReportingMetrics { | |
14 public: | |
15 // Represents the currently stored metrics. | |
16 struct Values { | |
17 // A count of crash dump attempts. | |
18 int crash_dump_attempts; | |
19 // A count of successful crash dump attempts. | |
20 int successful_crash_dumps; | |
21 // A count of failed crash dump attempts. | |
22 int failed_crash_dumps; | |
23 // A count of dump without crash attempts. | |
24 int dump_without_crash_attempts; | |
25 // A count of successful dump without crash attempts. | |
26 int successful_dumps_without_crash; | |
27 // A count of failed dump without crash attempts. | |
28 int failed_dumps_without_crash; | |
29 }; | |
30 | |
31 // Instantiates an instance that will store and retrieve its metrics from | |
32 // |registry_path|. | |
33 explicit CrashReportingMetrics(const base::string16& registry_path); | |
34 | |
35 // Records that a crash dump is being attempted. | |
36 void RecordCrashDumpAttempt(); | |
37 | |
38 // Records that a dump without crash is being attempted. | |
39 void RecordDumpWithoutCrashAttempt(); | |
40 | |
41 // Records the result of a crash dump attempt. | |
42 void RecordCrashDumpAttemptResult(bool succeeded); | |
43 | |
44 // Records the result of a dump without crash attempt. | |
45 void RecordDumpWithoutCrashAttemptResult(bool succeeded); | |
46 | |
47 // Returns the currently stored metrics and resets them to 0. | |
48 Values RetrieveAndResetMetrics(); | |
49 | |
50 private: | |
51 base::string16 registry_path_; | |
52 }; | |
53 | |
54 } // namespace browser_watcher | |
55 | |
56 #endif // COMPONENTS_BROWSER_WATCHER_CRASH_REPORTING_METRICS_WIN_H_ | |
OLD | NEW |