From 0da94acdf2150424b168cfd829d75660b4b38bb6 Mon Sep 17 00:00:00 2001 From: Marshall Greenblatt Date: Mon, 5 Dec 2016 14:29:54 +0100 Subject: [PATCH] Windows: Add missing crashpad initialization (issue #1995) --- libcef/browser/context.cc | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/libcef/browser/context.cc b/libcef/browser/context.cc index 6b7d89da3..121282dc5 100644 --- a/libcef/browser/context.cc +++ b/libcef/browser/context.cc @@ -56,7 +56,8 @@ class CefForceShutdown { } } g_force_shutdown; -#if defined(OS_WIN) && defined(ARCH_CPU_X86_64) +#if defined(OS_WIN) +#if defined(ARCH_CPU_X86_64) // VS2013 only checks the existence of FMA3 instructions, not the enabled-ness // of them at the OS level (this is fixed in VS2015). We force off usage of // FMA3 instructions in the CRT to avoid using that path and hitting illegal @@ -68,16 +69,30 @@ void DisableFMA3() { disabled = true; _set_FMA3_enable(0); } -#endif // WIN && ARCH_CPU_X86_64 +#endif // defined(ARCH_CPU_X86_64) + +// Signal chrome_elf to initialize crash reporting, rather than doing it in +// DllMain. See https://crbug.com/656800 for details. +void InitializeCrashReporting() { + static bool initialized = false; + if (initialized) + return; + initialized = true; + SignalInitializeCrashReporting(); +} +#endif // defined(OS_WIN) } // namespace int CefExecuteProcess(const CefMainArgs& args, CefRefPtr application, void* windows_sandbox_info) { -#if defined(OS_WIN) && defined(ARCH_CPU_X86_64) +#if defined(OS_WIN) +#if defined(ARCH_CPU_X86_64) DisableFMA3(); #endif + InitializeCrashReporting(); +#endif base::CommandLine command_line(base::CommandLine::NO_PROGRAM); #if defined(OS_WIN) @@ -131,9 +146,12 @@ bool CefInitialize(const CefMainArgs& args, const CefSettings& settings, CefRefPtr application, void* windows_sandbox_info) { -#if defined(OS_WIN) && defined(ARCH_CPU_X86_64) +#if defined(OS_WIN) +#if defined(ARCH_CPU_X86_64) DisableFMA3(); #endif + InitializeCrashReporting(); +#endif // Return true if the global context already exists. if (g_context)