Index: handler/mac/crash_report_exception_handler.cc |
diff --git a/handler/mac/crash_report_exception_handler.cc b/handler/mac/crash_report_exception_handler.cc |
index bad4c1c692d3cfbdb1dd9f4491f843bdf8e43f7a..78710d69b9669a2b44cda53393f0e827abce49de 100644 |
--- a/handler/mac/crash_report_exception_handler.cc |
+++ b/handler/mac/crash_report_exception_handler.cc |
@@ -14,12 +14,11 @@ |
#include "handler/mac/crash_report_exception_handler.h" |
-#include <servers/bootstrap.h> |
- |
#include <vector> |
#include "base/logging.h" |
#include "base/mac/mach_logging.h" |
+#include "base/mac/scoped_mach_port.h" |
#include "base/strings/stringprintf.h" |
#include "client/settings.h" |
#include "minidump/minidump_file_writer.h" |
@@ -202,15 +201,9 @@ kern_return_t CrashReportExceptionHandler::CatchMachException( |
// Note that normally, EXC_RESOURCE and EXC_GUARD exceptions are sent to the |
// system-level com.apple.ReportCrash.Root job, and not to the user-level |
// job that they are forwarded to here. |
- mach_port_t system_crash_reporter_port; |
- const char kSystemCrashReporterServiceName[] = "com.apple.ReportCrash"; |
- kern_return_t kr = bootstrap_look_up(bootstrap_port, |
- kSystemCrashReporterServiceName, |
- &system_crash_reporter_port); |
- if (kr != BOOTSTRAP_SUCCESS) { |
- BOOTSTRAP_LOG(ERROR, kr) << "bootstrap_look_up " |
- << kSystemCrashReporterServiceName; |
- } else { |
+ base::mac::ScopedMachSendRight |
+ system_crash_reporter_handler(SystemCrashReporterHandler()); |
+ if (system_crash_reporter_handler) { |
// Make copies of mutable out parameters so that the system crash reporter |
// can’t influence the state returned by this method. |
thread_state_flavor_t flavor_forward = *flavor; |
@@ -227,9 +220,9 @@ kern_return_t CrashReportExceptionHandler::CatchMachException( |
// problems may arise if the state wasn’t available and the system crash |
// reporter changes in the future to use it. However, normally, the state |
// will be available. |
- kr = UniversalExceptionRaise( |
+ kern_return_t kr = UniversalExceptionRaise( |
EXCEPTION_STATE_IDENTITY | MACH_EXCEPTION_CODES, |
- system_crash_reporter_port, |
+ system_crash_reporter_handler, |
thread, |
task, |
exception, |
@@ -240,8 +233,7 @@ kern_return_t CrashReportExceptionHandler::CatchMachException( |
old_state_count, |
new_state_forward_count ? &new_state_forward[0] : nullptr, |
&new_state_forward_count); |
- MACH_LOG_IF(WARNING, kr != KERN_SUCCESS, kr) |
- << "UniversalExceptionRaise " << kSystemCrashReporterServiceName; |
+ MACH_LOG_IF(WARNING, kr != KERN_SUCCESS, kr) << "UniversalExceptionRaise"; |
} |
} |