Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: headless/app/headless_shell.cc

Issue 2835913002: Added crashpad support for Windows (Closed)
Patch Set: Added comment Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « headless/BUILD.gn ('k') | headless/lib/headless_content_main_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <memory> 5 #include <memory>
6 #include <sstream> 6 #include <sstream>
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 14 matching lines...) Expand all
25 #include "headless/lib/browser/headless_devtools.h" 25 #include "headless/lib/browser/headless_devtools.h"
26 #include "headless/public/headless_devtools_target.h" 26 #include "headless/public/headless_devtools_target.h"
27 #include "headless/public/util/deterministic_http_protocol_handler.h" 27 #include "headless/public/util/deterministic_http_protocol_handler.h"
28 #include "net/base/io_buffer.h" 28 #include "net/base/io_buffer.h"
29 #include "net/base/ip_address.h" 29 #include "net/base/ip_address.h"
30 #include "net/base/net_errors.h" 30 #include "net/base/net_errors.h"
31 #include "net/http/http_util.h" 31 #include "net/http/http_util.h"
32 #include "ui/gfx/geometry/size.h" 32 #include "ui/gfx/geometry/size.h"
33 33
34 #if defined(OS_WIN) 34 #if defined(OS_WIN)
35 #include "components/crash/content/app/crash_switches.h"
36 #include "components/crash/content/app/run_as_crashpad_handler_win.h"
35 #include "sandbox/win/src/sandbox_types.h" 37 #include "sandbox/win/src/sandbox_types.h"
36 #endif 38 #endif
37 39
38 namespace headless { 40 namespace headless {
39 namespace { 41 namespace {
40 // Address where to listen to incoming DevTools connections. 42 // Address where to listen to incoming DevTools connections.
41 const char kDevToolsHttpServerAddress[] = "127.0.0.1"; 43 const char kDevToolsHttpServerAddress[] = "127.0.0.1";
42 // Default file name for screenshot. Can be overriden by "--screenshot" switch. 44 // Default file name for screenshot. Can be overriden by "--screenshot" switch.
43 const char kDefaultScreenshotFileName[] = "screenshot.png"; 45 const char kDefaultScreenshotFileName[] = "screenshot.png";
44 // Default file name for pdf. Can be overriden by "--print-to-pdf" switch. 46 // Default file name for pdf. Can be overriden by "--print-to-pdf" switch.
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 << "when remote debugging is enabled."; 542 << "when remote debugging is enabled.";
541 return false; 543 return false;
542 } 544 }
543 return true; 545 return true;
544 } 546 }
545 547
546 #if defined(OS_WIN) 548 #if defined(OS_WIN)
547 int HeadlessShellMain(HINSTANCE instance, 549 int HeadlessShellMain(HINSTANCE instance,
548 sandbox::SandboxInterfaceInfo* sandbox_info) { 550 sandbox::SandboxInterfaceInfo* sandbox_info) {
549 base::CommandLine::Init(0, nullptr); 551 base::CommandLine::Init(0, nullptr);
552 #if defined(HEADLESS_USE_CRASPHAD)
553 std::string process_type =
554 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
555 ::switches::kProcessType);
556 if (process_type == crash_reporter::switches::kCrashpadHandler) {
557 return crash_reporter::RunAsCrashpadHandler(
558 *base::CommandLine::ForCurrentProcess(), ::switches::kProcessType);
559 }
560 #endif // defined(HEADLESS_USE_CRASPHAD)
550 RunChildProcessIfNeeded(instance, sandbox_info); 561 RunChildProcessIfNeeded(instance, sandbox_info);
551 HeadlessBrowser::Options::Builder builder(0, nullptr); 562 HeadlessBrowser::Options::Builder builder(0, nullptr);
552 builder.SetInstance(instance); 563 builder.SetInstance(instance);
553 builder.SetSandboxInfo(std::move(sandbox_info)); 564 builder.SetSandboxInfo(std::move(sandbox_info));
554 #else 565 #else
555 int HeadlessShellMain(int argc, const char** argv) { 566 int HeadlessShellMain(int argc, const char** argv) {
556 base::CommandLine::Init(argc, argv); 567 base::CommandLine::Init(argc, argv);
557 RunChildProcessIfNeeded(argc, argv); 568 RunChildProcessIfNeeded(argc, argv);
558 HeadlessBrowser::Options::Builder builder(argc, argv); 569 HeadlessBrowser::Options::Builder builder(argc, argv);
559 #endif // defined(OS_WIN) 570 #endif // defined(OS_WIN)
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 678
668 int HeadlessShellMain(const content::ContentMainParams& params) { 679 int HeadlessShellMain(const content::ContentMainParams& params) {
669 #if defined(OS_WIN) 680 #if defined(OS_WIN)
670 return HeadlessShellMain(params.instance, params.sandbox_info); 681 return HeadlessShellMain(params.instance, params.sandbox_info);
671 #else 682 #else
672 return HeadlessShellMain(params.argc, params.argv); 683 return HeadlessShellMain(params.argc, params.argv);
673 #endif 684 #endif
674 } 685 }
675 686
676 } // namespace headless 687 } // namespace headless
OLDNEW
« no previous file with comments | « headless/BUILD.gn ('k') | headless/lib/headless_content_main_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698