OLD | NEW |
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 "chrome/browser/metrics/chrome_stability_metrics_provider.h" | 5 #include "chrome/browser/metrics/chrome_stability_metrics_provider.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
11 #include "base/metrics/sparse_histogram.h" | 11 #include "base/metrics/sparse_histogram.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
14 #include "chrome/common/chrome_constants.h" | |
15 #include "content/public/browser/child_process_data.h" | 14 #include "content/public/browser/child_process_data.h" |
16 #include "content/public/browser/notification_service.h" | 15 #include "content/public/browser/notification_service.h" |
17 #include "content/public/browser/render_process_host.h" | 16 #include "content/public/browser/render_process_host.h" |
18 | 17 |
19 #if defined(ENABLE_EXTENSIONS) | 18 #if defined(ENABLE_EXTENSIONS) |
20 #include "extensions/browser/process_map.h" | 19 #include "extensions/browser/process_map.h" |
21 #endif | 20 #endif |
22 | 21 |
23 #if defined(ENABLE_PLUGINS) | 22 #if defined(ENABLE_PLUGINS) |
24 #include "chrome/browser/metrics/plugin_metrics_provider.h" | 23 #include "chrome/browser/metrics/plugin_metrics_provider.h" |
25 #endif | 24 #endif |
26 | 25 |
27 #if defined(OS_WIN) | 26 #if defined(OS_WIN) |
28 #include <windows.h> // Needed for STATUS_* codes | 27 #include <windows.h> // Needed for STATUS_* codes |
29 #include "chrome/installer/util/install_util.h" | 28 #include "chrome/common/metrics_constants_util_win.h" |
30 #include "components/browser_watcher/crash_reporting_metrics_win.h" | 29 #include "components/browser_watcher/crash_reporting_metrics_win.h" |
31 #endif | 30 #endif |
32 | 31 |
33 namespace { | 32 namespace { |
34 | 33 |
35 #if defined(OS_WIN) | 34 #if defined(OS_WIN) |
36 void CountBrowserCrashDumpAttempts() { | 35 void CountBrowserCrashDumpAttempts() { |
37 enum Outcome { | 36 enum Outcome { |
38 OUTCOME_SUCCESS, | 37 OUTCOME_SUCCESS, |
39 OUTCOME_FAILURE, | 38 OUTCOME_FAILURE, |
40 OUTCOME_UNKNOWN, | 39 OUTCOME_UNKNOWN, |
41 OUTCOME_MAX_VALUE | 40 OUTCOME_MAX_VALUE |
42 }; | 41 }; |
43 | 42 |
44 browser_watcher::CrashReportingMetrics::Values metrics = | 43 browser_watcher::CrashReportingMetrics::Values metrics = |
45 browser_watcher::CrashReportingMetrics( | 44 browser_watcher::CrashReportingMetrics( |
46 InstallUtil::IsChromeSxSProcess() | 45 chrome::GetBrowserCrashDumpAttemptsRegistryPath()) |
47 ? chrome::kBrowserCrashDumpAttemptsRegistryPathSxS | |
48 : chrome::kBrowserCrashDumpAttemptsRegistryPath) | |
49 .RetrieveAndResetMetrics(); | 46 .RetrieveAndResetMetrics(); |
50 | 47 |
51 for (int i = 0; i < metrics.crash_dump_attempts; ++i) { | 48 for (int i = 0; i < metrics.crash_dump_attempts; ++i) { |
52 Outcome outcome = OUTCOME_UNKNOWN; | 49 Outcome outcome = OUTCOME_UNKNOWN; |
53 if (i < metrics.successful_crash_dumps) | 50 if (i < metrics.successful_crash_dumps) |
54 outcome = OUTCOME_SUCCESS; | 51 outcome = OUTCOME_SUCCESS; |
55 else if (i < metrics.successful_crash_dumps + metrics.failed_crash_dumps) | 52 else if (i < metrics.successful_crash_dumps + metrics.failed_crash_dumps) |
56 outcome = OUTCOME_FAILURE; | 53 outcome = OUTCOME_FAILURE; |
57 | 54 |
58 UMA_STABILITY_HISTOGRAM_ENUMERATION("CrashReport.BreakpadCrashDumpOutcome", | 55 UMA_STABILITY_HISTOGRAM_ENUMERATION("CrashReport.BreakpadCrashDumpOutcome", |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 int exit_code) { | 156 int exit_code) { |
160 #if defined(ENABLE_PLUGINS) | 157 #if defined(ENABLE_PLUGINS) |
161 // Exclude plugin crashes from the count below because we report them via | 158 // Exclude plugin crashes from the count below because we report them via |
162 // a separate UMA metric. | 159 // a separate UMA metric. |
163 if (PluginMetricsProvider::IsPluginProcess(data.process_type)) | 160 if (PluginMetricsProvider::IsPluginProcess(data.process_type)) |
164 return; | 161 return; |
165 #endif | 162 #endif |
166 | 163 |
167 helper_.BrowserChildProcessCrashed(); | 164 helper_.BrowserChildProcessCrashed(); |
168 } | 165 } |
OLD | NEW |