OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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/crash/content/app/crashpad.h" | 5 #include "components/crash/content/app/crashpad.h" |
6 | 6 |
7 #include <CoreFoundation/CoreFoundation.h> | 7 #include <CoreFoundation/CoreFoundation.h> |
8 #include <string.h> | 8 #include <string.h> |
9 #include <unistd.h> | 9 #include <unistd.h> |
10 | 10 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 #endif | 74 #endif |
75 | 75 |
76 NSString* version = | 76 NSString* version = |
77 base::mac::ObjCCast<NSString>([base::mac::FrameworkBundle() | 77 base::mac::ObjCCast<NSString>([base::mac::FrameworkBundle() |
78 objectForInfoDictionaryKey:@"CFBundleShortVersionString"]); | 78 objectForInfoDictionaryKey:@"CFBundleShortVersionString"]); |
79 process_annotations["ver"] = base::SysNSStringToUTF8(version); | 79 process_annotations["ver"] = base::SysNSStringToUTF8(version); |
80 | 80 |
81 process_annotations["plat"] = std::string("OS X"); | 81 process_annotations["plat"] = std::string("OS X"); |
82 | 82 |
83 std::vector<std::string> arguments; | 83 std::vector<std::string> arguments; |
| 84 |
| 85 if (crash_reporter_client->ShouldMonitorCrashHandlerExpensively()) { |
| 86 arguments.push_back("--monitor-self"); |
| 87 } |
| 88 |
| 89 // Set up --monitor-self-annotation even in the absence of --monitor-self |
| 90 // so that minidumps produced by generate_dump will contain these |
| 91 // annotations. |
| 92 arguments.push_back("--monitor-self-annotation=ptype=crashpad-handler"); |
| 93 |
84 if (!browser_process) { | 94 if (!browser_process) { |
85 // If this is an initial client that's not the browser process, it's | 95 // If this is an initial client that's not the browser process, it's |
86 // important that the new Crashpad handler also not be connected to any | 96 // important that the new Crashpad handler also not be connected to any |
87 // existing handler. This argument tells the new Crashpad handler to | 97 // existing handler. This argument tells the new Crashpad handler to |
88 // sever this connection. | 98 // sever this connection. |
89 arguments.push_back( | 99 arguments.push_back( |
90 "--reset-own-crash-exception-port-to-system-default"); | 100 "--reset-own-crash-exception-port-to-system-default"); |
91 } | 101 } |
92 | 102 |
93 bool result = GetCrashpadClient().StartHandler( | 103 bool result = GetCrashpadClient().StartHandler( |
94 handler_path, database_path, metrics_path, url, process_annotations, | 104 handler_path, database_path, metrics_path, url, process_annotations, |
95 arguments, true, false); | 105 arguments, true, false); |
96 | 106 |
97 // If this is an initial client that's not the browser process, it's | 107 // If this is an initial client that's not the browser process, it's |
98 // important to sever the connection to any existing handler. If | 108 // important to sever the connection to any existing handler. If |
99 // StartHandler() failed, call UseSystemDefaultHandler() to drop the link | 109 // StartHandler() failed, call UseSystemDefaultHandler() to drop the link |
100 // to the existing handler. | 110 // to the existing handler. |
101 if (!result && !browser_process) { | 111 if (!result && !browser_process) { |
102 crashpad::CrashpadClient::UseSystemDefaultHandler(); | 112 crashpad::CrashpadClient::UseSystemDefaultHandler(); |
103 } | 113 } |
104 } // @autoreleasepool | 114 } // @autoreleasepool |
105 } | 115 } |
106 | 116 |
107 return database_path; | 117 return database_path; |
108 } | 118 } |
109 | 119 |
110 } // namespace internal | 120 } // namespace internal |
111 } // namespace crash_reporter | 121 } // namespace crash_reporter |
OLD | NEW |