Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/app/chrome_main_delegate.h" | 10 #include "chrome/app/chrome_main_delegate.h" |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 #if defined(OS_MACOSX) | 26 #if defined(OS_MACOSX) |
| 27 #include "chrome/app/chrome_main_mac.h" | 27 #include "chrome/app/chrome_main_mac.h" |
| 28 #endif | 28 #endif |
| 29 | 29 |
| 30 #if defined(OS_WIN) | 30 #if defined(OS_WIN) |
| 31 #include "base/debug/dump_without_crashing.h" | 31 #include "base/debug/dump_without_crashing.h" |
| 32 #include "base/win/win_util.h" | 32 #include "base/win/win_util.h" |
| 33 #include "chrome/common/chrome_constants.h" | 33 #include "chrome/common/chrome_constants.h" |
| 34 #include "chrome/install_static/initialize_from_primary_module.h" | 34 #include "chrome/install_static/initialize_from_primary_module.h" |
| 35 #include "chrome/install_static/install_details.h" | 35 #include "chrome/install_static/install_details.h" |
| 36 #include "chrome_elf/chrome_elf_main.h" | |
| 36 | 37 |
| 37 #define DLLEXPORT __declspec(dllexport) | 38 #define DLLEXPORT __declspec(dllexport) |
| 38 | 39 |
| 39 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. | 40 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. |
| 40 extern "C" { | 41 extern "C" { |
| 41 DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, | 42 DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, |
| 42 sandbox::SandboxInterfaceInfo* sandbox_info, | 43 sandbox::SandboxInterfaceInfo* sandbox_info, |
| 43 int64_t exe_entry_point_ticks); | 44 int64_t exe_entry_point_ticks); |
| 44 } | 45 } |
| 45 #elif defined(OS_POSIX) | 46 #elif defined(OS_POSIX) |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 66 base::TimeTicks::FromInternalValue(exe_entry_point_ticks)); | 67 base::TimeTicks::FromInternalValue(exe_entry_point_ticks)); |
| 67 content::ContentMainParams params(&chrome_main_delegate); | 68 content::ContentMainParams params(&chrome_main_delegate); |
| 68 | 69 |
| 69 #if defined(OS_WIN) | 70 #if defined(OS_WIN) |
| 70 // The process should crash when going through abnormal termination. | 71 // The process should crash when going through abnormal termination. |
| 71 base::win::SetShouldCrashOnProcessDetach(true); | 72 base::win::SetShouldCrashOnProcessDetach(true); |
| 72 base::win::SetAbortBehaviorForCrashReporting(); | 73 base::win::SetAbortBehaviorForCrashReporting(); |
| 73 params.instance = instance; | 74 params.instance = instance; |
| 74 params.sandbox_info = sandbox_info; | 75 params.sandbox_info = sandbox_info; |
| 75 | 76 |
| 76 // SetDumpWithoutCrashingFunction must be passed the DumpProcess function | 77 base::debug::SetDumpWithoutCrashingFunction(GetDumpWithoutCrashingFunction()); |
|
scottmg
2017/06/15 23:08:47
Why does this have to be a function that returns a
Will Harris
2017/06/15 23:37:24
base can't call out of base, which is why we pass
scottmg
2017/06/16 00:26:24
But couldn't it just be
base::debug::SetDumpWi
Will Harris
2017/06/16 00:37:48
maybe - but &DumpWithoutCrashingFunction would be
Will Harris
2017/06/21 14:31:26
this is done, and verified that it calls down to t
| |
| 77 // from chrome_elf and not from the DLL in order for DumpWithoutCrashing to | |
| 78 // function correctly. | |
| 79 typedef void (__cdecl *DumpProcessFunction)(); | |
| 80 DumpProcessFunction DumpProcess = reinterpret_cast<DumpProcessFunction>( | |
| 81 ::GetProcAddress(::GetModuleHandle(chrome::kChromeElfDllName), | |
| 82 "DumpProcessWithoutCrash")); | |
| 83 CHECK(DumpProcess); | |
| 84 base::debug::SetDumpWithoutCrashingFunction(DumpProcess); | |
| 85 | 78 |
| 86 // Verify that chrome_elf and this module (chrome.dll and chrome_child.dll) | 79 // Verify that chrome_elf and this module (chrome.dll and chrome_child.dll) |
| 87 // have the same version. | 80 // have the same version. |
| 88 if (install_static::InstallDetails::Get().VersionMismatch()) | 81 if (install_static::InstallDetails::Get().VersionMismatch()) |
| 89 base::debug::DumpWithoutCrashing(); | 82 base::debug::DumpWithoutCrashing(); |
| 90 #else | 83 #else |
| 91 params.argc = argc; | 84 params.argc = argc; |
| 92 params.argv = argv; | 85 params.argv = argv; |
| 93 base::CommandLine::Init(params.argc, params.argv); | 86 base::CommandLine::Init(params.argc, params.argv); |
| 94 #endif // defined(OS_WIN) | 87 #endif // defined(OS_WIN) |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 117 #endif // BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | 110 #endif // BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) |
| 118 | 111 |
| 119 int rv = content::ContentMain(params); | 112 int rv = content::ContentMain(params); |
| 120 | 113 |
| 121 #if defined(OS_WIN) | 114 #if defined(OS_WIN) |
| 122 base::win::SetShouldCrashOnProcessDetach(false); | 115 base::win::SetShouldCrashOnProcessDetach(false); |
| 123 #endif | 116 #endif |
| 124 | 117 |
| 125 return rv; | 118 return rv; |
| 126 } | 119 } |
| OLD | NEW |