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 <utility> |
| 8 |
7 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
8 #include "base/command_line.h" | 10 #include "base/command_line.h" |
9 #include "base/environment.h" | 11 #include "base/environment.h" |
10 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
11 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
12 #include "base/path_service.h" | 14 #include "base/path_service.h" |
13 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
14 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
15 #include "base/trace_event/trace_event.h" | 17 #include "base/trace_event/trace_event.h" |
16 #include "components/crash/content/app/breakpad_linux.h" | 18 #include "components/crash/content/app/breakpad_linux.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 } | 151 } |
150 | 152 |
151 void HeadlessContentMainDelegate::InitCrashReporter( | 153 void HeadlessContentMainDelegate::InitCrashReporter( |
152 const base::CommandLine& command_line) { | 154 const base::CommandLine& command_line) { |
153 const std::string process_type = | 155 const std::string process_type = |
154 command_line.GetSwitchValueASCII(switches::kProcessType); | 156 command_line.GetSwitchValueASCII(switches::kProcessType); |
155 crash_reporter::SetCrashReporterClient(g_headless_crash_client.Pointer()); | 157 crash_reporter::SetCrashReporterClient(g_headless_crash_client.Pointer()); |
156 g_headless_crash_client.Pointer()->set_crash_dumps_dir( | 158 g_headless_crash_client.Pointer()->set_crash_dumps_dir( |
157 browser_->options()->crash_dumps_dir); | 159 browser_->options()->crash_dumps_dir); |
158 | 160 |
159 #if !defined(OS_MACOSX) | 161 #if defined(OS_LINUX) |
160 if (!browser_->options()->enable_crash_reporter) { | 162 if (!browser_->options()->enable_crash_reporter) { |
161 DCHECK(!breakpad::IsCrashReporterEnabled()); | 163 DCHECK(!breakpad::IsCrashReporterEnabled()); |
162 return; | 164 return; |
163 } | 165 } |
164 #if defined(HEADLESS_USE_BREAKPAD) | 166 #if defined(HEADLESS_USE_BREAKPAD) |
165 if (process_type != switches::kZygoteProcess) | 167 if (process_type != switches::kZygoteProcess) |
166 breakpad::InitCrashReporter(process_type); | 168 breakpad::InitCrashReporter(process_type); |
167 #endif // defined(HEADLESS_USE_BREAKPAD) | 169 #endif // defined(HEADLESS_USE_BREAKPAD) |
168 #endif // !defined(OS_MACOSX) | 170 #endif // defined(OS_LINUX) |
169 } | 171 } |
170 | 172 |
171 void HeadlessContentMainDelegate::PreSandboxStartup() { | 173 void HeadlessContentMainDelegate::PreSandboxStartup() { |
172 const base::CommandLine& command_line( | 174 const base::CommandLine& command_line( |
173 *base::CommandLine::ForCurrentProcess()); | 175 *base::CommandLine::ForCurrentProcess()); |
174 #if defined(OS_WIN) | 176 #if defined(OS_WIN) |
175 // Windows always needs to initialize logging, otherwise you get a renderer | 177 // Windows always needs to initialize logging, otherwise you get a renderer |
176 // crash. | 178 // crash. |
177 InitLogging(command_line); | 179 InitLogging(command_line); |
178 #else | 180 #else |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 #endif | 266 #endif |
265 } | 267 } |
266 | 268 |
267 content::ContentBrowserClient* | 269 content::ContentBrowserClient* |
268 HeadlessContentMainDelegate::CreateContentBrowserClient() { | 270 HeadlessContentMainDelegate::CreateContentBrowserClient() { |
269 browser_client_.reset(new HeadlessContentBrowserClient(browser_.get())); | 271 browser_client_.reset(new HeadlessContentBrowserClient(browser_.get())); |
270 return browser_client_.get(); | 272 return browser_client_.get(); |
271 } | 273 } |
272 | 274 |
273 } // namespace headless | 275 } // namespace headless |
OLD | NEW |