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

Side by Side Diff: chrome/app/chrome_crash_reporter_client_mac.mm

Issue 2799013002: Monitor crashpad_handler for crashes [sometimes] (Closed)
Patch Set: Address review feedback (scottmg) Created 3 years, 8 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/app/chrome_crash_reporter_client.h" 5 #include "chrome/app/chrome_crash_reporter_client.h"
6 6
7 #include <CoreFoundation/CoreFoundation.h> 7 #include <CoreFoundation/CoreFoundation.h>
8 8
9 #include "base/mac/scoped_cftyperef.h" 9 #include "base/mac/scoped_cftyperef.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/rand_util.h"
11 #include "base/strings/sys_string_conversions.h" 12 #include "base/strings/sys_string_conversions.h"
13 #include "chrome/common/channel_info.h"
12 #include "chrome/common/chrome_paths.h" 14 #include "chrome/common/chrome_paths.h"
13 #include "components/policy/policy_constants.h" 15 #include "components/policy/policy_constants.h"
16 #include "components/version_info/version_info.h"
14 17
15 #if !defined(DISABLE_NACL) 18 #if !defined(DISABLE_NACL)
16 #include "base/command_line.h" 19 #include "base/command_line.h"
17 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
18 #include "components/nacl/common/nacl_switches.h" 21 #include "components/nacl/common/nacl_switches.h"
19 #include "native_client/src/trusted/service_runtime/osx/crash_filter.h" 22 #include "native_client/src/trusted/service_runtime/osx/crash_filter.h"
20 #endif 23 #endif
21 24
22 bool ChromeCrashReporterClient::GetCrashMetricsLocation( 25 bool ChromeCrashReporterClient::GetCrashMetricsLocation(
23 base::FilePath* metrics_dir) { 26 base::FilePath* metrics_dir) {
24 return PathService::Get(chrome::DIR_USER_DATA, metrics_dir); 27 return PathService::Get(chrome::DIR_USER_DATA, metrics_dir);
25 } 28 }
26 29
27 bool ChromeCrashReporterClient::ReportingIsEnforcedByPolicy( 30 bool ChromeCrashReporterClient::ReportingIsEnforcedByPolicy(
28 bool* breakpad_enabled) { 31 bool* breakpad_enabled) {
29 base::ScopedCFTypeRef<CFStringRef> key( 32 base::ScopedCFTypeRef<CFStringRef> key(
30 base::SysUTF8ToCFStringRef(policy::key::kMetricsReportingEnabled)); 33 base::SysUTF8ToCFStringRef(policy::key::kMetricsReportingEnabled));
31 Boolean key_valid; 34 Boolean key_valid;
32 Boolean metrics_reporting_enabled = CFPreferencesGetAppBooleanValue(key, 35 Boolean metrics_reporting_enabled = CFPreferencesGetAppBooleanValue(key,
33 kCFPreferencesCurrentApplication, &key_valid); 36 kCFPreferencesCurrentApplication, &key_valid);
34 if (key_valid && 37 if (key_valid &&
35 CFPreferencesAppValueIsForced(key, kCFPreferencesCurrentApplication)) { 38 CFPreferencesAppValueIsForced(key, kCFPreferencesCurrentApplication)) {
36 *breakpad_enabled = metrics_reporting_enabled; 39 *breakpad_enabled = metrics_reporting_enabled;
37 return true; 40 return true;
38 } 41 }
39 return false; 42 return false;
40 } 43 }
44
45 bool ChromeCrashReporterClient::ShouldMonitorCrashHandlerExpensively() {
46 // This mechanism dedicates a process to be crashpad_handler's own
47 // crashpad_handler. In Google Chrome, scale back on this in the more stable
48 // channels. Other builds are of more of a developmental nature, so always
49 // enable the additional crash reporting.
50 double probability;
51 switch (chrome::GetChannel()) {
52 case version_info::Channel::STABLE:
53 probability = 0.01;
54 break;
55
56 case version_info::Channel::BETA:
57 probability = 0.1;
58 break;
59
60 case version_info::Channel::DEV:
61 probability = 0.25;
62 break;
63
64 default:
65 return true;
66 }
67
68 return base::RandDouble() < probability;
69 }
OLDNEW
« no previous file with comments | « chrome/app/chrome_crash_reporter_client.h ('k') | chrome/app/chrome_crash_reporter_client_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698