Index: content/app/content_main.cc |
=================================================================== |
--- content/app/content_main.cc (revision 100721) |
+++ content/app/content_main.cc (working copy) |
@@ -5,7 +5,6 @@ |
#include "content/app/content_main.h" |
#include "base/at_exit.h" |
-#include "base/base_switches.h" |
#include "base/command_line.h" |
#include "base/debug/debugger.h" |
#include "base/i18n/icu_util.h" |
@@ -17,6 +16,7 @@ |
#include "base/stringprintf.h" |
#include "base/string_number_conversions.h" |
#include "content/app/content_main_delegate.h" |
+#include "content/app/startup_helper_win.h" |
#include "content/common/content_constants.h" |
#include "content/common/content_paths.h" |
#include "content/common/content_switches.h" |
@@ -31,7 +31,6 @@ |
#if defined(OS_WIN) |
#include <atlbase.h> |
#include <atlapp.h> |
-#include <new.h> |
#include <malloc.h> |
#elif defined(OS_MACOSX) |
#include "base/mach_ipc_mac.h" |
@@ -76,31 +75,6 @@ |
static CAppModule _Module; |
-#pragma optimize("", off) |
-// Handlers for invalid parameter and pure call. They generate a breakpoint to |
-// tell breakpad that it needs to dump the process. |
-void InvalidParameter(const wchar_t* expression, const wchar_t* function, |
- const wchar_t* file, unsigned int line, |
- uintptr_t reserved) { |
- __debugbreak(); |
- _exit(1); |
-} |
- |
-void PureCall() { |
- __debugbreak(); |
- _exit(1); |
-} |
-#pragma optimize("", on) |
- |
-// Register the invalid param handler and pure call handler to be able to |
-// notify breakpad when it happens. |
-void RegisterInvalidParamHandler() { |
- _set_invalid_parameter_handler(InvalidParameter); |
- _set_purecall_handler(PureCall); |
- // Also enable the new handler for malloc() based failures. |
- _set_new_mode(1); |
-} |
- |
#elif defined(OS_MACOSX) |
// Completes the Mach IPC handshake by sending this process' task port to the |
@@ -154,19 +128,6 @@ |
#endif // OS_POSIX |
-void SetupCRT(const CommandLine& command_line) { |
-#if defined(OS_WIN) |
-#if defined(_CRTDBG_MAP_ALLOC) |
- _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); |
- _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); |
-#else |
- if (!command_line.HasSwitch(switches::kDisableBreakpad)) { |
- _CrtSetReportMode(_CRT_ASSERT, 0); |
- } |
-#endif |
-#endif |
-} |
- |
void CommonSubprocessInit(const std::string& process_type) { |
#if defined(OS_WIN) |
// HACK: Let Windows know that we have started. This is needed to suppress |
@@ -319,7 +280,7 @@ |
int argc = 0; |
char** argv = NULL; |
- RegisterInvalidParamHandler(); |
+ content::RegisterInvalidParamHandler(); |
_Module.Init(NULL, static_cast<HINSTANCE>(instance)); |
#else |
int ContentMain(int argc, |
@@ -392,6 +353,8 @@ |
(!delegate || delegate->ShouldSendMachPort(process_type))) { |
SendTaskPortToParentProcess(); |
} |
+#elif defined(OS_WIN) |
+ content::SetupCRT(command_line); |
#endif |
#if defined(OS_POSIX) |
@@ -412,8 +375,6 @@ |
} |
#endif |
- SetupCRT(command_line); |
- |
#if defined(USE_NSS) |
crypto::EarlySetupForNSSInit(); |
#endif |