OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "headless/lib/headless_content_main_delegate.h" | 5 #include "headless/lib/headless_content_main_delegate.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 } | 153 } |
154 #if defined(HEADLESS_USE_BREAKPAD) | 154 #if defined(HEADLESS_USE_BREAKPAD) |
155 if (process_type != switches::kZygoteProcess) | 155 if (process_type != switches::kZygoteProcess) |
156 breakpad::InitCrashReporter(process_type); | 156 breakpad::InitCrashReporter(process_type); |
157 #endif // defined(HEADLESS_USE_BREAKPAD) | 157 #endif // defined(HEADLESS_USE_BREAKPAD) |
158 } | 158 } |
159 | 159 |
160 void HeadlessContentMainDelegate::PreSandboxStartup() { | 160 void HeadlessContentMainDelegate::PreSandboxStartup() { |
161 const base::CommandLine& command_line( | 161 const base::CommandLine& command_line( |
162 *base::CommandLine::ForCurrentProcess()); | 162 *base::CommandLine::ForCurrentProcess()); |
163 const std::string process_type = | 163 #if defined(OS_WIN) |
164 command_line.GetSwitchValueASCII(switches::kProcessType); | 164 // Windows always needs to initialize logging, otherwise you get a renderer |
| 165 // crash. |
165 InitLogging(command_line); | 166 InitLogging(command_line); |
| 167 #else |
| 168 if (command_line.HasSwitch(switches::kEnableLogging)) |
| 169 InitLogging(command_line); |
| 170 #endif |
166 InitCrashReporter(command_line); | 171 InitCrashReporter(command_line); |
167 InitializeResourceBundle(); | 172 InitializeResourceBundle(); |
168 } | 173 } |
169 | 174 |
170 int HeadlessContentMainDelegate::RunProcess( | 175 int HeadlessContentMainDelegate::RunProcess( |
171 const std::string& process_type, | 176 const std::string& process_type, |
172 const content::MainFunctionParams& main_function_params) { | 177 const content::MainFunctionParams& main_function_params) { |
173 if (!process_type.empty()) | 178 if (!process_type.empty()) |
174 return -1; | 179 return -1; |
175 | 180 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 #endif | 244 #endif |
240 } | 245 } |
241 | 246 |
242 content::ContentBrowserClient* | 247 content::ContentBrowserClient* |
243 HeadlessContentMainDelegate::CreateContentBrowserClient() { | 248 HeadlessContentMainDelegate::CreateContentBrowserClient() { |
244 browser_client_.reset(new HeadlessContentBrowserClient(browser_.get())); | 249 browser_client_.reset(new HeadlessContentBrowserClient(browser_.get())); |
245 return browser_client_.get(); | 250 return browser_client_.get(); |
246 } | 251 } |
247 | 252 |
248 } // namespace headless | 253 } // namespace headless |
OLD | NEW |