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" |
11 #include "chrome/common/chrome_switches.h" | 11 #include "chrome/common/chrome_switches.h" |
12 #include "chrome/common/features.h" | 12 #include "chrome/common/features.h" |
13 #include "content/public/app/content_main.h" | 13 #include "content/public/app/content_main.h" |
14 #include "content/public/common/content_switches.h" | 14 #include "content/public/common/content_switches.h" |
15 #include "headless/public/headless_shell.h" | 15 #include "headless/public/headless_shell.h" |
16 #include "ui/gfx/switches.h" | 16 #include "ui/gfx/switches.h" |
17 | 17 |
| 18 #if BUILDFLAG(ENABLE_OOP_HEAP_PROFILING) |
| 19 #include "chrome/profiling/profiling_main.h" |
| 20 #endif |
| 21 |
18 #if BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | 22 #if BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) |
19 #include "services/service_manager/runner/common/client_util.h" | 23 #include "services/service_manager/runner/common/client_util.h" |
20 #endif | 24 #endif |
21 | 25 |
22 #if defined(OS_MACOSX) | 26 #if defined(OS_MACOSX) |
23 #include "chrome/app/chrome_main_mac.h" | 27 #include "chrome/app/chrome_main_mac.h" |
24 #endif | 28 #endif |
25 | 29 |
26 #if defined(OS_WIN) | 30 #if defined(OS_WIN) |
27 #include "base/debug/dump_without_crashing.h" | 31 #include "base/debug/dump_without_crashing.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 base::debug::DumpWithoutCrashing(); | 89 base::debug::DumpWithoutCrashing(); |
86 #else | 90 #else |
87 params.argc = argc; | 91 params.argc = argc; |
88 params.argv = argv; | 92 params.argv = argv; |
89 base::CommandLine::Init(params.argc, params.argv); | 93 base::CommandLine::Init(params.argc, params.argv); |
90 #endif // defined(OS_WIN) | 94 #endif // defined(OS_WIN) |
91 base::CommandLine::Init(0, nullptr); | 95 base::CommandLine::Init(0, nullptr); |
92 const base::CommandLine* command_line(base::CommandLine::ForCurrentProcess()); | 96 const base::CommandLine* command_line(base::CommandLine::ForCurrentProcess()); |
93 ALLOW_UNUSED_LOCAL(command_line); | 97 ALLOW_UNUSED_LOCAL(command_line); |
94 | 98 |
| 99 // Chrome-specific process modes. |
95 #if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_WIN) | 100 #if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_WIN) |
96 if (command_line->HasSwitch(switches::kHeadless)) { | 101 if (command_line->HasSwitch(switches::kHeadless)) { |
97 #if defined(OS_MACOSX) | 102 #if defined(OS_MACOSX) |
98 SetUpBundleOverrides(); | 103 SetUpBundleOverrides(); |
99 #endif | 104 #endif |
100 return headless::HeadlessShellMain(params); | 105 return headless::HeadlessShellMain(params); |
101 } | 106 } |
102 #endif // defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_WIN) | 107 #endif // defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_WIN) |
103 | 108 |
| 109 #if BUILDFLAG(ENABLE_OOP_HEAP_PROFILING) |
| 110 if (command_line->GetSwitchValueASCII(switches::kProcessType) == |
| 111 "profiling") { |
| 112 return profiling::ProfilingMain(*command_line); |
| 113 } |
| 114 #endif // ENABLE_OOP_HEAP_PROFILING |
| 115 |
104 #if defined(OS_CHROMEOS) && BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | 116 #if defined(OS_CHROMEOS) && BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) |
105 if (service_manager::ServiceManagerIsRemote()) | 117 if (service_manager::ServiceManagerIsRemote()) |
106 params.env_mode = aura::Env::Mode::MUS; | 118 params.env_mode = aura::Env::Mode::MUS; |
107 #endif // BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | 119 #endif // BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) |
108 | 120 |
109 int rv = content::ContentMain(params); | 121 int rv = content::ContentMain(params); |
110 | 122 |
111 #if defined(OS_WIN) | 123 #if defined(OS_WIN) |
112 base::win::SetShouldCrashOnProcessDetach(false); | 124 base::win::SetShouldCrashOnProcessDetach(false); |
113 #endif | 125 #endif |
114 | 126 |
115 return rv; | 127 return rv; |
116 } | 128 } |
OLD | NEW |