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 "build/build_config.h" | 7 #include "build/build_config.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
10 #include "chrome/app/chrome_main_delegate.h" | 10 #include "chrome/app/chrome_main_delegate.h" |
11 #include "chrome/common/features.h" | 11 #include "chrome/common/features.h" |
12 #include "content/public/app/content_main.h" | 12 #include "content/public/app/content_main.h" |
13 #include "content/public/common/content_switches.h" | 13 #include "content/public/common/content_switches.h" |
14 #include "headless/public/headless_shell.h" | 14 #include "headless/public/headless_shell.h" |
15 #include "ui/gfx/switches.h" | 15 #include "ui/gfx/switches.h" |
16 | 16 |
17 #if BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | 17 #if BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) |
18 #include "chrome/app/mash/mash_runner.h" | 18 #include "chrome/app/mash/mash_runner.h" |
19 #include "chrome/common/channel_info.h" | 19 #include "chrome/common/channel_info.h" |
20 #include "components/version_info/version_info.h" | 20 #include "components/version_info/version_info.h" |
21 #include "services/service_manager/runner/common/client_util.h" | 21 #include "services/service_manager/runner/common/client_util.h" |
22 #endif | 22 #endif |
23 | 23 |
24 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
25 #include "base/debug/dump_without_crashing.h" | 25 #include "base/debug/dump_without_crashing.h" |
26 #include "base/win/win_util.h" | 26 #include "base/win/win_util.h" |
27 #include "chrome/common/chrome_constants.h" | 27 #include "chrome/common/chrome_constants.h" |
| 28 #include "chrome/install_static/initialize_from_primary_module.h" |
28 #include "chrome/install_static/install_details.h" | 29 #include "chrome/install_static/install_details.h" |
29 | 30 |
30 #define DLLEXPORT __declspec(dllexport) | 31 #define DLLEXPORT __declspec(dllexport) |
31 | 32 |
32 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. | 33 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. |
33 extern "C" { | 34 extern "C" { |
34 DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, | 35 DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, |
35 sandbox::SandboxInterfaceInfo* sandbox_info, | 36 sandbox::SandboxInterfaceInfo* sandbox_info, |
36 int64_t exe_entry_point_ticks); | 37 int64_t exe_entry_point_ticks); |
37 } | 38 } |
38 #elif defined(OS_POSIX) | 39 #elif defined(OS_POSIX) |
39 extern "C" { | 40 extern "C" { |
40 __attribute__((visibility("default"))) | 41 __attribute__((visibility("default"))) |
41 int ChromeMain(int argc, const char** argv); | 42 int ChromeMain(int argc, const char** argv); |
42 } | 43 } |
43 #endif | 44 #endif |
44 | 45 |
45 #if defined(OS_WIN) | 46 #if defined(OS_WIN) |
46 DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, | 47 DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, |
47 sandbox::SandboxInterfaceInfo* sandbox_info, | 48 sandbox::SandboxInterfaceInfo* sandbox_info, |
48 int64_t exe_entry_point_ticks) { | 49 int64_t exe_entry_point_ticks) { |
49 #elif defined(OS_POSIX) | 50 #elif defined(OS_POSIX) |
50 int ChromeMain(int argc, const char** argv) { | 51 int ChromeMain(int argc, const char** argv) { |
51 int64_t exe_entry_point_ticks = 0; | 52 int64_t exe_entry_point_ticks = 0; |
52 #endif | 53 #endif |
53 | 54 |
54 #if defined(OS_WIN) | 55 #if defined(OS_WIN) |
55 install_static::InstallDetails::InitializeFromPrimaryModule( | 56 install_static::InitializeFromPrimaryModule(); |
56 chrome::kChromeElfDllName); | |
57 #endif | 57 #endif |
58 | 58 |
59 ChromeMainDelegate chrome_main_delegate( | 59 ChromeMainDelegate chrome_main_delegate( |
60 base::TimeTicks::FromInternalValue(exe_entry_point_ticks)); | 60 base::TimeTicks::FromInternalValue(exe_entry_point_ticks)); |
61 content::ContentMainParams params(&chrome_main_delegate); | 61 content::ContentMainParams params(&chrome_main_delegate); |
62 | 62 |
63 #if defined(OS_WIN) | 63 #if defined(OS_WIN) |
64 // The process should crash when going through abnormal termination. | 64 // The process should crash when going through abnormal termination. |
65 base::win::SetShouldCrashOnProcessDetach(true); | 65 base::win::SetShouldCrashOnProcessDetach(true); |
66 base::win::SetAbortBehaviorForCrashReporting(); | 66 base::win::SetAbortBehaviorForCrashReporting(); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 #endif // BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | 110 #endif // BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) |
111 | 111 |
112 int rv = content::ContentMain(params); | 112 int rv = content::ContentMain(params); |
113 | 113 |
114 #if defined(OS_WIN) | 114 #if defined(OS_WIN) |
115 base::win::SetShouldCrashOnProcessDetach(false); | 115 base::win::SetShouldCrashOnProcessDetach(false); |
116 #endif | 116 #endif |
117 | 117 |
118 return rv; | 118 return rv; |
119 } | 119 } |
OLD | NEW |