Commit df591fb5 authored by Daniel Bratell's avatar Daniel Bratell Committed by Commit Bot

Compiling headless_shell_switches.cc once should be enough

In Windows (multi dll) builds, headless_shell_switches.cc was
compiled twice and with some timings and linkers, that cause
a duplicate symbol link error. In other cases one set of symbols
was discarded as unused before the link errors.

This setup was probably triggered by several build target
(headless_renderer, headless_shell_browser_lib,
headless_shell_child_lib and more) being compiled as if they
were inside headless.dll in component builds. That prevented
them from actually accessing the switches inside headless.dll.

The fix is to only compile headless.dll ("component headless")
with HEADLESS_IMPLEMENTATION, which controls HEADLESS_EXPORT,
and to not have a duplicate copy of the switches in
headless_shell_browser_lib.

Bug: 919231
Change-Id: Id0d5cade84b47b9053474a26a1b14723c576d346
Reviewed-on: https://chromium-review.googlesource.com/c/1440141
Commit-Queue: Daniel Bratell <bratell@opera.com>
Reviewed-by: default avatarSami Kyöstilä <skyostil@chromium.org>
Cr-Commit-Position: refs/heads/master@{#628335}
parent abe32644
...@@ -18,12 +18,9 @@ import("//tools/grit/grit_rule.gni") ...@@ -18,12 +18,9 @@ import("//tools/grit/grit_rule.gni")
import("//tools/grit/repack.gni") import("//tools/grit/repack.gni")
import("//tools/v8_context_snapshot/v8_context_snapshot.gni") import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
config("headless_implementation") { # For code inside the build component "headless".
config("inside_headless_component") {
defines = [ "HEADLESS_IMPLEMENTATION" ] defines = [ "HEADLESS_IMPLEMENTATION" ]
if (headless_use_embedded_resources) {
defines += [ "HEADLESS_USE_EMBEDDED_RESOURCES" ]
}
} }
group("headless_lib") { group("headless_lib") {
...@@ -226,7 +223,7 @@ if (headless_fontconfig_utils && !is_fuchsia) { ...@@ -226,7 +223,7 @@ if (headless_fontconfig_utils && !is_fuchsia) {
"//third_party/fontconfig", "//third_party/fontconfig",
] ]
configs += [ ":headless_implementation" ] configs += [ ":inside_headless_component" ]
} }
} }
...@@ -476,6 +473,7 @@ jumbo_component("headless") { ...@@ -476,6 +473,7 @@ jumbo_component("headless") {
} }
if (headless_use_embedded_resources) { if (headless_use_embedded_resources) {
defines = [ "HEADLESS_USE_EMBEDDED_RESOURCES" ]
deps += [ ":embed_resources" ] deps += [ ":embed_resources" ]
sources += [ sources += [
"$root_gen_dir/headless/embedded_resource_pak.cc", "$root_gen_dir/headless/embedded_resource_pak.cc",
...@@ -493,7 +491,7 @@ jumbo_component("headless") { ...@@ -493,7 +491,7 @@ jumbo_component("headless") {
deps += [ ":headless_fontconfig_utils" ] deps += [ ":headless_fontconfig_utils" ]
} }
configs += [ ":headless_implementation" ] configs += [ ":inside_headless_component" ]
} }
# Headless renderer is a convenience library for non component builds that # Headless renderer is a convenience library for non component builds that
...@@ -527,8 +525,6 @@ if (!is_component_build) { ...@@ -527,8 +525,6 @@ if (!is_component_build) {
if (enable_basic_printing) { if (enable_basic_printing) {
deps += [ "//components/printing/renderer" ] deps += [ "//components/printing/renderer" ]
} }
configs += [ ":headless_implementation" ]
} }
} else { } else {
# For component builds all dependencies are already included in the headless # For component builds all dependencies are already included in the headless
...@@ -777,8 +773,6 @@ if (is_win) { ...@@ -777,8 +773,6 @@ if (is_win) {
sources = [ sources = [
"app/headless_shell.cc", "app/headless_shell.cc",
"app/headless_shell.h", "app/headless_shell.h",
"app/headless_shell_switches.cc",
"app/headless_shell_switches.h",
"app/headless_shell_win.cc", "app/headless_shell_win.cc",
"lib/browser/headless_content_browser_client.cc", "lib/browser/headless_content_browser_client.cc",
"lib/browser/headless_content_browser_client.h", "lib/browser/headless_content_browser_client.h",
...@@ -811,8 +805,6 @@ if (is_win) { ...@@ -811,8 +805,6 @@ if (is_win) {
"//third_party/blink/public:blink_headers", "//third_party/blink/public:blink_headers",
] ]
} }
configs += [ ":headless_implementation" ]
} }
# Headless library with child specific dependencies (e.g., renderer). This # Headless library with child specific dependencies (e.g., renderer). This
...@@ -847,8 +839,6 @@ if (is_win) { ...@@ -847,8 +839,6 @@ if (is_win) {
"//third_party/blink/public:blink_headers", "//third_party/blink/public:blink_headers",
] ]
} }
configs += [ ":headless_implementation" ]
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment