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/callback_helpers.h" | 7 #include "base/callback_helpers.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 "build/build_config.h" | 10 #include "build/build_config.h" |
11 #include "chrome/app/chrome_main_delegate.h" | 11 #include "chrome/app/chrome_main_delegate.h" |
| 12 #include "chrome/browser/profiling_host/profiling_process_host.h" |
12 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
13 #include "chrome/common/features.h" | 14 #include "chrome/common/features.h" |
14 #include "content/public/app/content_main.h" | 15 #include "content/public/app/content_main.h" |
15 #include "content/public/common/content_switches.h" | 16 #include "content/public/common/content_switches.h" |
16 #include "headless/public/headless_shell.h" | 17 #include "headless/public/headless_shell.h" |
17 #include "ui/gfx/switches.h" | 18 #include "ui/gfx/switches.h" |
18 | 19 |
19 #if BUILDFLAG(ENABLE_OOP_HEAP_PROFILING) | 20 #if BUILDFLAG(ENABLE_OOP_HEAP_PROFILING) |
20 #include "chrome/common/profiling/memlog_sender.h" | 21 #include "chrome/common/profiling/memlog_sender.h" |
21 #include "chrome/profiling/profiling_main.h" | 22 #include "chrome/profiling/profiling_main.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 #if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_WIN) | 102 #if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_WIN) |
102 if (command_line->HasSwitch(switches::kHeadless)) { | 103 if (command_line->HasSwitch(switches::kHeadless)) { |
103 #if defined(OS_MACOSX) | 104 #if defined(OS_MACOSX) |
104 SetUpBundleOverrides(); | 105 SetUpBundleOverrides(); |
105 #endif | 106 #endif |
106 return headless::HeadlessShellMain(params); | 107 return headless::HeadlessShellMain(params); |
107 } | 108 } |
108 #endif // defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_WIN) | 109 #endif // defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_WIN) |
109 | 110 |
110 #if BUILDFLAG(ENABLE_OOP_HEAP_PROFILING) | 111 #if BUILDFLAG(ENABLE_OOP_HEAP_PROFILING) |
111 #if !defined(OS_WIN) || defined(CHROME_MULTIPLE_DLL_BROWSER) | 112 #if !defined(OS_WIN) || defined(COMPONENT_BUILD) || \ |
| 113 defined(CHROME_MULTIPLE_DLL_BROWSER) |
112 // The profiling server is only compiled into the browser process. On Windows, | 114 // The profiling server is only compiled into the browser process. On Windows, |
113 // it should be called only for CHROME_MULTIPLE_DLL_BROWSER. | 115 // non-component builds, browser code is only used for |
| 116 // CHROME_MULTIPLE_DLL_BROWSER. |
114 if (command_line->HasSwitch(switches::kMemlog)) | 117 if (command_line->HasSwitch(switches::kMemlog)) |
| 118 profiling::ProfilingProcessHost::EnsureStarted(); |
| 119 #endif |
| 120 // The profiling process. This is a child process type implemented at the |
| 121 // Chrome layer rather than the content layer (like the other child procs.). |
| 122 if (command_line->GetSwitchValueASCII(switches::kProcessType) == |
| 123 switches::kProfiling) |
115 return profiling::ProfilingMain(*command_line); | 124 return profiling::ProfilingMain(*command_line); |
116 #endif | |
117 profiling::InitMemlogSenderIfNecessary(*command_line); | 125 profiling::InitMemlogSenderIfNecessary(*command_line); |
118 #endif // ENABLE_OOP_HEAP_PROFILING | 126 #endif // ENABLE_OOP_HEAP_PROFILING |
119 | 127 |
120 #if defined(OS_CHROMEOS) && BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | 128 #if defined(OS_CHROMEOS) && BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) |
121 if (service_manager::ServiceManagerIsRemote()) | 129 if (service_manager::ServiceManagerIsRemote()) |
122 params.env_mode = aura::Env::Mode::MUS; | 130 params.env_mode = aura::Env::Mode::MUS; |
123 #endif // BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) | 131 #endif // BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES) |
124 | 132 |
125 int rv = content::ContentMain(params); | 133 int rv = content::ContentMain(params); |
126 | 134 |
127 return rv; | 135 return rv; |
128 } | 136 } |
OLD | NEW |