| 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> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/base_switches.h" | 9 #include "base/base_switches.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "ui/base/resource/resource_bundle.h" | 25 #include "ui/base/resource/resource_bundle.h" |
| 26 #include "ui/base/ui_base_switches.h" | 26 #include "ui/base/ui_base_switches.h" |
| 27 #include "ui/gfx/switches.h" | 27 #include "ui/gfx/switches.h" |
| 28 #include "ui/gl/gl_switches.h" | 28 #include "ui/gl/gl_switches.h" |
| 29 #include "ui/ozone/public/ozone_switches.h" | 29 #include "ui/ozone/public/ozone_switches.h" |
| 30 | 30 |
| 31 #ifdef HEADLESS_USE_EMBEDDED_RESOURCES | 31 #ifdef HEADLESS_USE_EMBEDDED_RESOURCES |
| 32 #include "headless/embedded_resource_pak.h" | 32 #include "headless/embedded_resource_pak.h" |
| 33 #endif | 33 #endif |
| 34 | 34 |
| 35 #if defined(OS_MACOSX) | 35 #if defined(OS_MACOSX) || defined(OS_WIN) |
| 36 #include "components/crash/content/app/crashpad.h" | 36 #include "components/crash/content/app/crashpad.h" |
| 37 #endif | 37 #endif |
| 38 | 38 |
| 39 #if !defined(CHROME_MULTIPLE_DLL_BROWSER) | 39 #if !defined(CHROME_MULTIPLE_DLL_BROWSER) |
| 40 #include "headless/lib/renderer/headless_content_renderer_client.h" | 40 #include "headless/lib/renderer/headless_content_renderer_client.h" |
| 41 #endif | 41 #endif |
| 42 | 42 |
| 43 namespace headless { | 43 namespace headless { |
| 44 namespace { | 44 namespace { |
| 45 // Keep in sync with content/common/content_constants_internal.h. | 45 // Keep in sync with content/common/content_constants_internal.h. |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 browser_->options()->crash_dumps_dir); | 172 browser_->options()->crash_dumps_dir); |
| 173 | 173 |
| 174 #if defined(HEADLESS_USE_BREAKPAD) | 174 #if defined(HEADLESS_USE_BREAKPAD) |
| 175 if (!browser_->options()->enable_crash_reporter) { | 175 if (!browser_->options()->enable_crash_reporter) { |
| 176 DCHECK(!breakpad::IsCrashReporterEnabled()); | 176 DCHECK(!breakpad::IsCrashReporterEnabled()); |
| 177 return; | 177 return; |
| 178 } | 178 } |
| 179 if (process_type != switches::kZygoteProcess) | 179 if (process_type != switches::kZygoteProcess) |
| 180 breakpad::InitCrashReporter(process_type); | 180 breakpad::InitCrashReporter(process_type); |
| 181 #elif defined(OS_MACOSX) | 181 #elif defined(OS_MACOSX) |
| 182 const bool browser_process = process_type.empty(); | 182 crash_reporter::InitializeCrashpad(process_type.empty(), process_type); |
| 183 crash_reporter::InitializeCrashpad(browser_process, process_type); | 183 // Avoid adding this dependency in Windows Chrome component build, since it |
| 184 // chrashpad is already enabled. |
| 185 // TODO(dvallet): Ideally we would also want to avoid this for component build. |
| 186 #elif defined(OS_WIN) && !defined(CHROME_MULTIPLE_DLL) |
| 187 crash_reporter::InitializeCrashpadWithEmbeddedHandler(process_type.empty(), |
| 188 process_type); |
| 184 #endif // defined(HEADLESS_USE_BREAKPAD) | 189 #endif // defined(HEADLESS_USE_BREAKPAD) |
| 185 } | 190 } |
| 186 | 191 |
| 187 void HeadlessContentMainDelegate::PreSandboxStartup() { | 192 void HeadlessContentMainDelegate::PreSandboxStartup() { |
| 188 const base::CommandLine& command_line( | 193 const base::CommandLine& command_line( |
| 189 *base::CommandLine::ForCurrentProcess()); | 194 *base::CommandLine::ForCurrentProcess()); |
| 190 #if defined(OS_WIN) | 195 #if defined(OS_WIN) |
| 191 // Windows always needs to initialize logging, otherwise you get a renderer | 196 // Windows always needs to initialize logging, otherwise you get a renderer |
| 192 // crash. | 197 // crash. |
| 193 InitLogging(command_line); | 198 InitLogging(command_line); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 HeadlessContentMainDelegate::CreateContentRendererClient() { | 308 HeadlessContentMainDelegate::CreateContentRendererClient() { |
| 304 #if defined(CHROME_MULTIPLE_DLL_BROWSER) | 309 #if defined(CHROME_MULTIPLE_DLL_BROWSER) |
| 305 return nullptr; | 310 return nullptr; |
| 306 #else | 311 #else |
| 307 renderer_client_ = base::MakeUnique<HeadlessContentRendererClient>(); | 312 renderer_client_ = base::MakeUnique<HeadlessContentRendererClient>(); |
| 308 return renderer_client_.get(); | 313 return renderer_client_.get(); |
| 309 #endif | 314 #endif |
| 310 } | 315 } |
| 311 | 316 |
| 312 } // namespace headless | 317 } // namespace headless |
| OLD | NEW |