| 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/time/time.h" | 9 #include "base/time/time.h" |
| 9 #include "chrome/app/chrome_main_delegate.h" | 10 #include "chrome/app/chrome_main_delegate.h" |
| 10 #include "chrome/common/features.h" | 11 #include "chrome/common/features.h" |
| 11 #include "content/public/app/content_main.h" | 12 #include "content/public/app/content_main.h" |
| 13 #include "content/public/common/content_switches.h" |
| 14 #include "headless/app/headless_shell.h" |
| 12 | 15 |
| 13 #if BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | 16 #if BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) |
| 14 #include "base/command_line.h" | |
| 15 #include "chrome/app/mash/mash_runner.h" | 17 #include "chrome/app/mash/mash_runner.h" |
| 16 #include "chrome/common/channel_info.h" | 18 #include "chrome/common/channel_info.h" |
| 17 #include "components/version_info/version_info.h" | 19 #include "components/version_info/version_info.h" |
| 18 #endif | 20 #endif |
| 19 | 21 |
| 20 #if defined(OS_WIN) | 22 #if defined(OS_WIN) |
| 21 #include "base/debug/dump_without_crashing.h" | 23 #include "base/debug/dump_without_crashing.h" |
| 22 #include "base/win/win_util.h" | 24 #include "base/win/win_util.h" |
| 23 #include "chrome/common/chrome_constants.h" | 25 #include "chrome/common/chrome_constants.h" |
| 24 #include "chrome/install_static/install_details.h" | 26 #include "chrome/install_static/install_details.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 51 // of them at the OS level (this is fixed in VS2015). We force off usage of | 53 // of them at the OS level (this is fixed in VS2015). We force off usage of |
| 52 // FMA3 instructions in the CRT to avoid using that path and hitting illegal | 54 // FMA3 instructions in the CRT to avoid using that path and hitting illegal |
| 53 // instructions when running on CPUs that support FMA3, but OSs that don't. | 55 // instructions when running on CPUs that support FMA3, but OSs that don't. |
| 54 // See http://crbug.com/436603. | 56 // See http://crbug.com/436603. |
| 55 _set_FMA3_enable(0); | 57 _set_FMA3_enable(0); |
| 56 #endif // WIN && ARCH_CPU_X86_64 | 58 #endif // WIN && ARCH_CPU_X86_64 |
| 57 | 59 |
| 58 #if defined(OS_WIN) | 60 #if defined(OS_WIN) |
| 59 install_static::InstallDetails::InitializeFromPrimaryModule( | 61 install_static::InstallDetails::InitializeFromPrimaryModule( |
| 60 chrome::kChromeElfDllName); | 62 chrome::kChromeElfDllName); |
| 63 |
| 64 const base::CommandLine command_line(argc, argv); |
| 65 #if defined(OS_LINUX) |
| 66 if (command_line.HasSwitch(switches::kHeadless)) |
| 67 return HeadlessShellMain(argc, argv); |
| 61 #endif | 68 #endif |
| 62 | 69 |
| 63 ChromeMainDelegate chrome_main_delegate( | 70 ChromeMainDelegate chrome_main_delegate( |
| 64 base::TimeTicks::FromInternalValue(exe_entry_point_ticks)); | 71 base::TimeTicks::FromInternalValue(exe_entry_point_ticks)); |
| 65 content::ContentMainParams params(&chrome_main_delegate); | 72 content::ContentMainParams params(&chrome_main_delegate); |
| 66 | 73 |
| 67 #if defined(OS_WIN) | 74 #if defined(OS_WIN) |
| 68 // The process should crash when going through abnormal termination. | 75 // The process should crash when going through abnormal termination. |
| 69 base::win::SetShouldCrashOnProcessDetach(true); | 76 base::win::SetShouldCrashOnProcessDetach(true); |
| 70 base::win::SetAbortBehaviorForCrashReporting(); | 77 base::win::SetAbortBehaviorForCrashReporting(); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 91 #endif | 98 #endif |
| 92 | 99 |
| 93 #if BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | 100 #if BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) |
| 94 #if !defined(OS_WIN) | 101 #if !defined(OS_WIN) |
| 95 base::CommandLine::Init(params.argc, params.argv); | 102 base::CommandLine::Init(params.argc, params.argv); |
| 96 #endif | 103 #endif |
| 97 | 104 |
| 98 version_info::Channel channel = chrome::GetChannel(); | 105 version_info::Channel channel = chrome::GetChannel(); |
| 99 if (channel == version_info::Channel::CANARY || | 106 if (channel == version_info::Channel::CANARY || |
| 100 channel == version_info::Channel::UNKNOWN) { | 107 channel == version_info::Channel::UNKNOWN) { |
| 101 const base::CommandLine& command_line = | |
| 102 *base::CommandLine::ForCurrentProcess(); | |
| 103 if (command_line.HasSwitch("mash")) | 108 if (command_line.HasSwitch("mash")) |
| 104 return MashMain(); | 109 return MashMain(); |
| 105 } | 110 } |
| 106 #endif // BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | 111 #endif // BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) |
| 107 | 112 |
| 108 int rv = content::ContentMain(params); | 113 int rv = content::ContentMain(params); |
| 109 | 114 |
| 110 #if defined(OS_WIN) | 115 #if defined(OS_WIN) |
| 111 base::win::SetShouldCrashOnProcessDetach(false); | 116 base::win::SetShouldCrashOnProcessDetach(false); |
| 112 #endif | 117 #endif |
| 113 | 118 |
| 114 return rv; | 119 return rv; |
| 115 } | 120 } |
| OLD | NEW |