| 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 18 matching lines...) Expand all Loading... |
| 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(CHROME_MULTIPLE_DLL_BROWSER) | 35 #if !defined(CHROME_MULTIPLE_DLL_BROWSER) |
| 36 #include "headless/lib/renderer/headless_content_renderer_client.h" | 36 #include "headless/lib/renderer/headless_content_renderer_client.h" |
| 37 #endif | 37 #endif |
| 38 | 38 |
| 39 #if defined(OS_MACOSX) | 39 #if defined(OS_MACOSX) || defined(OS_WIN) |
| 40 #include "components/crash/content/app/crashpad.h" | 40 #include "components/crash/content/app/crashpad.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. |
| 46 // TODO(skyostil): Add a tracing test for this. | 46 // TODO(skyostil): Add a tracing test for this. |
| 47 const int kTraceEventBrowserProcessSortIndex = -6; | 47 const int kTraceEventBrowserProcessSortIndex = -6; |
| 48 | 48 |
| 49 HeadlessContentMainDelegate* g_current_headless_content_main_delegate = nullptr; | 49 HeadlessContentMainDelegate* g_current_headless_content_main_delegate = nullptr; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 browser_->options()->crash_dumps_dir); | 170 browser_->options()->crash_dumps_dir); |
| 171 | 171 |
| 172 #if defined(HEADLESS_USE_BREAKPAD) | 172 #if defined(HEADLESS_USE_BREAKPAD) |
| 173 if (!browser_->options()->enable_crash_reporter) { | 173 if (!browser_->options()->enable_crash_reporter) { |
| 174 DCHECK(!breakpad::IsCrashReporterEnabled()); | 174 DCHECK(!breakpad::IsCrashReporterEnabled()); |
| 175 return; | 175 return; |
| 176 } | 176 } |
| 177 if (process_type != switches::kZygoteProcess) | 177 if (process_type != switches::kZygoteProcess) |
| 178 breakpad::InitCrashReporter(process_type); | 178 breakpad::InitCrashReporter(process_type); |
| 179 #elif defined(OS_MACOSX) | 179 #elif defined(OS_MACOSX) |
| 180 const bool browser_process = process_type.empty(); | 180 crash_reporter::InitializeCrashpad(process_type.empty(), process_type); |
| 181 crash_reporter::InitializeCrashpad(browser_process, process_type); | 181 #elif defined(OS_WIN) |
| 182 crash_reporter::InitializeCrashpadWithEmbeddedHandler(process_type.empty(), |
| 183 process_type); |
| 182 #endif // defined(HEADLESS_USE_BREAKPAD) | 184 #endif // defined(HEADLESS_USE_BREAKPAD) |
| 183 } | 185 } |
| 184 | 186 |
| 185 void HeadlessContentMainDelegate::PreSandboxStartup() { | 187 void HeadlessContentMainDelegate::PreSandboxStartup() { |
| 186 const base::CommandLine& command_line( | 188 const base::CommandLine& command_line( |
| 187 *base::CommandLine::ForCurrentProcess()); | 189 *base::CommandLine::ForCurrentProcess()); |
| 188 #if defined(OS_WIN) | 190 #if defined(OS_WIN) |
| 189 // Windows always needs to initialize logging, otherwise you get a renderer | 191 // Windows always needs to initialize logging, otherwise you get a renderer |
| 190 // crash. | 192 // crash. |
| 191 InitLogging(command_line); | 193 InitLogging(command_line); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 HeadlessContentMainDelegate::CreateContentRendererClient() { | 296 HeadlessContentMainDelegate::CreateContentRendererClient() { |
| 295 #if defined(CHROME_MULTIPLE_DLL_BROWSER) | 297 #if defined(CHROME_MULTIPLE_DLL_BROWSER) |
| 296 return nullptr; | 298 return nullptr; |
| 297 #else | 299 #else |
| 298 renderer_client_ = base::MakeUnique<HeadlessContentRendererClient>(); | 300 renderer_client_ = base::MakeUnique<HeadlessContentRendererClient>(); |
| 299 return renderer_client_.get(); | 301 return renderer_client_.get(); |
| 300 #endif | 302 #endif |
| 301 } | 303 } |
| 302 | 304 |
| 303 } // namespace headless | 305 } // namespace headless |
| OLD | NEW |