Windows: Revert early chrome_elf crashpad initialization (issue #2122)

This commit is contained in:
Marshall Greenblatt 2017-04-27 13:02:21 -04:00
parent 0a2b82757a
commit a2b8c250a8
5 changed files with 24 additions and 30 deletions

View File

@ -48,7 +48,6 @@
#include "ui/wm/core/wm_state.h"
#if defined(OS_WIN)
#include "libcef/common/crash_reporting_win.h"
#include "ui/base/cursor/cursor_loader_win.h"
#endif
#endif // defined(USE_AURA)
@ -172,10 +171,6 @@ int CefBrowserMainParts::PreCreateThreads() {
}
void CefBrowserMainParts::PreMainMessageLoopRun() {
#if defined(OS_WIN)
crash_reporting_win::BlockUntilHandlerStarted();
#endif
if (extensions::ExtensionsEnabled()) {
// Initialize extension global objects before creating the global
// BrowserContext.

View File

@ -60,7 +60,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
@ -72,7 +73,18 @@ void DisableFMA3() {
disabled = true;
_set_FMA3_enable(0);
}
#endif
#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 InitCrashReporter() {
static bool initialized = false;
if (initialized)
return;
initialized = true;
SignalInitializeCrashReporting();
}
#endif // defined(OS_WIN)
#if defined(OS_MACOSX) || defined(OS_WIN)
@ -143,9 +155,12 @@ bool GetColor(const cef_color_t cef_in, bool is_windowless, SkColor* sk_out) {
int CefExecuteProcess(const CefMainArgs& args,
CefRefPtr<CefApp> 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
InitCrashReporter();
#endif
base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
#if defined(OS_WIN)
@ -199,9 +214,12 @@ bool CefInitialize(const CefMainArgs& args,
const CefSettings& settings,
CefRefPtr<CefApp> 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
InitCrashReporter();
#endif
// Return true if the global context already exists.
if (g_context)

View File

@ -6,8 +6,6 @@
#include "libcef/common/crash_reporting_win.h"
#include "libcef/common/crash_reporting.h"
#include "base/debug/crash_logging.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/common/chrome_constants.h"
@ -119,17 +117,4 @@ bool InitializeCrashReportingForModule() {
return false;
}
void BlockUntilHandlerStarted() {
if (!crash_reporting::Enabled())
return;
HMODULE chrome_elf = GetModuleHandle(chrome::kChromeElfDllName);
if (chrome_elf) {
auto block_until_handler_started = reinterpret_cast<void (*)()>(
GetProcAddress(chrome_elf, "BlockUntilHandlerStartedImpl"));
if (block_until_handler_started)
block_until_handler_started();
}
}
} // namespace crash_reporting_win

View File

@ -8,8 +8,4 @@ namespace crash_reporting_win {
// state from chrome_elf via exported functions.
bool InitializeCrashReportingForModule();
// Called from libcef early in main process startup to ensure that the crash
// handler process is started before other sub-processes are created.
void BlockUntilHandlerStarted();
} // namespace crash_reporting_win

View File

@ -557,10 +557,10 @@ index 94a350f..61667a8 100644
(*annotations)["special"] = base::UTF16ToUTF8(special_build);
#if defined(ARCH_CPU_X86)
- (*annotations)["plat"] = std::string("Win32");
+ (*annotations)["platform"] = std::string("Win32");
+ (*annotations)["platform"] = std::string("win32");
#elif defined(ARCH_CPU_X86_64)
- (*annotations)["plat"] = std::string("Win64");
+ (*annotations)["platform"] = std::string("Win64");
+ (*annotations)["platform"] = std::string("win64");
#endif
}