Skip to content

Commit

Permalink
Revert of Add --headless flag to Windows (patchset chromium#1 id:1 of h…
Browse files Browse the repository at this point in the history
…ttps://codereview.chromium.org/2832963002/ )

Reason for revert:
Failed compilation on Mac bot
https://luci-logdog.appspot.com/v/?s=chromium%2Fbb%2Fchromium%2FMac%2F26461%2F%2B%2Frecipes%2Fsteps%2Fcompile%2F0%2Fstdout

Original issue's description:
> Reland of Add --headless flag to Windows (patchset chromium#1 id:1 of https://codereview.chromium.org/2835603002/ )
>
> Reason for revert:
> Re-land patch set, looks like it could've been a transient issue with Mac waterfall build, patching in updated upstream and investigating
>
> Original issue's description:
> > Revert of Add --headless flag to Windows (patchset chromium#28 id:540001 of https://codereview.chromium.org/2762593002/ )
> >
> > Reason for revert:
> >
> > Findit(https://goo.gl/kROfz5) identified CL at revision 466176 as the
> > culprit for failures in the build cycles as shown on:
> > https://findit-for-me.appspot.com/waterfall/culprit?key=ag9zfmZpbmRpdC1mb3ItbWVyRAsSDVdmU3VzcGVjdGVkQ0wiMWNocm9taXVtL2UzYzc0NWQ0YjM3YTY1OWFmYWEwMzU4YzdkZTdiOWJjODgxZGVjYjUM
> >
> > Original issue's description:
> > > Launch bug: https://bugs.chromium.org/p/chromium/issues/detail?id=705916
> > >
> > > Add --headless flag to Windows:
> > >
> > > Fix browser_tests not compiling properly on windows
> > > Fix headless/BUILD.gn by:
> > >    - Changing headless_lib to a headless component, following steps in https://chromium.googlesource.com/chromium/src/+/master/docs/component_build.md and fixing the build for linux, since it now compiles as a shared_library when component build is true.
> > >    - Adding neccesary HEADLESS_EXPORT (submitted in https://codereview.chromium.org/2775693003/)
> > >    - Disabling breakpad in windows (will fix in a separate CL)
> > >
> > >
> > > BUG=686608
> > >
> > > Review-Url: https://codereview.chromium.org/2762593002
> > > Cr-Commit-Position: refs/heads/master@{#466176}
> > > Committed: https://chromium.googlesource.com/chromium/src/+/e3c745d4b37a659afaa0358c7de7b9bc881decb5
> >
> > TBR=alexclarke@chromium.org,sky@chromium.org,skyostil@chromium.org,wfh@chromium.org,jzfeng@chromium.org,nick@chromium.org,dvallet@chromium.org
> > # Skipping CQ checks because original CL landed less than 1 days ago.
> > NOPRESUBMIT=true
> > NOTREECHECKS=true
> > NOTRY=true
> > BUG=686608
> >
> > Review-Url: https://codereview.chromium.org/2835603002
> > Cr-Commit-Position: refs/heads/master@{#466189}
> > Committed: https://chromium.googlesource.com/chromium/src/+/87a65c2fbb5db04ce025fadbfdfc7183003f6831
>
> TBR=nick@chromium.org,tdanderson@google.com,jzfeng@chromium.org,fhorschig@google.com,sky@chromium.org,keishi@google.com,xlai@google.com,alexclarke@chromium.org,skyostil@chromium.org,wfh@chromium.org,tdanderson@chromium.org,findit-for-me@appspot.gserviceaccount.com
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=686608
>
> Review-Url: https://codereview.chromium.org/2832963002
> Cr-Commit-Position: refs/heads/master@{#466206}
> Committed: https://chromium.googlesource.com/chromium/src/+/e0800c0393765b299e3fcd81f2d97b8bbe997a2f

TBR=jzfeng@chromium.org,alexclarke@chromium.org,fhorschig@google.com,findit-for-me@appspot.gserviceaccount.com,keishi@google.com,nick@chromium.org,sky@chromium.org,skyostil@chromium.org,tdanderson@google.com,tdanderson@chromium.org,wfh@chromium.org,xlai@google.com,dvallet@chromium.org
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=686608

Review-Url: https://codereview.chromium.org/2828203003
Cr-Commit-Position: refs/heads/master@{#466214}
  • Loading branch information
keishi authored and Commit bot committed Apr 21, 2017
1 parent e28fe03 commit 4f8bacc
Show file tree
Hide file tree
Showing 22 changed files with 74 additions and 280 deletions.
2 changes: 0 additions & 2 deletions chrome/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,6 @@ if (is_win) {
"//components/policy:generated",
"//content/app/resources",
"//crypto",
"//headless:headless_shell_browser_lib",
"//net:net_resources",
"//ppapi/features",
"//third_party/cld",
Expand Down Expand Up @@ -433,7 +432,6 @@ if (is_win) {
"//components/browser_watcher:browser_watcher_client",
"//components/crash/content/app",
"//content/public/app:child",
"//headless:headless_shell_child_lib",
]

ldflags = [
Expand Down
12 changes: 7 additions & 5 deletions chrome/app/chrome_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,20 +89,22 @@ int ChromeMain(int argc, const char** argv) {
#else
params.argc = argc;
params.argv = argv;
#endif

#if !defined(OS_WIN)
base::CommandLine::Init(params.argc, params.argv);
#endif // defined(OS_WIN)
base::CommandLine::Init(0, nullptr);
const base::CommandLine* command_line(base::CommandLine::ForCurrentProcess());
ALLOW_UNUSED_LOCAL(command_line);
#endif

#if defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_WIN)
#if defined(OS_LINUX) || defined(OS_MACOSX)
if (command_line->HasSwitch(switches::kHeadless)) {
#if defined(OS_MACOSX)
SetUpBundleOverrides();
#endif
return headless::HeadlessShellMain(params);
return headless::HeadlessShellMain(argc, argv);
}
#endif // defined(OS_LINUX) || defined(OS_MACOSX) || defined(OS_WIN)
#endif // defined(OS_LINUX) || defined(OS_MACOSX)

#if defined(OS_CHROMEOS) && BUILDFLAG(ENABLE_PACKAGE_MASH_SERVICES)
version_info::Channel channel = chrome::GetChannel();
Expand Down
146 changes: 28 additions & 118 deletions headless/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ config("headless_implementation") {
}
}

group("headless_lib") {
group("headless") {
deps = [
"//headless:headless",
"//headless:headless_lib",
]
}

Expand Down Expand Up @@ -202,7 +202,7 @@ action("gen_devtools_client_api") {
]
}

component("headless") {
static_library("headless_lib") {
sources = generated_devtools_api + [
"app/headless_shell_switches.cc",
"app/headless_shell_switches.h",
Expand Down Expand Up @@ -244,6 +244,10 @@ component("headless") {
"lib/headless_crash_reporter_client.h",
"lib/headless_content_client.cc",
"lib/headless_content_client.h",
"lib/headless_content_main_delegate.cc",
"lib/headless_content_main_delegate.h",
"lib/renderer/headless_content_renderer_client.cc",
"lib/renderer/headless_content_renderer_client.h",
"public/headless_browser.cc",
"public/headless_browser.h",
"public/headless_browser_context.h",
Expand Down Expand Up @@ -324,6 +328,9 @@ component("headless") {
"//components/crash/content/browser",
"//components/security_state/content",
"//components/security_state/core",
"//content/public/app:both",
"//content/public/browser",
"//content/public/child:child",
"//content/public/common",
"//content/public/common:service_names",
"//services/service_manager/public/cpp",
Expand All @@ -335,26 +342,17 @@ component("headless") {
"//url",
]

if (is_component_build) {
sources += [
"lib/headless_content_main_delegate.cc",
"lib/headless_content_main_delegate.h",
"lib/renderer/headless_content_renderer_client.cc",
"lib/renderer/headless_content_renderer_client.h",
]

if (enable_basic_printing) {
deps += [
"//components/printing/browser",
"//components/printing/renderer",
]
}
}

if (!is_mac) {
deps += [ "//ui/aura" ]
}

if (enable_basic_printing) {
deps += [
"//components/printing/browser",
"//components/printing/renderer",
]
}

if (headless_use_embedded_resources) {
deps += [ ":embed_resources" ]
sources += [
Expand All @@ -368,32 +366,8 @@ component("headless") {
if (use_ozone) {
deps += [ "//ui/ozone" ]
}
configs += [ ":headless_implementation" ]
}

# Headless renderer is a convenience source set that includes headless classes
# that depend on the reenderer. These are not added in case of a component build
# since in that case they are already included in the headless component.
source_set("headless_renderer") {
deps = [
":headless",
]
if (!is_component_build) {
sources = [
"lib/headless_content_main_delegate.cc",
"lib/headless_content_main_delegate.h",
"lib/renderer/headless_content_renderer_client.cc",
"lib/renderer/headless_content_renderer_client.h",
]
deps += [ "//ui/base" ]
if (enable_basic_printing) {
deps += [
"//components/printing/browser",
"//components/printing/renderer",
]
}
configs += [ ":headless_implementation" ]
}
configs += [ ":headless_implementation" ]
}

group("headless_tests") {
Expand All @@ -418,7 +392,7 @@ test("headless_unittests") {
]

deps = [
":headless",
":headless_lib",
"//base/test:run_all_unittests",
"//base/test:test_support",
"//testing/gmock",
Expand Down Expand Up @@ -492,114 +466,50 @@ test("headless_browsertests") {
deps = [
":embedder_mojo_for_testing",
":headless_browser_tests_pak",
":headless_renderer",
"//base",
"//content/test:test_support",
"//headless:headless_lib",
"//testing/gmock",
"//testing/gtest",
]
}

# Headless library with only browser dependencies. This is used when no child
# dependencies are needed in the target (e.g. chrome:main_dll).
static_library("headless_shell_browser_lib") {
if (is_multi_dll_chrome) {
defines = [ "CHROME_MULTIPLE_DLL_BROWSER" ]
}

sources = [
"app/headless_shell.cc",
"app/headless_shell.h",
"app/headless_shell_switches.cc",
"app/headless_shell_switches.h",
"app/shell_navigation_request.cc",
"app/shell_navigation_request.h",
"lib/headless_content_main_delegate.cc",
"lib/headless_content_main_delegate.h",
"public/headless_shell.h",
]

deps = [
":headless",
"//content/public/browser",
"//content/public/common",
]

if (is_win) {
deps += [
"//content:sandbox_helper_win",
"//sandbox",
]
}

configs += [ ":headless_implementation" ]
}

# Headless library with child specific dependencies (e.g., renderer). This
# is used when no browser depencendies are needed (e.g. chrome:child_dll).
static_library("headless_shell_child_lib") {
if (is_multi_dll_chrome) {
defines = [ "CHROME_MULTIPLE_DLL_CHILD" ]
}

static_library("headless_shell_lib") {
sources = [
"app/headless_shell.cc",
"app/headless_shell.h",
"app/headless_shell_switches.cc",
"app/headless_shell_switches.h",
"app/shell_navigation_request.cc",
"app/shell_navigation_request.h",
"lib/headless_content_main_delegate.cc",
"lib/headless_content_main_delegate.h",
"public/headless_shell.h",
]

deps = [
":headless_renderer",
"//content/public/child:child",
"//ui/base",
"//headless:headless_lib",
]

configs += [ ":headless_implementation" ]
}

# Headless library with all included dependencies. Use this library unless you
# have browser/child dependencies restrictions.
static_library("headless_shell_lib") {
executable("headless_shell") {
sources = [
"app/headless_shell.cc",
"app/headless_shell.h",
"app/headless_shell_switches.cc",
"app/headless_shell_switches.h",
"app/shell_navigation_request.cc",
"app/shell_navigation_request.h",
"public/headless_shell.h",
"app/headless_shell_main.cc",
]

deps = [
":headless_renderer",
"//content/public/app:both",
"//content/public/browser",
"//content/public/child:child",
"//content/public/common",
"//headless:headless_shell_lib",
]

if (is_win) {
deps += [
"//build/win:default_exe_manifest",
"//content:sandbox_helper_win",
"//sandbox",
]
}
}

executable("headless_shell") {
sources = [
"app/headless_shell_main.cc",
]

deps = [
":headless_shell_lib",
]
configs += [ ":headless_implementation" ]
}

process_version("version_header") {
Expand All @@ -617,6 +527,6 @@ executable("headless_example") {
]

deps = [
":headless_shell_lib",
"//headless:headless_shell_lib",
]
}
2 changes: 0 additions & 2 deletions headless/DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ include_rules = [
"+components/crash/content/browser",
"+content/public/app",
"+content/public/browser",
"+content/public/renderer",
"+content/public/common",
"+content/public/test",
"+mojo/public",
Expand All @@ -17,6 +16,5 @@ include_rules = [
"+ui/gfx/geometry",
"+ui/gl",
"+ui/ozone/public",
"+sandbox/win/src",
"+services/service_manager/public",
]
15 changes: 0 additions & 15 deletions headless/app/headless_example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/memory/weak_ptr.h"
#include "build/build_config.h"
#include "headless/public/devtools/domains/page.h"
#include "headless/public/devtools/domains/runtime.h"
#include "headless/public/headless_browser.h"
Expand All @@ -20,11 +19,6 @@
#include "headless/public/headless_web_contents.h"
#include "ui/gfx/geometry/size.h"

#if defined(OS_WIN)
#include "content/public/app/sandbox_helper_win.h"
#include "sandbox/win/src/sandbox_types.h"
#endif

// This class contains the main application logic, i.e., waiting for a page to
// load and printing its DOM. Note that browser initialization happens outside
// this class.
Expand Down Expand Up @@ -164,24 +158,15 @@ void OnHeadlessBrowserStarted(headless::HeadlessBrowser* browser) {
}

int main(int argc, const char** argv) {
#if !defined(OS_WIN)
// This function must be the first thing we call to make sure child processes
// such as the renderer are started properly. The headless library starts
// child processes by forking and exec'ing the main application.
headless::RunChildProcessIfNeeded(argc, argv);
#endif

// Create a headless browser instance. There can be one of these per process
// and it can only be initialized once.
headless::HeadlessBrowser::Options::Builder builder(argc, argv);

#if defined(OS_WIN)
// In windows, you must initialize and set the sandbox, or pass it along
// if it has already been initialized.
sandbox::SandboxInterfaceInfo sandbox_info = {0};
content::InitializeSandboxInfo(&sandbox_info);
builder.SetSandboxInfo(&sandbox_info);
#endif
// Here you can customize browser options. As an example we set the window
// size.
builder.SetWindowSize(gfx::Size(800, 600));
Expand Down
Loading

0 comments on commit 4f8bacc

Please sign in to comment.