Index: headless/lib/headless_content_main_delegate.cc |
diff --git a/headless/lib/headless_content_main_delegate.cc b/headless/lib/headless_content_main_delegate.cc |
index 067ef27193dd9feb922c84c636bb7d6393778e3e..41561b0c423605e0564594c2fcf8dd5a57736f0f 100644 |
--- a/headless/lib/headless_content_main_delegate.cc |
+++ b/headless/lib/headless_content_main_delegate.cc |
@@ -33,6 +33,10 @@ |
#include "headless/embedded_resource_pak.h" |
#endif |
+#if defined(OS_MACOSX) |
+#include "components/crash/content/app/crashpad.h" |
+#endif |
+ |
namespace headless { |
namespace { |
// Keep in sync with content/common/content_constants_internal.h. |
@@ -151,6 +155,15 @@ void HeadlessContentMainDelegate::InitLogging( |
DCHECK(success); |
} |
+#if defined(OS_MACOSX) |
+void HeadlessContentMainDelegate::InitMacCrashReporter( |
+ const base::CommandLine& command_line, |
jzfeng
2017/04/12 06:22:04
command_line is not used?
dvallet
2017/04/12 07:04:09
Done.
|
+ const std::string& process_type) { |
+ const bool browser_process = process_type.empty(); |
+ crash_reporter::InitializeCrashpad(browser_process, process_type); |
+} |
+#endif // defined(OS_MACOSX) |
+ |
void HeadlessContentMainDelegate::InitCrashReporter( |
const base::CommandLine& command_line) { |
const std::string process_type = |
@@ -159,16 +172,16 @@ void HeadlessContentMainDelegate::InitCrashReporter( |
g_headless_crash_client.Pointer()->set_crash_dumps_dir( |
browser_->options()->crash_dumps_dir); |
-#if !defined(OS_MACOSX) |
+#if defined(HEADLESS_USE_BREAKPAD) |
if (!browser_->options()->enable_crash_reporter) { |
DCHECK(!breakpad::IsCrashReporterEnabled()); |
return; |
} |
-#if defined(HEADLESS_USE_BREAKPAD) |
if (process_type != switches::kZygoteProcess) |
breakpad::InitCrashReporter(process_type); |
+#elif defined(OS_MACOSX) |
+ InitMacCrashReporter(command_line, process_type); |
jzfeng
2017/04/12 06:22:04
there is only two line of code, just put them here
dvallet
2017/04/12 07:04:09
Done. I'm expecting to add more stuff later for cr
|
#endif // defined(HEADLESS_USE_BREAKPAD) |
-#endif // !defined(OS_MACOSX) |
} |
void HeadlessContentMainDelegate::PreSandboxStartup() { |
@@ -181,10 +194,8 @@ void HeadlessContentMainDelegate::PreSandboxStartup() { |
#else |
if (command_line.HasSwitch(switches::kEnableLogging)) |
InitLogging(command_line); |
-#endif |
-#if !defined(OS_MACOSX) |
+#endif // defined(OS_WIN) |
InitCrashReporter(command_line); |
-#endif |
InitializeResourceBundle(); |
} |