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 16 matching lines...) Expand all Loading... |
27 #if defined(OS_MACOSX) | 27 #if defined(OS_MACOSX) |
28 #include "chrome/app/chrome_main_mac.h" | 28 #include "chrome/app/chrome_main_mac.h" |
29 #endif | 29 #endif |
30 | 30 |
31 #if defined(OS_WIN) | 31 #if defined(OS_WIN) |
32 #include "base/debug/dump_without_crashing.h" | 32 #include "base/debug/dump_without_crashing.h" |
33 #include "base/win/win_util.h" | 33 #include "base/win/win_util.h" |
34 #include "chrome/common/chrome_constants.h" | 34 #include "chrome/common/chrome_constants.h" |
35 #include "chrome/install_static/initialize_from_primary_module.h" | 35 #include "chrome/install_static/initialize_from_primary_module.h" |
36 #include "chrome/install_static/install_details.h" | 36 #include "chrome/install_static/install_details.h" |
| 37 #include "chrome_elf/chrome_elf_main.h" |
37 | 38 |
38 #define DLLEXPORT __declspec(dllexport) | 39 #define DLLEXPORT __declspec(dllexport) |
39 | 40 |
40 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. | 41 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. |
41 extern "C" { | 42 extern "C" { |
42 DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, | 43 DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, |
43 sandbox::SandboxInterfaceInfo* sandbox_info, | 44 sandbox::SandboxInterfaceInfo* sandbox_info, |
44 int64_t exe_entry_point_ticks); | 45 int64_t exe_entry_point_ticks); |
45 } | 46 } |
46 #elif defined(OS_POSIX) | 47 #elif defined(OS_POSIX) |
(...skipping 20 matching lines...) Expand all Loading... |
67 base::TimeTicks::FromInternalValue(exe_entry_point_ticks)); | 68 base::TimeTicks::FromInternalValue(exe_entry_point_ticks)); |
68 content::ContentMainParams params(&chrome_main_delegate); | 69 content::ContentMainParams params(&chrome_main_delegate); |
69 | 70 |
70 #if defined(OS_WIN) | 71 #if defined(OS_WIN) |
71 // The process should crash when going through abnormal termination. | 72 // The process should crash when going through abnormal termination. |
72 base::win::SetShouldCrashOnProcessDetach(true); | 73 base::win::SetShouldCrashOnProcessDetach(true); |
73 base::win::SetAbortBehaviorForCrashReporting(); | 74 base::win::SetAbortBehaviorForCrashReporting(); |
74 params.instance = instance; | 75 params.instance = instance; |
75 params.sandbox_info = sandbox_info; | 76 params.sandbox_info = sandbox_info; |
76 | 77 |
77 // SetDumpWithoutCrashingFunction must be passed the DumpProcess function | 78 base::debug::SetDumpWithoutCrashingFunction(&DumpWithoutCrashing); |
78 // from chrome_elf and not from the DLL in order for DumpWithoutCrashing to | |
79 // function correctly. | |
80 typedef void (__cdecl *DumpProcessFunction)(); | |
81 DumpProcessFunction DumpProcess = reinterpret_cast<DumpProcessFunction>( | |
82 ::GetProcAddress(::GetModuleHandle(chrome::kChromeElfDllName), | |
83 "DumpProcessWithoutCrash")); | |
84 CHECK(DumpProcess); | |
85 base::debug::SetDumpWithoutCrashingFunction(DumpProcess); | |
86 | 79 |
87 // Verify that chrome_elf and this module (chrome.dll and chrome_child.dll) | 80 // Verify that chrome_elf and this module (chrome.dll and chrome_child.dll) |
88 // have the same version. | 81 // have the same version. |
89 if (install_static::InstallDetails::Get().VersionMismatch()) | 82 if (install_static::InstallDetails::Get().VersionMismatch()) |
90 base::debug::DumpWithoutCrashing(); | 83 base::debug::DumpWithoutCrashing(); |
91 #else | 84 #else |
92 params.argc = argc; | 85 params.argc = argc; |
93 params.argv = argv; | 86 params.argv = argv; |
94 base::CommandLine::Init(params.argc, params.argv); | 87 base::CommandLine::Init(params.argc, params.argv); |
95 #endif // defined(OS_WIN) | 88 #endif // defined(OS_WIN) |
(...skipping 27 matching lines...) Expand all Loading... |
123 #endif // BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | 116 #endif // BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) |
124 | 117 |
125 int rv = content::ContentMain(params); | 118 int rv = content::ContentMain(params); |
126 | 119 |
127 #if defined(OS_WIN) | 120 #if defined(OS_WIN) |
128 base::win::SetShouldCrashOnProcessDetach(false); | 121 base::win::SetShouldCrashOnProcessDetach(false); |
129 #endif | 122 #endif |
130 | 123 |
131 return rv; | 124 return rv; |
132 } | 125 } |
OLD | NEW |